post method

Future<Object> post({
  1. required String path,
  2. Map<String, Object>? parameters,
  3. Object? body,
  4. RequestOptions? requestOptions,
})

Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API.

Parameters:

  • path Path of the endpoint, anything after "/1" must be specified.
  • parameters Query parameters to apply to the current query.
  • body Parameters to send with the custom request.
  • requestOptions additional request configuration.

Implementation

Future<Object> post({
  required String path,
  Map<String, Object>? parameters,
  Object? body,
  RequestOptions? requestOptions,
}) async {
  assert(
    path.isNotEmpty,
    'Parameter `path` is required when calling `post`.',
  );
  final request = ApiRequest(
    method: RequestMethod.post,
    path: r'/1{path}'.replaceAll('{' r'path' '}', path),
    queryParams: {
      ...?parameters,
    },
    body: body,
  );
  final response = await _retryStrategy.execute(
    request: request,
    options: requestOptions,
  );
  return deserialize<Object, Object>(
    response,
    'Object',
    growable: true,
  );
}