Skip to content

docs(java): document browse and waitForApiKey #956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions website/docs/clients/guides/wait-for-api-key-to-be-valid.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,45 @@ $client->waitForApiKey('delete', $key);

```

</TabItem>
<TabItem value="java">

```java
import com.algolia.api.SearchClient;
import com.algolia.model.search.*;
import com.algolia.utils.*;

SearchClient client = new SearchClient("<YOUR_APP_ID>", "<YOUR_API_KEY>");

AddApiKeyResponse keyResponse = client.addApiKey(new ApiKey().addAcl(Acl.ANALYTICS).addAcl(Acl.BROWSE).addAcl(Acl.EDIT_SETTINGS));
String key = keyResponse.getKey();

// Poll the task status with defaults values
client.waitForApiKey(ApiKeyOperation.ADD, key);

// The fields to update on your API key
ApiKey updatesToPerform = new ApiKey()
.addAcl(Acl.ANALYTICS)
.addAcl(Acl.SEARCH)
.addIndexes("products");

// Call for update
client.updateApiKey(key, updatesToPerform);

// Wait for update to be done
client.waitForApiKey(
ApiKeyOperation.UPDATE,
key,
// We provide the updated fields to check if the changes have been applied
updatesToPerform
);

// Call for delete
client.deleteApiKey(key);

// Wait for delete to be done
client.waitForApiKey(ApiKeyOperation.DELETE, key);
```

</TabItem>
</TabsLanguage>
32 changes: 31 additions & 1 deletion website/docs/clients/migration-guides/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,37 @@ var_dump($rules);
<TabItem value="java">

```java
// WIP
// browse records
Iterable<MyObject> objects = client.browseObjects(
"<YOUR_INDEX_NAME>",
// all base `browse` options are forwarded to the `browse` method
new BrowseParamsObject()
);
for (MyObject object : objects) {
System.out.println(object.myProperty);
}

// browse rules
Iterable<Rule> rules = client.browseRules(
"<YOUR_INDEX_NAME>",
// all base `searchRules` options are forwarded to the `searchRules` method (optional)
new SearchRulesParams()
);
for (Rule rule : rules) {
System.out.println(rule);
}

// browse synonyms
Iterable<SynonymHit> synonyms = client.browseRules(
"<YOUR_INDEX_NAME>",
// only search for specific types of synonyms. (optional)
null,
// all base `searchSynonyms` options are forwarded to the `searchSynonyms` method (optional)
new SearchSynonymsParams()
);
for (SynonymHit synonym : synonyms) {
System.out.println(synonym);
}

```

Expand Down