Usage
The Dart API client has three separate functions,
one for each operation.
var response = await client.WaitForApiKeyAsync(
"api-key-add-operation-test-csharp",
Enum.Parse<ApiKeyOperation>("Add")
);
response, err := client.WaitForApiKey(
"api-key-add-operation-test-go", search.ApiKeyOperation("add"))
if err != nil {
// handle the eventual error
panic(err)
}
GetApiKeyResponse response = client.waitForApiKey("api-key-add-operation-test-java", ApiKeyOperation.ADD);
const response = await client.waitForApiKey({ key: 'api-key-add-operation-test-javascript', operation: 'add' });
var response =
client.waitForApiKey(
key = "api-key-add-operation-test-kotlin",
operation = ApiKeyOperation.entries.first { it.value == "add" },
)
$response = $client->waitForApiKey(
'api-key-add-operation-test-php',
'add',
);
response = client.wait_for_api_key(
key="api-key-add-operation-test-python",
operation="add",
)
response = client.wait_for_api_key("api-key-add-operation-test-ruby", "add")
val response = Await.result(
client.waitForApiKey(
key = "api-key-add-operation-test-scala",
operation = ApiKeyOperation.withName("add")
),
Duration(100, "sec")
)
let response = try await client.waitForApiKey(
key: "api-key-add-operation-test-swift",
operation: ApiKeyOperation.add
)
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,
}
);
response, err := client.WaitForApiKey(
"api-key-update-operation-test-go", search.ApiKeyOperation("update"), search.WithApiKey(
search.NewEmptyApiKey().SetDescription("my updated api key").SetAcl(
[]search.Acl{search.Acl("search"), search.Acl("addObject"), search.Acl("deleteObject")}).SetIndexes(
[]string{"Movies", "Books"}).SetReferers(
[]string{"*google.com", "*algolia.com"}).SetValidity(305).SetMaxQueriesPerIPPerHour(95).SetMaxHitsPerQuery(20)))
if err != nil {
// handle the eventual error
panic(err)
}
GetApiKeyResponse response = client.waitForApiKey(
"api-key-update-operation-test-java",
ApiKeyOperation.UPDATE,
new ApiKey()
.setDescription("my updated api key")
.setAcl(Arrays.asList(Acl.SEARCH, Acl.ADD_OBJECT, Acl.DELETE_OBJECT))
.setIndexes(Arrays.asList("Movies", "Books"))
.setReferers(Arrays.asList("*google.com", "*algolia.com"))
.setValidity(305)
.setMaxQueriesPerIPPerHour(95)
.setMaxHitsPerQuery(20)
);
const response = await client.waitForApiKey({
key: 'api-key-update-operation-test-javascript',
operation: 'update',
apiKey: {
description: 'my updated api key',
acl: ['search', 'addObject', 'deleteObject'],
indexes: ['Movies', 'Books'],
referers: ['*google.com', '*algolia.com'],
validity: 305,
maxQueriesPerIPPerHour: 95,
maxHitsPerQuery: 20,
},
});
var response =
client.waitForApiKey(
key = "api-key-update-operation-test-kotlin",
operation = ApiKeyOperation.entries.first { it.value == "update" },
apiKey =
ApiKey(
description = "my updated api key",
acl =
listOf(
Acl.entries.first { it.value == "search" },
Acl.entries.first { it.value == "addObject" },
Acl.entries.first { it.value == "deleteObject" },
),
indexes = listOf("Movies", "Books"),
referers = listOf("*google.com", "*algolia.com"),
validity = 305,
maxQueriesPerIPPerHour = 95,
maxHitsPerQuery = 20,
),
)
$response = $client->waitForApiKey(
'api-key-update-operation-test-php',
'update',
['description' => 'my updated api key',
'acl' => [
'search',
'addObject',
'deleteObject',
],
'indexes' => [
'Movies',
'Books',
],
'referers' => [
'*google.com',
'*algolia.com',
],
'validity' => 305,
'maxQueriesPerIPPerHour' => 95,
'maxHitsPerQuery' => 20,
],
);
response = client.wait_for_api_key(
key="api-key-update-operation-test-python",
operation="update",
api_key={
"description": "my updated api key",
"acl": [
"search",
"addObject",
"deleteObject",
],
"indexes": [
"Movies",
"Books",
],
"referers": [
"*google.com",
"*algolia.com",
],
"validity": 305,
"maxQueriesPerIPPerHour": 95,
"maxHitsPerQuery": 20,
},
)
response = client.wait_for_api_key(
"api-key-update-operation-test-ruby",
"update",
Algolia::Search::ApiKey.new(
description: "my updated api key",
acl: ["search", "addObject", "deleteObject"],
indexes: ["Movies", "Books"],
referers: ["*google.com", "*algolia.com"],
validity: 305,
max_queries_per_ip_per_hour: 95,
max_hits_per_query: 20
)
)
val response = Await.result(
client.waitForApiKey(
key = "api-key-update-operation-test-scala",
operation = ApiKeyOperation.withName("update"),
apiKey = Some(
ApiKey(
description = Some("my updated api key"),
acl = Seq(Acl.withName("search"), Acl.withName("addObject"), Acl.withName("deleteObject")),
indexes = Some(Seq("Movies", "Books")),
referers = Some(Seq("*google.com", "*algolia.com")),
validity = Some(305),
maxQueriesPerIPPerHour = Some(95),
maxHitsPerQuery = Some(20)
)
)
),
Duration(100, "sec")
)
let response = try await client.waitForApiKey(
key: "api-key-update-operation-test-swift",
operation: ApiKeyOperation.update,
apiKey: ApiKey(
acl: [Acl.search, Acl.addObject, Acl.deleteObject],
description: "my updated api key",
indexes: ["Movies", "Books"],
maxHitsPerQuery: 20,
maxQueriesPerIPPerHour: 95,
referers: ["*google.com", "*algolia.com"],
validity: 305
)
)
var response = await client.WaitForApiKeyAsync(
"api-key-delete-operation-test-csharp",
Enum.Parse<ApiKeyOperation>("Delete")
);
response, err := client.WaitForApiKey(
"api-key-delete-operation-test-go", search.ApiKeyOperation("delete"))
if err != nil {
// handle the eventual error
panic(err)
}
GetApiKeyResponse response = client.waitForApiKey("api-key-delete-operation-test-java", ApiKeyOperation.DELETE);
const response = await client.waitForApiKey({ key: 'api-key-delete-operation-test-javascript', operation: 'delete' });
var response =
client.waitForApiKey(
key = "api-key-delete-operation-test-kotlin",
operation = ApiKeyOperation.entries.first { it.value == "delete" },
)
$response = $client->waitForApiKey(
'api-key-delete-operation-test-php',
'delete',
);
response = client.wait_for_api_key(
key="api-key-delete-operation-test-python",
operation="delete",
)
response = client.wait_for_api_key("api-key-delete-operation-test-ruby", "delete")
val response = Await.result(
client.waitForApiKey(
key = "api-key-delete-operation-test-scala",
operation = ApiKeyOperation.withName("delete")
),
Duration(100, "sec")
)
let response = try await client.waitForApiKey(
key: "api-key-delete-operation-test-swift",
operation: ApiKeyOperation.delete
)
Parameters
- C#
- Dart
- Go
- Java
- JavaScript
- Kotlin
- PHP
- Python
- Ruby
- Scala
- Swift
string
required
API key to wait for.
ApiKeyOperation
required
Operation type to wait for.
One of:
ApiKeyOperation.Add,
ApiKeyOperation.Update,
or ApiKeyOperation.Delete.ApiKey
API key object.
Required for
Update operations.
For details about the API key properties, see Update API key.int
default:50
Maximum number of retries for checking the status.
Func<int,int>
Returns a timeout based on the current number of iterations.
RequestOptions
Additional request options.
CancellationToken
Parameter that can be used as a signal to cancel the request.
string
required
API key to wait for.
ApiKey
API key object with expected properties.
Required for the
waitKeyUpdate method.
For details about the API key properties,
see Update API key.WaitParams
Hide child attributes
Hide child attributes
RequestOptions
Additional request options.
string
required
API key to wait for.
ApiKeyOperation
required
Operation type to wait for.
One of:
search.API_KEY_OPERATION_ADD,
search.API_KEY_OPERATION_UPDATE,
or search.API_KEY_OPERATION_DELETE.WaitForApiKeyOption
Functional options to provide extra arguments.
Show available functions
Show available functions
function
Signature:
func(apiKey ApiKey) waitForApiKeyOptionAPI key object.
Required for update operations.
For details about the API key properties, see Update API key.function
Signature:
func(maxRetries int) iterableOptionSets the maximum number of retries for this method.function
Signature:
func(count int) time.DurationReturns a timeout based on the current number of iterations.function
Signature:
func(key string, value string) requestOptionSets extra header parameters for this request.
To learn more, see request options.function
Signature:
func(key string, value string) requestOptionSets extra query parameters for this request.
To learn more, see request options.String
required
API key to wait for.
ApiKeyOperation
required
Operation type to wait for.
One of:
ApiKeyOperation.ADD,
ApiKeyOperation.UPDATE,
or ApiKeyOperation.DELETE.ApiKey
API key object.
Required for
UPDATE operations.
For details about the API key properties,
see Update API key.int
default:50
Maximum number of retries for checking the status.
function
Default:
(int retries) -> Math.min(retries * 200, 5000)Returns the time between status checks based on the current number of iterations.
By default, the initial delay is 200 milliseconds.
With every iteration, the delay increases by 200 milliseconds,
until a maximum of 5 seconds is reached.RequestOptions
Additional request options.
string
required
API key to wait for.
string
required
Operation type to wait for.
One of:
add, update, or delete.object
API key object.
Required for
update operations.
For details about the API key properties,
see Update API key.number
default:50
Maximum number of retries for checking the status.
function
Default:
(retryCount: number) -> Math.min(retryCount * 200, 5000)Returns the time between status checks based on the current number of iterations.
By default, the initial delay is 200 milliseconds.
With every iteration, the delay increases by 200 milliseconds,
until a maximum of 5 seconds is reached.RequestOptions
Additional request options.
String
required
API key to wait for.
ApiKeyOperation
required
Operation type to wait for.
Can be
ApiKeyOperation.Add,
ApiKeyOperation.Update,
or ApiKeyOperation.Delete.ApiKey
API key object.
Required for
update operations.
For details about the API key properties,
see Update API key.int
default:50
Maximum number of retries for checking the status.
Duration
default:"200 ms"
Time after which the status is checked for the first time.
This time is doubled after every check until it reaches the value set by
maxDelay.Duration
default:"5 seconds"
Maximum time to wait between status checks.
RequestOptions
Additional request options.
string
required
API key to wait for.
string
required
Operation type to wait for.
One of:
add, update, or delete.array
API key object.
Required for
update operations.
For details about the API key properties,
see Update API key.int
default:50
Maximum number of retries for checking the status.
int
default:5000
Number of milliseconds between status checks.
array
Additional request options.
str
required
API key to wait for.
str
required
Operation type to wait for.
One of:
add, update, or delete.dict | ApiKey
API key object.
Required for
update operations.
For details about the API key properties,
see Update API key.int
default:50
Maximum number of retries for checking the status.
Callable[[int], int]
Default:
min(retry_count*0.2, 5)Returns the time between status checks based on the current number of iterations.
By default, the initial delay is 200 milliseconds.
With every iteration, the delay increases by 200 milliseconds,
until a maximum of 5 seconds is reached.dict | RequestOptions
Additional request options.
String
required
API key to wait for.
String
required
Operation type to wait for.
One of:
add, update, or delete.ApiKey
API key object.
Required for
update operations.
For details about the API key properties,
see Update API key.Integer
default:50
Maximum number of retries for checking the status.
function
Default:
[retry_count * 200, 5000].minReturns the time between status checks based on the current number of iterations.
By default, the initial delay is 200 milliseconds.
With every iteration, the delay increases by 200 milliseconds,
until a maximum of 5 seconds is reached.Hash
Additional request options.
String
required
API key to wait for.
ApiKeyOperation
required
Operation type to wait for.
One of:
ApiKeyOperation.Add,
ApiKeyOperation.Update,
or ApiKeyOperation.Delete.Option[ApiKey]
API key object.
Required for
update operations.
For details about the API key properties,
see Update API key.int
default:50
Maximum number of retries for checking the status.
Long => Long
Default:
(retries: Long) => Math.min(retries * 200, 5000)Returns the time between status checks based on the current number of iterations.
By default, the initial delay is 200 milliseconds.
With every iteration, the delay increases by 200 milliseconds,
until a maximum of 5 seconds is reached.RequestOptions
Additional request options.
String
required
API key to wait for.
ApiKeyOperation
required
Operation type to wait for.
One of:
ApiKeyOperation.add,
ApiKeyOperation.update, or ApiKeyOperation.delete.ApiKey
API key object.
Required for
update operations.
For details about the API key properties,
see Update API key.int
default:50
Maximum number of retries for checking the status.
(int) -> TimeInterval
Default:
(retryCount) -> min(TimeInterval(retryCount) * 0.2, 5)Returns the time between status checks based on the current number of iterations.
By default, the initial delay is 200 milliseconds.
With every iteration, the delay increases by 200 milliseconds,
until a maximum of 5 seconds is reached.RequestOptions
Additional request options.