BellaClient class
High-level Bella Baxter client.
API key mode (most common — bella exec with a stored key):
final client = BellaClient(BellaClientOptions(
baseUrl: Platform.environment['BELLA_BAXTER_URL']!,
apiKey: Platform.environment['BELLA_BAXTER_API_KEY']!,
));
JWT mode (bella exec in SSO / OAuth mode):
final client = BellaClient(BellaClientOptions(
baseUrl: Platform.environment['BELLA_BAXTER_URL']!,
accessToken: Platform.environment['BELLA_BAXTER_ACCESS_TOKEN']!,
));
Auto-detect from environment (recommended — works for both modes):
final client = BellaClient.fromEnv();
final secrets = await client.pullSecrets();
Constructors
- BellaClient(BellaClientOptions options)
- BellaClient.fromEnv()
-
Creates a BellaClient from environment variables injected by
bella exec.factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getKeyContext(
) → Future< KeyContextResponse> -
Calls
GET /api/v1/keys/meto discover the project + environment this API key is scoped to. Result is cached for the lifetime of this client. -
getProject(
String ref) → Future< GetProjectResponse> - Gets a single project by GUID or slug.
-
listEnvironments(
String projectRef) → Future< List< EnvironmentResponse> > - Lists environments in a project.
-
listProjects(
{int page = 0, int size = 50}) → Future< List< ProjectResponse> > - Lists all projects the authenticated user has access to.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pullSecrets(
{String? projectRef, String? environmentSlug, bool fallbackOnError = true}) → Future< Map< String, String> > -
Returns all secrets for an environment merged into a flat
Map<String, String>. -
pullSecretsAs<
T> (T fromMap(Map< String, String> ), {String? projectRef, String? environmentSlug, bool fallbackOnError = true}) → Future<T> -
Pulls secrets and maps them to a typed object via
fromMap. -
toString(
) → String -
A string representation of this object.
inherited
-
watchSecrets(
{Duration interval = const Duration(minutes: 5), String? projectRef, String? environmentSlug}) → Stream< Map< String, String> > -
Returns a Stream that emits fresh secrets on
interval(default: 5 min). -
watchSecretsAs<
T> (T fromMap(Map< String, String> ), {Duration interval = const Duration(minutes: 5), String? projectRef, String? environmentSlug}) → Stream<T> -
Like watchSecrets but maps each emission through
fromMap.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited