@algolia/client-abtesting 5.0.0-alpha.7 → 5.0.0-alpha.71
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-abtesting.cjs.js +324 -316
- package/dist/client-abtesting.esm.browser.js +507 -547
- package/dist/client-abtesting.esm.node.js +324 -316
- package/dist/client-abtesting.umd.js +2 -2
- package/dist/model/aBTest.d.ts +39 -39
- package/dist/model/aBTest.d.ts.map +1 -1
- package/dist/model/aBTestResponse.d.ts +14 -14
- package/dist/model/aBTestResponse.d.ts.map +1 -1
- package/dist/model/abTestsVariant.d.ts +14 -14
- package/dist/model/abTestsVariant.d.ts.map +1 -1
- package/dist/model/abTestsVariantSearchParams.d.ts +3 -3
- package/dist/model/abTestsVariantSearchParams.d.ts.map +1 -1
- package/dist/model/addABTestsRequest.d.ts +15 -15
- package/dist/model/addABTestsRequest.d.ts.map +1 -1
- package/dist/model/addABTestsVariant.d.ts +3 -3
- package/dist/model/addABTestsVariant.d.ts.map +1 -1
- package/dist/model/clientMethodProps.d.ts +108 -100
- package/dist/model/clientMethodProps.d.ts.map +1 -1
- package/dist/model/customSearchParams.d.ts +3 -3
- package/dist/model/customSearchParams.d.ts.map +1 -1
- package/dist/model/errorBase.d.ts +6 -6
- package/dist/model/errorBase.d.ts.map +1 -1
- package/dist/model/index.d.ts +11 -11
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/listABTestsResponse.d.ts +15 -15
- package/dist/model/listABTestsResponse.d.ts.map +1 -1
- package/dist/model/variant.d.ts +50 -50
- package/dist/model/variant.d.ts.map +1 -1
- package/dist/src/abtestingClient.d.ts +126 -124
- package/dist/src/abtestingClient.d.ts.map +1 -1
- package/model/aBTest.ts +1 -1
- package/model/aBTestResponse.ts +1 -1
- package/model/abTestsVariant.ts +1 -1
- package/model/abTestsVariantSearchParams.ts +1 -1
- package/model/addABTestsRequest.ts +1 -1
- package/model/addABTestsVariant.ts +1 -1
- package/model/clientMethodProps.ts +9 -1
- package/model/customSearchParams.ts +1 -1
- package/model/errorBase.ts +1 -1
- package/model/index.ts +1 -1
- package/model/listABTestsResponse.ts +1 -1
- package/model/variant.ts +1 -1
- package/package.json +31 -13
|
@@ -1,324 +1,332 @@
|
|
|
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 = ['de', 'us'];
|
|
7
|
-
function getDefaultHosts(region) {
|
|
8
|
-
const url = !region
|
|
9
|
-
? 'analytics.algolia.com'
|
|
10
|
-
: 'analytics.{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 createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }) {
|
|
15
|
-
const auth = createAuth(appIdOption, apiKeyOption, authMode);
|
|
16
|
-
const transporter = createTransporter({
|
|
17
|
-
hosts: getDefaultHosts(regionOption),
|
|
18
|
-
...options,
|
|
19
|
-
algoliaAgent: getAlgoliaAgent({
|
|
20
|
-
algoliaAgents,
|
|
21
|
-
client: 'Abtesting',
|
|
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
|
-
* 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.
|
|
66
|
-
*
|
|
67
|
-
* @summary Create a test.
|
|
68
|
-
* @param addABTestsRequest - The addABTestsRequest object.
|
|
69
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
70
|
-
*/
|
|
71
|
-
addABTests(addABTestsRequest, requestOptions) {
|
|
72
|
-
if (!addABTestsRequest) {
|
|
73
|
-
throw new Error('Parameter `addABTestsRequest` is required when calling `addABTests`.');
|
|
74
|
-
}
|
|
75
|
-
if (!addABTestsRequest.name) {
|
|
76
|
-
throw new Error('Parameter `addABTestsRequest.name` is required when calling `addABTests`.');
|
|
77
|
-
}
|
|
78
|
-
if (!addABTestsRequest.variant) {
|
|
79
|
-
throw new Error('Parameter `addABTestsRequest.variant` is required when calling `addABTests`.');
|
|
80
|
-
}
|
|
81
|
-
if (!addABTestsRequest.endAt) {
|
|
82
|
-
throw new Error('Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.');
|
|
83
|
-
}
|
|
84
|
-
const requestPath = '/2/abtests';
|
|
85
|
-
const headers = {};
|
|
86
|
-
const queryParameters = {};
|
|
87
|
-
const request = {
|
|
88
|
-
method: 'POST',
|
|
89
|
-
path: requestPath,
|
|
90
|
-
queryParameters,
|
|
91
|
-
headers,
|
|
92
|
-
data: addABTestsRequest,
|
|
93
|
-
};
|
|
94
|
-
return transporter.request(request, requestOptions);
|
|
95
|
-
},
|
|
96
|
-
/**
|
|
97
|
-
* This method allow you to send requests to the Algolia REST API.
|
|
98
|
-
*
|
|
99
|
-
* @summary Send requests to the Algolia REST API.
|
|
100
|
-
* @param del - The del object.
|
|
101
|
-
* @param del.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
|
|
102
|
-
* @param del.parameters - Query parameters to be applied to the current query.
|
|
103
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
104
|
-
*/
|
|
105
|
-
del({ path, parameters }, requestOptions) {
|
|
106
|
-
if (!path) {
|
|
107
|
-
throw new Error('Parameter `path` is required when calling `del`.');
|
|
108
|
-
}
|
|
109
|
-
const requestPath = '/1{path}'.replace('{path}', path);
|
|
110
|
-
const headers = {};
|
|
111
|
-
const queryParameters = parameters ? parameters : {};
|
|
112
|
-
const request = {
|
|
113
|
-
method: 'DELETE',
|
|
114
|
-
path: requestPath,
|
|
115
|
-
queryParameters,
|
|
116
|
-
headers,
|
|
117
|
-
};
|
|
118
|
-
return transporter.request(request, requestOptions);
|
|
119
|
-
},
|
|
120
|
-
/**
|
|
121
|
-
* Delete a test.
|
|
122
|
-
*
|
|
123
|
-
* @summary Delete a test.
|
|
124
|
-
* @param deleteABTest - The deleteABTest object.
|
|
125
|
-
* @param deleteABTest.id - The A/B test ID.
|
|
126
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
127
|
-
*/
|
|
128
|
-
deleteABTest({ id }, requestOptions) {
|
|
129
|
-
if (!id) {
|
|
130
|
-
throw new Error('Parameter `id` is required when calling `deleteABTest`.');
|
|
131
|
-
}
|
|
132
|
-
const requestPath = '/2/abtests/{id}'.replace('{id}', encodeURIComponent(id));
|
|
133
|
-
const headers = {};
|
|
134
|
-
const queryParameters = {};
|
|
135
|
-
const request = {
|
|
136
|
-
method: 'DELETE',
|
|
137
|
-
path: requestPath,
|
|
138
|
-
queryParameters,
|
|
139
|
-
headers,
|
|
140
|
-
};
|
|
141
|
-
return transporter.request(request, requestOptions);
|
|
142
|
-
},
|
|
143
|
-
/**
|
|
144
|
-
* This method allow you to send requests to the Algolia REST API.
|
|
145
|
-
*
|
|
146
|
-
* @summary Send requests to the Algolia REST API.
|
|
147
|
-
* @param get - The get object.
|
|
148
|
-
* @param get.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
|
|
149
|
-
* @param get.parameters - Query parameters to be applied to the current query.
|
|
150
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
151
|
-
*/
|
|
152
|
-
get({ path, parameters }, requestOptions) {
|
|
153
|
-
if (!path) {
|
|
154
|
-
throw new Error('Parameter `path` is required when calling `get`.');
|
|
155
|
-
}
|
|
156
|
-
const requestPath = '/1{path}'.replace('{path}', path);
|
|
157
|
-
const headers = {};
|
|
158
|
-
const queryParameters = parameters ? parameters : {};
|
|
159
|
-
const request = {
|
|
160
|
-
method: 'GET',
|
|
161
|
-
path: requestPath,
|
|
162
|
-
queryParameters,
|
|
163
|
-
headers,
|
|
164
|
-
};
|
|
165
|
-
return transporter.request(request, requestOptions);
|
|
166
|
-
},
|
|
167
|
-
/**
|
|
168
|
-
* Returns metadata and metrics for an A/B test.
|
|
169
|
-
*
|
|
170
|
-
* @summary Get a test.
|
|
171
|
-
* @param getABTest - The getABTest object.
|
|
172
|
-
* @param getABTest.id - The A/B test ID.
|
|
173
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
174
|
-
*/
|
|
175
|
-
getABTest({ id }, requestOptions) {
|
|
176
|
-
if (!id) {
|
|
177
|
-
throw new Error('Parameter `id` is required when calling `getABTest`.');
|
|
178
|
-
}
|
|
179
|
-
const requestPath = '/2/abtests/{id}'.replace('{id}', encodeURIComponent(id));
|
|
180
|
-
const headers = {};
|
|
181
|
-
const queryParameters = {};
|
|
182
|
-
const request = {
|
|
183
|
-
method: 'GET',
|
|
184
|
-
path: requestPath,
|
|
185
|
-
queryParameters,
|
|
186
|
-
headers,
|
|
187
|
-
};
|
|
188
|
-
return transporter.request(request, requestOptions);
|
|
189
|
-
},
|
|
190
|
-
/**
|
|
191
|
-
* 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.
|
|
192
|
-
*
|
|
193
|
-
* @summary List all tests.
|
|
194
|
-
* @param listABTests - The listABTests object.
|
|
195
|
-
* @param listABTests.offset - Position of the starting record. Used for paging. 0 is the first record.
|
|
196
|
-
* @param listABTests.limit - Number of records to return. Limit is the size of the page.
|
|
197
|
-
* @param
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
const
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
queryParameters
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
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.71';
|
|
6
|
+
const REGIONS = ['de', 'us'];
|
|
7
|
+
function getDefaultHosts(region) {
|
|
8
|
+
const url = !region
|
|
9
|
+
? 'analytics.algolia.com'
|
|
10
|
+
: 'analytics.{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 createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }) {
|
|
15
|
+
const auth = createAuth(appIdOption, apiKeyOption, authMode);
|
|
16
|
+
const transporter = createTransporter({
|
|
17
|
+
hosts: getDefaultHosts(regionOption),
|
|
18
|
+
...options,
|
|
19
|
+
algoliaAgent: getAlgoliaAgent({
|
|
20
|
+
algoliaAgents,
|
|
21
|
+
client: 'Abtesting',
|
|
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
|
+
* 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.
|
|
66
|
+
*
|
|
67
|
+
* @summary Create a test.
|
|
68
|
+
* @param addABTestsRequest - The addABTestsRequest object.
|
|
69
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
70
|
+
*/
|
|
71
|
+
addABTests(addABTestsRequest, requestOptions) {
|
|
72
|
+
if (!addABTestsRequest) {
|
|
73
|
+
throw new Error('Parameter `addABTestsRequest` is required when calling `addABTests`.');
|
|
74
|
+
}
|
|
75
|
+
if (!addABTestsRequest.name) {
|
|
76
|
+
throw new Error('Parameter `addABTestsRequest.name` is required when calling `addABTests`.');
|
|
77
|
+
}
|
|
78
|
+
if (!addABTestsRequest.variant) {
|
|
79
|
+
throw new Error('Parameter `addABTestsRequest.variant` is required when calling `addABTests`.');
|
|
80
|
+
}
|
|
81
|
+
if (!addABTestsRequest.endAt) {
|
|
82
|
+
throw new Error('Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.');
|
|
83
|
+
}
|
|
84
|
+
const requestPath = '/2/abtests';
|
|
85
|
+
const headers = {};
|
|
86
|
+
const queryParameters = {};
|
|
87
|
+
const request = {
|
|
88
|
+
method: 'POST',
|
|
89
|
+
path: requestPath,
|
|
90
|
+
queryParameters,
|
|
91
|
+
headers,
|
|
92
|
+
data: addABTestsRequest,
|
|
93
|
+
};
|
|
94
|
+
return transporter.request(request, requestOptions);
|
|
95
|
+
},
|
|
96
|
+
/**
|
|
97
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
98
|
+
*
|
|
99
|
+
* @summary Send requests to the Algolia REST API.
|
|
100
|
+
* @param del - The del object.
|
|
101
|
+
* @param del.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
|
|
102
|
+
* @param del.parameters - Query parameters to be applied to the current query.
|
|
103
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
104
|
+
*/
|
|
105
|
+
del({ path, parameters }, requestOptions) {
|
|
106
|
+
if (!path) {
|
|
107
|
+
throw new Error('Parameter `path` is required when calling `del`.');
|
|
108
|
+
}
|
|
109
|
+
const requestPath = '/1{path}'.replace('{path}', path);
|
|
110
|
+
const headers = {};
|
|
111
|
+
const queryParameters = parameters ? parameters : {};
|
|
112
|
+
const request = {
|
|
113
|
+
method: 'DELETE',
|
|
114
|
+
path: requestPath,
|
|
115
|
+
queryParameters,
|
|
116
|
+
headers,
|
|
117
|
+
};
|
|
118
|
+
return transporter.request(request, requestOptions);
|
|
119
|
+
},
|
|
120
|
+
/**
|
|
121
|
+
* Delete a test.
|
|
122
|
+
*
|
|
123
|
+
* @summary Delete a test.
|
|
124
|
+
* @param deleteABTest - The deleteABTest object.
|
|
125
|
+
* @param deleteABTest.id - The A/B test ID.
|
|
126
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
127
|
+
*/
|
|
128
|
+
deleteABTest({ id }, requestOptions) {
|
|
129
|
+
if (!id) {
|
|
130
|
+
throw new Error('Parameter `id` is required when calling `deleteABTest`.');
|
|
131
|
+
}
|
|
132
|
+
const requestPath = '/2/abtests/{id}'.replace('{id}', encodeURIComponent(id));
|
|
133
|
+
const headers = {};
|
|
134
|
+
const queryParameters = {};
|
|
135
|
+
const request = {
|
|
136
|
+
method: 'DELETE',
|
|
137
|
+
path: requestPath,
|
|
138
|
+
queryParameters,
|
|
139
|
+
headers,
|
|
140
|
+
};
|
|
141
|
+
return transporter.request(request, requestOptions);
|
|
142
|
+
},
|
|
143
|
+
/**
|
|
144
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
145
|
+
*
|
|
146
|
+
* @summary Send requests to the Algolia REST API.
|
|
147
|
+
* @param get - The get object.
|
|
148
|
+
* @param get.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
|
|
149
|
+
* @param get.parameters - Query parameters to be applied to the current query.
|
|
150
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
151
|
+
*/
|
|
152
|
+
get({ path, parameters }, requestOptions) {
|
|
153
|
+
if (!path) {
|
|
154
|
+
throw new Error('Parameter `path` is required when calling `get`.');
|
|
155
|
+
}
|
|
156
|
+
const requestPath = '/1{path}'.replace('{path}', path);
|
|
157
|
+
const headers = {};
|
|
158
|
+
const queryParameters = parameters ? parameters : {};
|
|
159
|
+
const request = {
|
|
160
|
+
method: 'GET',
|
|
161
|
+
path: requestPath,
|
|
162
|
+
queryParameters,
|
|
163
|
+
headers,
|
|
164
|
+
};
|
|
165
|
+
return transporter.request(request, requestOptions);
|
|
166
|
+
},
|
|
167
|
+
/**
|
|
168
|
+
* Returns metadata and metrics for an A/B test.
|
|
169
|
+
*
|
|
170
|
+
* @summary Get a test.
|
|
171
|
+
* @param getABTest - The getABTest object.
|
|
172
|
+
* @param getABTest.id - The A/B test ID.
|
|
173
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
174
|
+
*/
|
|
175
|
+
getABTest({ id }, requestOptions) {
|
|
176
|
+
if (!id) {
|
|
177
|
+
throw new Error('Parameter `id` is required when calling `getABTest`.');
|
|
178
|
+
}
|
|
179
|
+
const requestPath = '/2/abtests/{id}'.replace('{id}', encodeURIComponent(id));
|
|
180
|
+
const headers = {};
|
|
181
|
+
const queryParameters = {};
|
|
182
|
+
const request = {
|
|
183
|
+
method: 'GET',
|
|
184
|
+
path: requestPath,
|
|
185
|
+
queryParameters,
|
|
186
|
+
headers,
|
|
187
|
+
};
|
|
188
|
+
return transporter.request(request, requestOptions);
|
|
189
|
+
},
|
|
190
|
+
/**
|
|
191
|
+
* 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.
|
|
192
|
+
*
|
|
193
|
+
* @summary List all tests.
|
|
194
|
+
* @param listABTests - The listABTests object.
|
|
195
|
+
* @param listABTests.offset - Position of the starting record. Used for paging. 0 is the first record.
|
|
196
|
+
* @param listABTests.limit - Number of records to return. Limit is the size of the page.
|
|
197
|
+
* @param listABTests.indexPrefix - Filters the returned ab tests by any indices starting with the provided prefix that are assigned to either variant of an ab test.
|
|
198
|
+
* @param listABTests.indexSuffix - Filters the returned ab tests by any indices ending with the provided suffix that are assigned to either variant of an ab test.
|
|
199
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
200
|
+
*/
|
|
201
|
+
listABTests({ offset, limit, indexPrefix, indexSuffix } = {}, requestOptions = undefined) {
|
|
202
|
+
const requestPath = '/2/abtests';
|
|
203
|
+
const headers = {};
|
|
204
|
+
const queryParameters = {};
|
|
205
|
+
if (offset !== undefined) {
|
|
206
|
+
queryParameters.offset = offset.toString();
|
|
207
|
+
}
|
|
208
|
+
if (limit !== undefined) {
|
|
209
|
+
queryParameters.limit = limit.toString();
|
|
210
|
+
}
|
|
211
|
+
if (indexPrefix !== undefined) {
|
|
212
|
+
queryParameters.indexPrefix = indexPrefix.toString();
|
|
213
|
+
}
|
|
214
|
+
if (indexSuffix !== undefined) {
|
|
215
|
+
queryParameters.indexSuffix = indexSuffix.toString();
|
|
216
|
+
}
|
|
217
|
+
const request = {
|
|
218
|
+
method: 'GET',
|
|
219
|
+
path: requestPath,
|
|
220
|
+
queryParameters,
|
|
221
|
+
headers,
|
|
222
|
+
};
|
|
223
|
+
return transporter.request(request, requestOptions);
|
|
224
|
+
},
|
|
225
|
+
/**
|
|
226
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
227
|
+
*
|
|
228
|
+
* @summary Send requests to the Algolia REST API.
|
|
229
|
+
* @param post - The post object.
|
|
230
|
+
* @param post.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
|
|
231
|
+
* @param post.parameters - Query parameters to be applied to the current query.
|
|
232
|
+
* @param post.body - The parameters to send with the custom request.
|
|
233
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
234
|
+
*/
|
|
235
|
+
post({ path, parameters, body }, requestOptions) {
|
|
236
|
+
if (!path) {
|
|
237
|
+
throw new Error('Parameter `path` is required when calling `post`.');
|
|
238
|
+
}
|
|
239
|
+
const requestPath = '/1{path}'.replace('{path}', path);
|
|
240
|
+
const headers = {};
|
|
241
|
+
const queryParameters = parameters ? parameters : {};
|
|
242
|
+
const request = {
|
|
243
|
+
method: 'POST',
|
|
244
|
+
path: requestPath,
|
|
245
|
+
queryParameters,
|
|
246
|
+
headers,
|
|
247
|
+
data: body ? body : {},
|
|
248
|
+
};
|
|
249
|
+
return transporter.request(request, requestOptions);
|
|
250
|
+
},
|
|
251
|
+
/**
|
|
252
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
253
|
+
*
|
|
254
|
+
* @summary Send requests to the Algolia REST API.
|
|
255
|
+
* @param put - The put object.
|
|
256
|
+
* @param put.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
|
|
257
|
+
* @param put.parameters - Query parameters to be applied to the current query.
|
|
258
|
+
* @param put.body - The parameters to send with the custom request.
|
|
259
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
260
|
+
*/
|
|
261
|
+
put({ path, parameters, body }, requestOptions) {
|
|
262
|
+
if (!path) {
|
|
263
|
+
throw new Error('Parameter `path` is required when calling `put`.');
|
|
264
|
+
}
|
|
265
|
+
const requestPath = '/1{path}'.replace('{path}', path);
|
|
266
|
+
const headers = {};
|
|
267
|
+
const queryParameters = parameters ? parameters : {};
|
|
268
|
+
const request = {
|
|
269
|
+
method: 'PUT',
|
|
270
|
+
path: requestPath,
|
|
271
|
+
queryParameters,
|
|
272
|
+
headers,
|
|
273
|
+
data: body ? body : {},
|
|
274
|
+
};
|
|
275
|
+
return transporter.request(request, requestOptions);
|
|
276
|
+
},
|
|
277
|
+
/**
|
|
278
|
+
* 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.
|
|
279
|
+
*
|
|
280
|
+
* @summary Stop a test.
|
|
281
|
+
* @param stopABTest - The stopABTest object.
|
|
282
|
+
* @param stopABTest.id - The A/B test ID.
|
|
283
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
284
|
+
*/
|
|
285
|
+
stopABTest({ id }, requestOptions) {
|
|
286
|
+
if (!id) {
|
|
287
|
+
throw new Error('Parameter `id` is required when calling `stopABTest`.');
|
|
288
|
+
}
|
|
289
|
+
const requestPath = '/2/abtests/{id}/stop'.replace('{id}', encodeURIComponent(id));
|
|
290
|
+
const headers = {};
|
|
291
|
+
const queryParameters = {};
|
|
292
|
+
const request = {
|
|
293
|
+
method: 'POST',
|
|
294
|
+
path: requestPath,
|
|
295
|
+
queryParameters,
|
|
296
|
+
headers,
|
|
297
|
+
};
|
|
298
|
+
return transporter.request(request, requestOptions);
|
|
299
|
+
},
|
|
300
|
+
};
|
|
293
301
|
}
|
|
294
302
|
|
|
295
|
-
//
|
|
296
|
-
function abtestingClient(appId, apiKey, region, options) {
|
|
297
|
-
if (!appId || typeof appId !== 'string') {
|
|
298
|
-
throw new Error('`appId` is missing.');
|
|
299
|
-
}
|
|
300
|
-
if (!apiKey || typeof apiKey !== 'string') {
|
|
301
|
-
throw new Error('`apiKey` is missing.');
|
|
302
|
-
}
|
|
303
|
-
if (region && (typeof region !== 'string' || !REGIONS.includes(region))) {
|
|
304
|
-
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(', ')}`);
|
|
305
|
-
}
|
|
306
|
-
return createAbtestingClient({
|
|
307
|
-
appId,
|
|
308
|
-
apiKey,
|
|
309
|
-
region,
|
|
310
|
-
timeouts: {
|
|
311
|
-
connect: DEFAULT_CONNECT_TIMEOUT_NODE,
|
|
312
|
-
read: DEFAULT_READ_TIMEOUT_NODE,
|
|
313
|
-
write: DEFAULT_WRITE_TIMEOUT_NODE,
|
|
314
|
-
},
|
|
315
|
-
requester: createHttpRequester(),
|
|
316
|
-
algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],
|
|
317
|
-
responsesCache: createNullCache(),
|
|
318
|
-
requestsCache: createNullCache(),
|
|
319
|
-
hostsCache: createMemoryCache(),
|
|
320
|
-
...options,
|
|
321
|
-
});
|
|
303
|
+
// 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.
|
|
304
|
+
function abtestingClient(appId, apiKey, region, options) {
|
|
305
|
+
if (!appId || typeof appId !== 'string') {
|
|
306
|
+
throw new Error('`appId` is missing.');
|
|
307
|
+
}
|
|
308
|
+
if (!apiKey || typeof apiKey !== 'string') {
|
|
309
|
+
throw new Error('`apiKey` is missing.');
|
|
310
|
+
}
|
|
311
|
+
if (region && (typeof region !== 'string' || !REGIONS.includes(region))) {
|
|
312
|
+
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(', ')}`);
|
|
313
|
+
}
|
|
314
|
+
return createAbtestingClient({
|
|
315
|
+
appId,
|
|
316
|
+
apiKey,
|
|
317
|
+
region,
|
|
318
|
+
timeouts: {
|
|
319
|
+
connect: DEFAULT_CONNECT_TIMEOUT_NODE,
|
|
320
|
+
read: DEFAULT_READ_TIMEOUT_NODE,
|
|
321
|
+
write: DEFAULT_WRITE_TIMEOUT_NODE,
|
|
322
|
+
},
|
|
323
|
+
requester: createHttpRequester(),
|
|
324
|
+
algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],
|
|
325
|
+
responsesCache: createNullCache(),
|
|
326
|
+
requestsCache: createNullCache(),
|
|
327
|
+
hostsCache: createMemoryCache(),
|
|
328
|
+
...options,
|
|
329
|
+
});
|
|
322
330
|
}
|
|
323
331
|
|
|
324
332
|
export { abtestingClient, apiClientVersion };
|