Skip to content

Commit

Permalink
add wait for api key for kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
aallam committed Sep 22, 2023
1 parent b8e8644 commit f8edb7e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.

This file was deleted.

This file was deleted.

29 changes: 28 additions & 1 deletion website/docs/clients/guides/wait-for-api-key-to-be-valid.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,34 @@ client.waitForApiKey(ApiKeyOperation.DELETE, key);
</TabItem>

<TabItem value="kotlin">
// TBD

```kotlin
import com.algolia.client.api.SearchClient
import com.algolia.client.extensions.*
import com.algolia.client.model.search.*

val client = SearchClient("<YOUR_APP_ID>", "<YOUR_API_KEY>")

val keyResponse = client.addApiKey(apiKey = ApiKey(acl = listOf(Acl.Analytics, Acl.Browse, Acl.EditSettings)))
// Poll the task status with defaults values
client.waitKeyCreation(keyResponse.key)

// The fields to update on your API key
val updatesToPerform = ApiKey(acl = listOf(Acl.Analytics, Acl.Search), indexes = listOf("products"))
// Call for update
client.updateApiKey(key = keyResponse.key, apiKey = updatesToPerform)
// Wait for update to be done
client.waitKeyUpdate(
key = keyResponse.key,
apiKey = updatesToPerform, // We provide the updated fields to check if the changes have been applied
);

// Call for delete
client.deleteApiKey(key = keyResponse.key)
// Wait for delete to be done
client.waitKeyDelete(key = keyResponse.key)
```

</TabItem>

<TabItem value="dart">
Expand Down

0 comments on commit f8edb7e

Please sign in to comment.