@algolia/client-abtesting 5.0.0-alpha.91 → 5.0.0-alpha.98

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.
@@ -4,7 +4,7 @@ var clientCommon = require('@algolia/client-common');
4
4
  var requesterNodeHttp = require('@algolia/requester-node-http');
5
5
 
6
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';
7
+ const apiClientVersion = '5.0.0-alpha.98';
8
8
  const REGIONS = ['de', 'us'];
9
9
  function getDefaultHosts(region) {
10
10
  const url = !region
@@ -99,14 +99,14 @@ function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authM
99
99
  * This method allow you to send requests to the Algolia REST API.
100
100
  *
101
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.
102
+ * @param customDelete - The customDelete object.
103
+ * @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
104
+ * @param customDelete.parameters - Query parameters to apply to the current query.
105
105
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
106
106
  */
107
- del({ path, parameters }, requestOptions) {
107
+ customDelete({ path, parameters }, requestOptions) {
108
108
  if (!path) {
109
- throw new Error('Parameter `path` is required when calling `del`.');
109
+ throw new Error('Parameter `path` is required when calling `customDelete`.');
110
110
  }
111
111
  const requestPath = '/1{path}'.replace('{path}', path);
112
112
  const headers = {};
@@ -120,22 +120,23 @@ function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authM
120
120
  return transporter.request(request, requestOptions);
121
121
  },
122
122
  /**
123
- * Delete an A/B test. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests).
123
+ * This method allow you to send requests to the Algolia REST API.
124
124
  *
125
- * @summary Delete an A/B test.
126
- * @param deleteABTest - The deleteABTest object.
127
- * @param deleteABTest.id - Unique A/B test ID.
125
+ * @summary Send requests to the Algolia REST API.
126
+ * @param customGet - The customGet object.
127
+ * @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
128
+ * @param customGet.parameters - Query parameters to apply to the current query.
128
129
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
129
130
  */
130
- deleteABTest({ id }, requestOptions) {
131
- if (!id) {
132
- throw new Error('Parameter `id` is required when calling `deleteABTest`.');
131
+ customGet({ path, parameters }, requestOptions) {
132
+ if (!path) {
133
+ throw new Error('Parameter `path` is required when calling `customGet`.');
133
134
  }
134
- const requestPath = '/2/abtests/{id}'.replace('{id}', encodeURIComponent(id));
135
+ const requestPath = '/1{path}'.replace('{path}', path);
135
136
  const headers = {};
136
- const queryParameters = {};
137
+ const queryParameters = parameters ? parameters : {};
137
138
  const request = {
138
- method: 'DELETE',
139
+ method: 'GET',
139
140
  path: requestPath,
140
141
  queryParameters,
141
142
  headers,
@@ -146,20 +147,71 @@ function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authM
146
147
  * This method allow you to send requests to the Algolia REST API.
147
148
  *
148
149
  * @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.
150
+ * @param customPost - The customPost object.
151
+ * @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
152
+ * @param customPost.parameters - Query parameters to apply to the current query.
153
+ * @param customPost.body - Parameters to send with the custom request.
152
154
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
153
155
  */
154
- get({ path, parameters }, requestOptions) {
156
+ customPost({ path, parameters, body }, requestOptions) {
155
157
  if (!path) {
156
- throw new Error('Parameter `path` is required when calling `get`.');
158
+ throw new Error('Parameter `path` is required when calling `customPost`.');
157
159
  }
158
160
  const requestPath = '/1{path}'.replace('{path}', path);
159
161
  const headers = {};
160
162
  const queryParameters = parameters ? parameters : {};
161
163
  const request = {
162
- method: 'GET',
164
+ method: 'POST',
165
+ path: requestPath,
166
+ queryParameters,
167
+ headers,
168
+ data: body ? body : {},
169
+ };
170
+ return transporter.request(request, requestOptions);
171
+ },
172
+ /**
173
+ * This method allow you to send requests to the Algolia REST API.
174
+ *
175
+ * @summary Send requests to the Algolia REST API.
176
+ * @param customPut - The customPut object.
177
+ * @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
178
+ * @param customPut.parameters - Query parameters to apply to the current query.
179
+ * @param customPut.body - Parameters to send with the custom request.
180
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
181
+ */
182
+ customPut({ path, parameters, body }, requestOptions) {
183
+ if (!path) {
184
+ throw new Error('Parameter `path` is required when calling `customPut`.');
185
+ }
186
+ const requestPath = '/1{path}'.replace('{path}', path);
187
+ const headers = {};
188
+ const queryParameters = parameters ? parameters : {};
189
+ const request = {
190
+ method: 'PUT',
191
+ path: requestPath,
192
+ queryParameters,
193
+ headers,
194
+ data: body ? body : {},
195
+ };
196
+ return transporter.request(request, requestOptions);
197
+ },
198
+ /**
199
+ * Delete an A/B test. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests).
200
+ *
201
+ * @summary Delete an A/B test.
202
+ * @param deleteABTest - The deleteABTest object.
203
+ * @param deleteABTest.id - Unique A/B test ID.
204
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
205
+ */
206
+ deleteABTest({ id }, requestOptions) {
207
+ if (!id) {
208
+ throw new Error('Parameter `id` is required when calling `deleteABTest`.');
209
+ }
210
+ const requestPath = '/2/abtests/{id}'.replace('{id}', encodeURIComponent(id));
211
+ const headers = {};
212
+ const queryParameters = {};
213
+ const request = {
214
+ method: 'DELETE',
163
215
  path: requestPath,
164
216
  queryParameters,
165
217
  headers,
@@ -224,58 +276,6 @@ function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authM
224
276
  };
225
277
  return transporter.request(request, requestOptions);
226
278
  },
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
279
  /**
280
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
281
  *
@@ -26,14 +26,35 @@ function createBrowserLocalStorageCache(options) {
26
26
  function getNamespace() {
27
27
  return JSON.parse(getStorage().getItem(namespaceKey) || '{}');
28
28
  }
29
+ function setNamespace(namespace) {
30
+ getStorage().setItem(namespaceKey, JSON.stringify(namespace));
31
+ }
32
+ function removeOutdatedCacheItems() {
33
+ const timeToLive = options.timeToLive ? options.timeToLive * 1000 : null;
34
+ const namespace = getNamespace();
35
+ const filteredNamespaceWithoutOldFormattedCacheItems = Object.fromEntries(Object.entries(namespace).filter(([, cacheItem]) => {
36
+ return cacheItem.timestamp !== undefined;
37
+ }));
38
+ setNamespace(filteredNamespaceWithoutOldFormattedCacheItems);
39
+ if (!timeToLive) {
40
+ return;
41
+ }
42
+ const filteredNamespaceWithoutExpiredItems = Object.fromEntries(Object.entries(filteredNamespaceWithoutOldFormattedCacheItems).filter(([, cacheItem]) => {
43
+ const currentTimestamp = new Date().getTime();
44
+ const isExpired = cacheItem.timestamp + timeToLive < currentTimestamp;
45
+ return !isExpired;
46
+ }));
47
+ setNamespace(filteredNamespaceWithoutExpiredItems);
48
+ }
29
49
  return {
30
50
  get(key, defaultValue, events = {
31
51
  miss: () => Promise.resolve()
32
52
  }) {
33
53
  return Promise.resolve().then(() => {
34
- const keyAsString = JSON.stringify(key);
35
- const value = getNamespace()[keyAsString];
36
- return Promise.all([value || defaultValue(), value !== undefined]);
54
+ removeOutdatedCacheItems();
55
+ return getNamespace()[JSON.stringify(key)];
56
+ }).then(value => {
57
+ return Promise.all([value ? value.value : defaultValue(), value !== undefined]);
37
58
  }).then(([value, exists]) => {
38
59
  return Promise.all([value, exists || events.miss(value)]);
39
60
  }).then(([value]) => value);
@@ -41,7 +62,10 @@ function createBrowserLocalStorageCache(options) {
41
62
  set(key, value) {
42
63
  return Promise.resolve().then(() => {
43
64
  const namespace = getNamespace();
44
- namespace[JSON.stringify(key)] = value;
65
+ namespace[JSON.stringify(key)] = {
66
+ timestamp: new Date().getTime(),
67
+ value
68
+ };
45
69
  getStorage().setItem(namespaceKey, JSON.stringify(namespace));
46
70
  return value;
47
71
  });
@@ -171,6 +195,20 @@ function createStatefulHost(host, status = 'up') {
171
195
  };
172
196
  }
173
197
 
198
+ function _toPrimitive(t, r) {
199
+ if ("object" != typeof t || !t) return t;
200
+ var e = t[Symbol.toPrimitive];
201
+ if (void 0 !== e) {
202
+ var i = e.call(t, r || "default");
203
+ if ("object" != typeof i) return i;
204
+ throw new TypeError("@@toPrimitive must return a primitive value.");
205
+ }
206
+ return ("string" === r ? String : Number)(t);
207
+ }
208
+ function _toPropertyKey(t) {
209
+ var i = _toPrimitive(t, "string");
210
+ return "symbol" == typeof i ? i : String(i);
211
+ }
174
212
  function _defineProperty(obj, key, value) {
175
213
  key = _toPropertyKey(key);
176
214
  if (key in obj) {
@@ -185,20 +223,6 @@ function _defineProperty(obj, key, value) {
185
223
  }
186
224
  return obj;
187
225
  }
188
- function _toPrimitive(input, hint) {
189
- if (typeof input !== "object" || input === null) return input;
190
- var prim = input[Symbol.toPrimitive];
191
- if (prim !== undefined) {
192
- var res = prim.call(input, hint || "default");
193
- if (typeof res !== "object") return res;
194
- throw new TypeError("@@toPrimitive must return a primitive value.");
195
- }
196
- return (hint === "string" ? String : Number)(input);
197
- }
198
- function _toPropertyKey(arg) {
199
- var key = _toPrimitive(arg, "string");
200
- return typeof key === "symbol" ? key : String(key);
201
- }
202
226
 
203
227
  class AlgoliaError extends Error {
204
228
  constructor(message, name) {
@@ -219,7 +243,7 @@ class ErrorWithStackTrace extends AlgoliaError {
219
243
  }
220
244
  class RetryError extends ErrorWithStackTrace {
221
245
  constructor(stackTrace) {
222
- super('Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.', stackTrace, 'RetryError');
246
+ super('Unreachable hosts - your application id may be incorrect. If the error persists, please create a ticket at https://support.algolia.com/ sharing steps we can use to reproduce the issue.', stackTrace, 'RetryError');
223
247
  }
224
248
  }
225
249
  class ApiError extends ErrorWithStackTrace {
@@ -662,7 +686,7 @@ function createXhrRequester() {
662
686
  }
663
687
 
664
688
  // 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.
665
- const apiClientVersion = '5.0.0-alpha.91';
689
+ const apiClientVersion = '5.0.0-alpha.98';
666
690
  const REGIONS = ['de', 'us'];
667
691
  function getDefaultHosts(region) {
668
692
  const url = !region
@@ -757,14 +781,14 @@ function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authM
757
781
  * This method allow you to send requests to the Algolia REST API.
758
782
  *
759
783
  * @summary Send requests to the Algolia REST API.
760
- * @param del - The del object.
761
- * @param del.path - Path of the endpoint, anything after \"/1\" must be specified.
762
- * @param del.parameters - Query parameters to apply to the current query.
784
+ * @param customDelete - The customDelete object.
785
+ * @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
786
+ * @param customDelete.parameters - Query parameters to apply to the current query.
763
787
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
764
788
  */
765
- del({ path, parameters }, requestOptions) {
789
+ customDelete({ path, parameters }, requestOptions) {
766
790
  if (!path) {
767
- throw new Error('Parameter `path` is required when calling `del`.');
791
+ throw new Error('Parameter `path` is required when calling `customDelete`.');
768
792
  }
769
793
  const requestPath = '/1{path}'.replace('{path}', path);
770
794
  const headers = {};
@@ -778,22 +802,23 @@ function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authM
778
802
  return transporter.request(request, requestOptions);
779
803
  },
780
804
  /**
781
- * Delete an A/B test. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests).
805
+ * This method allow you to send requests to the Algolia REST API.
782
806
  *
783
- * @summary Delete an A/B test.
784
- * @param deleteABTest - The deleteABTest object.
785
- * @param deleteABTest.id - Unique A/B test ID.
807
+ * @summary Send requests to the Algolia REST API.
808
+ * @param customGet - The customGet object.
809
+ * @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
810
+ * @param customGet.parameters - Query parameters to apply to the current query.
786
811
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
787
812
  */
788
- deleteABTest({ id }, requestOptions) {
789
- if (!id) {
790
- throw new Error('Parameter `id` is required when calling `deleteABTest`.');
813
+ customGet({ path, parameters }, requestOptions) {
814
+ if (!path) {
815
+ throw new Error('Parameter `path` is required when calling `customGet`.');
791
816
  }
792
- const requestPath = '/2/abtests/{id}'.replace('{id}', encodeURIComponent(id));
817
+ const requestPath = '/1{path}'.replace('{path}', path);
793
818
  const headers = {};
794
- const queryParameters = {};
819
+ const queryParameters = parameters ? parameters : {};
795
820
  const request = {
796
- method: 'DELETE',
821
+ method: 'GET',
797
822
  path: requestPath,
798
823
  queryParameters,
799
824
  headers,
@@ -804,20 +829,71 @@ function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authM
804
829
  * This method allow you to send requests to the Algolia REST API.
805
830
  *
806
831
  * @summary Send requests to the Algolia REST API.
807
- * @param get - The get object.
808
- * @param get.path - Path of the endpoint, anything after \"/1\" must be specified.
809
- * @param get.parameters - Query parameters to apply to the current query.
832
+ * @param customPost - The customPost object.
833
+ * @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
834
+ * @param customPost.parameters - Query parameters to apply to the current query.
835
+ * @param customPost.body - Parameters to send with the custom request.
810
836
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
811
837
  */
812
- get({ path, parameters }, requestOptions) {
838
+ customPost({ path, parameters, body }, requestOptions) {
813
839
  if (!path) {
814
- throw new Error('Parameter `path` is required when calling `get`.');
840
+ throw new Error('Parameter `path` is required when calling `customPost`.');
815
841
  }
816
842
  const requestPath = '/1{path}'.replace('{path}', path);
817
843
  const headers = {};
818
844
  const queryParameters = parameters ? parameters : {};
819
845
  const request = {
820
- method: 'GET',
846
+ method: 'POST',
847
+ path: requestPath,
848
+ queryParameters,
849
+ headers,
850
+ data: body ? body : {},
851
+ };
852
+ return transporter.request(request, requestOptions);
853
+ },
854
+ /**
855
+ * This method allow you to send requests to the Algolia REST API.
856
+ *
857
+ * @summary Send requests to the Algolia REST API.
858
+ * @param customPut - The customPut object.
859
+ * @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
860
+ * @param customPut.parameters - Query parameters to apply to the current query.
861
+ * @param customPut.body - Parameters to send with the custom request.
862
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
863
+ */
864
+ customPut({ path, parameters, body }, requestOptions) {
865
+ if (!path) {
866
+ throw new Error('Parameter `path` is required when calling `customPut`.');
867
+ }
868
+ const requestPath = '/1{path}'.replace('{path}', path);
869
+ const headers = {};
870
+ const queryParameters = parameters ? parameters : {};
871
+ const request = {
872
+ method: 'PUT',
873
+ path: requestPath,
874
+ queryParameters,
875
+ headers,
876
+ data: body ? body : {},
877
+ };
878
+ return transporter.request(request, requestOptions);
879
+ },
880
+ /**
881
+ * Delete an A/B test. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests).
882
+ *
883
+ * @summary Delete an A/B test.
884
+ * @param deleteABTest - The deleteABTest object.
885
+ * @param deleteABTest.id - Unique A/B test ID.
886
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
887
+ */
888
+ deleteABTest({ id }, requestOptions) {
889
+ if (!id) {
890
+ throw new Error('Parameter `id` is required when calling `deleteABTest`.');
891
+ }
892
+ const requestPath = '/2/abtests/{id}'.replace('{id}', encodeURIComponent(id));
893
+ const headers = {};
894
+ const queryParameters = {};
895
+ const request = {
896
+ method: 'DELETE',
821
897
  path: requestPath,
822
898
  queryParameters,
823
899
  headers,
@@ -882,58 +958,6 @@ function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authM
882
958
  };
883
959
  return transporter.request(request, requestOptions);
884
960
  },
885
- /**
886
- * This method allow you to send requests to the Algolia REST API.
887
- *
888
- * @summary Send requests to the Algolia REST API.
889
- * @param post - The post object.
890
- * @param post.path - Path of the endpoint, anything after \"/1\" must be specified.
891
- * @param post.parameters - Query parameters to apply to the current query.
892
- * @param post.body - Parameters to send with the custom request.
893
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
894
- */
895
- post({ path, parameters, body }, requestOptions) {
896
- if (!path) {
897
- throw new Error('Parameter `path` is required when calling `post`.');
898
- }
899
- const requestPath = '/1{path}'.replace('{path}', path);
900
- const headers = {};
901
- const queryParameters = parameters ? parameters : {};
902
- const request = {
903
- method: 'POST',
904
- path: requestPath,
905
- queryParameters,
906
- headers,
907
- data: body ? body : {},
908
- };
909
- return transporter.request(request, requestOptions);
910
- },
911
- /**
912
- * This method allow you to send requests to the Algolia REST API.
913
- *
914
- * @summary Send requests to the Algolia REST API.
915
- * @param put - The put object.
916
- * @param put.path - Path of the endpoint, anything after \"/1\" must be specified.
917
- * @param put.parameters - Query parameters to apply to the current query.
918
- * @param put.body - Parameters to send with the custom request.
919
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
920
- */
921
- put({ path, parameters, body }, requestOptions) {
922
- if (!path) {
923
- throw new Error('Parameter `path` is required when calling `put`.');
924
- }
925
- const requestPath = '/1{path}'.replace('{path}', path);
926
- const headers = {};
927
- const queryParameters = parameters ? parameters : {};
928
- const request = {
929
- method: 'PUT',
930
- path: requestPath,
931
- queryParameters,
932
- headers,
933
- data: body ? body : {},
934
- };
935
- return transporter.request(request, requestOptions);
936
- },
937
961
  /**
938
962
  * 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).
939
963
  *
@@ -2,7 +2,7 @@ import { createAuth, createTransporter, getAlgoliaAgent, DEFAULT_CONNECT_TIMEOUT
2
2
  import { createHttpRequester } from '@algolia/requester-node-http';
3
3
 
4
4
  // Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
5
- const apiClientVersion = '5.0.0-alpha.91';
5
+ const apiClientVersion = '5.0.0-alpha.98';
6
6
  const REGIONS = ['de', 'us'];
7
7
  function getDefaultHosts(region) {
8
8
  const url = !region
@@ -97,14 +97,14 @@ function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authM
97
97
  * This method allow you to send requests to the Algolia REST API.
98
98
  *
99
99
  * @summary Send requests to the Algolia REST API.
100
- * @param del - The del object.
101
- * @param del.path - Path of the endpoint, anything after \"/1\" must be specified.
102
- * @param del.parameters - Query parameters to apply to the current query.
100
+ * @param customDelete - The customDelete object.
101
+ * @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
102
+ * @param customDelete.parameters - Query parameters to apply to the current query.
103
103
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
104
104
  */
105
- del({ path, parameters }, requestOptions) {
105
+ customDelete({ path, parameters }, requestOptions) {
106
106
  if (!path) {
107
- throw new Error('Parameter `path` is required when calling `del`.');
107
+ throw new Error('Parameter `path` is required when calling `customDelete`.');
108
108
  }
109
109
  const requestPath = '/1{path}'.replace('{path}', path);
110
110
  const headers = {};
@@ -118,22 +118,23 @@ function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authM
118
118
  return transporter.request(request, requestOptions);
119
119
  },
120
120
  /**
121
- * Delete an A/B test. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests).
121
+ * This method allow you to send requests to the Algolia REST API.
122
122
  *
123
- * @summary Delete an A/B test.
124
- * @param deleteABTest - The deleteABTest object.
125
- * @param deleteABTest.id - Unique A/B test ID.
123
+ * @summary Send requests to the Algolia REST API.
124
+ * @param customGet - The customGet object.
125
+ * @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
126
+ * @param customGet.parameters - Query parameters to apply to the current query.
126
127
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
127
128
  */
128
- deleteABTest({ id }, requestOptions) {
129
- if (!id) {
130
- throw new Error('Parameter `id` is required when calling `deleteABTest`.');
129
+ customGet({ path, parameters }, requestOptions) {
130
+ if (!path) {
131
+ throw new Error('Parameter `path` is required when calling `customGet`.');
131
132
  }
132
- const requestPath = '/2/abtests/{id}'.replace('{id}', encodeURIComponent(id));
133
+ const requestPath = '/1{path}'.replace('{path}', path);
133
134
  const headers = {};
134
- const queryParameters = {};
135
+ const queryParameters = parameters ? parameters : {};
135
136
  const request = {
136
- method: 'DELETE',
137
+ method: 'GET',
137
138
  path: requestPath,
138
139
  queryParameters,
139
140
  headers,
@@ -144,20 +145,71 @@ function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authM
144
145
  * This method allow you to send requests to the Algolia REST API.
145
146
  *
146
147
  * @summary Send requests to the Algolia REST API.
147
- * @param get - The get object.
148
- * @param get.path - Path of the endpoint, anything after \"/1\" must be specified.
149
- * @param get.parameters - Query parameters to apply to the current query.
148
+ * @param customPost - The customPost object.
149
+ * @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
150
+ * @param customPost.parameters - Query parameters to apply to the current query.
151
+ * @param customPost.body - Parameters to send with the custom request.
150
152
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
151
153
  */
152
- get({ path, parameters }, requestOptions) {
154
+ customPost({ path, parameters, body }, requestOptions) {
153
155
  if (!path) {
154
- throw new Error('Parameter `path` is required when calling `get`.');
156
+ throw new Error('Parameter `path` is required when calling `customPost`.');
155
157
  }
156
158
  const requestPath = '/1{path}'.replace('{path}', path);
157
159
  const headers = {};
158
160
  const queryParameters = parameters ? parameters : {};
159
161
  const request = {
160
- method: 'GET',
162
+ method: 'POST',
163
+ path: requestPath,
164
+ queryParameters,
165
+ headers,
166
+ data: body ? body : {},
167
+ };
168
+ return transporter.request(request, requestOptions);
169
+ },
170
+ /**
171
+ * This method allow you to send requests to the Algolia REST API.
172
+ *
173
+ * @summary Send requests to the Algolia REST API.
174
+ * @param customPut - The customPut object.
175
+ * @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
176
+ * @param customPut.parameters - Query parameters to apply to the current query.
177
+ * @param customPut.body - Parameters to send with the custom request.
178
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
179
+ */
180
+ customPut({ path, parameters, body }, requestOptions) {
181
+ if (!path) {
182
+ throw new Error('Parameter `path` is required when calling `customPut`.');
183
+ }
184
+ const requestPath = '/1{path}'.replace('{path}', path);
185
+ const headers = {};
186
+ const queryParameters = parameters ? parameters : {};
187
+ const request = {
188
+ method: 'PUT',
189
+ path: requestPath,
190
+ queryParameters,
191
+ headers,
192
+ data: body ? body : {},
193
+ };
194
+ return transporter.request(request, requestOptions);
195
+ },
196
+ /**
197
+ * Delete an A/B test. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests).
198
+ *
199
+ * @summary Delete an A/B test.
200
+ * @param deleteABTest - The deleteABTest object.
201
+ * @param deleteABTest.id - Unique A/B test ID.
202
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
203
+ */
204
+ deleteABTest({ id }, requestOptions) {
205
+ if (!id) {
206
+ throw new Error('Parameter `id` is required when calling `deleteABTest`.');
207
+ }
208
+ const requestPath = '/2/abtests/{id}'.replace('{id}', encodeURIComponent(id));
209
+ const headers = {};
210
+ const queryParameters = {};
211
+ const request = {
212
+ method: 'DELETE',
161
213
  path: requestPath,
162
214
  queryParameters,
163
215
  headers,
@@ -222,58 +274,6 @@ function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authM
222
274
  };
223
275
  return transporter.request(request, requestOptions);
224
276
  },
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 - Path of the endpoint, anything after \"/1\" must be specified.
231
- * @param post.parameters - Query parameters to apply to the current query.
232
- * @param post.body - 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 - Path of the endpoint, anything after \"/1\" must be specified.
257
- * @param put.parameters - Query parameters to apply to the current query.
258
- * @param put.body - 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
277
  /**
278
278
  * 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).
279
279
  *
@@ -1,2 +1,2 @@
1
- /*! client-abtesting.umd.js | 5.0.0-alpha.91 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */
2
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@algolia/client-abtesting"]={})}(this,(function(e){"use strict";function t(e){let t;const r=`algolia-client-js-${e.key}`;function s(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function a(){return JSON.parse(s().getItem(r)||"{}")}return{get:(e,t,r={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>{const r=JSON.stringify(e),s=a()[r];return Promise.all([s||t(),void 0!==s])})).then((([e,t])=>Promise.all([e,t||r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const n=a();return n[JSON.stringify(e)]=t,s().setItem(r,JSON.stringify(n)),t})),delete:e=>Promise.resolve().then((()=>{const t=a();delete t[JSON.stringify(e)],s().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{s().removeItem(r)}))}}function r(e){const t=[...e.caches],s=t.shift();return void 0===s?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,a,n={miss:()=>Promise.resolve()})=>s.get(e,a,n).catch((()=>r({caches:t}).get(e,a,n))),set:(e,a)=>s.set(e,a).catch((()=>r({caches:t}).set(e,a))),delete:e=>s.delete(e).catch((()=>r({caches:t}).delete(e))),clear:()=>s.clear().catch((()=>r({caches:t}).clear()))}}function s(e={serializable:!0}){let t={};return{get(r,s,a={miss:()=>Promise.resolve()}){const n=JSON.stringify(r);if(n in t)return Promise.resolve(e.serializable?JSON.parse(t[n]):t[n]);const o=s();return o.then((e=>a.miss(e))).then((()=>o))},set:(r,s)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(s):s,Promise.resolve(s)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const a=12e4;function n(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>a},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=a}}}function o(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class i extends Error{constructor(e,t){super(e),o(this,"name","AlgoliaError"),t&&(this.name=t)}}class c extends i{constructor(e,t,r){super(e,r),o(this,"stackTrace",void 0),this.stackTrace=t}}class u extends c{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",e,"RetryError")}}class l extends c{constructor(e,t,r,s="ApiError"){super(e,r,s),o(this,"status",void 0),this.status=t}}class d extends i{constructor(e,t){super(e,"DeserializationError"),o(this,"response",void 0),this.response=t}}class h extends l{constructor(e,t,r,s){super(e,t,s,"DetailedApiError"),o(this,"error",void 0),this.error=r}}function m(e,t,r){const s=function(e){const t=e=>"[object Object]"===Object.prototype.toString.call(e)||"[object Array]"===Object.prototype.toString.call(e);return Object.keys(e).map((r=>`${r}=${encodeURIComponent(t(e[r])?JSON.stringify(e[r]):e[r])}`)).join("&")}(r);let a=`${e.protocol}://${e.url}/${"/"===t.charAt(0)?t.substr(1):t}`;return s.length&&(a+=`?${s}`),a}function p(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function f({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:s,algoliaAgent:a,timeouts:o,requester:i,requestsCache:c,responsesCache:f}){async function g(c,f,g=!0){const y=[],P=function(e,t){if("GET"===e.method||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(c,f),w=function(e,t,r){const s={Accept:"application/json",...e,...t,...r},a={};return Object.keys(s).forEach((e=>{const t=s[e];a[e.toLowerCase()]=t})),a}(r,c.headers,f.headers),v="GET"===c.method?{...c.data,...f.data}:{},q={...s,...c.queryParameters,...v};if(a.value&&(q["x-algolia-agent"]=a.value),f&&f.queryParameters)for(const e of Object.keys(f.queryParameters))f.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(f.queryParameters[e])?q[e]=f.queryParameters[e].toString():q[e]=f.queryParameters[e];let T=0;const b=async(e,r)=>{const s=e.pop();if(void 0===s)throw new u(function(e){return e.map((e=>p(e)))}(y));let a=f.timeout;void 0===a&&(a=g?o.read:o.write);const v={data:P,headers:w,method:c.method,url:m(s,c.path,q),connectTimeout:r(T,o.connect),responseTimeout:r(T,a)},O=t=>{const r={request:v,response:t,host:s,triesLeft:e.length};return y.push(r),r},A=await i.send(v);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&0==~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(A)){const a=O(A);return A.isTimedOut&&T++,console.log("Retryable failure",p(a)),await t.set(s,n(s,A.isTimedOut?"timed out":"down")),b(e,r)}if(function({status:e}){return 2==~~(e/100)}(A))return function(e){try{return JSON.parse(e.content)}catch(t){throw new d(t.message,e)}}(A);throw O(A),function({content:e,status:t},r){try{const s=JSON.parse(e);return"error"in s?new h(s.message,t,s.error,r):new l(s.message,t,r)}catch(e){}return new l(e,t,r)}(A,y)},O=e.filter((e=>"readWrite"===e.accept||(g?"read"===e.accept:"write"===e.accept))),A=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(n(e))))))),s=r.filter((e=>e.isUp())),a=r.filter((e=>e.isTimedOut())),o=[...s,...a];return{hosts:o.length>0?o:e,getTimeout:(e,t)=>(0===a.length&&0===e?1:a.length+3+e)*t}}(O);return b([...A.hosts].reverse(),A.getTimeout)}return{hostsCache:t,requester:i,timeouts:o,algoliaAgent:a,baseHeaders:r,baseQueryParameters:s,hosts:e,request:function(e,t={}){const a=e.useReadTransporter||"GET"===e.method;if(!a)return g(e,t,a);const n=()=>g(e,t);if(!0!==(t.cacheable||e.cacheable))return n();const o={request:e,requestOptions:t,transporter:{queryParameters:s,headers:r}};return f.get(o,(()=>c.get(o,(()=>c.set(o,n()).then((e=>Promise.all([c.delete(o),e])),(e=>Promise.all([c.delete(o),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>f.set(o,e)})},requestsCache:c,responsesCache:f}}function g({algoliaAgents:e,client:t,version:r}){const s=function(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}(r).add({segment:t,version:r});return e.forEach((e=>s.add(e))),s}const y="5.0.0-alpha.91",P=["de","us"];e.abtestingClient=function(e,a,n,o){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!a||"string"!=typeof a)throw new Error("`apiKey` is missing.");if(n&&("string"!=typeof n||!P.includes(n)))throw new Error(`\`region\` must be one of the following: ${P.join(", ")}`);return function({appId:e,apiKey:t,authMode:r,algoliaAgents:s,region:a,...n}){const o=function(e,t,r="WithinHeaders"){const s={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?s:{},queryParameters:()=>"WithinQueryParameters"===r?s:{}}}(e,t,r),i=f({hosts:(c=a,[{url:c?"analytics.{region}.algolia.com".replace("{region}",c):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]),...n,algoliaAgent:g({algoliaAgents:s,client:"Abtesting",version:y}),baseHeaders:{"content-type":"text/plain",...o.headers(),...n.baseHeaders},baseQueryParameters:{...o.queryParameters(),...n.baseQueryParameters}});var c;return{transporter:i,appId:e,clearCache:()=>Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then((()=>{})),get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(e,t){i.algoliaAgent.add({segment:e,version:t})},addABTests(e,t){if(!e)throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");if(!e.name)throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");if(!e.variants)throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");if(!e.endAt)throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");const r={method:"POST",path:"/2/abtests",queryParameters:{},headers:{},data:e};return i.request(r,t)},del({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `del`.");const s={method:"DELETE",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(s,r)},deleteABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `deleteABTest`.");const r={method:"DELETE",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(r,t)},get({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `get`.");const s={method:"GET",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(s,r)},getABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `getABTest`.");const r={method:"GET",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(r,t)},listABTests({offset:e,limit:t,indexPrefix:r,indexSuffix:s}={},a=void 0){const n={};void 0!==e&&(n.offset=e.toString()),void 0!==t&&(n.limit=t.toString()),void 0!==r&&(n.indexPrefix=r.toString()),void 0!==s&&(n.indexSuffix=s.toString());const o={method:"GET",path:"/2/abtests",queryParameters:n,headers:{}};return i.request(o,a)},post({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `post`.");const a={method:"POST",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(a,s)},put({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `put`.");const a={method:"PUT",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(a,s)},stopABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `stopABTest`.");const r={method:"POST",path:"/2/abtests/{id}/stop".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(r,t)}}}({appId:e,apiKey:a,region:n,timeouts:{connect:1e3,read:2e3,write:3e4},requester:{send:function(e){return new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const s=(e,s)=>setTimeout((()=>{r.abort(),t({status:0,content:s,isTimedOut:!0})}),e),a=s(e.connectTimeout,"Connection timeout");let n;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===n&&(clearTimeout(a),n=s(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(a),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(a),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:s(),requestsCache:s({serializable:!1}),hostsCache:r({caches:[t({key:`${y}-${e}`}),s()]}),...o})},e.apiClientVersion=y}));
1
+ /*! client-abtesting.umd.js | 5.0.0-alpha.98 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */
2
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@algolia/client-abtesting"]={})}(this,(function(e){"use strict";function t(e){let t;const r=`algolia-client-js-${e.key}`;function s(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function a(){return JSON.parse(s().getItem(r)||"{}")}function o(e){s().setItem(r,JSON.stringify(e))}return{get:(t,r,s={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>(function(){const t=e.timeToLive?1e3*e.timeToLive:null,r=a(),s=Object.fromEntries(Object.entries(r).filter((([,e])=>void 0!==e.timestamp)));if(o(s),!t)return;o(Object.fromEntries(Object.entries(s).filter((([,e])=>{const r=(new Date).getTime();return!(e.timestamp+t<r)}))))}(),a()[JSON.stringify(t)]))).then((e=>Promise.all([e?e.value:r(),void 0!==e]))).then((([e,t])=>Promise.all([e,t||s.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const o=a();return o[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},s().setItem(r,JSON.stringify(o)),t})),delete:e=>Promise.resolve().then((()=>{const t=a();delete t[JSON.stringify(e)],s().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{s().removeItem(r)}))}}function r(e){const t=[...e.caches],s=t.shift();return void 0===s?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,a,o={miss:()=>Promise.resolve()})=>s.get(e,a,o).catch((()=>r({caches:t}).get(e,a,o))),set:(e,a)=>s.set(e,a).catch((()=>r({caches:t}).set(e,a))),delete:e=>s.delete(e).catch((()=>r({caches:t}).delete(e))),clear:()=>s.clear().catch((()=>r({caches:t}).clear()))}}function s(e={serializable:!0}){let t={};return{get(r,s,a={miss:()=>Promise.resolve()}){const o=JSON.stringify(r);if(o in t)return Promise.resolve(e.serializable?JSON.parse(t[o]):t[o]);const n=s();return n.then((e=>a.miss(e))).then((()=>n))},set:(r,s)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(s):s,Promise.resolve(s)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const a=12e4;function o(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>a},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=a}}}function n(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function i(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class c extends Error{constructor(e,t){super(e),i(this,"name","AlgoliaError"),t&&(this.name=t)}}class u extends c{constructor(e,t,r){super(e,r),i(this,"stackTrace",void 0),this.stackTrace=t}}class l extends u{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, please create a ticket at https://support.algolia.com/ sharing steps we can use to reproduce the issue.",e,"RetryError")}}class d extends u{constructor(e,t,r,s="ApiError"){super(e,r,s),i(this,"status",void 0),this.status=t}}class m extends c{constructor(e,t){super(e,"DeserializationError"),i(this,"response",void 0),this.response=t}}class h extends d{constructor(e,t,r,s){super(e,t,s,"DetailedApiError"),i(this,"error",void 0),this.error=r}}function p(e,t,r){const s=function(e){const t=e=>"[object Object]"===Object.prototype.toString.call(e)||"[object Array]"===Object.prototype.toString.call(e);return Object.keys(e).map((r=>`${r}=${encodeURIComponent(t(e[r])?JSON.stringify(e[r]):e[r])}`)).join("&")}(r);let a=`${e.protocol}://${e.url}/${"/"===t.charAt(0)?t.substr(1):t}`;return s.length&&(a+=`?${s}`),a}function f(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function g({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:s,algoliaAgent:a,timeouts:n,requester:i,requestsCache:c,responsesCache:u}){async function g(c,u,g=!0){const y=[],P=function(e,t){if("GET"===e.method||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(c,u),w=function(e,t,r){const s={Accept:"application/json",...e,...t,...r},a={};return Object.keys(s).forEach((e=>{const t=s[e];a[e.toLowerCase()]=t})),a}(r,c.headers,u.headers),v="GET"===c.method?{...c.data,...u.data}:{},T={...s,...c.queryParameters,...v};if(a.value&&(T["x-algolia-agent"]=a.value),u&&u.queryParameters)for(const e of Object.keys(u.queryParameters))u.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(u.queryParameters[e])?T[e]=u.queryParameters[e].toString():T[e]=u.queryParameters[e];let q=0;const b=async(e,r)=>{const s=e.pop();if(void 0===s)throw new l(function(e){return e.map((e=>f(e)))}(y));let a=u.timeout;void 0===a&&(a=g?n.read:n.write);const v={data:P,headers:w,method:c.method,url:p(s,c.path,T),connectTimeout:r(q,n.connect),responseTimeout:r(q,a)},O=t=>{const r={request:v,response:t,host:s,triesLeft:e.length};return y.push(r),r},E=await i.send(v);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&0==~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(E)){const a=O(E);return E.isTimedOut&&q++,console.log("Retryable failure",f(a)),await t.set(s,o(s,E.isTimedOut?"timed out":"down")),b(e,r)}if(function({status:e}){return 2==~~(e/100)}(E))return function(e){try{return JSON.parse(e.content)}catch(t){throw new m(t.message,e)}}(E);throw O(E),function({content:e,status:t},r){try{const s=JSON.parse(e);return"error"in s?new h(s.message,t,s.error,r):new d(s.message,t,r)}catch(e){}return new d(e,t,r)}(E,y)},O=e.filter((e=>"readWrite"===e.accept||(g?"read"===e.accept:"write"===e.accept))),E=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(o(e))))))),s=r.filter((e=>e.isUp())),a=r.filter((e=>e.isTimedOut())),n=[...s,...a];return{hosts:n.length>0?n:e,getTimeout:(e,t)=>(0===a.length&&0===e?1:a.length+3+e)*t}}(O);return b([...E.hosts].reverse(),E.getTimeout)}return{hostsCache:t,requester:i,timeouts:n,algoliaAgent:a,baseHeaders:r,baseQueryParameters:s,hosts:e,request:function(e,t={}){const a=e.useReadTransporter||"GET"===e.method;if(!a)return g(e,t,a);const o=()=>g(e,t);if(!0!==(t.cacheable||e.cacheable))return o();const n={request:e,requestOptions:t,transporter:{queryParameters:s,headers:r}};return u.get(n,(()=>c.get(n,(()=>c.set(n,o()).then((e=>Promise.all([c.delete(n),e])),(e=>Promise.all([c.delete(n),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>u.set(n,e)})},requestsCache:c,responsesCache:u}}function y({algoliaAgents:e,client:t,version:r}){const s=function(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}(r).add({segment:t,version:r});return e.forEach((e=>s.add(e))),s}const P="5.0.0-alpha.98",w=["de","us"];e.abtestingClient=function(e,a,o,n){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!a||"string"!=typeof a)throw new Error("`apiKey` is missing.");if(o&&("string"!=typeof o||!w.includes(o)))throw new Error(`\`region\` must be one of the following: ${w.join(", ")}`);return function({appId:e,apiKey:t,authMode:r,algoliaAgents:s,region:a,...o}){const n=function(e,t,r="WithinHeaders"){const s={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?s:{},queryParameters:()=>"WithinQueryParameters"===r?s:{}}}(e,t,r),i=g({hosts:(c=a,[{url:c?"analytics.{region}.algolia.com".replace("{region}",c):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]),...o,algoliaAgent:y({algoliaAgents:s,client:"Abtesting",version:P}),baseHeaders:{"content-type":"text/plain",...n.headers(),...o.baseHeaders},baseQueryParameters:{...n.queryParameters(),...o.baseQueryParameters}});var c;return{transporter:i,appId:e,clearCache:()=>Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then((()=>{})),get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(e,t){i.algoliaAgent.add({segment:e,version:t})},addABTests(e,t){if(!e)throw new Error("Parameter `addABTestsRequest` is required when calling `addABTests`.");if(!e.name)throw new Error("Parameter `addABTestsRequest.name` is required when calling `addABTests`.");if(!e.variants)throw new Error("Parameter `addABTestsRequest.variants` is required when calling `addABTests`.");if(!e.endAt)throw new Error("Parameter `addABTestsRequest.endAt` is required when calling `addABTests`.");const r={method:"POST",path:"/2/abtests",queryParameters:{},headers:{},data:e};return i.request(r,t)},customDelete({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");const s={method:"DELETE",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(s,r)},customGet({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");const s={method:"GET",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(s,r)},customPost({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");const a={method:"POST",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(a,s)},customPut({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");const a={method:"PUT",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(a,s)},deleteABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `deleteABTest`.");const r={method:"DELETE",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(r,t)},getABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `getABTest`.");const r={method:"GET",path:"/2/abtests/{id}".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(r,t)},listABTests({offset:e,limit:t,indexPrefix:r,indexSuffix:s}={},a=void 0){const o={};void 0!==e&&(o.offset=e.toString()),void 0!==t&&(o.limit=t.toString()),void 0!==r&&(o.indexPrefix=r.toString()),void 0!==s&&(o.indexSuffix=s.toString());const n={method:"GET",path:"/2/abtests",queryParameters:o,headers:{}};return i.request(n,a)},stopABTest({id:e},t){if(!e)throw new Error("Parameter `id` is required when calling `stopABTest`.");const r={method:"POST",path:"/2/abtests/{id}/stop".replace("{id}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(r,t)}}}({appId:e,apiKey:a,region:o,timeouts:{connect:1e3,read:2e3,write:3e4},requester:{send:function(e){return new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const s=(e,s)=>setTimeout((()=>{r.abort(),t({status:0,content:s,isTimedOut:!0})}),e),a=s(e.connectTimeout,"Connection timeout");let o;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===o&&(clearTimeout(a),o=s(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(a),clearTimeout(o),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(a),clearTimeout(o),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:s(),requestsCache:s({serializable:!1}),hostsCache:r({caches:[t({key:`${P}-${e}`}),s()]}),...n})},e.apiClientVersion=P}));
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Properties for the `del` method.
2
+ * Properties for the `customDelete` method.
3
3
  */
4
- export type DelProps = {
4
+ export type CustomDeleteProps = {
5
5
  /**
6
6
  * Path of the endpoint, anything after \"/1\" must be specified.
7
7
  */
@@ -12,18 +12,39 @@ export type DelProps = {
12
12
  parameters?: Record<string, any>;
13
13
  };
14
14
  /**
15
- * Properties for the `deleteABTest` method.
15
+ * Properties for the `customGet` method.
16
16
  */
17
- export type DeleteABTestProps = {
17
+ export type CustomGetProps = {
18
18
  /**
19
- * Unique A/B test ID.
19
+ * Path of the endpoint, anything after \"/1\" must be specified.
20
20
  */
21
- id: number;
21
+ path: string;
22
+ /**
23
+ * Query parameters to apply to the current query.
24
+ */
25
+ parameters?: Record<string, any>;
26
+ };
27
+ /**
28
+ * Properties for the `customPost` method.
29
+ */
30
+ export type CustomPostProps = {
31
+ /**
32
+ * Path of the endpoint, anything after \"/1\" must be specified.
33
+ */
34
+ path: string;
35
+ /**
36
+ * Query parameters to apply to the current query.
37
+ */
38
+ parameters?: Record<string, any>;
39
+ /**
40
+ * Parameters to send with the custom request.
41
+ */
42
+ body?: Record<string, any>;
22
43
  };
23
44
  /**
24
- * Properties for the `get` method.
45
+ * Properties for the `customPut` method.
25
46
  */
26
- export type GetProps = {
47
+ export type CustomPutProps = {
27
48
  /**
28
49
  * Path of the endpoint, anything after \"/1\" must be specified.
29
50
  */
@@ -32,6 +53,19 @@ export type GetProps = {
32
53
  * Query parameters to apply to the current query.
33
54
  */
34
55
  parameters?: Record<string, any>;
56
+ /**
57
+ * Parameters to send with the custom request.
58
+ */
59
+ body?: Record<string, any>;
60
+ };
61
+ /**
62
+ * Properties for the `deleteABTest` method.
63
+ */
64
+ export type DeleteABTestProps = {
65
+ /**
66
+ * Unique A/B test ID.
67
+ */
68
+ id: number;
35
69
  };
36
70
  /**
37
71
  * Properties for the `getABTest` method.
@@ -63,40 +97,6 @@ export type ListABTestsProps = {
63
97
  */
64
98
  indexSuffix?: string;
65
99
  };
66
- /**
67
- * Properties for the `post` method.
68
- */
69
- export type PostProps = {
70
- /**
71
- * Path of the endpoint, anything after \"/1\" must be specified.
72
- */
73
- path: string;
74
- /**
75
- * Query parameters to apply to the current query.
76
- */
77
- parameters?: Record<string, any>;
78
- /**
79
- * Parameters to send with the custom request.
80
- */
81
- body?: Record<string, any>;
82
- };
83
- /**
84
- * Properties for the `put` method.
85
- */
86
- export type PutProps = {
87
- /**
88
- * Path of the endpoint, anything after \"/1\" must be specified.
89
- */
90
- path: string;
91
- /**
92
- * Query parameters to apply to the current query.
93
- */
94
- parameters?: Record<string, any>;
95
- /**
96
- * Parameters to send with the custom request.
97
- */
98
- body?: Record<string, any>;
99
- };
100
100
  /**
101
101
  * Properties for the `stopABTest` method.
102
102
  */
@@ -1 +1 @@
1
- {"version":3,"file":"clientMethodProps.d.ts","sourceRoot":"","sources":["../../model/clientMethodProps.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb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ACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC"}
@@ -70,5 +70,9 @@ export type Variant = {
70
70
  * Number of users during the A/B test.
71
71
  */
72
72
  userCount: number;
73
+ /**
74
+ * Number of users that performed a tracked search during the A/B test.
75
+ */
76
+ trackedUserCount: number;
73
77
  };
74
78
  //# sourceMappingURL=variant.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"variant.d.ts","sourceRoot":"","sources":["../../model/variant.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,MAAM,OAAO,GAAG;IACpB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,oBAAoB,EAAE,MAAM,CAAC;IAE7B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAE5C;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B;;OAEG;IACH,KAAK,EAAE,MAAM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kBAAkB,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC"}
@@ -2,9 +2,9 @@ import type { CreateClientOptions, RequestOptions } from '@algolia/client-common
2
2
  import type { ABTest } from '../model/aBTest';
3
3
  import type { ABTestResponse } from '../model/aBTestResponse';
4
4
  import type { AddABTestsRequest } from '../model/addABTestsRequest';
5
- import type { DelProps, DeleteABTestProps, GetProps, GetABTestProps, ListABTestsProps, PostProps, PutProps, StopABTestProps } from '../model/clientMethodProps';
5
+ import type { CustomDeleteProps, CustomGetProps, CustomPostProps, CustomPutProps, DeleteABTestProps, GetABTestProps, ListABTestsProps, StopABTestProps } from '../model/clientMethodProps';
6
6
  import type { ListABTestsResponse } from '../model/listABTestsResponse';
7
- export declare const apiClientVersion = "5.0.0-alpha.91";
7
+ export declare const apiClientVersion = "5.0.0-alpha.98";
8
8
  export declare const REGIONS: readonly ["de", "us"];
9
9
  export type Region = (typeof REGIONS)[number];
10
10
  export declare function createAbtestingClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & {
@@ -42,31 +42,53 @@ export declare function createAbtestingClient({ appId: appIdOption, apiKey: apiK
42
42
  * This method allow you to send requests to the Algolia REST API.
43
43
  *
44
44
  * @summary Send requests to the Algolia REST API.
45
- * @param del - The del object.
46
- * @param del.path - Path of the endpoint, anything after \"/1\" must be specified.
47
- * @param del.parameters - Query parameters to apply to the current query.
45
+ * @param customDelete - The customDelete object.
46
+ * @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
47
+ * @param customDelete.parameters - Query parameters to apply to the current query.
48
48
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
49
49
  */
50
- del({ path, parameters }: DelProps, requestOptions?: RequestOptions): Promise<Record<string, any>>;
50
+ customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, any>>;
51
51
  /**
52
- * Delete an A/B test. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests).
52
+ * This method allow you to send requests to the Algolia REST API.
53
53
  *
54
- * @summary Delete an A/B test.
55
- * @param deleteABTest - The deleteABTest object.
56
- * @param deleteABTest.id - Unique A/B test ID.
54
+ * @summary Send requests to the Algolia REST API.
55
+ * @param customGet - The customGet object.
56
+ * @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
57
+ * @param customGet.parameters - Query parameters to apply to the current query.
57
58
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
58
59
  */
59
- deleteABTest({ id }: DeleteABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
60
+ customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, any>>;
60
61
  /**
61
62
  * This method allow you to send requests to the Algolia REST API.
62
63
  *
63
64
  * @summary Send requests to the Algolia REST API.
64
- * @param get - The get object.
65
- * @param get.path - Path of the endpoint, anything after \"/1\" must be specified.
66
- * @param get.parameters - Query parameters to apply to the current query.
65
+ * @param customPost - The customPost object.
66
+ * @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
67
+ * @param customPost.parameters - Query parameters to apply to the current query.
68
+ * @param customPost.body - Parameters to send with the custom request.
69
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
70
+ */
71
+ customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, any>>;
72
+ /**
73
+ * This method allow you to send requests to the Algolia REST API.
74
+ *
75
+ * @summary Send requests to the Algolia REST API.
76
+ * @param customPut - The customPut object.
77
+ * @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
78
+ * @param customPut.parameters - Query parameters to apply to the current query.
79
+ * @param customPut.body - Parameters to send with the custom request.
80
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
81
+ */
82
+ customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, any>>;
83
+ /**
84
+ * Delete an A/B test. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests).
85
+ *
86
+ * @summary Delete an A/B test.
87
+ * @param deleteABTest - The deleteABTest object.
88
+ * @param deleteABTest.id - Unique A/B test ID.
67
89
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
68
90
  */
69
- get({ path, parameters }: GetProps, requestOptions?: RequestOptions): Promise<Record<string, any>>;
91
+ deleteABTest({ id }: DeleteABTestProps, requestOptions?: RequestOptions): Promise<ABTestResponse>;
70
92
  /**
71
93
  * 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).
72
94
  *
@@ -88,28 +110,6 @@ export declare function createAbtestingClient({ appId: appIdOption, apiKey: apiK
88
110
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
89
111
  */
90
112
  listABTests({ offset, limit, indexPrefix, indexSuffix }?: ListABTestsProps, requestOptions?: RequestOptions | undefined): Promise<ListABTestsResponse>;
91
- /**
92
- * This method allow you to send requests to the Algolia REST API.
93
- *
94
- * @summary Send requests to the Algolia REST API.
95
- * @param post - The post object.
96
- * @param post.path - Path of the endpoint, anything after \"/1\" must be specified.
97
- * @param post.parameters - Query parameters to apply to the current query.
98
- * @param post.body - Parameters to send with the custom request.
99
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
100
- */
101
- post({ path, parameters, body }: PostProps, requestOptions?: RequestOptions): Promise<Record<string, any>>;
102
- /**
103
- * This method allow you to send requests to the Algolia REST API.
104
- *
105
- * @summary Send requests to the Algolia REST API.
106
- * @param put - The put object.
107
- * @param put.path - Path of the endpoint, anything after \"/1\" must be specified.
108
- * @param put.parameters - Query parameters to apply to the current query.
109
- * @param put.body - Parameters to send with the custom request.
110
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
111
- */
112
- put({ path, parameters, body }: PutProps, requestOptions?: RequestOptions): Promise<Record<string, any>>;
113
113
  /**
114
114
  * 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).
115
115
  *
@@ -1 +1 @@
1
- {"version":3,"file":"abtestingClient.d.ts","sourceRoot":"","sources":["../../src/abtestingClient.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,mBAAmB,EAInB,cAAc,EAEf,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EACV,QAAQ,EACR,iBAAiB,EACjB,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,QAAQ,EACR,eAAe,EAChB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAExE,eAAO,MAAM,gBAAgB,mBAAmB,CAAC;AAEjD,eAAO,MAAM,OAAO,uBAAwB,CAAC;AAC7C,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAW9C,wBAAgB,qBAAqB,CAAC,EACpC,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,YAAY,EACpB,QAAQ,EACR,aAAa,EACb,MAAM,EAAE,YAAY,EACpB,GAAG,OAAO,EACX,EAAE,mBAAmB,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE;;IAwBxC;;OAEG;;IAGH;;OAEG;kBACW,QAAQ,IAAI,CAAC;IAO3B;;O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;;;;;;OAOG;yBAEO,iBAAiB,mBACR,cAAc,GAC9B,QAAQ,cAAc,CAAC;IAwB1B;;;;;;;OAOG;sBAEO,cAAc,mBACL,cAAc,GAC9B,QAAQ,MAAM,CAAC;IAsBlB;;;;;;;;;;OAUG;8DAE4C,gBAAgB,mBAC7C,cAAc,GAAG,SAAS,GACzC,QAAQ,mBAAmB,CAAC;IA+B/B;;;;;;;OAOG;uBAEO,eAAe,mBACN,cAAc,GAC9B,QAAQ,cAAc,CAAC;EAwB7B;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -1,9 +1,9 @@
1
1
  // 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.
2
2
 
3
3
  /**
4
- * Properties for the `del` method.
4
+ * Properties for the `customDelete` method.
5
5
  */
6
- export type DelProps = {
6
+ export type CustomDeleteProps = {
7
7
  /**
8
8
  * Path of the endpoint, anything after \"/1\" must be specified.
9
9
  */
@@ -15,19 +15,41 @@ export type DelProps = {
15
15
  };
16
16
 
17
17
  /**
18
- * Properties for the `deleteABTest` method.
18
+ * Properties for the `customGet` method.
19
19
  */
20
- export type DeleteABTestProps = {
20
+ export type CustomGetProps = {
21
21
  /**
22
- * Unique A/B test ID.
22
+ * Path of the endpoint, anything after \"/1\" must be specified.
23
23
  */
24
- id: number;
24
+ path: string;
25
+ /**
26
+ * Query parameters to apply to the current query.
27
+ */
28
+ parameters?: Record<string, any>;
29
+ };
30
+
31
+ /**
32
+ * Properties for the `customPost` method.
33
+ */
34
+ export type CustomPostProps = {
35
+ /**
36
+ * Path of the endpoint, anything after \"/1\" must be specified.
37
+ */
38
+ path: string;
39
+ /**
40
+ * Query parameters to apply to the current query.
41
+ */
42
+ parameters?: Record<string, any>;
43
+ /**
44
+ * Parameters to send with the custom request.
45
+ */
46
+ body?: Record<string, any>;
25
47
  };
26
48
 
27
49
  /**
28
- * Properties for the `get` method.
50
+ * Properties for the `customPut` method.
29
51
  */
30
- export type GetProps = {
52
+ export type CustomPutProps = {
31
53
  /**
32
54
  * Path of the endpoint, anything after \"/1\" must be specified.
33
55
  */
@@ -36,6 +58,20 @@ export type GetProps = {
36
58
  * Query parameters to apply to the current query.
37
59
  */
38
60
  parameters?: Record<string, any>;
61
+ /**
62
+ * Parameters to send with the custom request.
63
+ */
64
+ body?: Record<string, any>;
65
+ };
66
+
67
+ /**
68
+ * Properties for the `deleteABTest` method.
69
+ */
70
+ export type DeleteABTestProps = {
71
+ /**
72
+ * Unique A/B test ID.
73
+ */
74
+ id: number;
39
75
  };
40
76
 
41
77
  /**
@@ -70,42 +106,6 @@ export type ListABTestsProps = {
70
106
  indexSuffix?: string;
71
107
  };
72
108
 
73
- /**
74
- * Properties for the `post` method.
75
- */
76
- export type PostProps = {
77
- /**
78
- * Path of the endpoint, anything after \"/1\" must be specified.
79
- */
80
- path: string;
81
- /**
82
- * Query parameters to apply to the current query.
83
- */
84
- parameters?: Record<string, any>;
85
- /**
86
- * Parameters to send with the custom request.
87
- */
88
- body?: Record<string, any>;
89
- };
90
-
91
- /**
92
- * Properties for the `put` method.
93
- */
94
- export type PutProps = {
95
- /**
96
- * Path of the endpoint, anything after \"/1\" must be specified.
97
- */
98
- path: string;
99
- /**
100
- * Query parameters to apply to the current query.
101
- */
102
- parameters?: Record<string, any>;
103
- /**
104
- * Parameters to send with the custom request.
105
- */
106
- body?: Record<string, any>;
107
- };
108
-
109
109
  /**
110
110
  * Properties for the `stopABTest` method.
111
111
  */
package/model/variant.ts CHANGED
@@ -90,4 +90,9 @@ export type Variant = {
90
90
  * Number of users during the A/B test.
91
91
  */
92
92
  userCount: number;
93
+
94
+ /**
95
+ * Number of users that performed a tracked search during the A/B test.
96
+ */
97
+ trackedUserCount: number;
93
98
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@algolia/client-abtesting",
3
- "version": "5.0.0-alpha.91",
3
+ "version": "5.0.0-alpha.98",
4
4
  "description": "JavaScript client for client-abtesting",
5
5
  "repository": "algolia/algoliasearch-client-javascript",
6
6
  "license": "MIT",
@@ -39,14 +39,14 @@
39
39
  "clean": "rm -rf ./dist || true"
40
40
  },
41
41
  "dependencies": {
42
- "@algolia/client-common": "5.0.0-alpha.92",
43
- "@algolia/requester-browser-xhr": "5.0.0-alpha.92",
44
- "@algolia/requester-node-http": "5.0.0-alpha.92"
42
+ "@algolia/client-common": "5.0.0-alpha.99",
43
+ "@algolia/requester-browser-xhr": "5.0.0-alpha.99",
44
+ "@algolia/requester-node-http": "5.0.0-alpha.99"
45
45
  },
46
46
  "devDependencies": {
47
- "@types/node": "20.9.0",
48
- "rollup": "4.3.0",
49
- "typescript": "5.2.2"
47
+ "@types/node": "20.11.5",
48
+ "rollup": "4.9.5",
49
+ "typescript": "5.3.3"
50
50
  },
51
51
  "engines": {
52
52
  "node": ">= 14.0.0"