Skip to content

ApplicationsService

@blobs/sdk v0.1.0


@blobs/sdk / services / ApplicationsService

Defined in: services/ApplicationsService.ts:217

Manages OAuth-style applications and their API keys, used for programmatic, non-user access to the Blobs platform. Each Application is scoped to a specific network and granted a discrete set of ApiPermission scopes; API keys can be rotated via rotateKey, and the full key value is returned only at creation/rotation time.

Example

const sdk = createSDK({ networks: [...] });
const res = await sdk.applications.create({
name: 'CI Bot',
network_id: 'global',
permissions: ['read:blobs', 'write:blobs'],
});
if (res.success) console.log(res.data!.api_key); // shown only once

Constructors

Constructor

new ApplicationsService(context): ApplicationsService

Defined in: services/ApplicationsService.ts:225

Constructs an ApplicationsService bound to the given context.

Parameters

context

BlobsContext

Shared BlobsContext providing transport access.

Returns

ApplicationsService

Methods

create()

create(input, options?): Promise<Response<Application>>

Defined in: services/ApplicationsService.ts:259

Creates a new application and returns the freshly minted record including a one-time api_key value (which is not retrievable afterward).

Parameters

input

CreateApplicationInput

CreateApplicationInput describing the application to provision.

options?

MultiNetworkOptions

Optional network/tenant scoping options.

Returns

Promise<Response<Application>>

A Response containing the created Application; capture api_key immediately.

Throws

ValidationError when input is rejected.

Example

const res = await sdk.applications.create({
name: 'Bot',
network_id: 'global',
permissions: ['read:blobs'],
});

get()

get(id, options?): Promise<Response<Application>>

Defined in: services/ApplicationsService.ts:276

Fetches an application by ID. The returned record never includes the full api_key.

Parameters

id

string

The application identifier.

options?

MultiNetworkOptions

Optional network/tenant scoping options.

Returns

Promise<Response<Application>>

A Response containing the Application.

Throws

NotFoundError when no application with the given ID exists.


list()

list(input?, options?): Promise<Response<Application[]>>

Defined in: services/ApplicationsService.ts:292

Lists applications visible to the caller, filtered by organization and paginated.

Parameters

input?

ListApplicationsInput

Optional ListApplicationsInput with org_id, limit, and offset.

options?

MultiNetworkOptions

Optional network/tenant scoping options.

Returns

Promise<Response<Application[]>>

A Response containing the matching Application records.


update()

update(id, input, options?): Promise<Response<{ message: string; }>>

Defined in: services/ApplicationsService.ts:318

Updates application fields such as name, permissions, or enabled state.

Parameters

id

string

The application identifier.

input

UpdateApplicationInput

Partial UpdateApplicationInput fields to update.

options?

MultiNetworkOptions

Optional network/tenant scoping options.

Returns

Promise<Response<{ message: string; }>>

A Response containing a { message } confirmation payload.

Throws

NotFoundError when no application with the given ID exists.

Throws

PermissionError when the user lacks write access.


delete()

delete(id, options?): Promise<Response<{ message: string; }>>

Defined in: services/ApplicationsService.ts:340

Deletes an application, immediately revoking any keys it owns.

Parameters

id

string

The application identifier.

options?

MultiNetworkOptions

Optional network/tenant scoping options.

Returns

Promise<Response<{ message: string; }>>

A Response containing a { message } confirmation payload.

Throws

NotFoundError when no application with the given ID exists.

Throws

PermissionError when the user lacks delete access.


rotateKey()

rotateKey(id, options?): Promise<Response<{ api_key: string; }>>

Defined in: services/ApplicationsService.ts:359

Rotates the API key for an application, invalidating the old key. The new key is returned once and is not retrievable afterward.

Parameters

id

string

The application identifier.

options?

MultiNetworkOptions

Optional network/tenant scoping options.

Returns

Promise<Response<{ api_key: string; }>>

A Response containing { api_key } — the freshly issued key.

Throws

NotFoundError when no application with the given ID exists.

Throws

PermissionError when the user lacks write access.


getUserPermissionScopes()

getUserPermissionScopes(): ApiPermissionScope[]

Defined in: services/ApplicationsService.ts:374

Returns the catalog of user-level permission scopes available for application API keys. Useful for rendering permission pickers in UIs.

Returns

ApiPermissionScope[]

The static USER_PERMISSION_SCOPES list.


getOrgPermissionScopes()

getOrgPermissionScopes(): ApiPermissionScope[]

Defined in: services/ApplicationsService.ts:383

Returns the catalog of organization-level permission scopes available for application API keys.

Returns

ApiPermissionScope[]

The static ORG_PERMISSION_SCOPES list.


getAllPermissions()

getAllPermissions(): string[]

Defined in: services/ApplicationsService.ts:393

Returns the flat list of every available ApiPermission string, combining both user-level and organization-level scopes.

Returns

string[]

Array of all permission identifiers.