@algolia/client-query-suggestions 5.0.0-alpha.9 → 5.0.0-alpha.91
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 → client-query-suggestions.cjs} +351 -353
- package/dist/client-query-suggestions.esm.browser.js +533 -583
- package/dist/client-query-suggestions.esm.node.js +351 -351
- package/dist/client-query-suggestions.umd.js +2 -2
- package/dist/model/baseQuerySuggestionsConfigurationResponse.d.ts +19 -0
- package/dist/model/baseQuerySuggestionsConfigurationResponse.d.ts.map +1 -0
- package/dist/model/baseQuerySuggestionsConfigurationWithIndex.d.ts +7 -0
- package/dist/model/baseQuerySuggestionsConfigurationWithIndex.d.ts.map +1 -0
- package/dist/model/baseResponse.d.ts +11 -0
- package/dist/model/baseResponse.d.ts.map +1 -0
- 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/facet.d.ts +14 -0
- package/dist/model/facet.d.ts.map +1 -0
- package/dist/model/getConfigStatus200Response.d.ts +23 -0
- package/dist/model/getConfigStatus200Response.d.ts.map +1 -0
- package/dist/model/getLogFile200Response.d.ts +17 -0
- package/dist/model/getLogFile200Response.d.ts.map +1 -0
- package/dist/model/index.d.ts +14 -13
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/languages.d.ts +5 -0
- package/dist/model/languages.d.ts.map +1 -0
- package/dist/model/logLevel.d.ts +4 -4
- package/dist/model/logLevel.d.ts.map +1 -1
- package/dist/model/querySuggestionsConfiguration.d.ts +25 -0
- package/dist/model/querySuggestionsConfiguration.d.ts.map +1 -0
- package/dist/model/querySuggestionsConfigurationResponse.d.ts +4 -0
- package/dist/model/querySuggestionsConfigurationResponse.d.ts.map +1 -0
- package/dist/model/querySuggestionsConfigurationWithIndex.d.ts +7 -0
- package/dist/model/querySuggestionsConfigurationWithIndex.d.ts.map +1 -0
- package/dist/model/sourceIndex.d.ts +35 -31
- package/dist/model/sourceIndex.d.ts.map +1 -1
- package/dist/src/querySuggestionsClient.d.ts +141 -141
- package/dist/src/querySuggestionsClient.d.ts.map +1 -1
- package/index.js +1 -1
- package/model/baseQuerySuggestionsConfigurationResponse.ts +23 -0
- package/model/baseQuerySuggestionsConfigurationWithIndex.ts +8 -0
- package/model/baseResponse.ts +13 -0
- package/model/clientMethodProps.ts +18 -18
- package/model/errorBase.ts +1 -1
- package/model/facet.ts +16 -0
- package/model/getConfigStatus200Response.ts +28 -0
- package/model/getLogFile200Response.ts +22 -0
- package/model/index.ts +11 -10
- package/model/languages.ts +6 -0
- package/model/logLevel.ts +2 -2
- package/model/querySuggestionsConfiguration.ts +31 -0
- package/model/querySuggestionsConfigurationResponse.ts +8 -0
- package/model/querySuggestionsConfigurationWithIndex.ts +10 -0
- package/model/sourceIndex.ts +19 -14
- package/package.json +30 -13
- package/dist/model/indexName.d.ts +0 -7
- package/dist/model/indexName.d.ts.map +0 -1
- package/dist/model/logFile.d.ts +0 -17
- package/dist/model/logFile.d.ts.map +0 -1
- package/dist/model/querySuggestionsIndex.d.ts +0 -20
- package/dist/model/querySuggestionsIndex.d.ts.map +0 -1
- package/dist/model/querySuggestionsIndexParam.d.ts +0 -16
- package/dist/model/querySuggestionsIndexParam.d.ts.map +0 -1
- package/dist/model/querySuggestionsIndexWithIndexParam.d.ts +0 -4
- package/dist/model/querySuggestionsIndexWithIndexParam.d.ts.map +0 -1
- package/dist/model/sourceIndexExternal.d.ts +0 -11
- package/dist/model/sourceIndexExternal.d.ts.map +0 -1
- package/dist/model/sourceIndexWithReplicas.d.ts +0 -39
- package/dist/model/sourceIndexWithReplicas.d.ts.map +0 -1
- package/dist/model/status.d.ts +0 -15
- package/dist/model/status.d.ts.map +0 -1
- package/dist/model/successResponse.d.ts +0 -11
- package/dist/model/successResponse.d.ts.map +0 -1
- package/model/indexName.ts +0 -8
- package/model/logFile.ts +0 -22
- package/model/querySuggestionsIndex.ts +0 -25
- package/model/querySuggestionsIndexParam.ts +0 -20
- package/model/querySuggestionsIndexWithIndexParam.ts +0 -7
- package/model/sourceIndexExternal.ts +0 -13
- package/model/sourceIndexWithReplicas.ts +0 -48
- package/model/status.ts +0 -18
- package/model/successResponse.ts +0 -13
|
@@ -1,359 +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
|
|
64
|
-
*
|
|
65
|
-
* @summary Create a configuration.
|
|
66
|
-
* @param
|
|
67
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
68
|
-
*/
|
|
69
|
-
createConfig(
|
|
70
|
-
if (!
|
|
71
|
-
throw new Error('Parameter `
|
|
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:
|
|
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 -
|
|
91
|
-
* @param del.parameters - Query parameters to
|
|
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
|
|
111
|
-
*
|
|
112
|
-
* @summary Delete a configuration.
|
|
113
|
-
* @param deleteConfig - The deleteConfig object.
|
|
114
|
-
* @param deleteConfig.indexName -
|
|
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 -
|
|
138
|
-
* @param get.parameters - Query parameters to
|
|
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
|
-
*
|
|
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
|
|
176
|
-
*
|
|
177
|
-
* @summary Get a
|
|
178
|
-
* @param getConfig - The getConfig object.
|
|
179
|
-
* @param getConfig.indexName -
|
|
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
|
-
*
|
|
199
|
-
*
|
|
200
|
-
* @summary Get configuration status.
|
|
201
|
-
* @param getConfigStatus - The getConfigStatus object.
|
|
202
|
-
* @param getConfigStatus.indexName -
|
|
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
|
|
222
|
-
*
|
|
223
|
-
* @summary Get
|
|
224
|
-
* @param getLogFile - The getLogFile object.
|
|
225
|
-
* @param getLogFile.indexName -
|
|
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 -
|
|
249
|
-
* @param post.parameters - Query parameters to
|
|
250
|
-
* @param post.body -
|
|
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 -
|
|
275
|
-
* @param put.parameters - Query parameters to
|
|
276
|
-
* @param put.body -
|
|
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
|
|
297
|
-
*
|
|
298
|
-
* @summary Update a configuration.
|
|
299
|
-
* @param updateConfig - The updateConfig object.
|
|
300
|
-
* @param updateConfig.indexName -
|
|
301
|
-
* @param updateConfig.
|
|
302
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
303
|
-
*/
|
|
304
|
-
updateConfig({ indexName,
|
|
305
|
-
if (!indexName) {
|
|
306
|
-
throw new Error('Parameter `indexName` is required when calling `updateConfig`.');
|
|
307
|
-
}
|
|
308
|
-
if (!
|
|
309
|
-
throw new Error('Parameter `
|
|
310
|
-
}
|
|
311
|
-
if (!
|
|
312
|
-
throw new Error('Parameter `
|
|
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:
|
|
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.91';
|
|
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 new Query Suggestions configuration. You can have up to 100 configurations per Algolia application.
|
|
64
|
+
*
|
|
65
|
+
* @summary Create a configuration.
|
|
66
|
+
* @param querySuggestionsConfigurationWithIndex - The querySuggestionsConfigurationWithIndex object.
|
|
67
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
68
|
+
*/
|
|
69
|
+
createConfig(querySuggestionsConfigurationWithIndex, requestOptions) {
|
|
70
|
+
if (!querySuggestionsConfigurationWithIndex) {
|
|
71
|
+
throw new Error('Parameter `querySuggestionsConfigurationWithIndex` 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: querySuggestionsConfigurationWithIndex,
|
|
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 - Path of the endpoint, anything after \"/1\" must be specified.
|
|
91
|
+
* @param del.parameters - Query parameters to apply 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 Query Suggestions configuration. Deleting only removes the configuration and stops updates to the Query Suggestions index. The Query Suggestions index itself is not deleted.
|
|
111
|
+
*
|
|
112
|
+
* @summary Delete a configuration.
|
|
113
|
+
* @param deleteConfig - The deleteConfig object.
|
|
114
|
+
* @param deleteConfig.indexName - Query Suggestions index name.
|
|
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 - Path of the endpoint, anything after \"/1\" must be specified.
|
|
138
|
+
* @param get.parameters - Query parameters to apply 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
|
+
* List all Query Suggestions configurations of your Algolia application.
|
|
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 a single Query Suggestions configuration.
|
|
176
|
+
*
|
|
177
|
+
* @summary Get a configuration.
|
|
178
|
+
* @param getConfig - The getConfig object.
|
|
179
|
+
* @param getConfig.indexName - Query Suggestions index name.
|
|
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
|
+
* Report the status of a Query Suggestions index.
|
|
199
|
+
*
|
|
200
|
+
* @summary Get configuration status.
|
|
201
|
+
* @param getConfigStatus - The getConfigStatus object.
|
|
202
|
+
* @param getConfigStatus.indexName - Query Suggestions index name.
|
|
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 logs for a single Query Suggestions index.
|
|
222
|
+
*
|
|
223
|
+
* @summary Get logs.
|
|
224
|
+
* @param getLogFile - The getLogFile object.
|
|
225
|
+
* @param getLogFile.indexName - Query Suggestions index name.
|
|
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 - Path of the endpoint, anything after \"/1\" must be specified.
|
|
249
|
+
* @param post.parameters - Query parameters to apply to the current query.
|
|
250
|
+
* @param post.body - 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 - Path of the endpoint, anything after \"/1\" must be specified.
|
|
275
|
+
* @param put.parameters - Query parameters to apply to the current query.
|
|
276
|
+
* @param put.body - 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 a QuerySuggestions configuration.
|
|
297
|
+
*
|
|
298
|
+
* @summary Update a configuration.
|
|
299
|
+
* @param updateConfig - The updateConfig object.
|
|
300
|
+
* @param updateConfig.indexName - Query Suggestions index name.
|
|
301
|
+
* @param updateConfig.querySuggestionsConfiguration - The querySuggestionsConfiguration object.
|
|
302
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
303
|
+
*/
|
|
304
|
+
updateConfig({ indexName, querySuggestionsConfiguration }, requestOptions) {
|
|
305
|
+
if (!indexName) {
|
|
306
|
+
throw new Error('Parameter `indexName` is required when calling `updateConfig`.');
|
|
307
|
+
}
|
|
308
|
+
if (!querySuggestionsConfiguration) {
|
|
309
|
+
throw new Error('Parameter `querySuggestionsConfiguration` is required when calling `updateConfig`.');
|
|
310
|
+
}
|
|
311
|
+
if (!querySuggestionsConfiguration.sourceIndices) {
|
|
312
|
+
throw new Error('Parameter `querySuggestionsConfiguration.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: querySuggestionsConfiguration,
|
|
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
|
-
(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
|
-
});
|
|
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
|
+
});
|
|
357
357
|
}
|
|
358
358
|
|
|
359
359
|
export { apiClientVersion, querySuggestionsClient };
|