getApiGrant method

ApiScope? getApiGrant()

Returns the ApiScope if present; for versions < 0.6.0, returns a permissive default when absent (mirrors Python fallback).

Implementation

ApiScope? getApiGrant() {
  final api = grantScope('api');
  if (api is ApiScope) return api;

  if (_semverCompare(version, '0.6.0') < 0) {
    // <= 0.6.0 didn't fine-grain; default to broad access.
    return ApiScope(
      livekit: LivekitGrant(),
      queues: QueuesGrant(),
      messaging: MessagingGrant(),
      database: DatabaseGrant(),
      sync: SyncGrant(),
      storage: StorageGrant(),
      agents: AgentsGrant(),
      developer: DeveloperGrant(),
      // Note: matching Python "temp hack" to include containers.
      containers: ContainersGrant(),
    );
  }
  return null;
}