Skip to content

Collection

This class defines a Collection of [[Books]].

Extends

  • Resource<bkper.Collection>

Constructors

Constructor

new Collection(payload?, config?): Collection;

Parameters

ParameterType
payload?Collection
config?Config

Returns

Collection

Overrides

Resource<bkper.Collection>.constructor

Properties

payload

payload: Collection;

The underlying payload data for this resource

Inherited from

Resource.payload

Methods

addBooks()

addBooks(books): Promise<Book[]>;

Adds Books to this Collection.

Parameters

ParameterTypeDescription
booksBook[]The Books to add to this Collection

Returns

Promise<Book[]>

The added Book objects


create()

create(): Promise<Collection>;

Performs create new Collection.

Returns

Promise<Collection>

The created Collection object


getBooks()

getBooks(): Book[];

Gets all Books of this collection.

Returns

Book[]

All Books of this collection


getId()

getId(): string | undefined;

Gets the unique identifier of this Collection.

Returns

string | undefined

The id of this Collection


getName()

getName(): string | undefined;

Gets the name of this Collection.

Returns

string | undefined

The name of this Collection


getOwnerUsername()

getOwnerUsername(): string | undefined;

Gets the username of the owner of this Collection

Returns

string | undefined

The Collection’s owner username


getPermission()

getPermission(): Permission | undefined;

Gets the user permission for this Collection

Returns

Permission | undefined

The permission for the current user


getUpdatedAt()

getUpdatedAt(): string | undefined;

Gets the last update date of this Collection

Returns

string | undefined

The Collection’s last update timestamp, in milliseconds


json()

json(): Collection;

Gets an immutable copy of the JSON payload for this resource.

Returns

Collection

An immutable copy of the json payload

Inherited from

Resource.json

remove()

remove(): Promise<Book[]>;

Performs delete Collection.

Returns

Promise<Book[]>

The list of Books the user has access to that were affected by the deletion of this Collection


removeBooks()

removeBooks(books): Promise<Book[]>;

Removes Books from this Collection.

Parameters

ParameterTypeDescription
booksBook[]The Books to remove from this Collection

Returns

Promise<Book[]>

The removed Book objects


setName()

setName(name): Collection;

Sets the name of the Collection.

Parameters

ParameterTypeDescription
namestringThe name to set

Returns

Collection

This Collection, for chaining


update()

update(): Promise<Collection>;

Performs update Collection, applying pending changes.

Returns

Promise<Collection>

The updated Collection object