@algolia/client-query-suggestions 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.
- package/dist/browser.d.ts +1 -1
- package/dist/builds/browser.js +36 -37
- package/dist/builds/browser.js.map +1 -1
- package/dist/builds/browser.min.js +1 -1
- package/dist/builds/browser.min.js.map +1 -1
- package/dist/builds/browser.umd.js +2 -2
- package/dist/builds/fetch.js +397 -0
- package/dist/builds/fetch.js.map +1 -0
- package/dist/builds/node.cjs +36 -37
- package/dist/builds/node.cjs.map +1 -1
- package/dist/builds/node.js +36 -37
- package/dist/builds/node.js.map +1 -1
- package/dist/fetch.d.ts +409 -0
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/src/querySuggestionsClient.cjs +36 -37
- package/dist/src/querySuggestionsClient.cjs.map +1 -1
- package/dist/src/querySuggestionsClient.js +36 -37
- package/dist/src/querySuggestionsClient.js.map +1 -1
- package/package.json +9 -4
|
@@ -0,0 +1,397 @@
|
|
|
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/querySuggestionsClient.ts
|
|
12
|
+
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
|
|
13
|
+
var apiClientVersion = "5.4.0";
|
|
14
|
+
var REGIONS = ["eu", "us"];
|
|
15
|
+
function getDefaultHosts(region) {
|
|
16
|
+
const url = "query-suggestions.{region}.algolia.com".replace("{region}", region);
|
|
17
|
+
return [{ url, accept: "readWrite", protocol: "https" }];
|
|
18
|
+
}
|
|
19
|
+
function createQuerySuggestionsClient({
|
|
20
|
+
appId: appIdOption,
|
|
21
|
+
apiKey: apiKeyOption,
|
|
22
|
+
authMode,
|
|
23
|
+
algoliaAgents,
|
|
24
|
+
region: regionOption,
|
|
25
|
+
...options
|
|
26
|
+
}) {
|
|
27
|
+
const auth = createAuth(appIdOption, apiKeyOption, authMode);
|
|
28
|
+
const transporter = createTransporter({
|
|
29
|
+
hosts: getDefaultHosts(regionOption),
|
|
30
|
+
...options,
|
|
31
|
+
algoliaAgent: getAlgoliaAgent({
|
|
32
|
+
algoliaAgents,
|
|
33
|
+
client: "QuerySuggestions",
|
|
34
|
+
version: apiClientVersion
|
|
35
|
+
}),
|
|
36
|
+
baseHeaders: {
|
|
37
|
+
"content-type": "text/plain",
|
|
38
|
+
...auth.headers(),
|
|
39
|
+
...options.baseHeaders
|
|
40
|
+
},
|
|
41
|
+
baseQueryParameters: {
|
|
42
|
+
...auth.queryParameters(),
|
|
43
|
+
...options.baseQueryParameters
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return {
|
|
47
|
+
transporter,
|
|
48
|
+
/**
|
|
49
|
+
* The `appId` currently in use.
|
|
50
|
+
*/
|
|
51
|
+
appId: appIdOption,
|
|
52
|
+
/**
|
|
53
|
+
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
|
|
54
|
+
*/
|
|
55
|
+
clearCache() {
|
|
56
|
+
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
|
|
57
|
+
},
|
|
58
|
+
/**
|
|
59
|
+
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
|
|
60
|
+
*/
|
|
61
|
+
get _ua() {
|
|
62
|
+
return transporter.algoliaAgent.value;
|
|
63
|
+
},
|
|
64
|
+
/**
|
|
65
|
+
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
|
|
66
|
+
*
|
|
67
|
+
* @param segment - The algolia agent (user-agent) segment to add.
|
|
68
|
+
* @param version - The version of the agent.
|
|
69
|
+
*/
|
|
70
|
+
addAlgoliaAgent(segment, version) {
|
|
71
|
+
transporter.algoliaAgent.add({ segment, version });
|
|
72
|
+
},
|
|
73
|
+
/**
|
|
74
|
+
* Helper method to switch the API key used to authenticate the requests.
|
|
75
|
+
*
|
|
76
|
+
* @param params - Method params.
|
|
77
|
+
* @param params.apiKey - The new API Key to use.
|
|
78
|
+
*/
|
|
79
|
+
setClientApiKey({ apiKey }) {
|
|
80
|
+
if (!authMode || authMode === "WithinHeaders") {
|
|
81
|
+
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
|
|
82
|
+
} else {
|
|
83
|
+
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
/**
|
|
87
|
+
* Creates a new Query Suggestions configuration. You can have up to 100 configurations per Algolia application.
|
|
88
|
+
*
|
|
89
|
+
* Required API Key ACLs:
|
|
90
|
+
* - editSettings.
|
|
91
|
+
*
|
|
92
|
+
* @param configurationWithIndex - The configurationWithIndex object.
|
|
93
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
94
|
+
*/
|
|
95
|
+
createConfig(configurationWithIndex, requestOptions) {
|
|
96
|
+
if (!configurationWithIndex) {
|
|
97
|
+
throw new Error("Parameter `configurationWithIndex` is required when calling `createConfig`.");
|
|
98
|
+
}
|
|
99
|
+
const requestPath = "/1/configs";
|
|
100
|
+
const headers = {};
|
|
101
|
+
const queryParameters = {};
|
|
102
|
+
const request = {
|
|
103
|
+
method: "POST",
|
|
104
|
+
path: requestPath,
|
|
105
|
+
queryParameters,
|
|
106
|
+
headers,
|
|
107
|
+
data: configurationWithIndex
|
|
108
|
+
};
|
|
109
|
+
return transporter.request(request, requestOptions);
|
|
110
|
+
},
|
|
111
|
+
/**
|
|
112
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
113
|
+
*
|
|
114
|
+
* @param customDelete - The customDelete object.
|
|
115
|
+
* @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
116
|
+
* @param customDelete.parameters - Query parameters to apply to the current query.
|
|
117
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
118
|
+
*/
|
|
119
|
+
customDelete({ path, parameters }, requestOptions) {
|
|
120
|
+
if (!path) {
|
|
121
|
+
throw new Error("Parameter `path` is required when calling `customDelete`.");
|
|
122
|
+
}
|
|
123
|
+
const requestPath = "/{path}".replace("{path}", path);
|
|
124
|
+
const headers = {};
|
|
125
|
+
const queryParameters = parameters ? parameters : {};
|
|
126
|
+
const request = {
|
|
127
|
+
method: "DELETE",
|
|
128
|
+
path: requestPath,
|
|
129
|
+
queryParameters,
|
|
130
|
+
headers
|
|
131
|
+
};
|
|
132
|
+
return transporter.request(request, requestOptions);
|
|
133
|
+
},
|
|
134
|
+
/**
|
|
135
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
136
|
+
*
|
|
137
|
+
* @param customGet - The customGet object.
|
|
138
|
+
* @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
139
|
+
* @param customGet.parameters - Query parameters to apply to the current query.
|
|
140
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
141
|
+
*/
|
|
142
|
+
customGet({ path, parameters }, requestOptions) {
|
|
143
|
+
if (!path) {
|
|
144
|
+
throw new Error("Parameter `path` is required when calling `customGet`.");
|
|
145
|
+
}
|
|
146
|
+
const requestPath = "/{path}".replace("{path}", path);
|
|
147
|
+
const headers = {};
|
|
148
|
+
const queryParameters = parameters ? parameters : {};
|
|
149
|
+
const request = {
|
|
150
|
+
method: "GET",
|
|
151
|
+
path: requestPath,
|
|
152
|
+
queryParameters,
|
|
153
|
+
headers
|
|
154
|
+
};
|
|
155
|
+
return transporter.request(request, requestOptions);
|
|
156
|
+
},
|
|
157
|
+
/**
|
|
158
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
159
|
+
*
|
|
160
|
+
* @param customPost - The customPost object.
|
|
161
|
+
* @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
162
|
+
* @param customPost.parameters - Query parameters to apply to the current query.
|
|
163
|
+
* @param customPost.body - Parameters to send with the custom request.
|
|
164
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
165
|
+
*/
|
|
166
|
+
customPost({ path, parameters, body }, requestOptions) {
|
|
167
|
+
if (!path) {
|
|
168
|
+
throw new Error("Parameter `path` is required when calling `customPost`.");
|
|
169
|
+
}
|
|
170
|
+
const requestPath = "/{path}".replace("{path}", path);
|
|
171
|
+
const headers = {};
|
|
172
|
+
const queryParameters = parameters ? parameters : {};
|
|
173
|
+
const request = {
|
|
174
|
+
method: "POST",
|
|
175
|
+
path: requestPath,
|
|
176
|
+
queryParameters,
|
|
177
|
+
headers,
|
|
178
|
+
data: body ? body : {}
|
|
179
|
+
};
|
|
180
|
+
return transporter.request(request, requestOptions);
|
|
181
|
+
},
|
|
182
|
+
/**
|
|
183
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
184
|
+
*
|
|
185
|
+
* @param customPut - The customPut object.
|
|
186
|
+
* @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
187
|
+
* @param customPut.parameters - Query parameters to apply to the current query.
|
|
188
|
+
* @param customPut.body - Parameters to send with the custom request.
|
|
189
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
190
|
+
*/
|
|
191
|
+
customPut({ path, parameters, body }, requestOptions) {
|
|
192
|
+
if (!path) {
|
|
193
|
+
throw new Error("Parameter `path` is required when calling `customPut`.");
|
|
194
|
+
}
|
|
195
|
+
const requestPath = "/{path}".replace("{path}", path);
|
|
196
|
+
const headers = {};
|
|
197
|
+
const queryParameters = parameters ? parameters : {};
|
|
198
|
+
const request = {
|
|
199
|
+
method: "PUT",
|
|
200
|
+
path: requestPath,
|
|
201
|
+
queryParameters,
|
|
202
|
+
headers,
|
|
203
|
+
data: body ? body : {}
|
|
204
|
+
};
|
|
205
|
+
return transporter.request(request, requestOptions);
|
|
206
|
+
},
|
|
207
|
+
/**
|
|
208
|
+
* Deletes a Query Suggestions configuration. Deleting only removes the configuration and stops updates to the Query Suggestions index. To delete the Query Suggestions index itself, use the Search API and the `Delete an index` operation.
|
|
209
|
+
*
|
|
210
|
+
* Required API Key ACLs:
|
|
211
|
+
* - editSettings.
|
|
212
|
+
*
|
|
213
|
+
* @param deleteConfig - The deleteConfig object.
|
|
214
|
+
* @param deleteConfig.indexName - Query Suggestions index name.
|
|
215
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
216
|
+
*/
|
|
217
|
+
deleteConfig({ indexName }, requestOptions) {
|
|
218
|
+
if (!indexName) {
|
|
219
|
+
throw new Error("Parameter `indexName` is required when calling `deleteConfig`.");
|
|
220
|
+
}
|
|
221
|
+
const requestPath = "/1/configs/{indexName}".replace("{indexName}", encodeURIComponent(indexName));
|
|
222
|
+
const headers = {};
|
|
223
|
+
const queryParameters = {};
|
|
224
|
+
const request = {
|
|
225
|
+
method: "DELETE",
|
|
226
|
+
path: requestPath,
|
|
227
|
+
queryParameters,
|
|
228
|
+
headers
|
|
229
|
+
};
|
|
230
|
+
return transporter.request(request, requestOptions);
|
|
231
|
+
},
|
|
232
|
+
/**
|
|
233
|
+
* Retrieves all Query Suggestions configurations of your Algolia application.
|
|
234
|
+
*
|
|
235
|
+
* Required API Key ACLs:
|
|
236
|
+
* - settings.
|
|
237
|
+
*
|
|
238
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
239
|
+
*/
|
|
240
|
+
getAllConfigs(requestOptions) {
|
|
241
|
+
const requestPath = "/1/configs";
|
|
242
|
+
const headers = {};
|
|
243
|
+
const queryParameters = {};
|
|
244
|
+
const request = {
|
|
245
|
+
method: "GET",
|
|
246
|
+
path: requestPath,
|
|
247
|
+
queryParameters,
|
|
248
|
+
headers
|
|
249
|
+
};
|
|
250
|
+
return transporter.request(request, requestOptions);
|
|
251
|
+
},
|
|
252
|
+
/**
|
|
253
|
+
* Retrieves a single Query Suggestions configuration by its index name.
|
|
254
|
+
*
|
|
255
|
+
* Required API Key ACLs:
|
|
256
|
+
* - settings.
|
|
257
|
+
*
|
|
258
|
+
* @param getConfig - The getConfig object.
|
|
259
|
+
* @param getConfig.indexName - Query Suggestions index name.
|
|
260
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
261
|
+
*/
|
|
262
|
+
getConfig({ indexName }, requestOptions) {
|
|
263
|
+
if (!indexName) {
|
|
264
|
+
throw new Error("Parameter `indexName` is required when calling `getConfig`.");
|
|
265
|
+
}
|
|
266
|
+
const requestPath = "/1/configs/{indexName}".replace("{indexName}", encodeURIComponent(indexName));
|
|
267
|
+
const headers = {};
|
|
268
|
+
const queryParameters = {};
|
|
269
|
+
const request = {
|
|
270
|
+
method: "GET",
|
|
271
|
+
path: requestPath,
|
|
272
|
+
queryParameters,
|
|
273
|
+
headers
|
|
274
|
+
};
|
|
275
|
+
return transporter.request(request, requestOptions);
|
|
276
|
+
},
|
|
277
|
+
/**
|
|
278
|
+
* Reports the status of a Query Suggestions index.
|
|
279
|
+
*
|
|
280
|
+
* Required API Key ACLs:
|
|
281
|
+
* - settings.
|
|
282
|
+
*
|
|
283
|
+
* @param getConfigStatus - The getConfigStatus object.
|
|
284
|
+
* @param getConfigStatus.indexName - Query Suggestions index name.
|
|
285
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
286
|
+
*/
|
|
287
|
+
getConfigStatus({ indexName }, requestOptions) {
|
|
288
|
+
if (!indexName) {
|
|
289
|
+
throw new Error("Parameter `indexName` is required when calling `getConfigStatus`.");
|
|
290
|
+
}
|
|
291
|
+
const requestPath = "/1/configs/{indexName}/status".replace("{indexName}", encodeURIComponent(indexName));
|
|
292
|
+
const headers = {};
|
|
293
|
+
const queryParameters = {};
|
|
294
|
+
const request = {
|
|
295
|
+
method: "GET",
|
|
296
|
+
path: requestPath,
|
|
297
|
+
queryParameters,
|
|
298
|
+
headers
|
|
299
|
+
};
|
|
300
|
+
return transporter.request(request, requestOptions);
|
|
301
|
+
},
|
|
302
|
+
/**
|
|
303
|
+
* Retrieves the logs for a single Query Suggestions index.
|
|
304
|
+
*
|
|
305
|
+
* Required API Key ACLs:
|
|
306
|
+
* - settings.
|
|
307
|
+
*
|
|
308
|
+
* @param getLogFile - The getLogFile object.
|
|
309
|
+
* @param getLogFile.indexName - Query Suggestions index name.
|
|
310
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
311
|
+
*/
|
|
312
|
+
getLogFile({ indexName }, requestOptions) {
|
|
313
|
+
if (!indexName) {
|
|
314
|
+
throw new Error("Parameter `indexName` is required when calling `getLogFile`.");
|
|
315
|
+
}
|
|
316
|
+
const requestPath = "/1/logs/{indexName}".replace("{indexName}", encodeURIComponent(indexName));
|
|
317
|
+
const headers = {};
|
|
318
|
+
const queryParameters = {};
|
|
319
|
+
const request = {
|
|
320
|
+
method: "GET",
|
|
321
|
+
path: requestPath,
|
|
322
|
+
queryParameters,
|
|
323
|
+
headers
|
|
324
|
+
};
|
|
325
|
+
return transporter.request(request, requestOptions);
|
|
326
|
+
},
|
|
327
|
+
/**
|
|
328
|
+
* Updates a QuerySuggestions configuration.
|
|
329
|
+
*
|
|
330
|
+
* Required API Key ACLs:
|
|
331
|
+
* - editSettings.
|
|
332
|
+
*
|
|
333
|
+
* @param updateConfig - The updateConfig object.
|
|
334
|
+
* @param updateConfig.indexName - Query Suggestions index name.
|
|
335
|
+
* @param updateConfig.configuration - The configuration object.
|
|
336
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
337
|
+
*/
|
|
338
|
+
updateConfig({ indexName, configuration }, requestOptions) {
|
|
339
|
+
if (!indexName) {
|
|
340
|
+
throw new Error("Parameter `indexName` is required when calling `updateConfig`.");
|
|
341
|
+
}
|
|
342
|
+
if (!configuration) {
|
|
343
|
+
throw new Error("Parameter `configuration` is required when calling `updateConfig`.");
|
|
344
|
+
}
|
|
345
|
+
if (!configuration.sourceIndices) {
|
|
346
|
+
throw new Error("Parameter `configuration.sourceIndices` is required when calling `updateConfig`.");
|
|
347
|
+
}
|
|
348
|
+
const requestPath = "/1/configs/{indexName}".replace("{indexName}", encodeURIComponent(indexName));
|
|
349
|
+
const headers = {};
|
|
350
|
+
const queryParameters = {};
|
|
351
|
+
const request = {
|
|
352
|
+
method: "PUT",
|
|
353
|
+
path: requestPath,
|
|
354
|
+
queryParameters,
|
|
355
|
+
headers,
|
|
356
|
+
data: configuration
|
|
357
|
+
};
|
|
358
|
+
return transporter.request(request, requestOptions);
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// builds/fetch.ts
|
|
364
|
+
function querySuggestionsClient(appId, apiKey, region, options) {
|
|
365
|
+
if (!appId || typeof appId !== "string") {
|
|
366
|
+
throw new Error("`appId` is missing.");
|
|
367
|
+
}
|
|
368
|
+
if (!apiKey || typeof apiKey !== "string") {
|
|
369
|
+
throw new Error("`apiKey` is missing.");
|
|
370
|
+
}
|
|
371
|
+
if (!region || region && (typeof region !== "string" || !REGIONS.includes(region))) {
|
|
372
|
+
throw new Error(`\`region\` is required and must be one of the following: ${REGIONS.join(", ")}`);
|
|
373
|
+
}
|
|
374
|
+
return {
|
|
375
|
+
...createQuerySuggestionsClient({
|
|
376
|
+
appId,
|
|
377
|
+
apiKey,
|
|
378
|
+
region,
|
|
379
|
+
timeouts: {
|
|
380
|
+
connect: DEFAULT_CONNECT_TIMEOUT_NODE,
|
|
381
|
+
read: DEFAULT_READ_TIMEOUT_NODE,
|
|
382
|
+
write: DEFAULT_WRITE_TIMEOUT_NODE
|
|
383
|
+
},
|
|
384
|
+
algoliaAgents: [{ segment: "Fetch" }],
|
|
385
|
+
requester: createFetchRequester(),
|
|
386
|
+
responsesCache: createNullCache(),
|
|
387
|
+
requestsCache: createNullCache(),
|
|
388
|
+
hostsCache: createMemoryCache(),
|
|
389
|
+
...options
|
|
390
|
+
})
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
export {
|
|
394
|
+
apiClientVersion,
|
|
395
|
+
querySuggestionsClient
|
|
396
|
+
};
|
|
397
|
+
//# sourceMappingURL=fetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../builds/fetch.ts","../../src/querySuggestionsClient.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 type { Region } from '../src/querySuggestionsClient';\nimport { createQuerySuggestionsClient, REGIONS } from '../src/querySuggestionsClient';\n\nexport type QuerySuggestionsClient = ReturnType<typeof createQuerySuggestionsClient>;\n\nexport { apiClientVersion, Region } from '../src/querySuggestionsClient';\nexport * from '../model';\n\nexport function querySuggestionsClient(\n appId: string,\n apiKey: string,\n region: Region,\n options?: ClientOptions,\n): QuerySuggestionsClient {\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 if (!region || (region && (typeof region !== 'string' || !REGIONS.includes(region)))) {\n throw new Error(`\\`region\\` is required and must be one of the following: ${REGIONS.join(', ')}`);\n }\n\n return {\n ...createQuerySuggestionsClient({\n appId,\n apiKey,\n region,\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 } 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 { BaseResponse } from '../model/baseResponse';\nimport type {\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteConfigProps,\n GetConfigProps,\n GetConfigStatusProps,\n GetLogFileProps,\n UpdateConfigProps,\n} from '../model/clientMethodProps';\nimport type { ConfigStatus } from '../model/configStatus';\nimport type { ConfigurationResponse } from '../model/configurationResponse';\nimport type { ConfigurationWithIndex } from '../model/configurationWithIndex';\nimport type { LogFile } from '../model/logFile';\n\nexport const apiClientVersion = '5.4.0';\n\nexport const REGIONS = ['eu', 'us'] as const;\nexport type Region = (typeof REGIONS)[number];\n\nfunction getDefaultHosts(region: Region): Host[] {\n const url = 'query-suggestions.{region}.algolia.com'.replace('{region}', region);\n\n return [{ url, accept: 'readWrite', protocol: 'https' }];\n}\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function createQuerySuggestionsClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n region: regionOption,\n ...options\n}: CreateClientOptions & { region: Region }) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n const transporter = createTransporter({\n hosts: getDefaultHosts(regionOption),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'QuerySuggestions',\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 * Creates a new Query Suggestions configuration. You can have up to 100 configurations per Algolia application.\n *\n * Required API Key ACLs:\n * - editSettings.\n *\n * @param configurationWithIndex - The configurationWithIndex object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n createConfig(\n configurationWithIndex: ConfigurationWithIndex,\n requestOptions?: RequestOptions,\n ): Promise<BaseResponse> {\n if (!configurationWithIndex) {\n throw new Error('Parameter `configurationWithIndex` is required when calling `createConfig`.');\n }\n\n const requestPath = '/1/configs';\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: configurationWithIndex,\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 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 Query Suggestions configuration. Deleting only removes the configuration and stops updates to the Query Suggestions index. To delete the Query Suggestions index itself, use the Search API and the `Delete an index` operation.\n *\n * Required API Key ACLs:\n * - editSettings.\n *\n * @param deleteConfig - The deleteConfig object.\n * @param deleteConfig.indexName - Query Suggestions index name.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteConfig({ indexName }: DeleteConfigProps, requestOptions?: RequestOptions): Promise<BaseResponse> {\n if (!indexName) {\n throw new Error('Parameter `indexName` is required when calling `deleteConfig`.');\n }\n\n const requestPath = '/1/configs/{indexName}'.replace('{indexName}', encodeURIComponent(indexName));\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 all Query Suggestions configurations of your Algolia application.\n *\n * Required API Key ACLs:\n * - settings.\n *\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getAllConfigs(requestOptions?: RequestOptions): Promise<ConfigurationResponse[]> {\n const requestPath = '/1/configs';\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 a single Query Suggestions configuration by its index name.\n *\n * Required API Key ACLs:\n * - settings.\n *\n * @param getConfig - The getConfig object.\n * @param getConfig.indexName - Query Suggestions index name.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getConfig({ indexName }: GetConfigProps, requestOptions?: RequestOptions): Promise<ConfigurationResponse> {\n if (!indexName) {\n throw new Error('Parameter `indexName` is required when calling `getConfig`.');\n }\n\n const requestPath = '/1/configs/{indexName}'.replace('{indexName}', encodeURIComponent(indexName));\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 * Reports the status of a Query Suggestions index.\n *\n * Required API Key ACLs:\n * - settings.\n *\n * @param getConfigStatus - The getConfigStatus object.\n * @param getConfigStatus.indexName - Query Suggestions index name.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getConfigStatus({ indexName }: GetConfigStatusProps, requestOptions?: RequestOptions): Promise<ConfigStatus> {\n if (!indexName) {\n throw new Error('Parameter `indexName` is required when calling `getConfigStatus`.');\n }\n\n const requestPath = '/1/configs/{indexName}/status'.replace('{indexName}', encodeURIComponent(indexName));\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 the logs for a single Query Suggestions index.\n *\n * Required API Key ACLs:\n * - settings.\n *\n * @param getLogFile - The getLogFile object.\n * @param getLogFile.indexName - Query Suggestions index name.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getLogFile({ indexName }: GetLogFileProps, requestOptions?: RequestOptions): Promise<LogFile> {\n if (!indexName) {\n throw new Error('Parameter `indexName` is required when calling `getLogFile`.');\n }\n\n const requestPath = '/1/logs/{indexName}'.replace('{indexName}', encodeURIComponent(indexName));\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 * Updates a QuerySuggestions configuration.\n *\n * Required API Key ACLs:\n * - editSettings.\n *\n * @param updateConfig - The updateConfig object.\n * @param updateConfig.indexName - Query Suggestions index name.\n * @param updateConfig.configuration - The configuration object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n updateConfig(\n { indexName, configuration }: UpdateConfigProps,\n requestOptions?: RequestOptions,\n ): Promise<BaseResponse> {\n if (!indexName) {\n throw new Error('Parameter `indexName` is required when calling `updateConfig`.');\n }\n\n if (!configuration) {\n throw new Error('Parameter `configuration` is required when calling `updateConfig`.');\n }\n\n if (!configuration.sourceIndices) {\n throw new Error('Parameter `configuration.sourceIndices` is required when calling `updateConfig`.');\n }\n\n const requestPath = '/1/configs/{indexName}'.replace('{indexName}', encodeURIComponent(indexName));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: configuration,\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,uBAAuB;AA2BxD,IAAM,mBAAmB;AAEzB,IAAM,UAAU,CAAC,MAAM,IAAI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AU;AACvC,UAAM,IAAI,MAAM,qBAAqB;AAAA,EACvC;AAEA,MAAI,CAAC,UAAU,OAAO,WAAW,UAAU;AACzC,UAAM,IAAI,MAAM,sBAAsB;AAAA,EACxC;AAEA,MAAI,CAAC,UAAW,WAAW,OAAO,WAAW,YAAY,CAAC,QAAQ,SAAS,MAAM,IAAK;AACpF,UAAM,IAAI,MAAM,4DAA4D,QAAQ,KAAK,IAAI,CAAC,EAAE;AAAA,EAClG;AAEA,SAAO;AAAA,IACL,GAAG,6BAA6B;AAAA,MAC9B;AAAA,MACA;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":[]}
|
package/dist/builds/node.cjs
CHANGED
|
@@ -29,7 +29,7 @@ var import_requester_node_http = require("@algolia/requester-node-http");
|
|
|
29
29
|
|
|
30
30
|
// src/querySuggestionsClient.ts
|
|
31
31
|
var import_client_common = require("@algolia/client-common");
|
|
32
|
-
var apiClientVersion = "5.
|
|
32
|
+
var apiClientVersion = "5.4.0";
|
|
33
33
|
var REGIONS = ["eu", "us"];
|
|
34
34
|
function getDefaultHosts(region) {
|
|
35
35
|
const url = "query-suggestions.{region}.algolia.com".replace("{region}", region);
|
|
@@ -44,25 +44,26 @@ function createQuerySuggestionsClient({
|
|
|
44
44
|
...options
|
|
45
45
|
}) {
|
|
46
46
|
const auth = (0, import_client_common.createAuth)(appIdOption, apiKeyOption, authMode);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
version: apiClientVersion
|
|
55
|
-
}),
|
|
56
|
-
baseHeaders: {
|
|
57
|
-
"content-type": "text/plain",
|
|
58
|
-
...auth.headers(),
|
|
59
|
-
...options.baseHeaders
|
|
60
|
-
},
|
|
61
|
-
baseQueryParameters: {
|
|
62
|
-
...auth.queryParameters(),
|
|
63
|
-
...options.baseQueryParameters
|
|
64
|
-
}
|
|
47
|
+
const transporter = (0, import_client_common.createTransporter)({
|
|
48
|
+
hosts: getDefaultHosts(regionOption),
|
|
49
|
+
...options,
|
|
50
|
+
algoliaAgent: (0, import_client_common.getAlgoliaAgent)({
|
|
51
|
+
algoliaAgents,
|
|
52
|
+
client: "QuerySuggestions",
|
|
53
|
+
version: apiClientVersion
|
|
65
54
|
}),
|
|
55
|
+
baseHeaders: {
|
|
56
|
+
"content-type": "text/plain",
|
|
57
|
+
...auth.headers(),
|
|
58
|
+
...options.baseHeaders
|
|
59
|
+
},
|
|
60
|
+
baseQueryParameters: {
|
|
61
|
+
...auth.queryParameters(),
|
|
62
|
+
...options.baseQueryParameters
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
return {
|
|
66
|
+
transporter,
|
|
66
67
|
/**
|
|
67
68
|
* The `appId` currently in use.
|
|
68
69
|
*/
|
|
@@ -71,15 +72,13 @@ function createQuerySuggestionsClient({
|
|
|
71
72
|
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
|
|
72
73
|
*/
|
|
73
74
|
clearCache() {
|
|
74
|
-
return Promise.all([
|
|
75
|
-
() => void 0
|
|
76
|
-
);
|
|
75
|
+
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
|
|
77
76
|
},
|
|
78
77
|
/**
|
|
79
78
|
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
|
|
80
79
|
*/
|
|
81
80
|
get _ua() {
|
|
82
|
-
return
|
|
81
|
+
return transporter.algoliaAgent.value;
|
|
83
82
|
},
|
|
84
83
|
/**
|
|
85
84
|
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
|
|
@@ -88,7 +87,7 @@ function createQuerySuggestionsClient({
|
|
|
88
87
|
* @param version - The version of the agent.
|
|
89
88
|
*/
|
|
90
89
|
addAlgoliaAgent(segment, version) {
|
|
91
|
-
|
|
90
|
+
transporter.algoliaAgent.add({ segment, version });
|
|
92
91
|
},
|
|
93
92
|
/**
|
|
94
93
|
* Helper method to switch the API key used to authenticate the requests.
|
|
@@ -98,9 +97,9 @@ function createQuerySuggestionsClient({
|
|
|
98
97
|
*/
|
|
99
98
|
setClientApiKey({ apiKey }) {
|
|
100
99
|
if (!authMode || authMode === "WithinHeaders") {
|
|
101
|
-
|
|
100
|
+
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
|
|
102
101
|
} else {
|
|
103
|
-
|
|
102
|
+
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
|
|
104
103
|
}
|
|
105
104
|
},
|
|
106
105
|
/**
|
|
@@ -126,7 +125,7 @@ function createQuerySuggestionsClient({
|
|
|
126
125
|
headers,
|
|
127
126
|
data: configurationWithIndex
|
|
128
127
|
};
|
|
129
|
-
return
|
|
128
|
+
return transporter.request(request, requestOptions);
|
|
130
129
|
},
|
|
131
130
|
/**
|
|
132
131
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -149,7 +148,7 @@ function createQuerySuggestionsClient({
|
|
|
149
148
|
queryParameters,
|
|
150
149
|
headers
|
|
151
150
|
};
|
|
152
|
-
return
|
|
151
|
+
return transporter.request(request, requestOptions);
|
|
153
152
|
},
|
|
154
153
|
/**
|
|
155
154
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -172,7 +171,7 @@ function createQuerySuggestionsClient({
|
|
|
172
171
|
queryParameters,
|
|
173
172
|
headers
|
|
174
173
|
};
|
|
175
|
-
return
|
|
174
|
+
return transporter.request(request, requestOptions);
|
|
176
175
|
},
|
|
177
176
|
/**
|
|
178
177
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -197,7 +196,7 @@ function createQuerySuggestionsClient({
|
|
|
197
196
|
headers,
|
|
198
197
|
data: body ? body : {}
|
|
199
198
|
};
|
|
200
|
-
return
|
|
199
|
+
return transporter.request(request, requestOptions);
|
|
201
200
|
},
|
|
202
201
|
/**
|
|
203
202
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -222,7 +221,7 @@ function createQuerySuggestionsClient({
|
|
|
222
221
|
headers,
|
|
223
222
|
data: body ? body : {}
|
|
224
223
|
};
|
|
225
|
-
return
|
|
224
|
+
return transporter.request(request, requestOptions);
|
|
226
225
|
},
|
|
227
226
|
/**
|
|
228
227
|
* Deletes a Query Suggestions configuration. Deleting only removes the configuration and stops updates to the Query Suggestions index. To delete the Query Suggestions index itself, use the Search API and the `Delete an index` operation.
|
|
@@ -247,7 +246,7 @@ function createQuerySuggestionsClient({
|
|
|
247
246
|
queryParameters,
|
|
248
247
|
headers
|
|
249
248
|
};
|
|
250
|
-
return
|
|
249
|
+
return transporter.request(request, requestOptions);
|
|
251
250
|
},
|
|
252
251
|
/**
|
|
253
252
|
* Retrieves all Query Suggestions configurations of your Algolia application.
|
|
@@ -267,7 +266,7 @@ function createQuerySuggestionsClient({
|
|
|
267
266
|
queryParameters,
|
|
268
267
|
headers
|
|
269
268
|
};
|
|
270
|
-
return
|
|
269
|
+
return transporter.request(request, requestOptions);
|
|
271
270
|
},
|
|
272
271
|
/**
|
|
273
272
|
* Retrieves a single Query Suggestions configuration by its index name.
|
|
@@ -292,7 +291,7 @@ function createQuerySuggestionsClient({
|
|
|
292
291
|
queryParameters,
|
|
293
292
|
headers
|
|
294
293
|
};
|
|
295
|
-
return
|
|
294
|
+
return transporter.request(request, requestOptions);
|
|
296
295
|
},
|
|
297
296
|
/**
|
|
298
297
|
* Reports the status of a Query Suggestions index.
|
|
@@ -317,7 +316,7 @@ function createQuerySuggestionsClient({
|
|
|
317
316
|
queryParameters,
|
|
318
317
|
headers
|
|
319
318
|
};
|
|
320
|
-
return
|
|
319
|
+
return transporter.request(request, requestOptions);
|
|
321
320
|
},
|
|
322
321
|
/**
|
|
323
322
|
* Retrieves the logs for a single Query Suggestions index.
|
|
@@ -342,7 +341,7 @@ function createQuerySuggestionsClient({
|
|
|
342
341
|
queryParameters,
|
|
343
342
|
headers
|
|
344
343
|
};
|
|
345
|
-
return
|
|
344
|
+
return transporter.request(request, requestOptions);
|
|
346
345
|
},
|
|
347
346
|
/**
|
|
348
347
|
* Updates a QuerySuggestions configuration.
|
|
@@ -375,7 +374,7 @@ function createQuerySuggestionsClient({
|
|
|
375
374
|
headers,
|
|
376
375
|
data: configuration
|
|
377
376
|
};
|
|
378
|
-
return
|
|
377
|
+
return transporter.request(request, requestOptions);
|
|
379
378
|
}
|
|
380
379
|
};
|
|
381
380
|
}
|