@algolia/client-abtesting 5.3.1 → 5.4.0

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.
@@ -0,0 +1,402 @@
1
+ // builds/fetch.ts
2
+ import {
3
+ createMemoryCache,
4
+ createNullCache,
5
+ DEFAULT_CONNECT_TIMEOUT_NODE,
6
+ DEFAULT_READ_TIMEOUT_NODE,
7
+ DEFAULT_WRITE_TIMEOUT_NODE
8
+ } from "@algolia/client-common";
9
+ import { createFetchRequester } from "@algolia/requester-fetch";
10
+
11
+ // src/abtestingClient.ts
12
+ import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
13
+ var apiClientVersion = "5.4.0";
14
+ var REGIONS = ["de", "us"];
15
+ function getDefaultHosts(region) {
16
+ const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
17
+ return [{ url, accept: "readWrite", protocol: "https" }];
18
+ }
19
+ function createAbtestingClient({
20
+ appId: appIdOption,
21
+ apiKey: apiKeyOption,
22
+ authMode,
23
+ algoliaAgents,
24
+ region: regionOption,
25
+ ...options
26
+ }) {
27
+ const auth = createAuth(appIdOption, apiKeyOption, authMode);
28
+ const transporter = createTransporter({
29
+ hosts: getDefaultHosts(regionOption),
30
+ ...options,
31
+ algoliaAgent: getAlgoliaAgent({
32
+ algoliaAgents,
33
+ client: "Abtesting",
34
+ version: apiClientVersion
35
+ }),
36
+ baseHeaders: {
37
+ "content-type": "text/plain",
38
+ ...auth.headers(),
39
+ ...options.baseHeaders
40
+ },
41
+ baseQueryParameters: {
42
+ ...auth.queryParameters(),
43
+ ...options.baseQueryParameters
44
+ }
45
+ });
46
+ return {
47
+ transporter,
48
+ /**
49
+ * The `appId` currently in use.
50
+ */
51
+ appId: appIdOption,
52
+ /**
53
+ * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
54
+ */
55
+ clearCache() {
56
+ return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
57
+ },
58
+ /**
59
+ * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
60
+ */
61
+ get _ua() {
62
+ return transporter.algoliaAgent.value;
63
+ },
64
+ /**
65
+ * Adds a `segment` to the `x-algolia-agent` sent with every requests.
66
+ *
67
+ * @param segment - The algolia agent (user-agent) segment to add.
68
+ * @param version - The version of the agent.
69
+ */
70
+ addAlgoliaAgent(segment, version) {
71
+ transporter.algoliaAgent.add({ segment, version });
72
+ },
73
+ /**
74
+ * Helper method to switch the API key used to authenticate the requests.
75
+ *
76
+ * @param params - Method params.
77
+ * @param params.apiKey - The new API Key to use.
78
+ */
79
+ setClientApiKey({ apiKey }) {
80
+ if (!authMode || authMode === "WithinHeaders") {
81
+ transporter.baseHeaders["x-algolia-api-key"] = apiKey;
82
+ } else {
83
+ transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
84
+ }
85
+ },
86
+ /**
87
+ * Creates a new A/B test.
88
+ *
89
+ * Required API Key ACLs:
90
+ * - editSettings.
91
+ *
92
+ * @param addABTestsRequest - The addABTestsRequest object.
93
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
94
+ */
95
+ addABTests(addABTestsRequest, requestOptions) {
96
+ if (!addABTestsRequest) {
97
+ throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");
98
+ }
99
+ if (!addABTestsRequest.name) {
100
+ throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");
101
+ }
102
+ if (!addABTestsRequest.variants) {
103
+ throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");
104
+ }
105
+ if (!addABTestsRequest.endAt) {
106
+ throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");
107
+ }
108
+ const requestPath = "/2/abtests";
109
+ const headers = {};
110
+ const queryParameters = {};
111
+ const request = {
112
+ method: "POST",
113
+ path: requestPath,
114
+ queryParameters,
115
+ headers,
116
+ data: addABTestsRequest
117
+ };
118
+ return transporter.request(request, requestOptions);
119
+ },
120
+ /**
121
+ * This method allow you to send requests to the Algolia REST API.
122
+ *
123
+ * @param customDelete - The customDelete object.
124
+ * @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
125
+ * @param customDelete.parameters - Query parameters to apply to the current query.
126
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
127
+ */
128
+ customDelete({ path, parameters }, requestOptions) {
129
+ if (!path) {
130
+ throw new Error("Parameter `path` is required when calling `customDelete`.");
131
+ }
132
+ const requestPath = "/{path}".replace("{path}", path);
133
+ const headers = {};
134
+ const queryParameters = parameters ? parameters : {};
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
+ * @param customGet - The customGet object.
147
+ * @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
148
+ * @param customGet.parameters - Query parameters to apply to the current query.
149
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
150
+ */
151
+ customGet({ path, parameters }, requestOptions) {
152
+ if (!path) {
153
+ throw new Error("Parameter `path` is required when calling `customGet`.");
154
+ }
155
+ const requestPath = "/{path}".replace("{path}", path);
156
+ const headers = {};
157
+ const queryParameters = parameters ? parameters : {};
158
+ const request = {
159
+ method: "GET",
160
+ path: requestPath,
161
+ queryParameters,
162
+ headers
163
+ };
164
+ return transporter.request(request, requestOptions);
165
+ },
166
+ /**
167
+ * This method allow you to send requests to the Algolia REST API.
168
+ *
169
+ * @param customPost - The customPost object.
170
+ * @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
171
+ * @param customPost.parameters - Query parameters to apply to the current query.
172
+ * @param customPost.body - Parameters to send with the custom request.
173
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
174
+ */
175
+ customPost({ path, parameters, body }, requestOptions) {
176
+ if (!path) {
177
+ throw new Error("Parameter `path` is required when calling `customPost`.");
178
+ }
179
+ const requestPath = "/{path}".replace("{path}", path);
180
+ const headers = {};
181
+ const queryParameters = parameters ? parameters : {};
182
+ const request = {
183
+ method: "POST",
184
+ path: requestPath,
185
+ queryParameters,
186
+ headers,
187
+ data: body ? body : {}
188
+ };
189
+ return transporter.request(request, requestOptions);
190
+ },
191
+ /**
192
+ * This method allow you to send requests to the Algolia REST API.
193
+ *
194
+ * @param customPut - The customPut object.
195
+ * @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
196
+ * @param customPut.parameters - Query parameters to apply to the current query.
197
+ * @param customPut.body - Parameters to send with the custom request.
198
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
199
+ */
200
+ customPut({ path, parameters, body }, requestOptions) {
201
+ if (!path) {
202
+ throw new Error("Parameter `path` is required when calling `customPut`.");
203
+ }
204
+ const requestPath = "/{path}".replace("{path}", path);
205
+ const headers = {};
206
+ const queryParameters = parameters ? parameters : {};
207
+ const request = {
208
+ method: "PUT",
209
+ path: requestPath,
210
+ queryParameters,
211
+ headers,
212
+ data: body ? body : {}
213
+ };
214
+ return transporter.request(request, requestOptions);
215
+ },
216
+ /**
217
+ * Deletes an A/B test by its ID.
218
+ *
219
+ * Required API Key ACLs:
220
+ * - editSettings.
221
+ *
222
+ * @param deleteABTest - The deleteABTest object.
223
+ * @param deleteABTest.id - Unique A/B test identifier.
224
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
225
+ */
226
+ deleteABTest({ id }, requestOptions) {
227
+ if (!id) {
228
+ throw new Error("Parameter `id` is required when calling `deleteABTest`.");
229
+ }
230
+ const requestPath = "/2/abtests/{id}".replace("{id}", encodeURIComponent(id));
231
+ const headers = {};
232
+ const queryParameters = {};
233
+ const request = {
234
+ method: "DELETE",
235
+ path: requestPath,
236
+ queryParameters,
237
+ headers
238
+ };
239
+ return transporter.request(request, requestOptions);
240
+ },
241
+ /**
242
+ * Retrieves the details for an A/B test by its ID.
243
+ *
244
+ * Required API Key ACLs:
245
+ * - analytics.
246
+ *
247
+ * @param getABTest - The getABTest object.
248
+ * @param getABTest.id - Unique A/B test identifier.
249
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
250
+ */
251
+ getABTest({ id }, requestOptions) {
252
+ if (!id) {
253
+ throw new Error("Parameter `id` is required when calling `getABTest`.");
254
+ }
255
+ const requestPath = "/2/abtests/{id}".replace("{id}", encodeURIComponent(id));
256
+ const headers = {};
257
+ const queryParameters = {};
258
+ const request = {
259
+ method: "GET",
260
+ path: requestPath,
261
+ queryParameters,
262
+ headers
263
+ };
264
+ return transporter.request(request, requestOptions);
265
+ },
266
+ /**
267
+ * Lists all A/B tests you configured for this application.
268
+ *
269
+ * Required API Key ACLs:
270
+ * - analytics.
271
+ *
272
+ * @param listABTests - The listABTests object.
273
+ * @param listABTests.offset - Position of the first item to return.
274
+ * @param listABTests.limit - Number of items to return.
275
+ * @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
276
+ * @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
277
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
278
+ */
279
+ listABTests({ offset, limit, indexPrefix, indexSuffix } = {}, requestOptions = void 0) {
280
+ const requestPath = "/2/abtests";
281
+ const headers = {};
282
+ const queryParameters = {};
283
+ if (offset !== void 0) {
284
+ queryParameters.offset = offset.toString();
285
+ }
286
+ if (limit !== void 0) {
287
+ queryParameters.limit = limit.toString();
288
+ }
289
+ if (indexPrefix !== void 0) {
290
+ queryParameters.indexPrefix = indexPrefix.toString();
291
+ }
292
+ if (indexSuffix !== void 0) {
293
+ queryParameters.indexSuffix = indexSuffix.toString();
294
+ }
295
+ const request = {
296
+ method: "GET",
297
+ path: requestPath,
298
+ queryParameters,
299
+ headers
300
+ };
301
+ return transporter.request(request, requestOptions);
302
+ },
303
+ /**
304
+ * Schedule an A/B test to be started at a later time.
305
+ *
306
+ * Required API Key ACLs:
307
+ * - editSettings.
308
+ *
309
+ * @param scheduleABTestsRequest - The scheduleABTestsRequest object.
310
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
311
+ */
312
+ scheduleABTest(scheduleABTestsRequest, requestOptions) {
313
+ if (!scheduleABTestsRequest) {
314
+ throw new Error("Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.");
315
+ }
316
+ if (!scheduleABTestsRequest.name) {
317
+ throw new Error("Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.");
318
+ }
319
+ if (!scheduleABTestsRequest.variants) {
320
+ throw new Error("Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.");
321
+ }
322
+ if (!scheduleABTestsRequest.scheduledAt) {
323
+ throw new Error("Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.");
324
+ }
325
+ if (!scheduleABTestsRequest.endAt) {
326
+ throw new Error("Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.");
327
+ }
328
+ const requestPath = "/2/abtests/schedule";
329
+ const headers = {};
330
+ const queryParameters = {};
331
+ const request = {
332
+ method: "POST",
333
+ path: requestPath,
334
+ queryParameters,
335
+ headers,
336
+ data: scheduleABTestsRequest
337
+ };
338
+ return transporter.request(request, requestOptions);
339
+ },
340
+ /**
341
+ * Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
342
+ *
343
+ * Required API Key ACLs:
344
+ * - editSettings.
345
+ *
346
+ * @param stopABTest - The stopABTest object.
347
+ * @param stopABTest.id - Unique A/B test identifier.
348
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
349
+ */
350
+ stopABTest({ id }, requestOptions) {
351
+ if (!id) {
352
+ throw new Error("Parameter `id` is required when calling `stopABTest`.");
353
+ }
354
+ const requestPath = "/2/abtests/{id}/stop".replace("{id}", encodeURIComponent(id));
355
+ const headers = {};
356
+ const queryParameters = {};
357
+ const request = {
358
+ method: "POST",
359
+ path: requestPath,
360
+ queryParameters,
361
+ headers
362
+ };
363
+ return transporter.request(request, requestOptions);
364
+ }
365
+ };
366
+ }
367
+
368
+ // builds/fetch.ts
369
+ function abtestingClient(appId, apiKey, region, options) {
370
+ if (!appId || typeof appId !== "string") {
371
+ throw new Error("`appId` is missing.");
372
+ }
373
+ if (!apiKey || typeof apiKey !== "string") {
374
+ throw new Error("`apiKey` is missing.");
375
+ }
376
+ if (region && (typeof region !== "string" || !REGIONS.includes(region))) {
377
+ throw new Error(`\`region\` must be one of the following: ${REGIONS.join(", ")}`);
378
+ }
379
+ return {
380
+ ...createAbtestingClient({
381
+ appId,
382
+ apiKey,
383
+ region,
384
+ timeouts: {
385
+ connect: DEFAULT_CONNECT_TIMEOUT_NODE,
386
+ read: DEFAULT_READ_TIMEOUT_NODE,
387
+ write: DEFAULT_WRITE_TIMEOUT_NODE
388
+ },
389
+ algoliaAgents: [{ segment: "Fetch" }],
390
+ requester: createFetchRequester(),
391
+ responsesCache: createNullCache(),
392
+ requestsCache: createNullCache(),
393
+ hostsCache: createMemoryCache(),
394
+ ...options
395
+ })
396
+ };
397
+ }
398
+ export {
399
+ abtestingClient,
400
+ apiClientVersion
401
+ };
402
+ //# sourceMappingURL=fetch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../builds/fetch.ts","../../src/abtestingClient.ts"],"sourcesContent":["// 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.\n\nimport type { ClientOptions } from '@algolia/client-common';\nimport {\n createMemoryCache,\n createNullCache,\n DEFAULT_CONNECT_TIMEOUT_NODE,\n DEFAULT_READ_TIMEOUT_NODE,\n DEFAULT_WRITE_TIMEOUT_NODE,\n} from '@algolia/client-common';\nimport { createFetchRequester } from '@algolia/requester-fetch';\n\nimport type { Region } from '../src/abtestingClient';\nimport { createAbtestingClient, REGIONS } from '../src/abtestingClient';\n\nexport type AbtestingClient = ReturnType<typeof createAbtestingClient>;\n\nexport { apiClientVersion, Region } from '../src/abtestingClient';\nexport * from '../model';\n\nexport function abtestingClient(\n appId: string,\n apiKey: string,\n region?: Region,\n options?: ClientOptions,\n): AbtestingClient {\n if (!appId || typeof appId !== 'string') {\n throw new Error('`appId` is missing.');\n }\n\n if (!apiKey || typeof apiKey !== 'string') {\n throw new Error('`apiKey` is missing.');\n }\n\n if (region && (typeof region !== 'string' || !REGIONS.includes(region))) {\n throw new Error(`\\`region\\` must be one of the following: ${REGIONS.join(', ')}`);\n }\n\n return {\n ...createAbtestingClient({\n appId,\n apiKey,\n region,\n timeouts: {\n connect: DEFAULT_CONNECT_TIMEOUT_NODE,\n read: DEFAULT_READ_TIMEOUT_NODE,\n write: DEFAULT_WRITE_TIMEOUT_NODE,\n },\n algoliaAgents: [{ segment: 'Fetch' }],\n requester: createFetchRequester(),\n responsesCache: createNullCache(),\n requestsCache: createNullCache(),\n hostsCache: createMemoryCache(),\n ...options,\n }),\n };\n}\n","// 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.\n\nimport { createAuth, createTransporter, getAlgoliaAgent } from '@algolia/client-common';\nimport type {\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n} from '@algolia/client-common';\n\nimport type { ABTest } from '../model/aBTest';\nimport type { ABTestResponse } from '../model/aBTestResponse';\nimport type { AddABTestsRequest } from '../model/addABTestsRequest';\nimport type {\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteABTestProps,\n GetABTestProps,\n ListABTestsProps,\n StopABTestProps,\n} from '../model/clientMethodProps';\nimport type { ListABTestsResponse } from '../model/listABTestsResponse';\nimport type { ScheduleABTestResponse } from '../model/scheduleABTestResponse';\nimport type { ScheduleABTestsRequest } from '../model/scheduleABTestsRequest';\n\nexport const apiClientVersion = '5.4.0';\n\nexport const REGIONS = ['de', 'us'] as const;\nexport type Region = (typeof REGIONS)[number];\n\nfunction getDefaultHosts(region?: Region): Host[] {\n const url = !region ? 'analytics.algolia.com' : 'analytics.{region}.algolia.com'.replace('{region}', region);\n\n return [{ url, accept: 'readWrite', protocol: 'https' }];\n}\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function createAbtestingClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n region: regionOption,\n ...options\n}: CreateClientOptions & { region?: Region }) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n const transporter = createTransporter({\n hosts: getDefaultHosts(regionOption),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'Abtesting',\n version: apiClientVersion,\n }),\n baseHeaders: {\n 'content-type': 'text/plain',\n ...auth.headers(),\n ...options.baseHeaders,\n },\n baseQueryParameters: {\n ...auth.queryParameters(),\n ...options.baseQueryParameters,\n },\n });\n\n return {\n transporter,\n\n /**\n * The `appId` currently in use.\n */\n appId: appIdOption,\n\n /**\n * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string): void {\n transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * Helper method to switch the API key used to authenticate the requests.\n *\n * @param params - Method params.\n * @param params.apiKey - The new API Key to use.\n */\n setClientApiKey({ apiKey }: { apiKey: string }): void {\n if (!authMode || authMode === 'WithinHeaders') {\n transporter.baseHeaders['x-algolia-api-key'] = apiKey;\n } else {\n transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;\n }\n },\n\n /**\n * Creates a new A/B test.\n *\n * Required API Key ACLs:\n * - editSettings.\n *\n * @param addABTestsRequest - The addABTestsRequest object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n addABTests(addABTestsRequest: AddABTestsRequest, requestOptions?: RequestOptions): Promise<ABTestResponse> {\n if (!addABTestsRequest) {\n throw new Error('Parameter `addABTestsRequest` is required when calling `addABTests`.');\n }\n\n if (!addABTestsRequest.name) {\n throw new Error('Parameter `addABTestsRequest.name` is required when calling `addABTests`.');\n }\n if (!addABTestsRequest.variants) {\n throw new Error('Parameter `addABTestsRequest.variants` is required when calling `addABTests`.');\n }\n if (!addABTestsRequest.endAt) {\n throw new Error('Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.');\n }\n\n const requestPath = '/2/abtests';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: addABTestsRequest,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customDelete`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customGet`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPost`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPut`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Deletes an A/B test by its ID.\n *\n * Required API Key ACLs:\n * - editSettings.\n *\n * @param deleteABTest - The deleteABTest object.\n * @param deleteABTest.id - Unique A/B test identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteABTest({ id }: DeleteABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse> {\n if (!id) {\n throw new Error('Parameter `id` is required when calling `deleteABTest`.');\n }\n\n const requestPath = '/2/abtests/{id}'.replace('{id}', encodeURIComponent(id));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves the details for an A/B test by its ID.\n *\n * Required API Key ACLs:\n * - analytics.\n *\n * @param getABTest - The getABTest object.\n * @param getABTest.id - Unique A/B test identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getABTest({ id }: GetABTestProps, requestOptions?: RequestOptions): Promise<ABTest> {\n if (!id) {\n throw new Error('Parameter `id` is required when calling `getABTest`.');\n }\n\n const requestPath = '/2/abtests/{id}'.replace('{id}', encodeURIComponent(id));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Lists all A/B tests you configured for this application.\n *\n * Required API Key ACLs:\n * - analytics.\n *\n * @param listABTests - The listABTests object.\n * @param listABTests.offset - Position of the first item to return.\n * @param listABTests.limit - Number of items to return.\n * @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.\n * @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n listABTests(\n { offset, limit, indexPrefix, indexSuffix }: ListABTestsProps = {},\n requestOptions: RequestOptions | undefined = undefined,\n ): Promise<ListABTestsResponse> {\n const requestPath = '/2/abtests';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n if (offset !== undefined) {\n queryParameters.offset = offset.toString();\n }\n if (limit !== undefined) {\n queryParameters.limit = limit.toString();\n }\n\n if (indexPrefix !== undefined) {\n queryParameters.indexPrefix = indexPrefix.toString();\n }\n if (indexSuffix !== undefined) {\n queryParameters.indexSuffix = indexSuffix.toString();\n }\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Schedule an A/B test to be started at a later time.\n *\n * Required API Key ACLs:\n * - editSettings.\n *\n * @param scheduleABTestsRequest - The scheduleABTestsRequest object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n scheduleABTest(\n scheduleABTestsRequest: ScheduleABTestsRequest,\n requestOptions?: RequestOptions,\n ): Promise<ScheduleABTestResponse> {\n if (!scheduleABTestsRequest) {\n throw new Error('Parameter `scheduleABTestsRequest` is required when calling `scheduleABTest`.');\n }\n\n if (!scheduleABTestsRequest.name) {\n throw new Error('Parameter `scheduleABTestsRequest.name` is required when calling `scheduleABTest`.');\n }\n if (!scheduleABTestsRequest.variants) {\n throw new Error('Parameter `scheduleABTestsRequest.variants` is required when calling `scheduleABTest`.');\n }\n if (!scheduleABTestsRequest.scheduledAt) {\n throw new Error('Parameter `scheduleABTestsRequest.scheduledAt` is required when calling `scheduleABTest`.');\n }\n if (!scheduleABTestsRequest.endAt) {\n throw new Error('Parameter `scheduleABTestsRequest.endAt` is required when calling `scheduleABTest`.');\n }\n\n const requestPath = '/2/abtests/schedule';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: scheduleABTestsRequest,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Stops an A/B test by its ID. You can\\'t restart stopped A/B tests.\n *\n * Required API Key ACLs:\n * - editSettings.\n *\n * @param stopABTest - The stopABTest object.\n * @param stopABTest.id - Unique A/B test identifier.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n stopABTest({ id }: StopABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse> {\n if (!id) {\n throw new Error('Parameter `id` is required when calling `stopABTest`.');\n }\n\n const requestPath = '/2/abtests/{id}/stop'.replace('{id}', encodeURIComponent(id));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n };\n}\n"],"mappings":";AAGA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,4BAA4B;;;ACRrC,SAAS,YAAY,mBAAmB,uBAAuB;AA2BxD,IAAM,mBAAmB;AAEzB,IAAM,UAAU,CAAC,MAAM,IAAI;AAGlC,SAAS,gBAAgB,QAAyB;AAChD,QAAM,MAAM,CAAC,SAAS,0BAA0B,iCAAiC,QAAQ,YAAY,MAAM;AAE3G,SAAO,CAAC,EAAE,KAAK,QAAQ,aAAa,UAAU,QAAQ,CAAC;AACzD;AAGO,SAAS,sBAAsB;AAAA,EACpC,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,GAAG;AACL,GAA8C;AAC5C,QAAM,OAAO,WAAW,aAAa,cAAc,QAAQ;AAC3D,QAAM,cAAc,kBAAkB;AAAA,IACpC,OAAO,gBAAgB,YAAY;AAAA,IACnC,GAAG;AAAA,IACH,cAAc,gBAAgB;AAAA,MAC5B;AAAA,MACA,QAAQ;AAAA,M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AAS,MAAM,IAAI;AACvE,UAAM,IAAI,MAAM,4CAA4C,QAAQ,KAAK,IAAI,CAAC,EAAE;AAAA,EAClF;AAEA,SAAO;AAAA,IACL,GAAG,sBAAsB;AAAA,MACvB;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU;AAAA,QACR,SAAS;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,MACA,eAAe,CAAC,EAAE,SAAS,QAAQ,CAAC;AAAA,MACpC,WAAW,qBAAqB;AAAA,MAChC,gBAAgB,gBAAgB;AAAA,MAChC,eAAe,gBAAgB;AAAA,MAC/B,YAAY,kBAAkB;AAAA,MAC9B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;","names":[]}
@@ -29,7 +29,7 @@ var import_requester_node_http = require("@algolia/requester-node-http");
29
29
 
30
30
  // src/abtestingClient.ts
31
31
  var import_client_common = require("@algolia/client-common");
32
- var apiClientVersion = "5.3.1";
32
+ var apiClientVersion = "5.4.0";
33
33
  var REGIONS = ["de", "us"];
34
34
  function getDefaultHosts(region) {
35
35
  const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
@@ -44,25 +44,26 @@ function createAbtestingClient({
44
44
  ...options
45
45
  }) {
46
46
  const auth = (0, import_client_common.createAuth)(appIdOption, apiKeyOption, authMode);
47
- return {
48
- transporter: (0, import_client_common.createTransporter)({
49
- hosts: getDefaultHosts(regionOption),
50
- ...options,
51
- algoliaAgent: (0, import_client_common.getAlgoliaAgent)({
52
- algoliaAgents,
53
- client: "Abtesting",
54
- version: apiClientVersion
55
- }),
56
- baseHeaders: {
57
- "content-type": "text/plain",
58
- ...auth.headers(),
59
- ...options.baseHeaders
60
- },
61
- baseQueryParameters: {
62
- ...auth.queryParameters(),
63
- ...options.baseQueryParameters
64
- }
47
+ const transporter = (0, import_client_common.createTransporter)({
48
+ hosts: getDefaultHosts(regionOption),
49
+ ...options,
50
+ algoliaAgent: (0, import_client_common.getAlgoliaAgent)({
51
+ algoliaAgents,
52
+ client: "Abtesting",
53
+ version: apiClientVersion
65
54
  }),
55
+ baseHeaders: {
56
+ "content-type": "text/plain",
57
+ ...auth.headers(),
58
+ ...options.baseHeaders
59
+ },
60
+ baseQueryParameters: {
61
+ ...auth.queryParameters(),
62
+ ...options.baseQueryParameters
63
+ }
64
+ });
65
+ return {
66
+ transporter,
66
67
  /**
67
68
  * The `appId` currently in use.
68
69
  */
@@ -71,15 +72,13 @@ function createAbtestingClient({
71
72
  * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
72
73
  */
73
74
  clearCache() {
74
- return Promise.all([this.transporter.requestsCache.clear(), this.transporter.responsesCache.clear()]).then(
75
- () => void 0
76
- );
75
+ return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
77
76
  },
78
77
  /**
79
78
  * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
80
79
  */
81
80
  get _ua() {
82
- return this.transporter.algoliaAgent.value;
81
+ return transporter.algoliaAgent.value;
83
82
  },
84
83
  /**
85
84
  * Adds a `segment` to the `x-algolia-agent` sent with every requests.
@@ -88,7 +87,7 @@ function createAbtestingClient({
88
87
  * @param version - The version of the agent.
89
88
  */
90
89
  addAlgoliaAgent(segment, version) {
91
- this.transporter.algoliaAgent.add({ segment, version });
90
+ transporter.algoliaAgent.add({ segment, version });
92
91
  },
93
92
  /**
94
93
  * Helper method to switch the API key used to authenticate the requests.
@@ -98,9 +97,9 @@ function createAbtestingClient({
98
97
  */
99
98
  setClientApiKey({ apiKey }) {
100
99
  if (!authMode || authMode === "WithinHeaders") {
101
- this.transporter.baseHeaders["x-algolia-api-key"] = apiKey;
100
+ transporter.baseHeaders["x-algolia-api-key"] = apiKey;
102
101
  } else {
103
- this.transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
102
+ transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
104
103
  }
105
104
  },
106
105
  /**
@@ -135,7 +134,7 @@ function createAbtestingClient({
135
134
  headers,
136
135
  data: addABTestsRequest
137
136
  };
138
- return this.transporter.request(request, requestOptions);
137
+ return transporter.request(request, requestOptions);
139
138
  },
140
139
  /**
141
140
  * This method allow you to send requests to the Algolia REST API.
@@ -158,7 +157,7 @@ function createAbtestingClient({
158
157
  queryParameters,
159
158
  headers
160
159
  };
161
- return this.transporter.request(request, requestOptions);
160
+ return transporter.request(request, requestOptions);
162
161
  },
163
162
  /**
164
163
  * This method allow you to send requests to the Algolia REST API.
@@ -181,7 +180,7 @@ function createAbtestingClient({
181
180
  queryParameters,
182
181
  headers
183
182
  };
184
- return this.transporter.request(request, requestOptions);
183
+ return transporter.request(request, requestOptions);
185
184
  },
186
185
  /**
187
186
  * This method allow you to send requests to the Algolia REST API.
@@ -206,7 +205,7 @@ function createAbtestingClient({
206
205
  headers,
207
206
  data: body ? body : {}
208
207
  };
209
- return this.transporter.request(request, requestOptions);
208
+ return transporter.request(request, requestOptions);
210
209
  },
211
210
  /**
212
211
  * This method allow you to send requests to the Algolia REST API.
@@ -231,7 +230,7 @@ function createAbtestingClient({
231
230
  headers,
232
231
  data: body ? body : {}
233
232
  };
234
- return this.transporter.request(request, requestOptions);
233
+ return transporter.request(request, requestOptions);
235
234
  },
236
235
  /**
237
236
  * Deletes an A/B test by its ID.
@@ -256,7 +255,7 @@ function createAbtestingClient({
256
255
  queryParameters,
257
256
  headers
258
257
  };
259
- return this.transporter.request(request, requestOptions);
258
+ return transporter.request(request, requestOptions);
260
259
  },
261
260
  /**
262
261
  * Retrieves the details for an A/B test by its ID.
@@ -281,7 +280,7 @@ function createAbtestingClient({
281
280
  queryParameters,
282
281
  headers
283
282
  };
284
- return this.transporter.request(request, requestOptions);
283
+ return transporter.request(request, requestOptions);
285
284
  },
286
285
  /**
287
286
  * Lists all A/B tests you configured for this application.
@@ -318,7 +317,7 @@ function createAbtestingClient({
318
317
  queryParameters,
319
318
  headers
320
319
  };
321
- return this.transporter.request(request, requestOptions);
320
+ return transporter.request(request, requestOptions);
322
321
  },
323
322
  /**
324
323
  * Schedule an A/B test to be started at a later time.
@@ -355,7 +354,7 @@ function createAbtestingClient({
355
354
  headers,
356
355
  data: scheduleABTestsRequest
357
356
  };
358
- return this.transporter.request(request, requestOptions);
357
+ return transporter.request(request, requestOptions);
359
358
  },
360
359
  /**
361
360
  * Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
@@ -380,7 +379,7 @@ function createAbtestingClient({
380
379
  queryParameters,
381
380
  headers
382
381
  };
383
- return this.transporter.request(request, requestOptions);
382
+ return transporter.request(request, requestOptions);
384
383
  }
385
384
  };
386
385
  }