KintoClientBase
Direct Subclass:
High level HTTP client for the Kinto API.
Example:
const client = new KintoClient("https://kinto.dev.mozaws.net/v1");
client.bucket("default")
.collection("my-blog")
.createRecord({title: "First article"})
.then(console.log.bind(console))
.catch(console.error.bind(console));
Constructor Summary
Public Constructor | ||
public |
constructor(remote: String, options: Object) Constructor. |
Member Summary
Public Members | ||
public get |
Backoff remaining time, in milliseconds. |
|
public get |
The remote endpoint base URL. |
|
public get |
The current server protocol version, eg. |
Method Summary
Public Methods | ||
public |
Retrieve a bucket object to perform operations on it. |
|
public |
Creates a new bucket on the server. |
|
public |
fetchHTTPApiVersion(options: {}): Promise<Object, Error> Retrieve authenticated user information. |
|
public |
fetchServerCapabilities(options: {}): Promise<Object, Error> Retrieve server capabilities information. |
|
public |
fetchServerInfo(options: Object): Promise<Object, Error> Retrieves server information and persist them locally. |
|
public |
fetchServerSettings(options: {}): Promise<Object, Error> Retrieves Kinto server settings. |
|
public |
Retrieve authenticated user information. |
|
public |
listBuckets(options: Object): Promise<Object[], Error> Retrieves the list of buckets. |
Public Constructors
public constructor(remote: String, options: Object) source
Constructor.
Params:
Name | Type | Attribute | Description |
remote | String | The remote URL. |
|
options | Object | The options object. |
|
options.safe | Boolean | Adds concurrency headers to every
requests (default: |
|
options.events | EventEmitter | The events handler. If none provided
an |
|
options.headers | Object | The key-value headers to pass to each
request (default: |
|
options.bucket | String | The default bucket to use (default:
|
|
options.requestMode | String | The HTTP request mode (from ES6 fetch spec). |
|
options.timeout | Number | The requests timeout in ms (default: |
Public Members
public get backoff: Number source
Backoff remaining time, in milliseconds. Defaults to zero if no backoff is ongoing.
Public Methods
public bucket(name: String, options: Object, safe: Boolean, bucket: String, headers: Object): Bucket source
Retrieve a bucket object to perform operations on it.
Test:
public createBucket(id: String, options: Object): Promise<Object, Error> source
Creates a new bucket on the server.
public fetchHTTPApiVersion(options: {}): Promise<Object, Error> source
Retrieve authenticated user information.
Params:
Name | Type | Attribute | Description |
options | {} |
|
public fetchServerCapabilities(options: {}): Promise<Object, Error> source
Retrieve server capabilities information.
Params:
Name | Type | Attribute | Description |
options | {} |
|
public fetchServerInfo(options: Object): Promise<Object, Error> source
Retrieves server information and persist them locally. This operation is usually performed a single time during the instance lifecycle.
Params:
Name | Type | Attribute | Description |
options | Object | The request options. |
public fetchServerSettings(options: {}): Promise<Object, Error> source
Retrieves Kinto server settings.
Params:
Name | Type | Attribute | Description |
options | {} |
|