create method

Creates the specified index.

A newly created index's initial state is CREATING. On completion of the returned google.longrunning.Operation, the state will be READY. If the index already exists, the call will return an ALREADY_EXISTS status. During creation, the process could result in an error, in which case the index will move to the ERROR state. The process can be recovered by fixing the data that caused the error, removing the index with delete, then re-creating the index with create. Indexes with a single field cannot be created.

request - The metadata request object.

Request parameters:

parent - The name of the database this index will apply to. For example: projects/{project_id}/databases/{database_id} Value must have pattern ^projects/\[^/\]+/databases/\[^/\]+$.

$fields - Selector specifying which fields to include in a partial response.

Completes with a GoogleLongrunningOperation.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<GoogleLongrunningOperation> create(
  GoogleFirestoreAdminV1beta1Index request,
  core.String parent, {
  core.String? $fields,
}) async {
  final _body = convert.json.encode(request);
  final _queryParams = <core.String, core.List<core.String>>{
    if ($fields != null) 'fields': [$fields],
  };

  final _url = 'v1beta1/' + core.Uri.encodeFull('$parent') + '/indexes';

  final _response = await _requester.request(
    _url,
    'POST',
    body: _body,
    queryParams: _queryParams,
  );
  return GoogleLongrunningOperation.fromJson(
      _response as core.Map<core.String, core.dynamic>);
}