ChinoAPICollections

ChinoAPICollections

new ChinoAPICollections(baseUrl, customerId, customerKey)

Create a caller for Collections Chino APIs

Parameters:
Name Type Default Description
baseUrl string

The url endpoint for APIs

customerId string

The Chino customer id or bearer token

customerKey string | null null

The Chino customer key or null (not provided)

Source:

Methods

create(data) → {Promise.<objects.Collection, objects.ChinoException>}

Create a new collection

Parameters:
Name Type Description
data object
Source:
Returns:

A promise that return a Collection object if resolved, otherwise throw an ChinoException object if rejected or was not retrieved a success status

Type
Promise.<objects.Collection, objects.ChinoException>

delete(collectionId, force) → {Promise.<objects.Success, objects.ChinoException>}

Deactivate (or delete) collection selected by its id

Parameters:
Name Type Default Description
collectionId string
force boolean false

If true delete collection information otherwise only deactivate it. Default value is false (deactivate)

Source:
Returns:

A promise that return a Success object if resolved, otherwise throw an ChinoException object if rejected or was not retrieved a success status

Type
Promise.<objects.Success, objects.ChinoException>

details(collectionId) → {Promise.<objects.Collection, objects.ChinoException>}

Return information about collection selected by its id

Parameters:
Name Type Description
collectionId string
Source:
Returns:

A promise that return a Collection object if resolved, otherwise throw an ChinoException object if rejected or was not retrieved a success status

Type
Promise.<objects.Collection, objects.ChinoException>

insertDocument(collectionId, documentId) → {Promise.<objects.Document, objects.ChinoException>}

Insert a new document inside collection selected by their id

Parameters:
Name Type Description
collectionId string
documentId string
Source:
Returns:

A promise that return a Success object if resolved, otherwise throw an ChinoException object if rejected or was not retrieved a success status

Type
Promise.<objects.Document, objects.ChinoException>

list(offset, limit) → {Promise.<Array, objects.ChinoException>}

Return a list of existing collections

Parameters:
Name Type Default Description
offset int 0
limit int 10
Source:
Returns:

A promise that return a list of Collection object if resolved, otherwise throw an ChinoException object if rejected or was not retrieved a success status

Type
Promise.<Array, objects.ChinoException>

listDocuments(collectionId, offset, limit) → {Promise.<Array, objects.ChinoException>}

Return a list of documents inside the collections selected by its id

Parameters:
Name Type Default Description
collectionId string
offset int 0
limit int 10
Source:
Returns:

A promise that return a list of Documents object if resolved, otherwise throw an ChinoException object if rejected or was not retrieved a success status

Type
Promise.<Array, objects.ChinoException>

removeDocument(collectionId, documentId) → {Promise.<objects.Document, objects.ChinoException>}

Insert a new document inside collection selected by their id

Parameters:
Name Type Description
collectionId string
documentId string
Source:
Returns:

A promise that return a Success object if resolved, otherwise throw an ChinoException object if rejected or was not retrieved a success status

Type
Promise.<objects.Document, objects.ChinoException>

Search between collections filtering on name

Parameters:
Name Type Description
filter object
Source:
Returns:

A promise that return a list of Collection object matching filter if resolved, otherwise throw an ChinoException object if rejected or was not retrieved a success status

Type
Promise.<objects.Document, objects.ChinoException>

update(collectionId, data) → {Promise.<objects.Collection, objects.ChinoException>}

Update information about collection selected by its id with data as new collection information

Parameters:
Name Type Description
collectionId string
data object
Source:
Returns:

A promise that return a Collection object if resolved, otherwise throw an ChinoException object if rejected or was not retrieved a success status

Type
Promise.<objects.Collection, objects.ChinoException>