getRule method

Future<Rule> getRule({
  1. required String indexName,
  2. required String objectID,
  3. RequestOptions? requestOptions,
})

Retrieves a rule by its ID. To find the object ID of rules, use the search operation.

Required API Key ACLs:

  • settings

Parameters:

  • indexName Name of the index on which to perform the operation.
  • objectID Unique identifier of a rule object.
  • requestOptions additional request configuration.

Implementation

Future<Rule> getRule({
  required String indexName,
  required String objectID,
  RequestOptions? requestOptions,
}) async {
  assert(
    indexName.isNotEmpty,
    'Parameter `indexName` is required when calling `getRule`.',
  );
  assert(
    objectID.isNotEmpty,
    'Parameter `objectID` is required when calling `getRule`.',
  );
  final request = ApiRequest(
    method: RequestMethod.get,
    path: r'/1/indexes/{indexName}/rules/{objectID}'
        .replaceAll(
            '{' r'indexName' '}', Uri.encodeComponent(indexName.toString()))
        .replaceAll(
            '{' r'objectID' '}', Uri.encodeComponent(objectID.toString())),
  );
  final response = await _retryStrategy.execute(
    request: request,
    options: requestOptions,
  );
  return deserialize<Rule, Rule>(
    response,
    'Rule',
    growable: true,
  );
}