Skip to content

Commit 0f86f4b

Browse files
chore: generated code for commit 750721d0. [skip ci]
algolia/api-clients-automation@750721d Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent 8004842 commit 0f86f4b

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

packages/client-search/src/searchClient.ts

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -192,15 +192,19 @@ export function createSearchClient({
192192
* @param waitForTaskOptions - The waitForTaskOptions object.
193193
* @param waitForTaskOptions.indexName - The `indexName` where the operation was performed.
194194
* @param waitForTaskOptions.taskID - The `taskID` returned in the method response.
195+
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions.
195196
*/
196-
waitForTask({
197-
indexName,
198-
taskID,
199-
...createRetryablePromiseOptions
200-
}: WaitForTaskOptions): Promise<GetTaskResponse> {
197+
waitForTask(
198+
{
199+
indexName,
200+
taskID,
201+
...createRetryablePromiseOptions
202+
}: WaitForTaskOptions,
203+
requestOptions?: RequestOptions
204+
): Promise<GetTaskResponse> {
201205
return createRetryablePromise({
202206
...createRetryablePromiseOptions,
203-
func: () => this.getTask({ indexName, taskID }),
207+
func: () => this.getTask({ indexName, taskID }, requestOptions),
204208
validate: (response) => response.status === 'published',
205209
});
206210
},
@@ -213,13 +217,17 @@ export function createSearchClient({
213217
* @param waitForApiKeyOptions.operation - The `operation` that was done on a `key`.
214218
* @param waitForApiKeyOptions.key - The `key` that has been added, deleted or updated.
215219
* @param waitForApiKeyOptions.apiKey - Necessary to know if an `update` operation has been processed, compare fields of the response with it.
220+
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getApikey` method and merged with the transporter requestOptions.
216221
*/
217-
waitForApiKey({
218-
operation,
219-
key,
220-
apiKey,
221-
...createRetryablePromiseOptions
222-
}: WaitForApiKeyOptions): Promise<ApiError | Key> {
222+
waitForApiKey(
223+
{
224+
operation,
225+
key,
226+
apiKey,
227+
...createRetryablePromiseOptions
228+
}: WaitForApiKeyOptions,
229+
requestOptions?: RequestOptions
230+
): Promise<ApiError | Key> {
223231
if (operation === 'update') {
224232
if (!apiKey) {
225233
throw new Error(
@@ -229,7 +237,7 @@ export function createSearchClient({
229237

230238
return createRetryablePromise({
231239
...createRetryablePromiseOptions,
232-
func: () => this.getApiKey({ key }),
240+
func: () => this.getApiKey({ key }, requestOptions),
233241
validate: (response) => {
234242
for (const field of Object.keys(apiKey)) {
235243
if (Array.isArray(apiKey[field])) {
@@ -252,7 +260,8 @@ export function createSearchClient({
252260

253261
return createRetryablePromise({
254262
...createRetryablePromiseOptions,
255-
func: () => this.getApiKey({ key }).catch((error) => error),
263+
func: () =>
264+
this.getApiKey({ key }, requestOptions).catch((error) => error),
256265
validate: (error: ApiError) =>
257266
operation === 'add' ? error.status !== 404 : error.status === 404,
258267
});

0 commit comments

Comments
 (0)