Skip to content
Sign In

Bkper

This is the main entry point of the bkper-js library.

Constructors

Constructor

new Bkper(config?): Bkper;

Creates a new Bkper instance with the provided configuration.

Parameters

ParameterTypeDescription
config?ConfigThe Config object containing API key and OAuth token providers. If not provided, uses the global configuration set via setConfig().

Returns

Bkper

Methods

getApp()

getApp(id): Promise<App>;

Gets the App with the specified id.

Parameters

ParameterTypeDescription
idstringThe App id (agentId)

Returns

Promise<App>

The retrieved App


getApps()

getApps(): Promise<App[]>;

Gets all Apps available for the user.

Returns

Promise<App[]>

The retrieved list of Apps


getBook()

getBook(
id,
includeAccounts?,
includeGroups?): Promise<Book>;

Gets the Book with the specified bookId from url param.

Parameters

ParameterTypeDescription
idstringThe universal book id - The same bookId param of URL you access at app.bkper.com
includeAccounts?booleanOptional parameter to include accounts in the retrieved Book
includeGroups?booleanOptional parameter to include groups in the retrieved Book If both includeAccounts and includeGroups are false, the Book will be returned with only the basic information. If includeAccounts is true, the Book will be returned with the accounts and groups. If includeGroups is true, the Book will be returned with the groups.

Returns

Promise<Book>

The retrieved Book


getBooks()

getBooks(query?): Promise<Book[]>;

Gets all Books the user has access to.

Parameters

ParameterTypeDescription
query?stringOptional search term to filter books

Returns

Promise<Book[]>

The retrieved list of Books


getCollections()

getCollections(): Promise<Collection[]>;

Gets all Collections the user has access to.

Returns

Promise<Collection[]>

The retrieved list of Collections


getConfig()

getConfig(): Config;

Gets the current instance configuration.

Returns

Config

The Config object for this Bkper instance


getTemplates()

getTemplates(): Promise<Template[]>;

Gets all Templates available for the user.

Returns

Promise<Template[]>

The retrieved list of Templates


getUser()

getUser(): Promise<User>;

Gets the current logged User.

Returns

Promise<User>

The retrieved User


requestBookAccess()

requestBookAccess(
bookId,
permission,
message?): Promise<void>;

Requests access to a Book the current user cannot access.

Parameters

ParameterTypeDescription
bookIdstringThe universal Book id
permissionPermissionThe permission requested in the Book
message?stringAn optional message to the Book owner

Returns

Promise<void>


setConfig()

static setConfig(config): void;

Sets the global API configuration for all Bkper operations.

WARNING: This configuration will be shared and should NOT be used on shared environments.

Parameters

ParameterTypeDescription
configConfigThe Config object containing API key and OAuth token providers

Returns

void