Constructor Summary
Public Constructor | ||
public |
constructor(client: KintoClient, bucket: Bucket, name: String) Constructor. |
Method Summary
Public Methods | ||
public |
Performs batch operations at the current collection level. |
|
public |
Creates a record in current collection. |
|
public |
Deletes a record from the current collection. |
|
public |
Retrieves collection data. |
|
public |
getPermissions(options: Object): Promise<Object, Error> Retrieves the list of permissions for this collection. |
|
public |
Retrieves a record from the current collection. |
|
public |
listRecords(options: Object): Promise<Object, Error> Lists records from the current collection. |
|
public |
Set collection data. |
|
public |
Replaces all existing collection permissions with the ones provided. |
|
public |
Updates a record in current collection. |
Public Constructors
public constructor(client: KintoClient, bucket: Bucket, name: String) source
Constructor.
Params:
Name | Type | Attribute | Description |
client | KintoClient | The client instance. |
|
bucket | Bucket | The bucket instance. |
|
name | String | The collection name. |
|
options.headers | Object | The headers object option. |
|
options.safe | Boolean | The safe option. |
Public Methods
public batch(fn: Function, options: Object): Promise<Object, Error> source
Performs batch operations at the current collection level.
Test:
public createRecord(record: Object, options: Object): Promise<Object, Error> source
Creates a record in current collection.
public deleteRecord(record: Object | String, options: Object): Promise<Object, Error> source
Deletes a record from the current collection.
public getPermissions(options: Object): Promise<Object, Error> source
Retrieves the list of permissions for this collection.
public getRecord(id: String, options: Object): Promise<Object, Error> source
Retrieves a record from the current collection.
Test:
public listRecords(options: Object): Promise<Object, Error> source
Lists records from the current collection.
Sorting is done by passing a sort
string option:
- The field to order the results by, prefixed with
-
for descending. Default:-last_modified
.
Params:
Name | Type | Attribute | Description |
options | Object | The options object. |
|
options.headers | Object | The headers object option. |
|
options.filters | Object | The filters object. |
|
options.sort | String | The sort field. |
|
options.limit | String | The limit field. |
|
options.pages | String | The number of result pages to aggregate. |
|
options.since | Number | Only retrieve records modified since the provided timestamp. |
See:
- http://kinto.readthedocs.io/en/stable/core/api/resource.html#sorting Filtering is done by passing a `filters` option object: - `{fieldname: "value"}` - `{min_fieldname: 4000}` - `{in_fieldname: "1,2,3"}` - `{not_fieldname: 0}` - `{exclude_fieldname: "0,1"}`
- http://kinto.readthedocs.io/en/stable/core/api/resource.html#filtering Paginating is done by passing a `limit` option, then calling the `next()` method from the resolved result object to fetch the next page, if any.
public setPermissions(permissions: Object, options: Object): Promise<Object, Error> source
Replaces all existing collection permissions with the ones provided.