Skip to main content

Collection

Collection is a class that represents a collection in the MarcSync API.

METHODS

:createEntry(data: EntryData)

Creates a new entry in the collection and returns it as an Entry object.

Exceptions

InvalidAccessToken - Thrown when the accessToken is invalid.
CollectionNotFound - Thrown when the collection does not exist.
InvalidEntryData - Thrown when the EntryData is invalid.

:updateEntries(filters: EntryData, data: EntryData)

Updates all entries that match the specified filters with the specified data.

Exceptions

InvalidAccessToken - Thrown when the accessToken is invalid.
CollectionNotFound - Thrown when the collection does not exist.
InvalidEntryData - Thrown when the EntryData is invalid.

:getEntries(filters: EntryData)

Returns all entries that match the specified filters as an array of Entry objects.

Exceptions

InvalidAccessToken - Thrown when the accessToken is invalid.
CollectionNotFound - Thrown when the collection does not exist.
InvalidEntryData - Thrown when the EntryData is invalid.

:deleteEntries(filters: EntryData)

Deletes all entries that match the specified filters.

Exceptions

InvalidAccessToken - Thrown when the accessToken is invalid.
CollectionNotFound - Thrown when the collection does not exist.
InvalidEntryData - Thrown when the EntryData is invalid.

:drop()

Deletes the collection.

Exceptions

InvalidAccessToken - Thrown when the accessToken is invalid.
CollectionNotFound - Thrown when the collection does not exist.