@algolia/client-query-suggestions 5.0.0-alpha.7 → 5.0.0-alpha.70
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/builds/browser.d.ts +5 -5
- package/dist/builds/browser.d.ts.map +1 -1
- package/dist/builds/node.d.ts +5 -5
- package/dist/builds/node.d.ts.map +1 -1
- package/dist/client-query-suggestions.cjs.js +351 -353
- package/dist/client-query-suggestions.esm.browser.js +534 -584
- package/dist/client-query-suggestions.esm.node.js +351 -353
- package/dist/client-query-suggestions.umd.js +2 -2
- package/dist/model/clientMethodProps.d.ts +107 -107
- package/dist/model/clientMethodProps.d.ts.map +1 -1
- package/dist/model/errorBase.d.ts +6 -6
- package/dist/model/errorBase.d.ts.map +1 -1
- package/dist/model/index.d.ts +13 -13
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/indexName.d.ts +6 -6
- package/dist/model/indexName.d.ts.map +1 -1
- package/dist/model/logFile.d.ts +16 -16
- package/dist/model/logFile.d.ts.map +1 -1
- package/dist/model/logLevel.d.ts +4 -4
- package/dist/model/logLevel.d.ts.map +1 -1
- package/dist/model/querySuggestionsIndex.d.ts +19 -19
- package/dist/model/querySuggestionsIndex.d.ts.map +1 -1
- package/dist/model/querySuggestionsIndexParam.d.ts +15 -15
- package/dist/model/querySuggestionsIndexParam.d.ts.map +1 -1
- package/dist/model/querySuggestionsIndexWithIndexParam.d.ts +3 -3
- package/dist/model/querySuggestionsIndexWithIndexParam.d.ts.map +1 -1
- package/dist/model/sourceIndex.d.ts +31 -31
- package/dist/model/sourceIndex.d.ts.map +1 -1
- package/dist/model/sourceIndexExternal.d.ts +10 -10
- package/dist/model/sourceIndexExternal.d.ts.map +1 -1
- package/dist/model/sourceIndexWithReplicas.d.ts +38 -38
- package/dist/model/sourceIndexWithReplicas.d.ts.map +1 -1
- package/dist/model/status.d.ts +14 -14
- package/dist/model/status.d.ts.map +1 -1
- package/dist/model/successResponse.d.ts +10 -10
- package/dist/model/successResponse.d.ts.map +1 -1
- package/dist/src/querySuggestionsClient.d.ts +141 -141
- package/dist/src/querySuggestionsClient.d.ts.map +1 -1
- package/model/clientMethodProps.ts +1 -1
- package/model/errorBase.ts +1 -1
- package/model/index.ts +1 -1
- package/model/indexName.ts +1 -1
- package/model/logFile.ts +1 -1
- package/model/logLevel.ts +1 -1
- package/model/querySuggestionsIndex.ts +1 -1
- package/model/querySuggestionsIndexParam.ts +1 -1
- package/model/querySuggestionsIndexWithIndexParam.ts +1 -1
- package/model/sourceIndex.ts +1 -1
- package/model/sourceIndexExternal.ts +1 -1
- package/model/sourceIndexWithReplicas.ts +1 -1
- package/model/status.ts +1 -1
- package/model/successResponse.ts +1 -1
- package/package.json +31 -13
|
@@ -1,361 +1,359 @@
|
|
|
1
1
|
import { createAuth, createTransporter, getAlgoliaAgent, DEFAULT_CONNECT_TIMEOUT_NODE, DEFAULT_READ_TIMEOUT_NODE, DEFAULT_WRITE_TIMEOUT_NODE, createNullCache, createMemoryCache } from '@algolia/client-common';
|
|
2
2
|
import { createHttpRequester } from '@algolia/requester-node-http';
|
|
3
3
|
|
|
4
|
-
//
|
|
5
|
-
const apiClientVersion = '5.0.0-alpha.
|
|
6
|
-
const REGIONS = ['eu', 'us'];
|
|
7
|
-
function getDefaultHosts(region) {
|
|
8
|
-
const url = 'query-suggestions.{region}.algolia.com'.replace('{region}', region);
|
|
9
|
-
return [{ url, accept: 'readWrite', protocol: 'https' }];
|
|
10
|
-
}
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
12
|
-
function createQuerySuggestionsClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }) {
|
|
13
|
-
const auth = createAuth(appIdOption, apiKeyOption, authMode);
|
|
14
|
-
const transporter = createTransporter({
|
|
15
|
-
hosts: getDefaultHosts(regionOption),
|
|
16
|
-
...options,
|
|
17
|
-
algoliaAgent: getAlgoliaAgent({
|
|
18
|
-
algoliaAgents,
|
|
19
|
-
client: 'QuerySuggestions',
|
|
20
|
-
version: apiClientVersion,
|
|
21
|
-
}),
|
|
22
|
-
baseHeaders: {
|
|
23
|
-
'content-type': 'text/plain',
|
|
24
|
-
...auth.headers(),
|
|
25
|
-
...options.baseHeaders,
|
|
26
|
-
},
|
|
27
|
-
baseQueryParameters: {
|
|
28
|
-
...auth.queryParameters(),
|
|
29
|
-
...options.baseQueryParameters,
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
return {
|
|
33
|
-
transporter,
|
|
34
|
-
/**
|
|
35
|
-
* The `appId` currently in use.
|
|
36
|
-
*/
|
|
37
|
-
appId: appIdOption,
|
|
38
|
-
/**
|
|
39
|
-
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
|
|
40
|
-
*/
|
|
41
|
-
clearCache() {
|
|
42
|
-
return Promise.all([
|
|
43
|
-
transporter.requestsCache.clear(),
|
|
44
|
-
transporter.responsesCache.clear(),
|
|
45
|
-
]).then(() => undefined);
|
|
46
|
-
},
|
|
47
|
-
/**
|
|
48
|
-
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
|
|
49
|
-
*/
|
|
50
|
-
get _ua() {
|
|
51
|
-
return transporter.algoliaAgent.value;
|
|
52
|
-
},
|
|
53
|
-
/**
|
|
54
|
-
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
|
|
55
|
-
*
|
|
56
|
-
* @param segment - The algolia agent (user-agent) segment to add.
|
|
57
|
-
* @param version - The version of the agent.
|
|
58
|
-
*/
|
|
59
|
-
addAlgoliaAgent(segment, version) {
|
|
60
|
-
transporter.algoliaAgent.add({ segment, version });
|
|
61
|
-
},
|
|
62
|
-
/**
|
|
63
|
-
* Create a configuration of a Query Suggestions index. There\'s a limit of 100 configurations per application.
|
|
64
|
-
*
|
|
65
|
-
* @summary Create a configuration.
|
|
66
|
-
* @param querySuggestionsIndexWithIndexParam - The querySuggestionsIndexWithIndexParam object.
|
|
67
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
68
|
-
*/
|
|
69
|
-
createConfig(querySuggestionsIndexWithIndexParam, requestOptions) {
|
|
70
|
-
if (!querySuggestionsIndexWithIndexParam) {
|
|
71
|
-
throw new Error('Parameter `querySuggestionsIndexWithIndexParam` is required when calling `createConfig`.');
|
|
72
|
-
}
|
|
73
|
-
const requestPath = '/1/configs';
|
|
74
|
-
const headers = {};
|
|
75
|
-
const queryParameters = {};
|
|
76
|
-
const request = {
|
|
77
|
-
method: 'POST',
|
|
78
|
-
path: requestPath,
|
|
79
|
-
queryParameters,
|
|
80
|
-
headers,
|
|
81
|
-
data: querySuggestionsIndexWithIndexParam,
|
|
82
|
-
};
|
|
83
|
-
return transporter.request(request, requestOptions);
|
|
84
|
-
},
|
|
85
|
-
/**
|
|
86
|
-
* This method allow you to send requests to the Algolia REST API.
|
|
87
|
-
*
|
|
88
|
-
* @summary Send requests to the Algolia REST API.
|
|
89
|
-
* @param del - The del object.
|
|
90
|
-
* @param del.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
|
|
91
|
-
* @param del.parameters - Query parameters to be applied to the current query.
|
|
92
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
93
|
-
*/
|
|
94
|
-
del({ path, parameters }, requestOptions) {
|
|
95
|
-
if (!path) {
|
|
96
|
-
throw new Error('Parameter `path` is required when calling `del`.');
|
|
97
|
-
}
|
|
98
|
-
const requestPath = '/1{path}'.replace('{path}', path);
|
|
99
|
-
const headers = {};
|
|
100
|
-
const queryParameters = parameters ? parameters : {};
|
|
101
|
-
const request = {
|
|
102
|
-
method: 'DELETE',
|
|
103
|
-
path: requestPath,
|
|
104
|
-
queryParameters,
|
|
105
|
-
headers,
|
|
106
|
-
};
|
|
107
|
-
return transporter.request(request, requestOptions);
|
|
108
|
-
},
|
|
109
|
-
/**
|
|
110
|
-
* Delete a configuration of a Query Suggestion\'s index. By deleting a configuration, you stop all updates to the underlying query suggestion index. Note that when doing this, the underlying index does not change - existing suggestions remain untouched.
|
|
111
|
-
*
|
|
112
|
-
* @summary Delete a configuration.
|
|
113
|
-
* @param deleteConfig - The deleteConfig object.
|
|
114
|
-
* @param deleteConfig.indexName - The index in which to perform the request.
|
|
115
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
116
|
-
*/
|
|
117
|
-
deleteConfig({ indexName }, requestOptions) {
|
|
118
|
-
if (!indexName) {
|
|
119
|
-
throw new Error('Parameter `indexName` is required when calling `deleteConfig`.');
|
|
120
|
-
}
|
|
121
|
-
const requestPath = '/1/configs/{indexName}'.replace('{indexName}', encodeURIComponent(indexName));
|
|
122
|
-
const headers = {};
|
|
123
|
-
const queryParameters = {};
|
|
124
|
-
const request = {
|
|
125
|
-
method: 'DELETE',
|
|
126
|
-
path: requestPath,
|
|
127
|
-
queryParameters,
|
|
128
|
-
headers,
|
|
129
|
-
};
|
|
130
|
-
return transporter.request(request, requestOptions);
|
|
131
|
-
},
|
|
132
|
-
/**
|
|
133
|
-
* This method allow you to send requests to the Algolia REST API.
|
|
134
|
-
*
|
|
135
|
-
* @summary Send requests to the Algolia REST API.
|
|
136
|
-
* @param get - The get object.
|
|
137
|
-
* @param get.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
|
|
138
|
-
* @param get.parameters - Query parameters to be applied to the current query.
|
|
139
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
140
|
-
*/
|
|
141
|
-
get({ path, parameters }, requestOptions) {
|
|
142
|
-
if (!path) {
|
|
143
|
-
throw new Error('Parameter `path` is required when calling `get`.');
|
|
144
|
-
}
|
|
145
|
-
const requestPath = '/1{path}'.replace('{path}', path);
|
|
146
|
-
const headers = {};
|
|
147
|
-
const queryParameters = parameters ? parameters : {};
|
|
148
|
-
const request = {
|
|
149
|
-
method: 'GET',
|
|
150
|
-
path: requestPath,
|
|
151
|
-
queryParameters,
|
|
152
|
-
headers,
|
|
153
|
-
};
|
|
154
|
-
return transporter.request(request, requestOptions);
|
|
155
|
-
},
|
|
156
|
-
/**
|
|
157
|
-
* Get all the configurations of Query Suggestions. For each index, you get a block of JSON with a list of its configuration settings.
|
|
158
|
-
*
|
|
159
|
-
* @summary List configurations.
|
|
160
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
161
|
-
*/
|
|
162
|
-
getAllConfigs(requestOptions) {
|
|
163
|
-
const requestPath = '/1/configs';
|
|
164
|
-
const headers = {};
|
|
165
|
-
const queryParameters = {};
|
|
166
|
-
const request = {
|
|
167
|
-
method: 'GET',
|
|
168
|
-
path: requestPath,
|
|
169
|
-
queryParameters,
|
|
170
|
-
headers,
|
|
171
|
-
};
|
|
172
|
-
return transporter.request(request, requestOptions);
|
|
173
|
-
},
|
|
174
|
-
/**
|
|
175
|
-
* Get the configuration of a single Query Suggestions index.
|
|
176
|
-
*
|
|
177
|
-
* @summary Get a single configuration.
|
|
178
|
-
* @param getConfig - The getConfig object.
|
|
179
|
-
* @param getConfig.indexName - The index in which to perform the request.
|
|
180
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
181
|
-
*/
|
|
182
|
-
getConfig({ indexName }, requestOptions) {
|
|
183
|
-
if (!indexName) {
|
|
184
|
-
throw new Error('Parameter `indexName` is required when calling `getConfig`.');
|
|
185
|
-
}
|
|
186
|
-
const requestPath = '/1/configs/{indexName}'.replace('{indexName}', encodeURIComponent(indexName));
|
|
187
|
-
const headers = {};
|
|
188
|
-
const queryParameters = {};
|
|
189
|
-
const request = {
|
|
190
|
-
method: 'GET',
|
|
191
|
-
path: requestPath,
|
|
192
|
-
queryParameters,
|
|
193
|
-
headers,
|
|
194
|
-
};
|
|
195
|
-
return transporter.request(request, requestOptions);
|
|
196
|
-
},
|
|
197
|
-
/**
|
|
198
|
-
* Get the status of a Query Suggestion\'s index. The status includes whether the Query Suggestions index is currently in the process of being built, and the last build time.
|
|
199
|
-
*
|
|
200
|
-
* @summary Get configuration status.
|
|
201
|
-
* @param getConfigStatus - The getConfigStatus object.
|
|
202
|
-
* @param getConfigStatus.indexName - The index in which to perform the request.
|
|
203
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
204
|
-
*/
|
|
205
|
-
getConfigStatus({ indexName }, requestOptions) {
|
|
206
|
-
if (!indexName) {
|
|
207
|
-
throw new Error('Parameter `indexName` is required when calling `getConfigStatus`.');
|
|
208
|
-
}
|
|
209
|
-
const requestPath = '/1/configs/{indexName}/status'.replace('{indexName}', encodeURIComponent(indexName));
|
|
210
|
-
const headers = {};
|
|
211
|
-
const queryParameters = {};
|
|
212
|
-
const request = {
|
|
213
|
-
method: 'GET',
|
|
214
|
-
path: requestPath,
|
|
215
|
-
queryParameters,
|
|
216
|
-
headers,
|
|
217
|
-
};
|
|
218
|
-
return transporter.request(request, requestOptions);
|
|
219
|
-
},
|
|
220
|
-
/**
|
|
221
|
-
* Get the log file of the last build of a single Query Suggestion index.
|
|
222
|
-
*
|
|
223
|
-
* @summary Get a log file.
|
|
224
|
-
* @param getLogFile - The getLogFile object.
|
|
225
|
-
* @param getLogFile.indexName - The index in which to perform the request.
|
|
226
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
227
|
-
*/
|
|
228
|
-
getLogFile({ indexName }, requestOptions) {
|
|
229
|
-
if (!indexName) {
|
|
230
|
-
throw new Error('Parameter `indexName` is required when calling `getLogFile`.');
|
|
231
|
-
}
|
|
232
|
-
const requestPath = '/1/logs/{indexName}'.replace('{indexName}', encodeURIComponent(indexName));
|
|
233
|
-
const headers = {};
|
|
234
|
-
const queryParameters = {};
|
|
235
|
-
const request = {
|
|
236
|
-
method: 'GET',
|
|
237
|
-
path: requestPath,
|
|
238
|
-
queryParameters,
|
|
239
|
-
headers,
|
|
240
|
-
};
|
|
241
|
-
return transporter.request(request, requestOptions);
|
|
242
|
-
},
|
|
243
|
-
/**
|
|
244
|
-
* This method allow you to send requests to the Algolia REST API.
|
|
245
|
-
*
|
|
246
|
-
* @summary Send requests to the Algolia REST API.
|
|
247
|
-
* @param post - The post object.
|
|
248
|
-
* @param post.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
|
|
249
|
-
* @param post.parameters - Query parameters to be applied to the current query.
|
|
250
|
-
* @param post.body - The parameters to send with the custom request.
|
|
251
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
252
|
-
*/
|
|
253
|
-
post({ path, parameters, body }, requestOptions) {
|
|
254
|
-
if (!path) {
|
|
255
|
-
throw new Error('Parameter `path` is required when calling `post`.');
|
|
256
|
-
}
|
|
257
|
-
const requestPath = '/1{path}'.replace('{path}', path);
|
|
258
|
-
const headers = {};
|
|
259
|
-
const queryParameters = parameters ? parameters : {};
|
|
260
|
-
const request = {
|
|
261
|
-
method: 'POST',
|
|
262
|
-
path: requestPath,
|
|
263
|
-
queryParameters,
|
|
264
|
-
headers,
|
|
265
|
-
data: body ? body : {},
|
|
266
|
-
};
|
|
267
|
-
return transporter.request(request, requestOptions);
|
|
268
|
-
},
|
|
269
|
-
/**
|
|
270
|
-
* This method allow you to send requests to the Algolia REST API.
|
|
271
|
-
*
|
|
272
|
-
* @summary Send requests to the Algolia REST API.
|
|
273
|
-
* @param put - The put object.
|
|
274
|
-
* @param put.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
|
|
275
|
-
* @param put.parameters - Query parameters to be applied to the current query.
|
|
276
|
-
* @param put.body - The parameters to send with the custom request.
|
|
277
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
278
|
-
*/
|
|
279
|
-
put({ path, parameters, body }, requestOptions) {
|
|
280
|
-
if (!path) {
|
|
281
|
-
throw new Error('Parameter `path` is required when calling `put`.');
|
|
282
|
-
}
|
|
283
|
-
const requestPath = '/1{path}'.replace('{path}', path);
|
|
284
|
-
const headers = {};
|
|
285
|
-
const queryParameters = parameters ? parameters : {};
|
|
286
|
-
const request = {
|
|
287
|
-
method: 'PUT',
|
|
288
|
-
path: requestPath,
|
|
289
|
-
queryParameters,
|
|
290
|
-
headers,
|
|
291
|
-
data: body ? body : {},
|
|
292
|
-
};
|
|
293
|
-
return transporter.request(request, requestOptions);
|
|
294
|
-
},
|
|
295
|
-
/**
|
|
296
|
-
* Update the configuration of a Query Suggestions index.
|
|
297
|
-
*
|
|
298
|
-
* @summary Update a configuration.
|
|
299
|
-
* @param updateConfig - The updateConfig object.
|
|
300
|
-
* @param updateConfig.indexName - The index in which to perform the request.
|
|
301
|
-
* @param updateConfig.querySuggestionsIndexParam - The querySuggestionsIndexParam object.
|
|
302
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
303
|
-
*/
|
|
304
|
-
updateConfig({ indexName, querySuggestionsIndexParam }, requestOptions) {
|
|
305
|
-
if (!indexName) {
|
|
306
|
-
throw new Error('Parameter `indexName` is required when calling `updateConfig`.');
|
|
307
|
-
}
|
|
308
|
-
if (!querySuggestionsIndexParam) {
|
|
309
|
-
throw new Error('Parameter `querySuggestionsIndexParam` is required when calling `updateConfig`.');
|
|
310
|
-
}
|
|
311
|
-
if (!querySuggestionsIndexParam.sourceIndices) {
|
|
312
|
-
throw new Error('Parameter `querySuggestionsIndexParam.sourceIndices` is required when calling `updateConfig`.');
|
|
313
|
-
}
|
|
314
|
-
const requestPath = '/1/configs/{indexName}'.replace('{indexName}', encodeURIComponent(indexName));
|
|
315
|
-
const headers = {};
|
|
316
|
-
const queryParameters = {};
|
|
317
|
-
const request = {
|
|
318
|
-
method: 'PUT',
|
|
319
|
-
path: requestPath,
|
|
320
|
-
queryParameters,
|
|
321
|
-
headers,
|
|
322
|
-
data: querySuggestionsIndexParam,
|
|
323
|
-
};
|
|
324
|
-
return transporter.request(request, requestOptions);
|
|
325
|
-
},
|
|
326
|
-
};
|
|
4
|
+
// 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.
|
|
5
|
+
const apiClientVersion = '5.0.0-alpha.70';
|
|
6
|
+
const REGIONS = ['eu', 'us'];
|
|
7
|
+
function getDefaultHosts(region) {
|
|
8
|
+
const url = 'query-suggestions.{region}.algolia.com'.replace('{region}', region);
|
|
9
|
+
return [{ url, accept: 'readWrite', protocol: 'https' }];
|
|
10
|
+
}
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
12
|
+
function createQuerySuggestionsClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }) {
|
|
13
|
+
const auth = createAuth(appIdOption, apiKeyOption, authMode);
|
|
14
|
+
const transporter = createTransporter({
|
|
15
|
+
hosts: getDefaultHosts(regionOption),
|
|
16
|
+
...options,
|
|
17
|
+
algoliaAgent: getAlgoliaAgent({
|
|
18
|
+
algoliaAgents,
|
|
19
|
+
client: 'QuerySuggestions',
|
|
20
|
+
version: apiClientVersion,
|
|
21
|
+
}),
|
|
22
|
+
baseHeaders: {
|
|
23
|
+
'content-type': 'text/plain',
|
|
24
|
+
...auth.headers(),
|
|
25
|
+
...options.baseHeaders,
|
|
26
|
+
},
|
|
27
|
+
baseQueryParameters: {
|
|
28
|
+
...auth.queryParameters(),
|
|
29
|
+
...options.baseQueryParameters,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
return {
|
|
33
|
+
transporter,
|
|
34
|
+
/**
|
|
35
|
+
* The `appId` currently in use.
|
|
36
|
+
*/
|
|
37
|
+
appId: appIdOption,
|
|
38
|
+
/**
|
|
39
|
+
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
|
|
40
|
+
*/
|
|
41
|
+
clearCache() {
|
|
42
|
+
return Promise.all([
|
|
43
|
+
transporter.requestsCache.clear(),
|
|
44
|
+
transporter.responsesCache.clear(),
|
|
45
|
+
]).then(() => undefined);
|
|
46
|
+
},
|
|
47
|
+
/**
|
|
48
|
+
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
|
|
49
|
+
*/
|
|
50
|
+
get _ua() {
|
|
51
|
+
return transporter.algoliaAgent.value;
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
|
|
55
|
+
*
|
|
56
|
+
* @param segment - The algolia agent (user-agent) segment to add.
|
|
57
|
+
* @param version - The version of the agent.
|
|
58
|
+
*/
|
|
59
|
+
addAlgoliaAgent(segment, version) {
|
|
60
|
+
transporter.algoliaAgent.add({ segment, version });
|
|
61
|
+
},
|
|
62
|
+
/**
|
|
63
|
+
* Create a configuration of a Query Suggestions index. There\'s a limit of 100 configurations per application.
|
|
64
|
+
*
|
|
65
|
+
* @summary Create a configuration.
|
|
66
|
+
* @param querySuggestionsIndexWithIndexParam - The querySuggestionsIndexWithIndexParam object.
|
|
67
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
68
|
+
*/
|
|
69
|
+
createConfig(querySuggestionsIndexWithIndexParam, requestOptions) {
|
|
70
|
+
if (!querySuggestionsIndexWithIndexParam) {
|
|
71
|
+
throw new Error('Parameter `querySuggestionsIndexWithIndexParam` is required when calling `createConfig`.');
|
|
72
|
+
}
|
|
73
|
+
const requestPath = '/1/configs';
|
|
74
|
+
const headers = {};
|
|
75
|
+
const queryParameters = {};
|
|
76
|
+
const request = {
|
|
77
|
+
method: 'POST',
|
|
78
|
+
path: requestPath,
|
|
79
|
+
queryParameters,
|
|
80
|
+
headers,
|
|
81
|
+
data: querySuggestionsIndexWithIndexParam,
|
|
82
|
+
};
|
|
83
|
+
return transporter.request(request, requestOptions);
|
|
84
|
+
},
|
|
85
|
+
/**
|
|
86
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
87
|
+
*
|
|
88
|
+
* @summary Send requests to the Algolia REST API.
|
|
89
|
+
* @param del - The del object.
|
|
90
|
+
* @param del.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
|
|
91
|
+
* @param del.parameters - Query parameters to be applied to the current query.
|
|
92
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
93
|
+
*/
|
|
94
|
+
del({ path, parameters }, requestOptions) {
|
|
95
|
+
if (!path) {
|
|
96
|
+
throw new Error('Parameter `path` is required when calling `del`.');
|
|
97
|
+
}
|
|
98
|
+
const requestPath = '/1{path}'.replace('{path}', path);
|
|
99
|
+
const headers = {};
|
|
100
|
+
const queryParameters = parameters ? parameters : {};
|
|
101
|
+
const request = {
|
|
102
|
+
method: 'DELETE',
|
|
103
|
+
path: requestPath,
|
|
104
|
+
queryParameters,
|
|
105
|
+
headers,
|
|
106
|
+
};
|
|
107
|
+
return transporter.request(request, requestOptions);
|
|
108
|
+
},
|
|
109
|
+
/**
|
|
110
|
+
* Delete a configuration of a Query Suggestion\'s index. By deleting a configuration, you stop all updates to the underlying query suggestion index. Note that when doing this, the underlying index does not change - existing suggestions remain untouched.
|
|
111
|
+
*
|
|
112
|
+
* @summary Delete a configuration.
|
|
113
|
+
* @param deleteConfig - The deleteConfig object.
|
|
114
|
+
* @param deleteConfig.indexName - The index in which to perform the request.
|
|
115
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
116
|
+
*/
|
|
117
|
+
deleteConfig({ indexName }, requestOptions) {
|
|
118
|
+
if (!indexName) {
|
|
119
|
+
throw new Error('Parameter `indexName` is required when calling `deleteConfig`.');
|
|
120
|
+
}
|
|
121
|
+
const requestPath = '/1/configs/{indexName}'.replace('{indexName}', encodeURIComponent(indexName));
|
|
122
|
+
const headers = {};
|
|
123
|
+
const queryParameters = {};
|
|
124
|
+
const request = {
|
|
125
|
+
method: 'DELETE',
|
|
126
|
+
path: requestPath,
|
|
127
|
+
queryParameters,
|
|
128
|
+
headers,
|
|
129
|
+
};
|
|
130
|
+
return transporter.request(request, requestOptions);
|
|
131
|
+
},
|
|
132
|
+
/**
|
|
133
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
134
|
+
*
|
|
135
|
+
* @summary Send requests to the Algolia REST API.
|
|
136
|
+
* @param get - The get object.
|
|
137
|
+
* @param get.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
|
|
138
|
+
* @param get.parameters - Query parameters to be applied to the current query.
|
|
139
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
140
|
+
*/
|
|
141
|
+
get({ path, parameters }, requestOptions) {
|
|
142
|
+
if (!path) {
|
|
143
|
+
throw new Error('Parameter `path` is required when calling `get`.');
|
|
144
|
+
}
|
|
145
|
+
const requestPath = '/1{path}'.replace('{path}', path);
|
|
146
|
+
const headers = {};
|
|
147
|
+
const queryParameters = parameters ? parameters : {};
|
|
148
|
+
const request = {
|
|
149
|
+
method: 'GET',
|
|
150
|
+
path: requestPath,
|
|
151
|
+
queryParameters,
|
|
152
|
+
headers,
|
|
153
|
+
};
|
|
154
|
+
return transporter.request(request, requestOptions);
|
|
155
|
+
},
|
|
156
|
+
/**
|
|
157
|
+
* Get all the configurations of Query Suggestions. For each index, you get a block of JSON with a list of its configuration settings.
|
|
158
|
+
*
|
|
159
|
+
* @summary List configurations.
|
|
160
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
161
|
+
*/
|
|
162
|
+
getAllConfigs(requestOptions) {
|
|
163
|
+
const requestPath = '/1/configs';
|
|
164
|
+
const headers = {};
|
|
165
|
+
const queryParameters = {};
|
|
166
|
+
const request = {
|
|
167
|
+
method: 'GET',
|
|
168
|
+
path: requestPath,
|
|
169
|
+
queryParameters,
|
|
170
|
+
headers,
|
|
171
|
+
};
|
|
172
|
+
return transporter.request(request, requestOptions);
|
|
173
|
+
},
|
|
174
|
+
/**
|
|
175
|
+
* Get the configuration of a single Query Suggestions index.
|
|
176
|
+
*
|
|
177
|
+
* @summary Get a single configuration.
|
|
178
|
+
* @param getConfig - The getConfig object.
|
|
179
|
+
* @param getConfig.indexName - The index in which to perform the request.
|
|
180
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
181
|
+
*/
|
|
182
|
+
getConfig({ indexName }, requestOptions) {
|
|
183
|
+
if (!indexName) {
|
|
184
|
+
throw new Error('Parameter `indexName` is required when calling `getConfig`.');
|
|
185
|
+
}
|
|
186
|
+
const requestPath = '/1/configs/{indexName}'.replace('{indexName}', encodeURIComponent(indexName));
|
|
187
|
+
const headers = {};
|
|
188
|
+
const queryParameters = {};
|
|
189
|
+
const request = {
|
|
190
|
+
method: 'GET',
|
|
191
|
+
path: requestPath,
|
|
192
|
+
queryParameters,
|
|
193
|
+
headers,
|
|
194
|
+
};
|
|
195
|
+
return transporter.request(request, requestOptions);
|
|
196
|
+
},
|
|
197
|
+
/**
|
|
198
|
+
* Get the status of a Query Suggestion\'s index. The status includes whether the Query Suggestions index is currently in the process of being built, and the last build time.
|
|
199
|
+
*
|
|
200
|
+
* @summary Get configuration status.
|
|
201
|
+
* @param getConfigStatus - The getConfigStatus object.
|
|
202
|
+
* @param getConfigStatus.indexName - The index in which to perform the request.
|
|
203
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
204
|
+
*/
|
|
205
|
+
getConfigStatus({ indexName }, requestOptions) {
|
|
206
|
+
if (!indexName) {
|
|
207
|
+
throw new Error('Parameter `indexName` is required when calling `getConfigStatus`.');
|
|
208
|
+
}
|
|
209
|
+
const requestPath = '/1/configs/{indexName}/status'.replace('{indexName}', encodeURIComponent(indexName));
|
|
210
|
+
const headers = {};
|
|
211
|
+
const queryParameters = {};
|
|
212
|
+
const request = {
|
|
213
|
+
method: 'GET',
|
|
214
|
+
path: requestPath,
|
|
215
|
+
queryParameters,
|
|
216
|
+
headers,
|
|
217
|
+
};
|
|
218
|
+
return transporter.request(request, requestOptions);
|
|
219
|
+
},
|
|
220
|
+
/**
|
|
221
|
+
* Get the log file of the last build of a single Query Suggestion index.
|
|
222
|
+
*
|
|
223
|
+
* @summary Get a log file.
|
|
224
|
+
* @param getLogFile - The getLogFile object.
|
|
225
|
+
* @param getLogFile.indexName - The index in which to perform the request.
|
|
226
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
227
|
+
*/
|
|
228
|
+
getLogFile({ indexName }, requestOptions) {
|
|
229
|
+
if (!indexName) {
|
|
230
|
+
throw new Error('Parameter `indexName` is required when calling `getLogFile`.');
|
|
231
|
+
}
|
|
232
|
+
const requestPath = '/1/logs/{indexName}'.replace('{indexName}', encodeURIComponent(indexName));
|
|
233
|
+
const headers = {};
|
|
234
|
+
const queryParameters = {};
|
|
235
|
+
const request = {
|
|
236
|
+
method: 'GET',
|
|
237
|
+
path: requestPath,
|
|
238
|
+
queryParameters,
|
|
239
|
+
headers,
|
|
240
|
+
};
|
|
241
|
+
return transporter.request(request, requestOptions);
|
|
242
|
+
},
|
|
243
|
+
/**
|
|
244
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
245
|
+
*
|
|
246
|
+
* @summary Send requests to the Algolia REST API.
|
|
247
|
+
* @param post - The post object.
|
|
248
|
+
* @param post.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
|
|
249
|
+
* @param post.parameters - Query parameters to be applied to the current query.
|
|
250
|
+
* @param post.body - The parameters to send with the custom request.
|
|
251
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
252
|
+
*/
|
|
253
|
+
post({ path, parameters, body }, requestOptions) {
|
|
254
|
+
if (!path) {
|
|
255
|
+
throw new Error('Parameter `path` is required when calling `post`.');
|
|
256
|
+
}
|
|
257
|
+
const requestPath = '/1{path}'.replace('{path}', path);
|
|
258
|
+
const headers = {};
|
|
259
|
+
const queryParameters = parameters ? parameters : {};
|
|
260
|
+
const request = {
|
|
261
|
+
method: 'POST',
|
|
262
|
+
path: requestPath,
|
|
263
|
+
queryParameters,
|
|
264
|
+
headers,
|
|
265
|
+
data: body ? body : {},
|
|
266
|
+
};
|
|
267
|
+
return transporter.request(request, requestOptions);
|
|
268
|
+
},
|
|
269
|
+
/**
|
|
270
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
271
|
+
*
|
|
272
|
+
* @summary Send requests to the Algolia REST API.
|
|
273
|
+
* @param put - The put object.
|
|
274
|
+
* @param put.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
|
|
275
|
+
* @param put.parameters - Query parameters to be applied to the current query.
|
|
276
|
+
* @param put.body - The parameters to send with the custom request.
|
|
277
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
278
|
+
*/
|
|
279
|
+
put({ path, parameters, body }, requestOptions) {
|
|
280
|
+
if (!path) {
|
|
281
|
+
throw new Error('Parameter `path` is required when calling `put`.');
|
|
282
|
+
}
|
|
283
|
+
const requestPath = '/1{path}'.replace('{path}', path);
|
|
284
|
+
const headers = {};
|
|
285
|
+
const queryParameters = parameters ? parameters : {};
|
|
286
|
+
const request = {
|
|
287
|
+
method: 'PUT',
|
|
288
|
+
path: requestPath,
|
|
289
|
+
queryParameters,
|
|
290
|
+
headers,
|
|
291
|
+
data: body ? body : {},
|
|
292
|
+
};
|
|
293
|
+
return transporter.request(request, requestOptions);
|
|
294
|
+
},
|
|
295
|
+
/**
|
|
296
|
+
* Update the configuration of a Query Suggestions index.
|
|
297
|
+
*
|
|
298
|
+
* @summary Update a configuration.
|
|
299
|
+
* @param updateConfig - The updateConfig object.
|
|
300
|
+
* @param updateConfig.indexName - The index in which to perform the request.
|
|
301
|
+
* @param updateConfig.querySuggestionsIndexParam - The querySuggestionsIndexParam object.
|
|
302
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
303
|
+
*/
|
|
304
|
+
updateConfig({ indexName, querySuggestionsIndexParam }, requestOptions) {
|
|
305
|
+
if (!indexName) {
|
|
306
|
+
throw new Error('Parameter `indexName` is required when calling `updateConfig`.');
|
|
307
|
+
}
|
|
308
|
+
if (!querySuggestionsIndexParam) {
|
|
309
|
+
throw new Error('Parameter `querySuggestionsIndexParam` is required when calling `updateConfig`.');
|
|
310
|
+
}
|
|
311
|
+
if (!querySuggestionsIndexParam.sourceIndices) {
|
|
312
|
+
throw new Error('Parameter `querySuggestionsIndexParam.sourceIndices` is required when calling `updateConfig`.');
|
|
313
|
+
}
|
|
314
|
+
const requestPath = '/1/configs/{indexName}'.replace('{indexName}', encodeURIComponent(indexName));
|
|
315
|
+
const headers = {};
|
|
316
|
+
const queryParameters = {};
|
|
317
|
+
const request = {
|
|
318
|
+
method: 'PUT',
|
|
319
|
+
path: requestPath,
|
|
320
|
+
queryParameters,
|
|
321
|
+
headers,
|
|
322
|
+
data: querySuggestionsIndexParam,
|
|
323
|
+
};
|
|
324
|
+
return transporter.request(request, requestOptions);
|
|
325
|
+
},
|
|
326
|
+
};
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
-
//
|
|
330
|
-
function querySuggestionsClient(appId, apiKey, region, options) {
|
|
331
|
-
if (!appId || typeof appId !== 'string') {
|
|
332
|
-
throw new Error('`appId` is missing.');
|
|
333
|
-
}
|
|
334
|
-
if (!apiKey || typeof apiKey !== 'string') {
|
|
335
|
-
throw new Error('`apiKey` is missing.');
|
|
336
|
-
}
|
|
337
|
-
if (!region
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
},
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
...options,
|
|
358
|
-
});
|
|
329
|
+
// 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.
|
|
330
|
+
function querySuggestionsClient(appId, apiKey, region, options) {
|
|
331
|
+
if (!appId || typeof appId !== 'string') {
|
|
332
|
+
throw new Error('`appId` is missing.');
|
|
333
|
+
}
|
|
334
|
+
if (!apiKey || typeof apiKey !== 'string') {
|
|
335
|
+
throw new Error('`apiKey` is missing.');
|
|
336
|
+
}
|
|
337
|
+
if (!region ||
|
|
338
|
+
(region && (typeof region !== 'string' || !REGIONS.includes(region)))) {
|
|
339
|
+
throw new Error(`\`region\` is required and must be one of the following: ${REGIONS.join(', ')}`);
|
|
340
|
+
}
|
|
341
|
+
return createQuerySuggestionsClient({
|
|
342
|
+
appId,
|
|
343
|
+
apiKey,
|
|
344
|
+
region,
|
|
345
|
+
timeouts: {
|
|
346
|
+
connect: DEFAULT_CONNECT_TIMEOUT_NODE,
|
|
347
|
+
read: DEFAULT_READ_TIMEOUT_NODE,
|
|
348
|
+
write: DEFAULT_WRITE_TIMEOUT_NODE,
|
|
349
|
+
},
|
|
350
|
+
requester: createHttpRequester(),
|
|
351
|
+
algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],
|
|
352
|
+
responsesCache: createNullCache(),
|
|
353
|
+
requestsCache: createNullCache(),
|
|
354
|
+
hostsCache: createMemoryCache(),
|
|
355
|
+
...options,
|
|
356
|
+
});
|
|
359
357
|
}
|
|
360
358
|
|
|
361
359
|
export { apiClientVersion, querySuggestionsClient };
|