Skip to content

Commit f160d6f

Browse files
authored
docs: add saveObjects, deleteObjects and partialUpdateObjects to helpers (#3256)
1 parent 7a90e45 commit f160d6f

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

website/docs/contributing/add-new-api-client.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -178,19 +178,22 @@ For more information, see [Common Test Suite](../contributing/testing/common-tes
178178

179179
The API clients have hand-written helpers for tasks that would otherwise require custom code.
180180

181-
| Helper name | Description | Wrapped API call | Stop condition | Example |
182-
|-------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------| ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
183-
| `waitForTask` | Given a `taskID`, calls the `getTask` method until the status gets `published` | `getTask()` | `response.status == "published"` | [JavaScript](https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/client-search/src/searchClient.ts) |
184-
| `waitForAppTask` | Given a `taskID`, calls the `getAppTask` method until the status gets `published` | `getAppTask()` | `response.status == "published"` | [JavaScript](https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/client-search/src/searchClient.ts) |
185-
| `waitForApiKey` | Given a `Key`, calls the `getApiKey` method until the stop condition for the given `operation` is validated | `getApiKey()` | Diff between the given `Key` and the `response` payload | [JavaScript](https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/client-search/src/searchClient.ts) |
186-
| `browseObjects<T>` | Given an `indexName` and the same parameters as the `browse` method, aggregates all the `objects` returned by the API calls in a single `browse` response object | `browse()` | `response.cursor == null` | [JavaScript](https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/client-search/src/searchClient.ts) |
187-
| `browseRules` | Given an `indexName` and the same parameters as the `searchRules` method, aggregates all the `rules` returned by the API calls in a single `searchRules` response object | `searchRules()` | `response.nbHits < params.hitsPerPage` | [JavaScript](https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/client-search/src/searchClient.ts) |
188-
| `browseSynonyms` | Given an `indexName` and the same parameters as the `searchSynonyms` method, aggregates all the `synonyms` returned by the API calls in a single `searchSynonyms` response object | `searchSynonyms()` | `response.nbHits < params.hitsPerPage` | [JavaScript](https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/client-search/src/searchClient.ts) |
189-
| `searchForHits<T>` | Given the same parameters as the `search` method, returns the API response with the certainty that it will only contain `hits` by casting it to a generic `SearchResponse<T>` object | `search()` | `none` | [JavaScript](https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/client-search/src/searchClient.ts) |
190-
| `searchForFacets` | Given the same parameters as the `search` method, returns the API response with the certainty that it will only contain `facets` by casting it to a `SearchForFacetValuesResponse` object | `search()` | `none` | [JavaScript](https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/client-search/src/searchClient.ts) |
191-
| `replaceAllObjects` | Given an `indexName` and an array of `objects`, replace all objects in this index using a temporary one | `operationIndex(), chunkedBatch()` | `none` | [PHP](https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-php/lib/Api/SearchClient.php) |
192-
| `generateSecuredApiKey` | Given a `indexName` and an array of `restrictions`, generates a secured API Key using the SHA-256 algorithm | `none` | `none` | [PHP](https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-php/lib/Api/SearchClient.php) |
193-
| `chunkedBatch` | Creates chunks of `objects` in order to make them fit in multiple `batch` requests | `none` | `none` | [PHP](https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-php/lib/Api/SearchClient.php) |
181+
| Helper name | Description | Wrapped API call | Stop condition | Example |
182+
|-------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------| ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
183+
| `waitForTask` | Given a `taskID`, calls the `getTask` method until the status gets `published` | `getTask()` | `response.status == "published"` | [JavaScript](https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/client-search/src/searchClient.ts) |
184+
| `waitForAppTask` | Given a `taskID`, calls the `getAppTask` method until the status gets `published` | `getAppTask()` | `response.status == "published"` | [JavaScript](https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/client-search/src/searchClient.ts) |
185+
| `waitForApiKey` | Given a `Key`, calls the `getApiKey` method until the stop condition for the given `operation` is validated | `getApiKey()` | Diff between the given `Key` and the `response` payload | [JavaScript](https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/client-search/src/searchClient.ts) |
186+
| `browseObjects<T>` | Given an `indexName` and the same parameters as the `browse` method, aggregates all the `objects` returned by the API calls in a single `browse` response object | `browse()` | `response.cursor == null` | [JavaScript](https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/client-search/src/searchClient.ts) |
187+
| `browseRules` | Given an `indexName` and the same parameters as the `searchRules` method, aggregates all the `rules` returned by the API calls in a single `searchRules` response object | `searchRules()` | `response.nbHits < params.hitsPerPage` | [JavaScript](https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/client-search/src/searchClient.ts) |
188+
| `browseSynonyms` | Given an `indexName` and the same parameters as the `searchSynonyms` method, aggregates all the `synonyms` returned by the API calls in a single `searchSynonyms` response object | `searchSynonyms()` | `response.nbHits < params.hitsPerPage` | [JavaScript](https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/client-search/src/searchClient.ts) |
189+
| `searchForHits<T>` | Given the same parameters as the `search` method, returns the API response with the certainty that it will only contain `hits` by casting it to a generic `SearchResponse<T>` object | `search()` | `none` | [JavaScript](https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/client-search/src/searchClient.ts) |
190+
| `searchForFacets` | Given the same parameters as the `search` method, returns the API response with the certainty that it will only contain `facets` by casting it to a `SearchForFacetValuesResponse` object | `search()` | `none` | [JavaScript](https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/client-search/src/searchClient.ts) |
191+
| `replaceAllObjects` | Given an `indexName` and an array of `objects`, replace all objects in this index using a temporary one | `operationIndex(), batch()` | `none` | [PHP](https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-php/lib/Api/SearchClient.php) |
192+
| `generateSecuredApiKey` | Given an `indexName` and an array of `restrictions`, generates a secured API Key using the SHA-256 algorithm | `none` | `none` | [PHP](https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-php/lib/Api/SearchClient.php) |
193+
| `chunkedBatch` | Creates chunks of `objects` in order to make them fit in multiple `batch` requests | `batch()` | `none` | [PHP](https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-php/lib/Api/SearchClient.php) |
194+
| `saveObjects` | Saves the given array of objects in the given index. The `chunkedBatch` helper is used under the hood, which creates a `batch` requests with at most 1000 objects in it. | `batch()` | `none` | [Go](https://github.com/algolia/api-clients-automation/blob/main/templates/go/search_helpers.mustache) |
195+
| `deleteObjects` | Deletes every records for the given objectIDs. The `chunkedBatch` helper is used under the hood, which creates a `batch` requests with at most 1000 objectIDs in it. | `batch()` | `none` | [Go](https://github.com/algolia/api-clients-automation/blob/main/templates/go/search_helpers.mustache) |
196+
| `partialUpdateObjects` | Replaces object content of all the given objects according to their respective `objectID` field. The `chunkedBatch` helper is used under the hood, which creates a `batch` requests with at most 1000 objects in it. | `batch()` | `none` | [Go](https://github.com/algolia/api-clients-automation/blob/main/templates/go/search_helpers.mustache) |
194197

195198
### `replaceAllObjects`
196199

0 commit comments

Comments
 (0)