Skip to content

Config

This class defines the [[Bkper]] API Config.

Properties

agentIdProvider()?

optional agentIdProvider: () => Promise<string | undefined>;

Provides the agent ID to identify the calling agent for attribution purposes.

This ID is sent via the bkper-agent-id header with each API request, allowing the server to attribute actions to the correct agent.

Returns

Promise<string | undefined>


apiKeyProvider()?

optional apiKeyProvider: () => Promise<string>;

Optional API key for dedicated quota limits.

If not provided, requests use a shared managed quota via the Bkper API proxy. Use your own API key for dedicated quota limits and project-level usage tracking.

API keys are for project identification only, not for authentication or agent attribution. Agent attribution is handled separately via the agentIdProvider.

Returns

Promise<string>


oauthTokenProvider()?

optional oauthTokenProvider: () => Promise<string | undefined>;

Issue a valid OAuth2 access token with https://www.googleapis.com/auth/userinfo.email scope authorized.

Returns

Promise<string | undefined>


requestErrorHandler()?

optional requestErrorHandler: (error) => any;

Custom request error handler

Parameters

ParameterTypeDescription
erroranyThe error object of the failed request.

Returns

any


requestHeadersProvider()?

optional requestHeadersProvider: () => Promise<{
[key: string]: string;
}>;

Provides additional headers to append to the API request

Returns

Promise<{ [key: string]: string; }>


requestRetryHandler()?

optional requestRetryHandler: (status?, error?, attempt?) => Promise<void>;

Custom request retry handler.

This function is called when a request fails and needs to be retried. It provides the HTTP status code, error message, and the number of retry attempts made so far.

Parameters

ParameterTypeDescription
status?number-
error?anyThe error object of the failed request.
attempt?numberThe number of retry attempts made so far.

Returns

Promise<void>