@algolia/client-query-suggestions 5.0.0-alpha.8 → 5.0.0-alpha.80

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