@algolia/recommend 5.3.1 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,409 @@
1
+ // builds/fetch.ts
2
+ import {
3
+ createMemoryCache,
4
+ createNullCache,
5
+ DEFAULT_CONNECT_TIMEOUT_NODE,
6
+ DEFAULT_READ_TIMEOUT_NODE,
7
+ DEFAULT_WRITE_TIMEOUT_NODE
8
+ } from "@algolia/client-common";
9
+ import { createFetchRequester } from "@algolia/requester-fetch";
10
+
11
+ // src/recommendClient.ts
12
+ import { createAuth, createTransporter, getAlgoliaAgent, shuffle } from "@algolia/client-common";
13
+ var apiClientVersion = "5.4.0";
14
+ function getDefaultHosts(appId) {
15
+ return [
16
+ {
17
+ url: `${appId}-dsn.algolia.net`,
18
+ accept: "read",
19
+ protocol: "https"
20
+ },
21
+ {
22
+ url: `${appId}.algolia.net`,
23
+ accept: "write",
24
+ protocol: "https"
25
+ }
26
+ ].concat(
27
+ shuffle([
28
+ {
29
+ url: `${appId}-1.algolianet.com`,
30
+ accept: "readWrite",
31
+ protocol: "https"
32
+ },
33
+ {
34
+ url: `${appId}-2.algolianet.com`,
35
+ accept: "readWrite",
36
+ protocol: "https"
37
+ },
38
+ {
39
+ url: `${appId}-3.algolianet.com`,
40
+ accept: "readWrite",
41
+ protocol: "https"
42
+ }
43
+ ])
44
+ );
45
+ }
46
+ function createRecommendClient({
47
+ appId: appIdOption,
48
+ apiKey: apiKeyOption,
49
+ authMode,
50
+ algoliaAgents,
51
+ ...options
52
+ }) {
53
+ const auth = createAuth(appIdOption, apiKeyOption, authMode);
54
+ const transporter = createTransporter({
55
+ hosts: getDefaultHosts(appIdOption),
56
+ ...options,
57
+ algoliaAgent: getAlgoliaAgent({
58
+ algoliaAgents,
59
+ client: "Recommend",
60
+ version: apiClientVersion
61
+ }),
62
+ baseHeaders: {
63
+ "content-type": "text/plain",
64
+ ...auth.headers(),
65
+ ...options.baseHeaders
66
+ },
67
+ baseQueryParameters: {
68
+ ...auth.queryParameters(),
69
+ ...options.baseQueryParameters
70
+ }
71
+ });
72
+ return {
73
+ transporter,
74
+ /**
75
+ * The `appId` currently in use.
76
+ */
77
+ appId: appIdOption,
78
+ /**
79
+ * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
80
+ */
81
+ clearCache() {
82
+ return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
83
+ },
84
+ /**
85
+ * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
86
+ */
87
+ get _ua() {
88
+ return transporter.algoliaAgent.value;
89
+ },
90
+ /**
91
+ * Adds a `segment` to the `x-algolia-agent` sent with every requests.
92
+ *
93
+ * @param segment - The algolia agent (user-agent) segment to add.
94
+ * @param version - The version of the agent.
95
+ */
96
+ addAlgoliaAgent(segment, version) {
97
+ transporter.algoliaAgent.add({ segment, version });
98
+ },
99
+ /**
100
+ * Helper method to switch the API key used to authenticate the requests.
101
+ *
102
+ * @param params - Method params.
103
+ * @param params.apiKey - The new API Key to use.
104
+ */
105
+ setClientApiKey({ apiKey }) {
106
+ if (!authMode || authMode === "WithinHeaders") {
107
+ transporter.baseHeaders["x-algolia-api-key"] = apiKey;
108
+ } else {
109
+ transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
110
+ }
111
+ },
112
+ /**
113
+ * This method allow you to send requests to the Algolia REST API.
114
+ *
115
+ * @param customDelete - The customDelete object.
116
+ * @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
117
+ * @param customDelete.parameters - Query parameters to apply to the current query.
118
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
119
+ */
120
+ customDelete({ path, parameters }, requestOptions) {
121
+ if (!path) {
122
+ throw new Error("Parameter `path` is required when calling `customDelete`.");
123
+ }
124
+ const requestPath = "/{path}".replace("{path}", path);
125
+ const headers = {};
126
+ const queryParameters = parameters ? parameters : {};
127
+ const request = {
128
+ method: "DELETE",
129
+ path: requestPath,
130
+ queryParameters,
131
+ headers
132
+ };
133
+ return transporter.request(request, requestOptions);
134
+ },
135
+ /**
136
+ * This method allow you to send requests to the Algolia REST API.
137
+ *
138
+ * @param customGet - The customGet object.
139
+ * @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
140
+ * @param customGet.parameters - Query parameters to apply to the current query.
141
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
142
+ */
143
+ customGet({ path, parameters }, requestOptions) {
144
+ if (!path) {
145
+ throw new Error("Parameter `path` is required when calling `customGet`.");
146
+ }
147
+ const requestPath = "/{path}".replace("{path}", path);
148
+ const headers = {};
149
+ const queryParameters = parameters ? parameters : {};
150
+ const request = {
151
+ method: "GET",
152
+ path: requestPath,
153
+ queryParameters,
154
+ headers
155
+ };
156
+ return transporter.request(request, requestOptions);
157
+ },
158
+ /**
159
+ * This method allow you to send requests to the Algolia REST API.
160
+ *
161
+ * @param customPost - The customPost object.
162
+ * @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
163
+ * @param customPost.parameters - Query parameters to apply to the current query.
164
+ * @param customPost.body - Parameters to send with the custom request.
165
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
166
+ */
167
+ customPost({ path, parameters, body }, requestOptions) {
168
+ if (!path) {
169
+ throw new Error("Parameter `path` is required when calling `customPost`.");
170
+ }
171
+ const requestPath = "/{path}".replace("{path}", path);
172
+ const headers = {};
173
+ const queryParameters = parameters ? parameters : {};
174
+ const request = {
175
+ method: "POST",
176
+ path: requestPath,
177
+ queryParameters,
178
+ headers,
179
+ data: body ? body : {}
180
+ };
181
+ return transporter.request(request, requestOptions);
182
+ },
183
+ /**
184
+ * This method allow you to send requests to the Algolia REST API.
185
+ *
186
+ * @param customPut - The customPut object.
187
+ * @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
188
+ * @param customPut.parameters - Query parameters to apply to the current query.
189
+ * @param customPut.body - Parameters to send with the custom request.
190
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
191
+ */
192
+ customPut({ path, parameters, body }, requestOptions) {
193
+ if (!path) {
194
+ throw new Error("Parameter `path` is required when calling `customPut`.");
195
+ }
196
+ const requestPath = "/{path}".replace("{path}", path);
197
+ const headers = {};
198
+ const queryParameters = parameters ? parameters : {};
199
+ const request = {
200
+ method: "PUT",
201
+ path: requestPath,
202
+ queryParameters,
203
+ headers,
204
+ data: body ? body : {}
205
+ };
206
+ return transporter.request(request, requestOptions);
207
+ },
208
+ /**
209
+ * Deletes a Recommend rule from a recommendation scenario.
210
+ *
211
+ * Required API Key ACLs:
212
+ * - editSettings.
213
+ *
214
+ * @param deleteRecommendRule - The deleteRecommendRule object.
215
+ * @param deleteRecommendRule.indexName - Name of the index on which to perform the operation.
216
+ * @param deleteRecommendRule.model - [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).
217
+ * @param deleteRecommendRule.objectID - Unique record identifier.
218
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
219
+ */
220
+ deleteRecommendRule({ indexName, model, objectID }, requestOptions) {
221
+ if (!indexName) {
222
+ throw new Error("Parameter `indexName` is required when calling `deleteRecommendRule`.");
223
+ }
224
+ if (!model) {
225
+ throw new Error("Parameter `model` is required when calling `deleteRecommendRule`.");
226
+ }
227
+ if (!objectID) {
228
+ throw new Error("Parameter `objectID` is required when calling `deleteRecommendRule`.");
229
+ }
230
+ const requestPath = "/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{model}", encodeURIComponent(model)).replace("{objectID}", encodeURIComponent(objectID));
231
+ const headers = {};
232
+ const queryParameters = {};
233
+ const request = {
234
+ method: "DELETE",
235
+ path: requestPath,
236
+ queryParameters,
237
+ headers
238
+ };
239
+ return transporter.request(request, requestOptions);
240
+ },
241
+ /**
242
+ * Retrieves a Recommend rule that you previously created in the Algolia dashboard.
243
+ *
244
+ * Required API Key ACLs:
245
+ * - settings.
246
+ *
247
+ * @param getRecommendRule - The getRecommendRule object.
248
+ * @param getRecommendRule.indexName - Name of the index on which to perform the operation.
249
+ * @param getRecommendRule.model - [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).
250
+ * @param getRecommendRule.objectID - Unique record identifier.
251
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
252
+ */
253
+ getRecommendRule({ indexName, model, objectID }, requestOptions) {
254
+ if (!indexName) {
255
+ throw new Error("Parameter `indexName` is required when calling `getRecommendRule`.");
256
+ }
257
+ if (!model) {
258
+ throw new Error("Parameter `model` is required when calling `getRecommendRule`.");
259
+ }
260
+ if (!objectID) {
261
+ throw new Error("Parameter `objectID` is required when calling `getRecommendRule`.");
262
+ }
263
+ const requestPath = "/1/indexes/{indexName}/{model}/recommend/rules/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{model}", encodeURIComponent(model)).replace("{objectID}", encodeURIComponent(objectID));
264
+ const headers = {};
265
+ const queryParameters = {};
266
+ const request = {
267
+ method: "GET",
268
+ path: requestPath,
269
+ queryParameters,
270
+ headers
271
+ };
272
+ return transporter.request(request, requestOptions);
273
+ },
274
+ /**
275
+ * Checks the status of a given task. Deleting a Recommend rule is asynchronous. When you delete a rule, a task is created on a queue and completed depending on the load on the server. The API response includes a task ID that you can use to check the status.
276
+ *
277
+ * Required API Key ACLs:
278
+ * - editSettings.
279
+ *
280
+ * @param getRecommendStatus - The getRecommendStatus object.
281
+ * @param getRecommendStatus.indexName - Name of the index on which to perform the operation.
282
+ * @param getRecommendStatus.model - [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).
283
+ * @param getRecommendStatus.taskID - Unique task identifier.
284
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
285
+ */
286
+ getRecommendStatus({ indexName, model, taskID }, requestOptions) {
287
+ if (!indexName) {
288
+ throw new Error("Parameter `indexName` is required when calling `getRecommendStatus`.");
289
+ }
290
+ if (!model) {
291
+ throw new Error("Parameter `model` is required when calling `getRecommendStatus`.");
292
+ }
293
+ if (!taskID) {
294
+ throw new Error("Parameter `taskID` is required when calling `getRecommendStatus`.");
295
+ }
296
+ const requestPath = "/1/indexes/{indexName}/{model}/task/{taskID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{model}", encodeURIComponent(model)).replace("{taskID}", encodeURIComponent(taskID));
297
+ const headers = {};
298
+ const queryParameters = {};
299
+ const request = {
300
+ method: "GET",
301
+ path: requestPath,
302
+ queryParameters,
303
+ headers
304
+ };
305
+ return transporter.request(request, requestOptions);
306
+ },
307
+ /**
308
+ * Retrieves recommendations from selected AI models.
309
+ *
310
+ * Required API Key ACLs:
311
+ * - search.
312
+ *
313
+ * @param getRecommendationsParams - The getRecommendationsParams object.
314
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
315
+ */
316
+ getRecommendations(getRecommendationsParams, requestOptions) {
317
+ if (getRecommendationsParams && Array.isArray(getRecommendationsParams)) {
318
+ const newSignatureRequest = {
319
+ requests: getRecommendationsParams
320
+ };
321
+ getRecommendationsParams = newSignatureRequest;
322
+ }
323
+ if (!getRecommendationsParams) {
324
+ throw new Error("Parameter `getRecommendationsParams` is required when calling `getRecommendations`.");
325
+ }
326
+ if (!getRecommendationsParams.requests) {
327
+ throw new Error("Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.");
328
+ }
329
+ const requestPath = "/1/indexes/*/recommendations";
330
+ const headers = {};
331
+ const queryParameters = {};
332
+ const request = {
333
+ method: "POST",
334
+ path: requestPath,
335
+ queryParameters,
336
+ headers,
337
+ data: getRecommendationsParams,
338
+ useReadTransporter: true,
339
+ cacheable: true
340
+ };
341
+ return transporter.request(request, requestOptions);
342
+ },
343
+ /**
344
+ * Searches for Recommend rules. Use an empty query to list all rules for this recommendation scenario.
345
+ *
346
+ * Required API Key ACLs:
347
+ * - settings.
348
+ *
349
+ * @param searchRecommendRules - The searchRecommendRules object.
350
+ * @param searchRecommendRules.indexName - Name of the index on which to perform the operation.
351
+ * @param searchRecommendRules.model - [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).
352
+ * @param searchRecommendRules.searchRecommendRulesParams - The searchRecommendRulesParams object.
353
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
354
+ */
355
+ searchRecommendRules({ indexName, model, searchRecommendRulesParams }, requestOptions) {
356
+ if (!indexName) {
357
+ throw new Error("Parameter `indexName` is required when calling `searchRecommendRules`.");
358
+ }
359
+ if (!model) {
360
+ throw new Error("Parameter `model` is required when calling `searchRecommendRules`.");
361
+ }
362
+ const requestPath = "/1/indexes/{indexName}/{model}/recommend/rules/search".replace("{indexName}", encodeURIComponent(indexName)).replace("{model}", encodeURIComponent(model));
363
+ const headers = {};
364
+ const queryParameters = {};
365
+ const request = {
366
+ method: "POST",
367
+ path: requestPath,
368
+ queryParameters,
369
+ headers,
370
+ data: searchRecommendRulesParams ? searchRecommendRulesParams : {},
371
+ useReadTransporter: true,
372
+ cacheable: true
373
+ };
374
+ return transporter.request(request, requestOptions);
375
+ }
376
+ };
377
+ }
378
+
379
+ // builds/fetch.ts
380
+ function recommendClient(appId, apiKey, options) {
381
+ if (!appId || typeof appId !== "string") {
382
+ throw new Error("`appId` is missing.");
383
+ }
384
+ if (!apiKey || typeof apiKey !== "string") {
385
+ throw new Error("`apiKey` is missing.");
386
+ }
387
+ return {
388
+ ...createRecommendClient({
389
+ appId,
390
+ apiKey,
391
+ timeouts: {
392
+ connect: DEFAULT_CONNECT_TIMEOUT_NODE,
393
+ read: DEFAULT_READ_TIMEOUT_NODE,
394
+ write: DEFAULT_WRITE_TIMEOUT_NODE
395
+ },
396
+ algoliaAgents: [{ segment: "Fetch" }],
397
+ requester: createFetchRequester(),
398
+ responsesCache: createNullCache(),
399
+ requestsCache: createNullCache(),
400
+ hostsCache: createMemoryCache(),
401
+ ...options
402
+ })
403
+ };
404
+ }
405
+ export {
406
+ apiClientVersion,
407
+ recommendClient
408
+ };
409
+ //# sourceMappingURL=fetch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../builds/fetch.ts","../../src/recommendClient.ts"],"sourcesContent":["// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport type { ClientOptions } from '@algolia/client-common';\nimport {\n createMemoryCache,\n createNullCache,\n DEFAULT_CONNECT_TIMEOUT_NODE,\n DEFAULT_READ_TIMEOUT_NODE,\n DEFAULT_WRITE_TIMEOUT_NODE,\n} from '@algolia/client-common';\nimport { createFetchRequester } from '@algolia/requester-fetch';\n\nimport { createRecommendClient } from '../src/recommendClient';\n\nexport type RecommendClient = ReturnType<typeof createRecommendClient>;\n\nexport { apiClientVersion } from '../src/recommendClient';\nexport * from '../model';\n\nexport function recommendClient(appId: string, apiKey: string, options?: ClientOptions): RecommendClient {\n if (!appId || typeof appId !== 'string') {\n throw new Error('`appId` is missing.');\n }\n\n if (!apiKey || typeof apiKey !== 'string') {\n throw new Error('`apiKey` is missing.');\n }\n\n return {\n ...createRecommendClient({\n appId,\n apiKey,\n timeouts: {\n connect: DEFAULT_CONNECT_TIMEOUT_NODE,\n read: DEFAULT_READ_TIMEOUT_NODE,\n write: DEFAULT_WRITE_TIMEOUT_NODE,\n },\n algoliaAgents: [{ segment: 'Fetch' }],\n requester: createFetchRequester(),\n responsesCache: createNullCache(),\n requestsCache: createNullCache(),\n hostsCache: createMemoryCache(),\n ...options,\n }),\n };\n}\n","// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport { createAuth, createTransporter, getAlgoliaAgent, shuffle } from '@algolia/client-common';\nimport type {\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n} from '@algolia/client-common';\n\nimport type {\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteRecommendRuleProps,\n GetRecommendRuleProps,\n GetRecommendStatusProps,\n LegacyGetRecommendationsParams,\n SearchRecommendRulesProps,\n} from '../model/clientMethodProps';\nimport type { DeletedAtResponse } from '../model/deletedAtResponse';\nimport type { GetRecommendTaskResponse } from '../model/getRecommendTaskResponse';\nimport type { GetRecommendationsParams } from '../model/getRecommendationsParams';\nimport type { GetRecommendationsResponse } from '../model/getRecommendationsResponse';\nimport type { RecommendRule } from '../model/recommendRule';\nimport type { SearchRecommendRulesResponse } from '../model/searchRecommendRulesResponse';\n\nexport const apiClientVersion = '5.4.0';\n\nfunction getDefaultHosts(appId: string): Host[] {\n return (\n [\n {\n url: `${appId}-dsn.algolia.net`,\n accept: 'read',\n protocol: 'https',\n },\n {\n url: `${appId}.algolia.net`,\n accept: 'write',\n protocol: 'https',\n },\n ] as Host[]\n ).concat(\n shuffle([\n {\n url: `${appId}-1.algolianet.com`,\n accept: 'readWrite',\n protocol: 'https',\n },\n {\n url: `${appId}-2.algolianet.com`,\n accept: 'readWrite',\n protocol: 'https',\n },\n {\n url: `${appId}-3.algolianet.com`,\n accept: 'readWrite',\n protocol: 'https',\n },\n ]),\n );\n}\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function createRecommendClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n ...options\n}: CreateClientOptions) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n const transporter = createTransporter({\n hosts: getDefaultHosts(appIdOption),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'Recommend',\n version: apiClientVersion,\n }),\n baseHeaders: {\n 'content-type': 'text/plain',\n ...auth.headers(),\n ...options.baseHeaders,\n },\n baseQueryParameters: {\n ...auth.queryParameters(),\n ...options.baseQueryParameters,\n },\n });\n\n return {\n transporter,\n\n /**\n * The `appId` currently in use.\n */\n appId: appIdOption,\n\n /**\n * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string): void {\n transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * Helper method to switch the API key used to authenticate the requests.\n *\n * @param params - Method params.\n * @param params.apiKey - The new API Key to use.\n */\n setClientApiKey({ apiKey }: { apiKey: string }): void {\n if (!authMode || authMode === 'WithinHeaders') {\n transporter.baseHeaders['x-algolia-api-key'] = apiKey;\n } else {\n transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;\n }\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customDelete`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customGet`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPost`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPut`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Deletes a Recommend rule from a recommendation scenario.\n *\n * Required API Key ACLs:\n * - editSettings.\n *\n * @param deleteRecommendRule - The deleteRecommendRule object.\n * @param deleteRecommendRule.indexName - Name of the index on which to perform the operation.\n * @param deleteRecommendRule.model - [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).\n * @param deleteRecommendRule.objectID - Unique record identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteRecommendRule(\n { indexName, model, objectID }: DeleteRecommendRuleProps,\n requestOptions?: RequestOptions,\n ): Promise<DeletedAtResponse> {\n if (!indexName) {\n throw new Error('Parameter `indexName` is required when calling `deleteRecommendRule`.');\n }\n\n if (!model) {\n throw new Error('Parameter `model` is required when calling `deleteRecommendRule`.');\n }\n\n if (!objectID) {\n throw new Error('Parameter `objectID` is required when calling `deleteRecommendRule`.');\n }\n\n const requestPath = '/1/indexes/{indexName}/{model}/recommend/rules/{objectID}'\n .replace('{indexName}', encodeURIComponent(indexName))\n .replace('{model}', encodeURIComponent(model))\n .replace('{objectID}', encodeURIComponent(objectID));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves a Recommend rule that you previously created in the Algolia dashboard.\n *\n * Required API Key ACLs:\n * - settings.\n *\n * @param getRecommendRule - The getRecommendRule object.\n * @param getRecommendRule.indexName - Name of the index on which to perform the operation.\n * @param getRecommendRule.model - [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).\n * @param getRecommendRule.objectID - Unique record identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getRecommendRule(\n { indexName, model, objectID }: GetRecommendRuleProps,\n requestOptions?: RequestOptions,\n ): Promise<RecommendRule> {\n if (!indexName) {\n throw new Error('Parameter `indexName` is required when calling `getRecommendRule`.');\n }\n\n if (!model) {\n throw new Error('Parameter `model` is required when calling `getRecommendRule`.');\n }\n\n if (!objectID) {\n throw new Error('Parameter `objectID` is required when calling `getRecommendRule`.');\n }\n\n const requestPath = '/1/indexes/{indexName}/{model}/recommend/rules/{objectID}'\n .replace('{indexName}', encodeURIComponent(indexName))\n .replace('{model}', encodeURIComponent(model))\n .replace('{objectID}', encodeURIComponent(objectID));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Checks the status of a given task. Deleting a Recommend rule is asynchronous. When you delete a rule, a task is created on a queue and completed depending on the load on the server. The API response includes a task ID that you can use to check the status.\n *\n * Required API Key ACLs:\n * - editSettings.\n *\n * @param getRecommendStatus - The getRecommendStatus object.\n * @param getRecommendStatus.indexName - Name of the index on which to perform the operation.\n * @param getRecommendStatus.model - [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).\n * @param getRecommendStatus.taskID - Unique task identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getRecommendStatus(\n { indexName, model, taskID }: GetRecommendStatusProps,\n requestOptions?: RequestOptions,\n ): Promise<GetRecommendTaskResponse> {\n if (!indexName) {\n throw new Error('Parameter `indexName` is required when calling `getRecommendStatus`.');\n }\n\n if (!model) {\n throw new Error('Parameter `model` is required when calling `getRecommendStatus`.');\n }\n\n if (!taskID) {\n throw new Error('Parameter `taskID` is required when calling `getRecommendStatus`.');\n }\n\n const requestPath = '/1/indexes/{indexName}/{model}/task/{taskID}'\n .replace('{indexName}', encodeURIComponent(indexName))\n .replace('{model}', encodeURIComponent(model))\n .replace('{taskID}', encodeURIComponent(taskID));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves recommendations from selected AI models.\n *\n * Required API Key ACLs:\n * - search.\n *\n * @param getRecommendationsParams - The getRecommendationsParams object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getRecommendations(\n getRecommendationsParams: GetRecommendationsParams | LegacyGetRecommendationsParams,\n requestOptions?: RequestOptions,\n ): Promise<GetRecommendationsResponse> {\n if (getRecommendationsParams && Array.isArray(getRecommendationsParams)) {\n const newSignatureRequest: GetRecommendationsParams = {\n requests: getRecommendationsParams,\n };\n\n // eslint-disable-next-line no-param-reassign\n getRecommendationsParams = newSignatureRequest;\n }\n\n if (!getRecommendationsParams) {\n throw new Error('Parameter `getRecommendationsParams` is required when calling `getRecommendations`.');\n }\n\n if (!getRecommendationsParams.requests) {\n throw new Error('Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.');\n }\n\n const requestPath = '/1/indexes/*/recommendations';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: getRecommendationsParams,\n useReadTransporter: true,\n cacheable: true,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Searches for Recommend rules. Use an empty query to list all rules for this recommendation scenario.\n *\n * Required API Key ACLs:\n * - settings.\n *\n * @param searchRecommendRules - The searchRecommendRules object.\n * @param searchRecommendRules.indexName - Name of the index on which to perform the operation.\n * @param searchRecommendRules.model - [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).\n * @param searchRecommendRules.searchRecommendRulesParams - The searchRecommendRulesParams object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n searchRecommendRules(\n { indexName, model, searchRecommendRulesParams }: SearchRecommendRulesProps,\n requestOptions?: RequestOptions,\n ): Promise<SearchRecommendRulesResponse> {\n if (!indexName) {\n throw new Error('Parameter `indexName` is required when calling `searchRecommendRules`.');\n }\n\n if (!model) {\n throw new Error('Parameter `model` is required when calling `searchRecommendRules`.');\n }\n\n const requestPath = '/1/indexes/{indexName}/{model}/recommend/rules/search'\n .replace('{indexName}', encodeURIComponent(indexName))\n .replace('{model}', encodeURIComponent(model));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: searchRecommendRulesParams ? searchRecommendRulesParams : {},\n useReadTransporter: true,\n cacheable: true,\n };\n\n return transporter.request(request, requestOptions);\n },\n };\n}\n"],"mappings":";AAGA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,4BAA4B;;;ACRrC,SAAS,YAAY,mBAAmB,iBAAiB,eAAe;AA4BjE,IAAM,mBAAmB;AAEhC,SAAS,gBAAgB,OAAuB;AAC9C,SACE;AAAA,IACE;AAAA,MACE,KAAK,GAAG,KAAK;AAAA,MACb,QAAQ;AAAA,MACR,UAAU;AAAA,IACZ;AAAA,IACA;AAAA,MACE,KAAK,GAAG,KAAK;AAAA,MACb,QAAQ;AAAA,MACR,UAAU;AAAA,IACZ;AAAA,EACF,EACA;AAAA,IACA,QAAQ;AAAA,MACN;AAAA,QACE,KAAK,GAAG,KAAK;AAAA,QACb,QAAQ;AAAA,QACR,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,KAAK,GAAG,KAAK;AAAA,QACb,QAAQ;AAAA,QACR,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,KAAK,GAAG,KAAK;AAAA,QACb,QAAQ;AAAA,QACR,UAAU;AAAA,MACZ;AAAA,IACF,CAAC;AAAA,EACH;AACF;AAGO,SAAS,sBAAsB;AAAA,EACpC,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAwB;AACtB,QAAM,OAAO,WAAW,aAAa,cAAc,QAAQ;A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B;AAAA,EACvC;AAEA,MAAI,CAAC,UAAU,OAAO,WAAW,UAAU;AACzC,UAAM,IAAI,MAAM,sBAAsB;AAAA,EACxC;AAEA,SAAO;AAAA,IACL,GAAG,sBAAsB;AAAA,MACvB;AAAA,MACA;AAAA,MACA,UAAU;AAAA,QACR,SAAS;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,MACA,eAAe,CAAC,EAAE,SAAS,QAAQ,CAAC;AAAA,MACpC,WAAW,qBAAqB;AAAA,MAChC,gBAAgB,gBAAgB;AAAA,MAChC,eAAe,gBAAgB;AAAA,MAC/B,YAAY,kBAAkB;AAAA,MAC9B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;","names":[]}
@@ -29,7 +29,7 @@ var import_requester_node_http = require("@algolia/requester-node-http");
29
29
 
30
30
  // src/recommendClient.ts
31
31
  var import_client_common = require("@algolia/client-common");
32
- var apiClientVersion = "5.3.1";
32
+ var apiClientVersion = "5.4.0";
33
33
  function getDefaultHosts(appId) {
34
34
  return [
35
35
  {
@@ -70,25 +70,26 @@ function createRecommendClient({
70
70
  ...options
71
71
  }) {
72
72
  const auth = (0, import_client_common.createAuth)(appIdOption, apiKeyOption, authMode);
73
- return {
74
- transporter: (0, import_client_common.createTransporter)({
75
- hosts: getDefaultHosts(appIdOption),
76
- ...options,
77
- algoliaAgent: (0, import_client_common.getAlgoliaAgent)({
78
- algoliaAgents,
79
- client: "Recommend",
80
- version: apiClientVersion
81
- }),
82
- baseHeaders: {
83
- "content-type": "text/plain",
84
- ...auth.headers(),
85
- ...options.baseHeaders
86
- },
87
- baseQueryParameters: {
88
- ...auth.queryParameters(),
89
- ...options.baseQueryParameters
90
- }
73
+ const transporter = (0, import_client_common.createTransporter)({
74
+ hosts: getDefaultHosts(appIdOption),
75
+ ...options,
76
+ algoliaAgent: (0, import_client_common.getAlgoliaAgent)({
77
+ algoliaAgents,
78
+ client: "Recommend",
79
+ version: apiClientVersion
91
80
  }),
81
+ baseHeaders: {
82
+ "content-type": "text/plain",
83
+ ...auth.headers(),
84
+ ...options.baseHeaders
85
+ },
86
+ baseQueryParameters: {
87
+ ...auth.queryParameters(),
88
+ ...options.baseQueryParameters
89
+ }
90
+ });
91
+ return {
92
+ transporter,
92
93
  /**
93
94
  * The `appId` currently in use.
94
95
  */
@@ -97,15 +98,13 @@ function createRecommendClient({
97
98
  * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
98
99
  */
99
100
  clearCache() {
100
- return Promise.all([this.transporter.requestsCache.clear(), this.transporter.responsesCache.clear()]).then(
101
- () => void 0
102
- );
101
+ return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
103
102
  },
104
103
  /**
105
104
  * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
106
105
  */
107
106
  get _ua() {
108
- return this.transporter.algoliaAgent.value;
107
+ return transporter.algoliaAgent.value;
109
108
  },
110
109
  /**
111
110
  * Adds a `segment` to the `x-algolia-agent` sent with every requests.
@@ -114,7 +113,7 @@ function createRecommendClient({
114
113
  * @param version - The version of the agent.
115
114
  */
116
115
  addAlgoliaAgent(segment, version) {
117
- this.transporter.algoliaAgent.add({ segment, version });
116
+ transporter.algoliaAgent.add({ segment, version });
118
117
  },
119
118
  /**
120
119
  * Helper method to switch the API key used to authenticate the requests.
@@ -124,9 +123,9 @@ function createRecommendClient({
124
123
  */
125
124
  setClientApiKey({ apiKey }) {
126
125
  if (!authMode || authMode === "WithinHeaders") {
127
- this.transporter.baseHeaders["x-algolia-api-key"] = apiKey;
126
+ transporter.baseHeaders["x-algolia-api-key"] = apiKey;
128
127
  } else {
129
- this.transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
128
+ transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
130
129
  }
131
130
  },
132
131
  /**
@@ -150,7 +149,7 @@ function createRecommendClient({
150
149
  queryParameters,
151
150
  headers
152
151
  };
153
- return this.transporter.request(request, requestOptions);
152
+ return transporter.request(request, requestOptions);
154
153
  },
155
154
  /**
156
155
  * This method allow you to send requests to the Algolia REST API.
@@ -173,7 +172,7 @@ function createRecommendClient({
173
172
  queryParameters,
174
173
  headers
175
174
  };
176
- return this.transporter.request(request, requestOptions);
175
+ return transporter.request(request, requestOptions);
177
176
  },
178
177
  /**
179
178
  * This method allow you to send requests to the Algolia REST API.
@@ -198,7 +197,7 @@ function createRecommendClient({
198
197
  headers,
199
198
  data: body ? body : {}
200
199
  };
201
- return this.transporter.request(request, requestOptions);
200
+ return transporter.request(request, requestOptions);
202
201
  },
203
202
  /**
204
203
  * This method allow you to send requests to the Algolia REST API.
@@ -223,7 +222,7 @@ function createRecommendClient({
223
222
  headers,
224
223
  data: body ? body : {}
225
224
  };
226
- return this.transporter.request(request, requestOptions);
225
+ return transporter.request(request, requestOptions);
227
226
  },
228
227
  /**
229
228
  * Deletes a Recommend rule from a recommendation scenario.
@@ -256,7 +255,7 @@ function createRecommendClient({
256
255
  queryParameters,
257
256
  headers
258
257
  };
259
- return this.transporter.request(request, requestOptions);
258
+ return transporter.request(request, requestOptions);
260
259
  },
261
260
  /**
262
261
  * Retrieves a Recommend rule that you previously created in the Algolia dashboard.
@@ -289,7 +288,7 @@ function createRecommendClient({
289
288
  queryParameters,
290
289
  headers
291
290
  };
292
- return this.transporter.request(request, requestOptions);
291
+ return transporter.request(request, requestOptions);
293
292
  },
294
293
  /**
295
294
  * Checks the status of a given task. Deleting a Recommend rule is asynchronous. When you delete a rule, a task is created on a queue and completed depending on the load on the server. The API response includes a task ID that you can use to check the status.
@@ -322,7 +321,7 @@ function createRecommendClient({
322
321
  queryParameters,
323
322
  headers
324
323
  };
325
- return this.transporter.request(request, requestOptions);
324
+ return transporter.request(request, requestOptions);
326
325
  },
327
326
  /**
328
327
  * Retrieves recommendations from selected AI models.
@@ -358,7 +357,7 @@ function createRecommendClient({
358
357
  useReadTransporter: true,
359
358
  cacheable: true
360
359
  };
361
- return this.transporter.request(request, requestOptions);
360
+ return transporter.request(request, requestOptions);
362
361
  },
363
362
  /**
364
363
  * Searches for Recommend rules. Use an empty query to list all rules for this recommendation scenario.
@@ -391,7 +390,7 @@ function createRecommendClient({
391
390
  useReadTransporter: true,
392
391
  cacheable: true
393
392
  };
394
- return this.transporter.request(request, requestOptions);
393
+ return transporter.request(request, requestOptions);
395
394
  }
396
395
  };
397
396
  }