@algolia/client-abtesting 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.
Files changed (60) 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-abtesting.cjs.js → client-abtesting.cjs} +324 -318
  6. package/dist/client-abtesting.esm.browser.js +506 -548
  7. package/dist/client-abtesting.esm.node.js +324 -316
  8. package/dist/client-abtesting.umd.js +2 -2
  9. package/dist/model/aBTest.d.ts +51 -39
  10. package/dist/model/aBTest.d.ts.map +1 -1
  11. package/dist/model/aBTestResponse.d.ts +14 -14
  12. package/dist/model/aBTestResponse.d.ts.map +1 -1
  13. package/dist/model/abTestsVariant.d.ts +14 -14
  14. package/dist/model/abTestsVariant.d.ts.map +1 -1
  15. package/dist/model/abTestsVariantSearchParams.d.ts +3 -3
  16. package/dist/model/abTestsVariantSearchParams.d.ts.map +1 -1
  17. package/dist/model/addABTestsRequest.d.ts +15 -15
  18. package/dist/model/addABTestsRequest.d.ts.map +1 -1
  19. package/dist/model/addABTestsVariant.d.ts +3 -3
  20. package/dist/model/addABTestsVariant.d.ts.map +1 -1
  21. package/dist/model/clientMethodProps.d.ts +108 -100
  22. package/dist/model/clientMethodProps.d.ts.map +1 -1
  23. package/dist/model/currenciesValue.d.ts +19 -0
  24. package/dist/model/currenciesValue.d.ts.map +1 -0
  25. package/dist/model/customSearchParams.d.ts +6 -3
  26. package/dist/model/customSearchParams.d.ts.map +1 -1
  27. package/dist/model/errorBase.d.ts +6 -6
  28. package/dist/model/errorBase.d.ts.map +1 -1
  29. package/dist/model/filterEffects.d.ts +10 -0
  30. package/dist/model/filterEffects.d.ts.map +1 -0
  31. package/dist/model/filterEffectsEmptySearch.d.ts +14 -0
  32. package/dist/model/filterEffectsEmptySearch.d.ts.map +1 -0
  33. package/dist/model/filterEffectsOutliers.d.ts +14 -0
  34. package/dist/model/filterEffectsOutliers.d.ts.map +1 -0
  35. package/dist/model/index.d.ts +15 -11
  36. package/dist/model/index.d.ts.map +1 -1
  37. package/dist/model/listABTestsResponse.d.ts +15 -15
  38. package/dist/model/listABTestsResponse.d.ts.map +1 -1
  39. package/dist/model/variant.d.ts +73 -50
  40. package/dist/model/variant.d.ts.map +1 -1
  41. package/dist/src/abtestingClient.d.ts +126 -124
  42. package/dist/src/abtestingClient.d.ts.map +1 -1
  43. package/index.js +1 -1
  44. package/model/aBTest.ts +25 -10
  45. package/model/aBTestResponse.ts +4 -4
  46. package/model/abTestsVariant.ts +4 -4
  47. package/model/abTestsVariantSearchParams.ts +1 -1
  48. package/model/addABTestsRequest.ts +4 -4
  49. package/model/addABTestsVariant.ts +1 -1
  50. package/model/clientMethodProps.ts +23 -15
  51. package/model/currenciesValue.ts +23 -0
  52. package/model/customSearchParams.ts +4 -1
  53. package/model/errorBase.ts +1 -1
  54. package/model/filterEffects.ts +13 -0
  55. package/model/filterEffectsEmptySearch.ts +16 -0
  56. package/model/filterEffectsOutliers.ts +16 -0
  57. package/model/index.ts +5 -1
  58. package/model/listABTestsResponse.ts +4 -4
  59. package/model/variant.ts +43 -13
  60. package/package.json +30 -13
@@ -1,328 +1,334 @@
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.9';
10
- const REGIONS = ['de', 'us'];
11
- function getDefaultHosts(region) {
12
- const url = !region
13
- ? 'analytics.algolia.com'
14
- : 'analytics.{region}.algolia.com'.replace('{region}', region);
15
- return [{ url, accept: 'readWrite', protocol: 'https' }];
16
- }
17
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
18
- function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }) {
19
- const auth = clientCommon.createAuth(appIdOption, apiKeyOption, authMode);
20
- const transporter = clientCommon.createTransporter({
21
- hosts: getDefaultHosts(regionOption),
22
- ...options,
23
- algoliaAgent: clientCommon.getAlgoliaAgent({
24
- algoliaAgents,
25
- client: 'Abtesting',
26
- version: apiClientVersion,
27
- }),
28
- baseHeaders: {
29
- 'content-type': 'text/plain',
30
- ...auth.headers(),
31
- ...options.baseHeaders,
32
- },
33
- baseQueryParameters: {
34
- ...auth.queryParameters(),
35
- ...options.baseQueryParameters,
36
- },
37
- });
38
- return {
39
- transporter,
40
- /**
41
- * The `appId` currently in use.
42
- */
43
- appId: appIdOption,
44
- /**
45
- * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
46
- */
47
- clearCache() {
48
- return Promise.all([
49
- transporter.requestsCache.clear(),
50
- transporter.responsesCache.clear(),
51
- ]).then(() => undefined);
52
- },
53
- /**
54
- * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
55
- */
56
- get _ua() {
57
- return transporter.algoliaAgent.value;
58
- },
59
- /**
60
- * Adds a `segment` to the `x-algolia-agent` sent with every requests.
61
- *
62
- * @param segment - The algolia agent (user-agent) segment to add.
63
- * @param version - The version of the agent.
64
- */
65
- addAlgoliaAgent(segment, version) {
66
- transporter.algoliaAgent.add({ segment, version });
67
- },
68
- /**
69
- * Creates a new A/B test with provided configuration. You can set an A/B test on two different indices with different settings, or on the same index with different search parameters by providing a customSearchParameters setting on one of the variants.
70
- *
71
- * @summary Create a test.
72
- * @param addABTestsRequest - The addABTestsRequest object.
73
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
74
- */
75
- addABTests(addABTestsRequest, requestOptions) {
76
- if (!addABTestsRequest) {
77
- throw new Error('Parameter `addABTestsRequest` is required when calling `addABTests`.');
78
- }
79
- if (!addABTestsRequest.name) {
80
- throw new Error('Parameter `addABTestsRequest.name` is required when calling `addABTests`.');
81
- }
82
- if (!addABTestsRequest.variant) {
83
- throw new Error('Parameter `addABTestsRequest.variant` is required when calling `addABTests`.');
84
- }
85
- if (!addABTestsRequest.endAt) {
86
- throw new Error('Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.');
87
- }
88
- const requestPath = '/2/abtests';
89
- const headers = {};
90
- const queryParameters = {};
91
- const request = {
92
- method: 'POST',
93
- path: requestPath,
94
- queryParameters,
95
- headers,
96
- data: addABTestsRequest,
97
- };
98
- return transporter.request(request, requestOptions);
99
- },
100
- /**
101
- * This method allow you to send requests to the Algolia REST API.
102
- *
103
- * @summary Send requests to the Algolia REST API.
104
- * @param del - The del object.
105
- * @param del.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
106
- * @param del.parameters - Query parameters to be applied to the current query.
107
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
108
- */
109
- del({ path, parameters }, requestOptions) {
110
- if (!path) {
111
- throw new Error('Parameter `path` is required when calling `del`.');
112
- }
113
- const requestPath = '/1{path}'.replace('{path}', path);
114
- const headers = {};
115
- const queryParameters = parameters ? parameters : {};
116
- const request = {
117
- method: 'DELETE',
118
- path: requestPath,
119
- queryParameters,
120
- headers,
121
- };
122
- return transporter.request(request, requestOptions);
123
- },
124
- /**
125
- * Delete a test.
126
- *
127
- * @summary Delete a test.
128
- * @param deleteABTest - The deleteABTest object.
129
- * @param deleteABTest.id - The A/B test ID.
130
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
131
- */
132
- deleteABTest({ id }, requestOptions) {
133
- if (!id) {
134
- throw new Error('Parameter `id` is required when calling `deleteABTest`.');
135
- }
136
- const requestPath = '/2/abtests/{id}'.replace('{id}', encodeURIComponent(id));
137
- const headers = {};
138
- const queryParameters = {};
139
- const request = {
140
- method: 'DELETE',
141
- path: requestPath,
142
- queryParameters,
143
- headers,
144
- };
145
- return transporter.request(request, requestOptions);
146
- },
147
- /**
148
- * This method allow you to send requests to the Algolia REST API.
149
- *
150
- * @summary Send requests to the Algolia REST API.
151
- * @param get - The get object.
152
- * @param get.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
153
- * @param get.parameters - Query parameters to be applied to the current query.
154
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
155
- */
156
- get({ path, parameters }, requestOptions) {
157
- if (!path) {
158
- throw new Error('Parameter `path` is required when calling `get`.');
159
- }
160
- const requestPath = '/1{path}'.replace('{path}', path);
161
- const headers = {};
162
- const queryParameters = parameters ? parameters : {};
163
- const request = {
164
- method: 'GET',
165
- path: requestPath,
166
- queryParameters,
167
- headers,
168
- };
169
- return transporter.request(request, requestOptions);
170
- },
171
- /**
172
- * Returns metadata and metrics for an A/B test.
173
- *
174
- * @summary Get a test.
175
- * @param getABTest - The getABTest object.
176
- * @param getABTest.id - The A/B test ID.
177
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
178
- */
179
- getABTest({ id }, requestOptions) {
180
- if (!id) {
181
- throw new Error('Parameter `id` is required when calling `getABTest`.');
182
- }
183
- const requestPath = '/2/abtests/{id}'.replace('{id}', encodeURIComponent(id));
184
- const headers = {};
185
- const queryParameters = {};
186
- const request = {
187
- method: 'GET',
188
- path: requestPath,
189
- queryParameters,
190
- headers,
191
- };
192
- return transporter.request(request, requestOptions);
193
- },
194
- /**
195
- * Fetch all existing A/B tests for App that are available for the current API Key. When no data has been processed, the metrics will be returned as null.
196
- *
197
- * @summary List all tests.
198
- * @param listABTests - The listABTests object.
199
- * @param listABTests.offset - Position of the starting record. Used for paging. 0 is the first record.
200
- * @param listABTests.limit - Number of records to return. Limit is the size of the page.
201
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
202
- */
203
- listABTests({ offset, limit }, requestOptions) {
204
- const requestPath = '/2/abtests';
205
- const headers = {};
206
- const queryParameters = {};
207
- if (offset !== undefined) {
208
- queryParameters.offset = offset.toString();
209
- }
210
- if (limit !== undefined) {
211
- queryParameters.limit = limit.toString();
212
- }
213
- const request = {
214
- method: 'GET',
215
- path: requestPath,
216
- queryParameters,
217
- headers,
218
- };
219
- return transporter.request(request, requestOptions);
220
- },
221
- /**
222
- * This method allow you to send requests to the Algolia REST API.
223
- *
224
- * @summary Send requests to the Algolia REST API.
225
- * @param post - The post object.
226
- * @param post.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
227
- * @param post.parameters - Query parameters to be applied to the current query.
228
- * @param post.body - The parameters to send with the custom request.
229
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
230
- */
231
- post({ path, parameters, body }, requestOptions) {
232
- if (!path) {
233
- throw new Error('Parameter `path` is required when calling `post`.');
234
- }
235
- const requestPath = '/1{path}'.replace('{path}', path);
236
- const headers = {};
237
- const queryParameters = parameters ? parameters : {};
238
- const request = {
239
- method: 'POST',
240
- path: requestPath,
241
- queryParameters,
242
- headers,
243
- data: body ? body : {},
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 put - The put object.
252
- * @param put.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
253
- * @param put.parameters - Query parameters to be applied to the current query.
254
- * @param put.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
- put({ path, parameters, body }, requestOptions) {
258
- if (!path) {
259
- throw new Error('Parameter `path` is required when calling `put`.');
260
- }
261
- const requestPath = '/1{path}'.replace('{path}', path);
262
- const headers = {};
263
- const queryParameters = parameters ? parameters : {};
264
- const request = {
265
- method: 'PUT',
266
- path: requestPath,
267
- queryParameters,
268
- headers,
269
- data: body ? body : {},
270
- };
271
- return transporter.request(request, requestOptions);
272
- },
273
- /**
274
- * Marks the A/B test as stopped. At this point, the test is over and cannot be restarted. As a result, your application is back to normal: index A will perform as usual, receiving 100% of all search requests. Associated metadata and metrics are still stored.
275
- *
276
- * @summary Stop a test.
277
- * @param stopABTest - The stopABTest object.
278
- * @param stopABTest.id - The A/B test ID.
279
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
280
- */
281
- stopABTest({ id }, requestOptions) {
282
- if (!id) {
283
- throw new Error('Parameter `id` is required when calling `stopABTest`.');
284
- }
285
- const requestPath = '/2/abtests/{id}/stop'.replace('{id}', encodeURIComponent(id));
286
- const headers = {};
287
- const queryParameters = {};
288
- const request = {
289
- method: 'POST',
290
- path: requestPath,
291
- queryParameters,
292
- headers,
293
- };
294
- return transporter.request(request, requestOptions);
295
- },
296
- };
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.91';
8
+ const REGIONS = ['de', 'us'];
9
+ function getDefaultHosts(region) {
10
+ const url = !region
11
+ ? 'analytics.algolia.com'
12
+ : 'analytics.{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 createAbtestingClient({ 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: 'Abtesting',
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
+ * Creates an A/B test.
68
+ *
69
+ * @summary Create an A/B test.
70
+ * @param addABTestsRequest - The addABTestsRequest object.
71
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
72
+ */
73
+ addABTests(addABTestsRequest, requestOptions) {
74
+ if (!addABTestsRequest) {
75
+ throw new Error('Parameter `addABTestsRequest` is required when calling `addABTests`.');
76
+ }
77
+ if (!addABTestsRequest.name) {
78
+ throw new Error('Parameter `addABTestsRequest.name` is required when calling `addABTests`.');
79
+ }
80
+ if (!addABTestsRequest.variants) {
81
+ throw new Error('Parameter `addABTestsRequest.variants` is required when calling `addABTests`.');
82
+ }
83
+ if (!addABTestsRequest.endAt) {
84
+ throw new Error('Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.');
85
+ }
86
+ const requestPath = '/2/abtests';
87
+ const headers = {};
88
+ const queryParameters = {};
89
+ const request = {
90
+ method: 'POST',
91
+ path: requestPath,
92
+ queryParameters,
93
+ headers,
94
+ data: addABTestsRequest,
95
+ };
96
+ return transporter.request(request, requestOptions);
97
+ },
98
+ /**
99
+ * This method allow you to send requests to the Algolia REST API.
100
+ *
101
+ * @summary Send requests to the Algolia REST API.
102
+ * @param del - The del object.
103
+ * @param del.path - Path of the endpoint, anything after \"/1\" must be specified.
104
+ * @param del.parameters - Query parameters to apply to the current query.
105
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
106
+ */
107
+ del({ path, parameters }, requestOptions) {
108
+ if (!path) {
109
+ throw new Error('Parameter `path` is required when calling `del`.');
110
+ }
111
+ const requestPath = '/1{path}'.replace('{path}', path);
112
+ const headers = {};
113
+ const queryParameters = parameters ? parameters : {};
114
+ const request = {
115
+ method: 'DELETE',
116
+ path: requestPath,
117
+ queryParameters,
118
+ headers,
119
+ };
120
+ return transporter.request(request, requestOptions);
121
+ },
122
+ /**
123
+ * Delete an A/B test. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests).
124
+ *
125
+ * @summary Delete an A/B test.
126
+ * @param deleteABTest - The deleteABTest object.
127
+ * @param deleteABTest.id - Unique A/B test ID.
128
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
129
+ */
130
+ deleteABTest({ id }, requestOptions) {
131
+ if (!id) {
132
+ throw new Error('Parameter `id` is required when calling `deleteABTest`.');
133
+ }
134
+ const requestPath = '/2/abtests/{id}'.replace('{id}', encodeURIComponent(id));
135
+ const headers = {};
136
+ const queryParameters = {};
137
+ const request = {
138
+ method: 'DELETE',
139
+ path: requestPath,
140
+ queryParameters,
141
+ headers,
142
+ };
143
+ return transporter.request(request, requestOptions);
144
+ },
145
+ /**
146
+ * This method allow you to send requests to the Algolia REST API.
147
+ *
148
+ * @summary Send requests to the Algolia REST API.
149
+ * @param get - The get object.
150
+ * @param get.path - Path of the endpoint, anything after \"/1\" must be specified.
151
+ * @param get.parameters - Query parameters to apply to the current query.
152
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
153
+ */
154
+ get({ path, parameters }, requestOptions) {
155
+ if (!path) {
156
+ throw new Error('Parameter `path` is required when calling `get`.');
157
+ }
158
+ const requestPath = '/1{path}'.replace('{path}', path);
159
+ const headers = {};
160
+ const queryParameters = parameters ? parameters : {};
161
+ const request = {
162
+ method: 'GET',
163
+ path: requestPath,
164
+ queryParameters,
165
+ headers,
166
+ };
167
+ return transporter.request(request, requestOptions);
168
+ },
169
+ /**
170
+ * Get specific details for an A/B test. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests).
171
+ *
172
+ * @summary Get A/B test details.
173
+ * @param getABTest - The getABTest object.
174
+ * @param getABTest.id - Unique A/B test ID.
175
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
176
+ */
177
+ getABTest({ id }, requestOptions) {
178
+ if (!id) {
179
+ throw new Error('Parameter `id` is required when calling `getABTest`.');
180
+ }
181
+ const requestPath = '/2/abtests/{id}'.replace('{id}', encodeURIComponent(id));
182
+ const headers = {};
183
+ const queryParameters = {};
184
+ const request = {
185
+ method: 'GET',
186
+ path: requestPath,
187
+ queryParameters,
188
+ headers,
189
+ };
190
+ return transporter.request(request, requestOptions);
191
+ },
192
+ /**
193
+ * List all A/B tests.
194
+ *
195
+ * @summary List all A/B tests.
196
+ * @param listABTests - The listABTests object.
197
+ * @param listABTests.offset - Position of the starting record. Used for paging. 0 is the first record.
198
+ * @param listABTests.limit - Number of records to return (page size).
199
+ * @param listABTests.indexPrefix - Only return A/B tests for indices starting with this prefix.
200
+ * @param listABTests.indexSuffix - Only return A/B tests for indices ending with this suffix.
201
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
202
+ */
203
+ listABTests({ offset, limit, indexPrefix, indexSuffix } = {}, requestOptions = undefined) {
204
+ const requestPath = '/2/abtests';
205
+ const headers = {};
206
+ const queryParameters = {};
207
+ if (offset !== undefined) {
208
+ queryParameters.offset = offset.toString();
209
+ }
210
+ if (limit !== undefined) {
211
+ queryParameters.limit = limit.toString();
212
+ }
213
+ if (indexPrefix !== undefined) {
214
+ queryParameters.indexPrefix = indexPrefix.toString();
215
+ }
216
+ if (indexSuffix !== undefined) {
217
+ queryParameters.indexSuffix = indexSuffix.toString();
218
+ }
219
+ const request = {
220
+ method: 'GET',
221
+ path: requestPath,
222
+ queryParameters,
223
+ headers,
224
+ };
225
+ return transporter.request(request, requestOptions);
226
+ },
227
+ /**
228
+ * This method allow you to send requests to the Algolia REST API.
229
+ *
230
+ * @summary Send requests to the Algolia REST API.
231
+ * @param post - The post object.
232
+ * @param post.path - Path of the endpoint, anything after \"/1\" must be specified.
233
+ * @param post.parameters - Query parameters to apply to the current query.
234
+ * @param post.body - Parameters to send with the custom request.
235
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
236
+ */
237
+ post({ path, parameters, body }, requestOptions) {
238
+ if (!path) {
239
+ throw new Error('Parameter `path` is required when calling `post`.');
240
+ }
241
+ const requestPath = '/1{path}'.replace('{path}', path);
242
+ const headers = {};
243
+ const queryParameters = parameters ? parameters : {};
244
+ const request = {
245
+ method: 'POST',
246
+ path: requestPath,
247
+ queryParameters,
248
+ headers,
249
+ data: body ? body : {},
250
+ };
251
+ return transporter.request(request, requestOptions);
252
+ },
253
+ /**
254
+ * This method allow you to send requests to the Algolia REST API.
255
+ *
256
+ * @summary Send requests to the Algolia REST API.
257
+ * @param put - The put object.
258
+ * @param put.path - Path of the endpoint, anything after \"/1\" must be specified.
259
+ * @param put.parameters - Query parameters to apply to the current query.
260
+ * @param put.body - Parameters to send with the custom request.
261
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
262
+ */
263
+ put({ path, parameters, body }, requestOptions) {
264
+ if (!path) {
265
+ throw new Error('Parameter `path` is required when calling `put`.');
266
+ }
267
+ const requestPath = '/1{path}'.replace('{path}', path);
268
+ const headers = {};
269
+ const queryParameters = parameters ? parameters : {};
270
+ const request = {
271
+ method: 'PUT',
272
+ path: requestPath,
273
+ queryParameters,
274
+ headers,
275
+ data: body ? body : {},
276
+ };
277
+ return transporter.request(request, requestOptions);
278
+ },
279
+ /**
280
+ * If stopped, the test is over and can\'t be restarted. There is now only one index, receiving 100% of all search requests. The data gathered for stopped A/B tests is retained. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests).
281
+ *
282
+ * @summary Stop an A/B test.
283
+ * @param stopABTest - The stopABTest object.
284
+ * @param stopABTest.id - Unique A/B test ID.
285
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
286
+ */
287
+ stopABTest({ id }, requestOptions) {
288
+ if (!id) {
289
+ throw new Error('Parameter `id` is required when calling `stopABTest`.');
290
+ }
291
+ const requestPath = '/2/abtests/{id}/stop'.replace('{id}', encodeURIComponent(id));
292
+ const headers = {};
293
+ const queryParameters = {};
294
+ const request = {
295
+ method: 'POST',
296
+ path: requestPath,
297
+ queryParameters,
298
+ headers,
299
+ };
300
+ return transporter.request(request, requestOptions);
301
+ },
302
+ };
297
303
  }
298
304
 
299
- // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
300
- function abtestingClient(appId, apiKey, region, options) {
301
- if (!appId || typeof appId !== 'string') {
302
- throw new Error('`appId` is missing.');
303
- }
304
- if (!apiKey || typeof apiKey !== 'string') {
305
- throw new Error('`apiKey` is missing.');
306
- }
307
- if (region && (typeof region !== 'string' || !REGIONS.includes(region))) {
308
- throw new Error(`\`region\` must be one of the following: ${REGIONS.join(', ')}`);
309
- }
310
- return createAbtestingClient({
311
- appId,
312
- apiKey,
313
- region,
314
- timeouts: {
315
- connect: clientCommon.DEFAULT_CONNECT_TIMEOUT_NODE,
316
- read: clientCommon.DEFAULT_READ_TIMEOUT_NODE,
317
- write: clientCommon.DEFAULT_WRITE_TIMEOUT_NODE,
318
- },
319
- requester: requesterNodeHttp.createHttpRequester(),
320
- algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],
321
- responsesCache: clientCommon.createNullCache(),
322
- requestsCache: clientCommon.createNullCache(),
323
- hostsCache: clientCommon.createMemoryCache(),
324
- ...options,
325
- });
305
+ // 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.
306
+ function abtestingClient(appId, apiKey, region, options) {
307
+ if (!appId || typeof appId !== 'string') {
308
+ throw new Error('`appId` is missing.');
309
+ }
310
+ if (!apiKey || typeof apiKey !== 'string') {
311
+ throw new Error('`apiKey` is missing.');
312
+ }
313
+ if (region && (typeof region !== 'string' || !REGIONS.includes(region))) {
314
+ throw new Error(`\`region\` must be one of the following: ${REGIONS.join(', ')}`);
315
+ }
316
+ return createAbtestingClient({
317
+ appId,
318
+ apiKey,
319
+ region,
320
+ timeouts: {
321
+ connect: clientCommon.DEFAULT_CONNECT_TIMEOUT_NODE,
322
+ read: clientCommon.DEFAULT_READ_TIMEOUT_NODE,
323
+ write: clientCommon.DEFAULT_WRITE_TIMEOUT_NODE,
324
+ },
325
+ requester: requesterNodeHttp.createHttpRequester(),
326
+ algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],
327
+ responsesCache: clientCommon.createNullCache(),
328
+ requestsCache: clientCommon.createNullCache(),
329
+ hostsCache: clientCommon.createMemoryCache(),
330
+ ...options,
331
+ });
326
332
  }
327
333
 
328
334
  exports.abtestingClient = abtestingClient;