Skip to main content
When you add, update, or delete an API key, the changes might not be immediately visible. This method lets you wait until the operation is fully processed.

Usage

The Dart API client has three separate functions, one for each operation.
Wait until an API key is created:
var response = await client.WaitForApiKeyAsync(
  "api-key-add-operation-test-csharp",
  Enum.Parse<ApiKeyOperation>("Add")
);
Wait until an API key is updated:
var response = await client.WaitForApiKeyAsync(
  "api-key-update-operation-test-csharp",
  Enum.Parse<ApiKeyOperation>("Update"),
  new ApiKey
  {
    Description = "my updated api key",
    Acl = new List<Acl>
    {
      Enum.Parse<Acl>("Search"),
      Enum.Parse<Acl>("AddObject"),
      Enum.Parse<Acl>("DeleteObject"),
    },
    Indexes = new List<string> { "Movies", "Books" },
    Referers = new List<string> { "*google.com", "*algolia.com" },
    Validity = 305,
    MaxQueriesPerIPPerHour = 95,
    MaxHitsPerQuery = 20,
  }
);
Wait until an API key is deleted:
var response = await client.WaitForApiKeyAsync(
  "api-key-delete-operation-test-csharp",
  Enum.Parse<ApiKeyOperation>("Delete")
);

Parameters

  • C#
  • Dart
  • Go
  • Java
  • JavaScript
  • Kotlin
  • PHP
  • Python
  • Ruby
  • Scala
  • Swift
key
string
required
API key to wait for.
operation
ApiKeyOperation
required
Operation type to wait for. One of: ApiKeyOperation.Add, ApiKeyOperation.Update, or ApiKeyOperation.Delete.
apiKey
ApiKey
API key object. Required for Update operations. For details about the API key properties, see Update API key.
maxRetries
int
default:50
Maximum number of retries for checking the status.
timeout
Func<int,int>
Returns a timeout based on the current number of iterations.
requestOptions
RequestOptions
Additional request options.
cancellationToken
CancellationToken
Parameter that can be used as a signal to cancel the request.
I