@algolia/client-insights 5.0.0-alpha.90 → 5.0.0-alpha.97

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/client-insights.cjs +64 -41
  2. package/dist/client-insights.esm.browser.js +107 -60
  3. package/dist/client-insights.esm.node.js +64 -41
  4. package/dist/client-insights.umd.js +2 -2
  5. package/dist/model/addedToCartObjectIDs.d.ts +15 -13
  6. package/dist/model/addedToCartObjectIDs.d.ts.map +1 -1
  7. package/dist/model/addedToCartObjectIDsAfterSearch.d.ts +15 -13
  8. package/dist/model/addedToCartObjectIDsAfterSearch.d.ts.map +1 -1
  9. package/dist/model/clickedFilters.d.ts +7 -7
  10. package/dist/model/clickedFilters.d.ts.map +1 -1
  11. package/dist/model/clickedObjectIDs.d.ts +9 -5
  12. package/dist/model/clickedObjectIDs.d.ts.map +1 -1
  13. package/dist/model/clickedObjectIDsAfterSearch.d.ts +9 -9
  14. package/dist/model/clickedObjectIDsAfterSearch.d.ts.map +1 -1
  15. package/dist/model/clientMethodProps.d.ts +17 -8
  16. package/dist/model/clientMethodProps.d.ts.map +1 -1
  17. package/dist/model/convertedFilters.d.ts +7 -7
  18. package/dist/model/convertedFilters.d.ts.map +1 -1
  19. package/dist/model/convertedObjectIDs.d.ts +8 -8
  20. package/dist/model/convertedObjectIDs.d.ts.map +1 -1
  21. package/dist/model/convertedObjectIDsAfterSearch.d.ts +8 -8
  22. package/dist/model/convertedObjectIDsAfterSearch.d.ts.map +1 -1
  23. package/dist/model/discount.d.ts +1 -1
  24. package/dist/model/index.d.ts +1 -0
  25. package/dist/model/index.d.ts.map +1 -1
  26. package/dist/model/insightsEvents.d.ts +1 -1
  27. package/dist/model/objectData.d.ts +1 -1
  28. package/dist/model/objectDataAfterSearch.d.ts +2 -2
  29. package/dist/model/price.d.ts +1 -1
  30. package/dist/model/purchasedObjectIDs.d.ts +15 -13
  31. package/dist/model/purchasedObjectIDs.d.ts.map +1 -1
  32. package/dist/model/purchasedObjectIDsAfterSearch.d.ts +14 -16
  33. package/dist/model/purchasedObjectIDsAfterSearch.d.ts.map +1 -1
  34. package/dist/model/value.d.ts +5 -0
  35. package/dist/model/value.d.ts.map +1 -0
  36. package/dist/model/viewedFilters.d.ts +7 -7
  37. package/dist/model/viewedFilters.d.ts.map +1 -1
  38. package/dist/model/viewedObjectIDs.d.ts +8 -8
  39. package/dist/model/viewedObjectIDs.d.ts.map +1 -1
  40. package/dist/src/insightsClient.d.ts +35 -26
  41. package/dist/src/insightsClient.d.ts.map +1 -1
  42. package/model/addedToCartObjectIDs.ts +16 -13
  43. package/model/addedToCartObjectIDsAfterSearch.ts +16 -13
  44. package/model/clickedFilters.ts +7 -7
  45. package/model/clickedObjectIDs.ts +10 -5
  46. package/model/clickedObjectIDsAfterSearch.ts +9 -9
  47. package/model/clientMethodProps.ts +18 -8
  48. package/model/convertedFilters.ts +7 -7
  49. package/model/convertedObjectIDs.ts +8 -8
  50. package/model/convertedObjectIDsAfterSearch.ts +8 -8
  51. package/model/discount.ts +1 -1
  52. package/model/index.ts +1 -0
  53. package/model/insightsEvents.ts +1 -1
  54. package/model/objectData.ts +1 -1
  55. package/model/objectDataAfterSearch.ts +2 -2
  56. package/model/price.ts +1 -1
  57. package/model/purchasedObjectIDs.ts +16 -13
  58. package/model/purchasedObjectIDsAfterSearch.ts +14 -16
  59. package/model/value.ts +6 -0
  60. package/model/viewedFilters.ts +7 -7
  61. package/model/viewedObjectIDs.ts +8 -8
  62. package/package.json +7 -7
@@ -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.90';
7
+ const apiClientVersion = '5.0.0-alpha.97';
8
8
  const REGIONS = ['de', 'us'];
9
9
  function getDefaultHosts(region) {
10
10
  const url = !region
@@ -67,14 +67,14 @@ function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption, authMo
67
67
  * This method allow you to send requests to the Algolia REST API.
68
68
  *
69
69
  * @summary Send requests to the Algolia REST API.
70
- * @param del - The del object.
71
- * @param del.path - Path of the endpoint, anything after \"/1\" must be specified.
72
- * @param del.parameters - Query parameters to apply to the current query.
70
+ * @param customDelete - The customDelete object.
71
+ * @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
72
+ * @param customDelete.parameters - Query parameters to apply to the current query.
73
73
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
74
74
  */
75
- del({ path, parameters }, requestOptions) {
75
+ customDelete({ path, parameters }, requestOptions) {
76
76
  if (!path) {
77
- throw new Error('Parameter `path` is required when calling `del`.');
77
+ throw new Error('Parameter `path` is required when calling `customDelete`.');
78
78
  }
79
79
  const requestPath = '/1{path}'.replace('{path}', path);
80
80
  const headers = {};
@@ -91,14 +91,14 @@ function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption, authMo
91
91
  * This method allow you to send requests to the Algolia REST API.
92
92
  *
93
93
  * @summary Send requests to the Algolia REST API.
94
- * @param get - The get object.
95
- * @param get.path - Path of the endpoint, anything after \"/1\" must be specified.
96
- * @param get.parameters - Query parameters to apply to the current query.
94
+ * @param customGet - The customGet object.
95
+ * @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
96
+ * @param customGet.parameters - Query parameters to apply to the current query.
97
97
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
98
98
  */
99
- get({ path, parameters }, requestOptions) {
99
+ customGet({ path, parameters }, requestOptions) {
100
100
  if (!path) {
101
- throw new Error('Parameter `path` is required when calling `get`.');
101
+ throw new Error('Parameter `path` is required when calling `customGet`.');
102
102
  }
103
103
  const requestPath = '/1{path}'.replace('{path}', path);
104
104
  const headers = {};
@@ -115,15 +115,15 @@ function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption, authMo
115
115
  * This method allow you to send requests to the Algolia REST API.
116
116
  *
117
117
  * @summary Send requests to the Algolia REST API.
118
- * @param post - The post object.
119
- * @param post.path - Path of the endpoint, anything after \"/1\" must be specified.
120
- * @param post.parameters - Query parameters to apply to the current query.
121
- * @param post.body - Parameters to send with the custom request.
118
+ * @param customPost - The customPost object.
119
+ * @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
120
+ * @param customPost.parameters - Query parameters to apply to the current query.
121
+ * @param customPost.body - Parameters to send with the custom request.
122
122
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
123
123
  */
124
- post({ path, parameters, body }, requestOptions) {
124
+ customPost({ path, parameters, body }, requestOptions) {
125
125
  if (!path) {
126
- throw new Error('Parameter `path` is required when calling `post`.');
126
+ throw new Error('Parameter `path` is required when calling `customPost`.');
127
127
  }
128
128
  const requestPath = '/1{path}'.replace('{path}', path);
129
129
  const headers = {};
@@ -138,54 +138,77 @@ function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption, authMo
138
138
  return transporter.request(request, requestOptions);
139
139
  },
140
140
  /**
141
- * Send a list of events to the Insights API. You can include up to 1,000 events in a single request, but the request body must be smaller than 2 MB.
141
+ * This method allow you to send requests to the Algolia REST API.
142
142
  *
143
- * @summary Send events.
144
- * @param insightsEvents - The insightsEvents object.
143
+ * @summary Send requests to the Algolia REST API.
144
+ * @param customPut - The customPut object.
145
+ * @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
146
+ * @param customPut.parameters - Query parameters to apply to the current query.
147
+ * @param customPut.body - Parameters to send with the custom request.
145
148
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
146
149
  */
147
- pushEvents(insightsEvents, requestOptions) {
148
- if (!insightsEvents) {
149
- throw new Error('Parameter `insightsEvents` is required when calling `pushEvents`.');
150
+ customPut({ path, parameters, body }, requestOptions) {
151
+ if (!path) {
152
+ throw new Error('Parameter `path` is required when calling `customPut`.');
150
153
  }
151
- if (!insightsEvents.events) {
152
- throw new Error('Parameter `insightsEvents.events` is required when calling `pushEvents`.');
154
+ const requestPath = '/1{path}'.replace('{path}', path);
155
+ const headers = {};
156
+ const queryParameters = parameters ? parameters : {};
157
+ const request = {
158
+ method: 'PUT',
159
+ path: requestPath,
160
+ queryParameters,
161
+ headers,
162
+ data: body ? body : {},
163
+ };
164
+ return transporter.request(request, requestOptions);
165
+ },
166
+ /**
167
+ * Delete all events related to a certain user token from events metrics and analytics. To delete a personalization user profile, see [Delete a user profile](https://www.algolia.com/doc/rest-api/personalization/#delete-a-user-profile).
168
+ *
169
+ * @summary Delete user token.
170
+ * @param deleteUserToken - The deleteUserToken object.
171
+ * @param deleteUserToken.userToken - The user token for which to delete all associated events.
172
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
173
+ */
174
+ deleteUserToken({ userToken }, requestOptions) {
175
+ if (!userToken) {
176
+ throw new Error('Parameter `userToken` is required when calling `deleteUserToken`.');
153
177
  }
154
- const requestPath = '/1/events';
178
+ const requestPath = '/1/usertokens/{userToken}'.replace('{userToken}', encodeURIComponent(userToken));
155
179
  const headers = {};
156
180
  const queryParameters = {};
157
181
  const request = {
158
- method: 'POST',
182
+ method: 'DELETE',
159
183
  path: requestPath,
160
184
  queryParameters,
161
185
  headers,
162
- data: insightsEvents,
163
186
  };
164
187
  return transporter.request(request, requestOptions);
165
188
  },
166
189
  /**
167
- * This method allow you to send requests to the Algolia REST API.
190
+ * Send a list of events to the Insights API. You can include up to 1,000 events in a single request, but the request body must be smaller than 2 MB.
168
191
  *
169
- * @summary Send requests to the Algolia REST API.
170
- * @param put - The put object.
171
- * @param put.path - Path of the endpoint, anything after \"/1\" must be specified.
172
- * @param put.parameters - Query parameters to apply to the current query.
173
- * @param put.body - Parameters to send with the custom request.
192
+ * @summary Send events.
193
+ * @param insightsEvents - The insightsEvents object.
174
194
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
175
195
  */
176
- put({ path, parameters, body }, requestOptions) {
177
- if (!path) {
178
- throw new Error('Parameter `path` is required when calling `put`.');
196
+ pushEvents(insightsEvents, requestOptions) {
197
+ if (!insightsEvents) {
198
+ throw new Error('Parameter `insightsEvents` is required when calling `pushEvents`.');
179
199
  }
180
- const requestPath = '/1{path}'.replace('{path}', path);
200
+ if (!insightsEvents.events) {
201
+ throw new Error('Parameter `insightsEvents.events` is required when calling `pushEvents`.');
202
+ }
203
+ const requestPath = '/1/events';
181
204
  const headers = {};
182
- const queryParameters = parameters ? parameters : {};
205
+ const queryParameters = {};
183
206
  const request = {
184
- method: 'PUT',
207
+ method: 'POST',
185
208
  path: requestPath,
186
209
  queryParameters,
187
210
  headers,
188
- data: body ? body : {},
211
+ data: insightsEvents,
189
212
  };
190
213
  return transporter.request(request, requestOptions);
191
214
  },
@@ -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.90';
689
+ const apiClientVersion = '5.0.0-alpha.97';
666
690
  const REGIONS = ['de', 'us'];
667
691
  function getDefaultHosts(region) {
668
692
  const url = !region
@@ -725,14 +749,14 @@ function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption, authMo
725
749
  * This method allow you to send requests to the Algolia REST API.
726
750
  *
727
751
  * @summary Send requests to the Algolia REST API.
728
- * @param del - The del object.
729
- * @param del.path - Path of the endpoint, anything after \"/1\" must be specified.
730
- * @param del.parameters - Query parameters to apply to the current query.
752
+ * @param customDelete - The customDelete object.
753
+ * @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
754
+ * @param customDelete.parameters - Query parameters to apply to the current query.
731
755
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
732
756
  */
733
- del({ path, parameters }, requestOptions) {
757
+ customDelete({ path, parameters }, requestOptions) {
734
758
  if (!path) {
735
- throw new Error('Parameter `path` is required when calling `del`.');
759
+ throw new Error('Parameter `path` is required when calling `customDelete`.');
736
760
  }
737
761
  const requestPath = '/1{path}'.replace('{path}', path);
738
762
  const headers = {};
@@ -749,14 +773,14 @@ function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption, authMo
749
773
  * This method allow you to send requests to the Algolia REST API.
750
774
  *
751
775
  * @summary Send requests to the Algolia REST API.
752
- * @param get - The get object.
753
- * @param get.path - Path of the endpoint, anything after \"/1\" must be specified.
754
- * @param get.parameters - Query parameters to apply to the current query.
776
+ * @param customGet - The customGet object.
777
+ * @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
778
+ * @param customGet.parameters - Query parameters to apply to the current query.
755
779
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
756
780
  */
757
- get({ path, parameters }, requestOptions) {
781
+ customGet({ path, parameters }, requestOptions) {
758
782
  if (!path) {
759
- throw new Error('Parameter `path` is required when calling `get`.');
783
+ throw new Error('Parameter `path` is required when calling `customGet`.');
760
784
  }
761
785
  const requestPath = '/1{path}'.replace('{path}', path);
762
786
  const headers = {};
@@ -773,15 +797,15 @@ function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption, authMo
773
797
  * This method allow you to send requests to the Algolia REST API.
774
798
  *
775
799
  * @summary Send requests to the Algolia REST API.
776
- * @param post - The post object.
777
- * @param post.path - Path of the endpoint, anything after \"/1\" must be specified.
778
- * @param post.parameters - Query parameters to apply to the current query.
779
- * @param post.body - Parameters to send with the custom request.
800
+ * @param customPost - The customPost object.
801
+ * @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
802
+ * @param customPost.parameters - Query parameters to apply to the current query.
803
+ * @param customPost.body - Parameters to send with the custom request.
780
804
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
781
805
  */
782
- post({ path, parameters, body }, requestOptions) {
806
+ customPost({ path, parameters, body }, requestOptions) {
783
807
  if (!path) {
784
- throw new Error('Parameter `path` is required when calling `post`.');
808
+ throw new Error('Parameter `path` is required when calling `customPost`.');
785
809
  }
786
810
  const requestPath = '/1{path}'.replace('{path}', path);
787
811
  const headers = {};
@@ -796,54 +820,77 @@ function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption, authMo
796
820
  return transporter.request(request, requestOptions);
797
821
  },
798
822
  /**
799
- * Send a list of events to the Insights API. You can include up to 1,000 events in a single request, but the request body must be smaller than 2&nbsp;MB.
823
+ * This method allow you to send requests to the Algolia REST API.
800
824
  *
801
- * @summary Send events.
802
- * @param insightsEvents - The insightsEvents object.
825
+ * @summary Send requests to the Algolia REST API.
826
+ * @param customPut - The customPut object.
827
+ * @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
828
+ * @param customPut.parameters - Query parameters to apply to the current query.
829
+ * @param customPut.body - Parameters to send with the custom request.
803
830
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
804
831
  */
805
- pushEvents(insightsEvents, requestOptions) {
806
- if (!insightsEvents) {
807
- throw new Error('Parameter `insightsEvents` is required when calling `pushEvents`.');
832
+ customPut({ path, parameters, body }, requestOptions) {
833
+ if (!path) {
834
+ throw new Error('Parameter `path` is required when calling `customPut`.');
808
835
  }
809
- if (!insightsEvents.events) {
810
- throw new Error('Parameter `insightsEvents.events` is required when calling `pushEvents`.');
836
+ const requestPath = '/1{path}'.replace('{path}', path);
837
+ const headers = {};
838
+ const queryParameters = parameters ? parameters : {};
839
+ const request = {
840
+ method: 'PUT',
841
+ path: requestPath,
842
+ queryParameters,
843
+ headers,
844
+ data: body ? body : {},
845
+ };
846
+ return transporter.request(request, requestOptions);
847
+ },
848
+ /**
849
+ * Delete all events related to a certain user token from events metrics and analytics. To delete a personalization user profile, see [Delete a user profile](https://www.algolia.com/doc/rest-api/personalization/#delete-a-user-profile).
850
+ *
851
+ * @summary Delete user token.
852
+ * @param deleteUserToken - The deleteUserToken object.
853
+ * @param deleteUserToken.userToken - The user token for which to delete all associated events.
854
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
855
+ */
856
+ deleteUserToken({ userToken }, requestOptions) {
857
+ if (!userToken) {
858
+ throw new Error('Parameter `userToken` is required when calling `deleteUserToken`.');
811
859
  }
812
- const requestPath = '/1/events';
860
+ const requestPath = '/1/usertokens/{userToken}'.replace('{userToken}', encodeURIComponent(userToken));
813
861
  const headers = {};
814
862
  const queryParameters = {};
815
863
  const request = {
816
- method: 'POST',
864
+ method: 'DELETE',
817
865
  path: requestPath,
818
866
  queryParameters,
819
867
  headers,
820
- data: insightsEvents,
821
868
  };
822
869
  return transporter.request(request, requestOptions);
823
870
  },
824
871
  /**
825
- * This method allow you to send requests to the Algolia REST API.
872
+ * Send a list of events to the Insights API. You can include up to 1,000 events in a single request, but the request body must be smaller than 2&nbsp;MB.
826
873
  *
827
- * @summary Send requests to the Algolia REST API.
828
- * @param put - The put object.
829
- * @param put.path - Path of the endpoint, anything after \"/1\" must be specified.
830
- * @param put.parameters - Query parameters to apply to the current query.
831
- * @param put.body - Parameters to send with the custom request.
874
+ * @summary Send events.
875
+ * @param insightsEvents - The insightsEvents object.
832
876
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
833
877
  */
834
- put({ path, parameters, body }, requestOptions) {
835
- if (!path) {
836
- throw new Error('Parameter `path` is required when calling `put`.');
878
+ pushEvents(insightsEvents, requestOptions) {
879
+ if (!insightsEvents) {
880
+ throw new Error('Parameter `insightsEvents` is required when calling `pushEvents`.');
837
881
  }
838
- const requestPath = '/1{path}'.replace('{path}', path);
882
+ if (!insightsEvents.events) {
883
+ throw new Error('Parameter `insightsEvents.events` is required when calling `pushEvents`.');
884
+ }
885
+ const requestPath = '/1/events';
839
886
  const headers = {};
840
- const queryParameters = parameters ? parameters : {};
887
+ const queryParameters = {};
841
888
  const request = {
842
- method: 'PUT',
889
+ method: 'POST',
843
890
  path: requestPath,
844
891
  queryParameters,
845
892
  headers,
846
- data: body ? body : {},
893
+ data: insightsEvents,
847
894
  };
848
895
  return transporter.request(request, requestOptions);
849
896
  },
@@ -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.90';
5
+ const apiClientVersion = '5.0.0-alpha.97';
6
6
  const REGIONS = ['de', 'us'];
7
7
  function getDefaultHosts(region) {
8
8
  const url = !region
@@ -65,14 +65,14 @@ function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption, authMo
65
65
  * This method allow you to send requests to the Algolia REST API.
66
66
  *
67
67
  * @summary Send requests to the Algolia REST API.
68
- * @param del - The del object.
69
- * @param del.path - Path of the endpoint, anything after \"/1\" must be specified.
70
- * @param del.parameters - Query parameters to apply to the current query.
68
+ * @param customDelete - The customDelete object.
69
+ * @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
70
+ * @param customDelete.parameters - Query parameters to apply to the current query.
71
71
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
72
72
  */
73
- del({ path, parameters }, requestOptions) {
73
+ customDelete({ path, parameters }, requestOptions) {
74
74
  if (!path) {
75
- throw new Error('Parameter `path` is required when calling `del`.');
75
+ throw new Error('Parameter `path` is required when calling `customDelete`.');
76
76
  }
77
77
  const requestPath = '/1{path}'.replace('{path}', path);
78
78
  const headers = {};
@@ -89,14 +89,14 @@ function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption, authMo
89
89
  * This method allow you to send requests to the Algolia REST API.
90
90
  *
91
91
  * @summary Send requests to the Algolia REST API.
92
- * @param get - The get object.
93
- * @param get.path - Path of the endpoint, anything after \"/1\" must be specified.
94
- * @param get.parameters - Query parameters to apply to the current query.
92
+ * @param customGet - The customGet object.
93
+ * @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
94
+ * @param customGet.parameters - Query parameters to apply to the current query.
95
95
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
96
96
  */
97
- get({ path, parameters }, requestOptions) {
97
+ customGet({ path, parameters }, requestOptions) {
98
98
  if (!path) {
99
- throw new Error('Parameter `path` is required when calling `get`.');
99
+ throw new Error('Parameter `path` is required when calling `customGet`.');
100
100
  }
101
101
  const requestPath = '/1{path}'.replace('{path}', path);
102
102
  const headers = {};
@@ -113,15 +113,15 @@ function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption, authMo
113
113
  * This method allow you to send requests to the Algolia REST API.
114
114
  *
115
115
  * @summary Send requests to the Algolia REST API.
116
- * @param post - The post object.
117
- * @param post.path - Path of the endpoint, anything after \"/1\" must be specified.
118
- * @param post.parameters - Query parameters to apply to the current query.
119
- * @param post.body - Parameters to send with the custom request.
116
+ * @param customPost - The customPost object.
117
+ * @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
118
+ * @param customPost.parameters - Query parameters to apply to the current query.
119
+ * @param customPost.body - Parameters to send with the custom request.
120
120
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
121
121
  */
122
- post({ path, parameters, body }, requestOptions) {
122
+ customPost({ path, parameters, body }, requestOptions) {
123
123
  if (!path) {
124
- throw new Error('Parameter `path` is required when calling `post`.');
124
+ throw new Error('Parameter `path` is required when calling `customPost`.');
125
125
  }
126
126
  const requestPath = '/1{path}'.replace('{path}', path);
127
127
  const headers = {};
@@ -136,54 +136,77 @@ function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption, authMo
136
136
  return transporter.request(request, requestOptions);
137
137
  },
138
138
  /**
139
- * Send a list of events to the Insights API. You can include up to 1,000 events in a single request, but the request body must be smaller than 2&nbsp;MB.
139
+ * This method allow you to send requests to the Algolia REST API.
140
140
  *
141
- * @summary Send events.
142
- * @param insightsEvents - The insightsEvents object.
141
+ * @summary Send requests to the Algolia REST API.
142
+ * @param customPut - The customPut object.
143
+ * @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
144
+ * @param customPut.parameters - Query parameters to apply to the current query.
145
+ * @param customPut.body - Parameters to send with the custom request.
143
146
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
144
147
  */
145
- pushEvents(insightsEvents, requestOptions) {
146
- if (!insightsEvents) {
147
- throw new Error('Parameter `insightsEvents` is required when calling `pushEvents`.');
148
+ customPut({ path, parameters, body }, requestOptions) {
149
+ if (!path) {
150
+ throw new Error('Parameter `path` is required when calling `customPut`.');
148
151
  }
149
- if (!insightsEvents.events) {
150
- throw new Error('Parameter `insightsEvents.events` is required when calling `pushEvents`.');
152
+ const requestPath = '/1{path}'.replace('{path}', path);
153
+ const headers = {};
154
+ const queryParameters = parameters ? parameters : {};
155
+ const request = {
156
+ method: 'PUT',
157
+ path: requestPath,
158
+ queryParameters,
159
+ headers,
160
+ data: body ? body : {},
161
+ };
162
+ return transporter.request(request, requestOptions);
163
+ },
164
+ /**
165
+ * Delete all events related to a certain user token from events metrics and analytics. To delete a personalization user profile, see [Delete a user profile](https://www.algolia.com/doc/rest-api/personalization/#delete-a-user-profile).
166
+ *
167
+ * @summary Delete user token.
168
+ * @param deleteUserToken - The deleteUserToken object.
169
+ * @param deleteUserToken.userToken - The user token for which to delete all associated events.
170
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
171
+ */
172
+ deleteUserToken({ userToken }, requestOptions) {
173
+ if (!userToken) {
174
+ throw new Error('Parameter `userToken` is required when calling `deleteUserToken`.');
151
175
  }
152
- const requestPath = '/1/events';
176
+ const requestPath = '/1/usertokens/{userToken}'.replace('{userToken}', encodeURIComponent(userToken));
153
177
  const headers = {};
154
178
  const queryParameters = {};
155
179
  const request = {
156
- method: 'POST',
180
+ method: 'DELETE',
157
181
  path: requestPath,
158
182
  queryParameters,
159
183
  headers,
160
- data: insightsEvents,
161
184
  };
162
185
  return transporter.request(request, requestOptions);
163
186
  },
164
187
  /**
165
- * This method allow you to send requests to the Algolia REST API.
188
+ * Send a list of events to the Insights API. You can include up to 1,000 events in a single request, but the request body must be smaller than 2&nbsp;MB.
166
189
  *
167
- * @summary Send requests to the Algolia REST API.
168
- * @param put - The put object.
169
- * @param put.path - Path of the endpoint, anything after \"/1\" must be specified.
170
- * @param put.parameters - Query parameters to apply to the current query.
171
- * @param put.body - Parameters to send with the custom request.
190
+ * @summary Send events.
191
+ * @param insightsEvents - The insightsEvents object.
172
192
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
173
193
  */
174
- put({ path, parameters, body }, requestOptions) {
175
- if (!path) {
176
- throw new Error('Parameter `path` is required when calling `put`.');
194
+ pushEvents(insightsEvents, requestOptions) {
195
+ if (!insightsEvents) {
196
+ throw new Error('Parameter `insightsEvents` is required when calling `pushEvents`.');
177
197
  }
178
- const requestPath = '/1{path}'.replace('{path}', path);
198
+ if (!insightsEvents.events) {
199
+ throw new Error('Parameter `insightsEvents.events` is required when calling `pushEvents`.');
200
+ }
201
+ const requestPath = '/1/events';
179
202
  const headers = {};
180
- const queryParameters = parameters ? parameters : {};
203
+ const queryParameters = {};
181
204
  const request = {
182
- method: 'PUT',
205
+ method: 'POST',
183
206
  path: requestPath,
184
207
  queryParameters,
185
208
  headers,
186
- data: body ? body : {},
209
+ data: insightsEvents,
187
210
  };
188
211
  return transporter.request(request, requestOptions);
189
212
  },