clearIndex method

Future<AlgoliaTask> clearIndex()

ClearIndex

Clear the index referred to by this AlgoliaIndexReference.

Implementation

Future<AlgoliaTask> clearIndex() async {
  var response = await algolia._apiCall(
    ApiRequestType.post,
    'indexes/$encodedIndex/clear',
  );
  Map<String, dynamic> body = json.decode(response.body);

  if (!(response.statusCode >= 200 && response.statusCode < 300)) {
    throw AlgoliaError._(body, response.statusCode);
  }
  return AlgoliaTask._(algolia, index, body);
}