query #
Base method used to send queries to Kuzzle, following the API Documentation.
This is a low-level method, exposed to allow advanced SDK users to bypass high-level methods.
Arguments #
Future<KuzzleResponse> query(KuzzleRequest request,
{Map<String, dynamic> volatile, bool queueable = true})
Argument | Type | Description |
---|---|---|
request | KuzzleRequest | API request |
volatile | Map<String, dynamic> | Additional information to send to Kuzzle |
queueable | bool | If true, queues the request during downtime, until connected to Kuzzle again |
request #
All properties necessary for the Kuzzle API can be added in the query object. The following properties are the most common.
Property | Type | Description |
---|---|---|
controller | String | Controller name (mandatory) |
action | String | Action name (mandatory) |
body | Map<String, dynamic> | Query body for this action |
index | String | Index name for this action |
collection | String | Collection name for this action |
_id | String | id for this action |
volatile | Map<String, dynamic> | Additional information to send to Kuzzle |
Returns #
Returns a KuzzleResponse object which represents a raw Kuzzle API response. See the API Documentation.
Usage #
KuzzleResponse res = await kuzzle.query(KuzzleRequest(
controller: 'document',
action: 'create',
index: 'nyc-open-data',
collection: 'yellow-taxi',
uid: 'my-custom-document-id',
body: {
'trip_distance': 4.23,
'passenger_count': 2
},
waitForRefresh: true,
));
Edit this page on Github(opens new window)