@algolia/client-insights 5.0.0-alpha.10 → 5.0.0-alpha.100

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 (108) hide show
  1. package/dist/builds/browser.d.ts +5 -5
  2. package/dist/builds/browser.d.ts.map +1 -1
  3. package/dist/builds/node.d.ts +5 -5
  4. package/dist/builds/node.d.ts.map +1 -1
  5. package/dist/{client-insights.cjs.js → client-insights.cjs} +231 -216
  6. package/dist/client-insights.esm.browser.js +442 -451
  7. package/dist/client-insights.esm.node.js +231 -214
  8. package/dist/client-insights.umd.js +2 -2
  9. package/dist/model/addToCartEvent.d.ts +2 -0
  10. package/dist/model/addToCartEvent.d.ts.map +1 -0
  11. package/dist/model/addedToCartObjectIDs.d.ts +45 -0
  12. package/dist/model/addedToCartObjectIDs.d.ts.map +1 -0
  13. package/dist/model/addedToCartObjectIDsAfterSearch.d.ts +49 -0
  14. package/dist/model/addedToCartObjectIDsAfterSearch.d.ts.map +1 -0
  15. package/dist/model/clickEvent.d.ts +2 -0
  16. package/dist/model/clickEvent.d.ts.map +1 -0
  17. package/dist/model/clickedFilters.d.ts +32 -0
  18. package/dist/model/clickedFilters.d.ts.map +1 -0
  19. package/dist/model/clickedObjectIDs.d.ts +32 -0
  20. package/dist/model/clickedObjectIDs.d.ts.map +1 -0
  21. package/dist/model/clickedObjectIDsAfterSearch.d.ts +40 -0
  22. package/dist/model/clickedObjectIDsAfterSearch.d.ts.map +1 -0
  23. package/dist/model/clientMethodProps.d.ts +69 -60
  24. package/dist/model/clientMethodProps.d.ts.map +1 -1
  25. package/dist/model/conversionEvent.d.ts +2 -0
  26. package/dist/model/conversionEvent.d.ts.map +1 -0
  27. package/dist/model/convertedFilters.d.ts +29 -0
  28. package/dist/model/convertedFilters.d.ts.map +1 -0
  29. package/dist/model/convertedObjectIDs.d.ts +32 -0
  30. package/dist/model/convertedObjectIDs.d.ts.map +1 -0
  31. package/dist/model/convertedObjectIDsAfterSearch.d.ts +36 -0
  32. package/dist/model/convertedObjectIDsAfterSearch.d.ts.map +1 -0
  33. package/dist/model/discount.d.ts +5 -0
  34. package/dist/model/discount.d.ts.map +1 -0
  35. package/dist/model/errorBase.d.ts +6 -6
  36. package/dist/model/errorBase.d.ts.map +1 -1
  37. package/dist/model/eventsItems.d.ts +14 -0
  38. package/dist/model/eventsItems.d.ts.map +1 -0
  39. package/dist/model/eventsResponse.d.ts +14 -0
  40. package/dist/model/eventsResponse.d.ts.map +1 -0
  41. package/dist/model/index.d.ts +27 -6
  42. package/dist/model/index.d.ts.map +1 -1
  43. package/dist/model/insightsEvents.d.ts +8 -0
  44. package/dist/model/insightsEvents.d.ts.map +1 -0
  45. package/dist/model/objectData.d.ts +11 -0
  46. package/dist/model/objectData.d.ts.map +1 -0
  47. package/dist/model/objectDataAfterSearch.d.ts +15 -0
  48. package/dist/model/objectDataAfterSearch.d.ts.map +1 -0
  49. package/dist/model/price.d.ts +5 -0
  50. package/dist/model/price.d.ts.map +1 -0
  51. package/dist/model/purchaseEvent.d.ts +2 -0
  52. package/dist/model/purchaseEvent.d.ts.map +1 -0
  53. package/dist/model/purchasedObjectIDs.d.ts +45 -0
  54. package/dist/model/purchasedObjectIDs.d.ts.map +1 -0
  55. package/dist/model/purchasedObjectIDsAfterSearch.d.ts +45 -0
  56. package/dist/model/purchasedObjectIDsAfterSearch.d.ts.map +1 -0
  57. package/dist/model/value.d.ts +5 -0
  58. package/dist/model/value.d.ts.map +1 -0
  59. package/dist/model/viewEvent.d.ts +2 -0
  60. package/dist/model/viewEvent.d.ts.map +1 -0
  61. package/dist/model/viewedFilters.d.ts +32 -0
  62. package/dist/model/viewedFilters.d.ts.map +1 -0
  63. package/dist/model/viewedObjectIDs.d.ts +32 -0
  64. package/dist/model/viewedObjectIDs.d.ts.map +1 -0
  65. package/dist/src/insightsClient.d.ts +88 -85
  66. package/dist/src/insightsClient.d.ts.map +1 -1
  67. package/index.js +1 -1
  68. package/model/addToCartEvent.ts +3 -0
  69. package/model/addedToCartObjectIDs.ts +57 -0
  70. package/model/addedToCartObjectIDsAfterSearch.ts +62 -0
  71. package/model/clickEvent.ts +3 -0
  72. package/model/clickedFilters.ts +40 -0
  73. package/model/clickedObjectIDs.ts +40 -0
  74. package/model/clickedObjectIDsAfterSearch.ts +50 -0
  75. package/model/clientMethodProps.ts +29 -19
  76. package/model/conversionEvent.ts +3 -0
  77. package/model/convertedFilters.ts +37 -0
  78. package/model/convertedObjectIDs.ts +40 -0
  79. package/model/convertedObjectIDsAfterSearch.ts +45 -0
  80. package/model/discount.ts +6 -0
  81. package/model/errorBase.ts +1 -1
  82. package/model/eventsItems.ts +28 -0
  83. package/model/eventsResponse.ts +16 -0
  84. package/model/index.ts +26 -5
  85. package/model/insightsEvents.ts +10 -0
  86. package/model/objectData.ts +15 -0
  87. package/model/objectDataAfterSearch.ts +20 -0
  88. package/model/price.ts +6 -0
  89. package/model/purchaseEvent.ts +3 -0
  90. package/model/purchasedObjectIDs.ts +57 -0
  91. package/model/purchasedObjectIDsAfterSearch.ts +57 -0
  92. package/model/value.ts +6 -0
  93. package/model/viewEvent.ts +3 -0
  94. package/model/viewedFilters.ts +40 -0
  95. package/model/viewedObjectIDs.ts +40 -0
  96. package/package.json +30 -13
  97. package/dist/model/eventType.d.ts +0 -2
  98. package/dist/model/eventType.d.ts.map +0 -1
  99. package/dist/model/insightEvent.d.ts +0 -40
  100. package/dist/model/insightEvent.d.ts.map +0 -1
  101. package/dist/model/insightEvents.d.ts +0 -11
  102. package/dist/model/insightEvents.d.ts.map +0 -1
  103. package/dist/model/pushEventsResponse.d.ts +0 -7
  104. package/dist/model/pushEventsResponse.d.ts.map +0 -1
  105. package/model/eventType.ts +0 -3
  106. package/model/insightEvent.ts +0 -50
  107. package/model/insightEvents.ts +0 -13
  108. package/model/pushEventsResponse.ts +0 -8
@@ -1,6 +1,6 @@
1
- import type { ClientOptions } from '@algolia/client-common';
2
- import type { InsightsClient, Region } from '../src/insightsClient';
3
- export { apiClientVersion, InsightsClient } from '../src/insightsClient';
4
- export * from '../model';
5
- export declare function insightsClient(appId: string, apiKey: string, region?: Region, options?: ClientOptions): InsightsClient;
1
+ import type { ClientOptions } from '@algolia/client-common';
2
+ import type { InsightsClient, Region } from '../src/insightsClient';
3
+ export { apiClientVersion, InsightsClient, Region, } from '../src/insightsClient';
4
+ export * from '../model';
5
+ export declare function insightsClient(appId: string, apiKey: string, region?: Region, options?: ClientOptions): InsightsClient;
6
6
  //# sourceMappingURL=browser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../builds/browser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAW5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAOpE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACzE,cAAc,UAAU,CAAC;AAEzB,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,aAAa,GACtB,cAAc,CAqChB"}
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../builds/browser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAW5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAOpE,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,MAAM,GACP,MAAM,uBAAuB,CAAC;AAC/B,cAAc,UAAU,CAAC;AAEzB,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,aAAa,GACtB,cAAc,CAqChB"}
@@ -1,6 +1,6 @@
1
- import type { ClientOptions } from '@algolia/client-common';
2
- import type { InsightsClient, Region } from '../src/insightsClient';
3
- export { apiClientVersion, InsightsClient } from '../src/insightsClient';
4
- export * from '../model';
5
- export declare function insightsClient(appId: string, apiKey: string, region?: Region, options?: ClientOptions): InsightsClient;
1
+ import type { ClientOptions } from '@algolia/client-common';
2
+ import type { InsightsClient, Region } from '../src/insightsClient';
3
+ export { apiClientVersion, InsightsClient, Region, } from '../src/insightsClient';
4
+ export * from '../model';
5
+ export declare function insightsClient(appId: string, apiKey: string, region?: Region, options?: ClientOptions): InsightsClient;
6
6
  //# sourceMappingURL=node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../builds/node.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAU5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAGpE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACzE,cAAc,UAAU,CAAC;AAEzB,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,aAAa,GACtB,cAAc,CA+BhB"}
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../builds/node.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAU5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAGpE,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,MAAM,GACP,MAAM,uBAAuB,CAAC;AAC/B,cAAc,UAAU,CAAC;AAEzB,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,aAAa,GACtB,cAAc,CA+BhB"}
@@ -1,226 +1,241 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var clientCommon = require('@algolia/client-common');
6
4
  var requesterNodeHttp = require('@algolia/requester-node-http');
7
5
 
8
- // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
9
- const apiClientVersion = '5.0.0-alpha.10';
10
- const REGIONS = ['de', 'us'];
11
- function getDefaultHosts(region) {
12
- const url = !region
13
- ? 'insights.algolia.io'
14
- : 'insights.{region}.algolia.io'.replace('{region}', region);
15
- return [{ url, accept: 'readWrite', protocol: 'https' }];
16
- }
17
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
18
- function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }) {
19
- const auth = clientCommon.createAuth(appIdOption, apiKeyOption, authMode);
20
- const transporter = clientCommon.createTransporter({
21
- hosts: getDefaultHosts(regionOption),
22
- ...options,
23
- algoliaAgent: clientCommon.getAlgoliaAgent({
24
- algoliaAgents,
25
- client: 'Insights',
26
- version: apiClientVersion,
27
- }),
28
- baseHeaders: {
29
- 'content-type': 'text/plain',
30
- ...auth.headers(),
31
- ...options.baseHeaders,
32
- },
33
- baseQueryParameters: {
34
- ...auth.queryParameters(),
35
- ...options.baseQueryParameters,
36
- },
37
- });
38
- return {
39
- transporter,
40
- /**
41
- * The `appId` currently in use.
42
- */
43
- appId: appIdOption,
44
- /**
45
- * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
46
- */
47
- clearCache() {
48
- return Promise.all([
49
- transporter.requestsCache.clear(),
50
- transporter.responsesCache.clear(),
51
- ]).then(() => undefined);
52
- },
53
- /**
54
- * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
55
- */
56
- get _ua() {
57
- return transporter.algoliaAgent.value;
58
- },
59
- /**
60
- * Adds a `segment` to the `x-algolia-agent` sent with every requests.
61
- *
62
- * @param segment - The algolia agent (user-agent) segment to add.
63
- * @param version - The version of the agent.
64
- */
65
- addAlgoliaAgent(segment, version) {
66
- transporter.algoliaAgent.add({ segment, version });
67
- },
68
- /**
69
- * This method allow you to send requests to the Algolia REST API.
70
- *
71
- * @summary Send requests to the Algolia REST API.
72
- * @param del - The del object.
73
- * @param del.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
74
- * @param del.parameters - Query parameters to be applied to the current query.
75
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
76
- */
77
- del({ path, parameters }, requestOptions) {
78
- if (!path) {
79
- throw new Error('Parameter `path` is required when calling `del`.');
80
- }
81
- const requestPath = '/1{path}'.replace('{path}', path);
82
- const headers = {};
83
- const queryParameters = parameters ? parameters : {};
84
- const request = {
85
- method: 'DELETE',
86
- path: requestPath,
87
- queryParameters,
88
- headers,
89
- };
90
- return transporter.request(request, requestOptions);
91
- },
92
- /**
93
- * This method allow you to send requests to the Algolia REST API.
94
- *
95
- * @summary Send requests to the Algolia REST API.
96
- * @param get - The get object.
97
- * @param get.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
98
- * @param get.parameters - Query parameters to be applied to the current query.
99
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
100
- */
101
- get({ path, parameters }, requestOptions) {
102
- if (!path) {
103
- throw new Error('Parameter `path` is required when calling `get`.');
104
- }
105
- const requestPath = '/1{path}'.replace('{path}', path);
106
- const headers = {};
107
- const queryParameters = parameters ? parameters : {};
108
- const request = {
109
- method: 'GET',
110
- path: requestPath,
111
- queryParameters,
112
- headers,
113
- };
114
- return transporter.request(request, requestOptions);
115
- },
116
- /**
117
- * This method allow you to send requests to the Algolia REST API.
118
- *
119
- * @summary Send requests to the Algolia REST API.
120
- * @param post - The post object.
121
- * @param post.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
122
- * @param post.parameters - Query parameters to be applied to the current query.
123
- * @param post.body - The parameters to send with the custom request.
124
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
125
- */
126
- post({ path, parameters, body }, requestOptions) {
127
- if (!path) {
128
- throw new Error('Parameter `path` is required when calling `post`.');
129
- }
130
- const requestPath = '/1{path}'.replace('{path}', path);
131
- const headers = {};
132
- const queryParameters = parameters ? parameters : {};
133
- const request = {
134
- method: 'POST',
135
- path: requestPath,
136
- queryParameters,
137
- headers,
138
- data: body ? body : {},
139
- };
140
- return transporter.request(request, requestOptions);
141
- },
142
- /**
143
- * This command pushes an array of events. An event is - an action: `eventName` - performed in a context: `eventType` - at some point in time provided: `timestamp` - by an end user: `userToken` - on something: `index` Notes: - To be accepted, all events sent must be valid. - The size of the body must be *less than 2 MB*. - When an event is tied to an Algolia search, it must also provide a `queryID`. If that event is a `click`, their absolute `positions` should also be passed. - We consider that an `index` provides access to 2 resources: objects and filters. An event can only interact with a single resource type, but not necessarily on a single item. As such an event will accept an array of `objectIDs` or `filters`.
144
- *
145
- * @summary Push events.
146
- * @param insightEvents - The insightEvents object.
147
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
148
- */
149
- pushEvents(insightEvents, requestOptions) {
150
- if (!insightEvents) {
151
- throw new Error('Parameter `insightEvents` is required when calling `pushEvents`.');
152
- }
153
- if (!insightEvents.events) {
154
- throw new Error('Parameter `insightEvents.events` is required when calling `pushEvents`.');
155
- }
156
- const requestPath = '/1/events';
157
- const headers = {};
158
- const queryParameters = {};
159
- const request = {
160
- method: 'POST',
161
- path: requestPath,
162
- queryParameters,
163
- headers,
164
- data: insightEvents,
165
- };
166
- return transporter.request(request, requestOptions);
167
- },
168
- /**
169
- * This method allow you to send requests to the Algolia REST API.
170
- *
171
- * @summary Send requests to the Algolia REST API.
172
- * @param put - The put object.
173
- * @param put.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
174
- * @param put.parameters - Query parameters to be applied to the current query.
175
- * @param put.body - The parameters to send with the custom request.
176
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
177
- */
178
- put({ path, parameters, body }, requestOptions) {
179
- if (!path) {
180
- throw new Error('Parameter `path` is required when calling `put`.');
181
- }
182
- const requestPath = '/1{path}'.replace('{path}', path);
183
- const headers = {};
184
- const queryParameters = parameters ? parameters : {};
185
- const request = {
186
- method: 'PUT',
187
- path: requestPath,
188
- queryParameters,
189
- headers,
190
- data: body ? body : {},
191
- };
192
- return transporter.request(request, requestOptions);
193
- },
194
- };
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.100';
8
+ const REGIONS = ['de', 'us'];
9
+ function getDefaultHosts(region) {
10
+ const url = !region
11
+ ? 'insights.algolia.io'
12
+ : 'insights.{region}.algolia.io'.replace('{region}', region);
13
+ return [{ url, accept: 'readWrite', protocol: 'https' }];
14
+ }
15
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
16
+ function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }) {
17
+ const auth = clientCommon.createAuth(appIdOption, apiKeyOption, authMode);
18
+ const transporter = clientCommon.createTransporter({
19
+ hosts: getDefaultHosts(regionOption),
20
+ ...options,
21
+ algoliaAgent: clientCommon.getAlgoliaAgent({
22
+ algoliaAgents,
23
+ client: 'Insights',
24
+ version: apiClientVersion,
25
+ }),
26
+ baseHeaders: {
27
+ 'content-type': 'text/plain',
28
+ ...auth.headers(),
29
+ ...options.baseHeaders,
30
+ },
31
+ baseQueryParameters: {
32
+ ...auth.queryParameters(),
33
+ ...options.baseQueryParameters,
34
+ },
35
+ });
36
+ return {
37
+ transporter,
38
+ /**
39
+ * The `appId` currently in use.
40
+ */
41
+ appId: appIdOption,
42
+ /**
43
+ * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
44
+ */
45
+ clearCache() {
46
+ return Promise.all([
47
+ transporter.requestsCache.clear(),
48
+ transporter.responsesCache.clear(),
49
+ ]).then(() => undefined);
50
+ },
51
+ /**
52
+ * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
53
+ */
54
+ get _ua() {
55
+ return transporter.algoliaAgent.value;
56
+ },
57
+ /**
58
+ * Adds a `segment` to the `x-algolia-agent` sent with every requests.
59
+ *
60
+ * @param segment - The algolia agent (user-agent) segment to add.
61
+ * @param version - The version of the agent.
62
+ */
63
+ addAlgoliaAgent(segment, version) {
64
+ transporter.algoliaAgent.add({ segment, version });
65
+ },
66
+ /**
67
+ * This method allow you to send requests to the Algolia REST API.
68
+ *
69
+ * @param customDelete - The customDelete object.
70
+ * @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
71
+ * @param customDelete.parameters - Query parameters to apply to the current query.
72
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
73
+ */
74
+ customDelete({ path, parameters }, requestOptions) {
75
+ if (!path) {
76
+ throw new Error('Parameter `path` is required when calling `customDelete`.');
77
+ }
78
+ const requestPath = '/1{path}'.replace('{path}', path);
79
+ const headers = {};
80
+ const queryParameters = parameters ? parameters : {};
81
+ const request = {
82
+ method: 'DELETE',
83
+ path: requestPath,
84
+ queryParameters,
85
+ headers,
86
+ };
87
+ return transporter.request(request, requestOptions);
88
+ },
89
+ /**
90
+ * This method allow you to send requests to the Algolia REST API.
91
+ *
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
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
96
+ */
97
+ customGet({ path, parameters }, requestOptions) {
98
+ if (!path) {
99
+ throw new Error('Parameter `path` is required when calling `customGet`.');
100
+ }
101
+ const requestPath = '/1{path}'.replace('{path}', path);
102
+ const headers = {};
103
+ const queryParameters = parameters ? parameters : {};
104
+ const request = {
105
+ method: 'GET',
106
+ path: requestPath,
107
+ queryParameters,
108
+ headers,
109
+ };
110
+ return transporter.request(request, requestOptions);
111
+ },
112
+ /**
113
+ * This method allow you to send requests to the Algolia REST API.
114
+ *
115
+ * @param customPost - The customPost object.
116
+ * @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
117
+ * @param customPost.parameters - Query parameters to apply to the current query.
118
+ * @param customPost.body - Parameters to send with the custom request.
119
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
120
+ */
121
+ customPost({ path, parameters, body }, requestOptions) {
122
+ if (!path) {
123
+ throw new Error('Parameter `path` is required when calling `customPost`.');
124
+ }
125
+ const requestPath = '/1{path}'.replace('{path}', path);
126
+ const headers = {};
127
+ const queryParameters = parameters ? parameters : {};
128
+ const request = {
129
+ method: 'POST',
130
+ path: requestPath,
131
+ queryParameters,
132
+ headers,
133
+ data: body ? body : {},
134
+ };
135
+ return transporter.request(request, requestOptions);
136
+ },
137
+ /**
138
+ * This method allow you to send requests to the Algolia REST API.
139
+ *
140
+ * @param customPut - The customPut object.
141
+ * @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
142
+ * @param customPut.parameters - Query parameters to apply to the current query.
143
+ * @param customPut.body - Parameters to send with the custom request.
144
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
145
+ */
146
+ customPut({ path, parameters, body }, requestOptions) {
147
+ if (!path) {
148
+ throw new Error('Parameter `path` is required when calling `customPut`.');
149
+ }
150
+ const requestPath = '/1{path}'.replace('{path}', path);
151
+ const headers = {};
152
+ const queryParameters = parameters ? parameters : {};
153
+ const request = {
154
+ method: 'PUT',
155
+ path: requestPath,
156
+ queryParameters,
157
+ headers,
158
+ data: body ? body : {},
159
+ };
160
+ return transporter.request(request, requestOptions);
161
+ },
162
+ /**
163
+ * 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).
164
+ *
165
+ * @param deleteUserToken - The deleteUserToken object.
166
+ * @param deleteUserToken.userToken - The user token for which to delete all associated events.
167
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
168
+ */
169
+ deleteUserToken({ userToken }, requestOptions) {
170
+ if (!userToken) {
171
+ throw new Error('Parameter `userToken` is required when calling `deleteUserToken`.');
172
+ }
173
+ const requestPath = '/1/usertokens/{userToken}'.replace('{userToken}', encodeURIComponent(userToken));
174
+ const headers = {};
175
+ const queryParameters = {};
176
+ const request = {
177
+ method: 'DELETE',
178
+ path: requestPath,
179
+ queryParameters,
180
+ headers,
181
+ };
182
+ return transporter.request(request, requestOptions);
183
+ },
184
+ /**
185
+ * 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.
186
+ *
187
+ * @param insightsEvents - The insightsEvents object.
188
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
189
+ */
190
+ pushEvents(insightsEvents, requestOptions) {
191
+ if (!insightsEvents) {
192
+ throw new Error('Parameter `insightsEvents` is required when calling `pushEvents`.');
193
+ }
194
+ if (!insightsEvents.events) {
195
+ throw new Error('Parameter `insightsEvents.events` is required when calling `pushEvents`.');
196
+ }
197
+ const requestPath = '/1/events';
198
+ const headers = {};
199
+ const queryParameters = {};
200
+ const request = {
201
+ method: 'POST',
202
+ path: requestPath,
203
+ queryParameters,
204
+ headers,
205
+ data: insightsEvents,
206
+ };
207
+ return transporter.request(request, requestOptions);
208
+ },
209
+ };
195
210
  }
196
211
 
197
- // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
198
- function insightsClient(appId, apiKey, region, options) {
199
- if (!appId || typeof appId !== 'string') {
200
- throw new Error('`appId` is missing.');
201
- }
202
- if (!apiKey || typeof apiKey !== 'string') {
203
- throw new Error('`apiKey` is missing.');
204
- }
205
- if (region && (typeof region !== 'string' || !REGIONS.includes(region))) {
206
- throw new Error(`\`region\` must be one of the following: ${REGIONS.join(', ')}`);
207
- }
208
- return createInsightsClient({
209
- appId,
210
- apiKey,
211
- region,
212
- timeouts: {
213
- connect: clientCommon.DEFAULT_CONNECT_TIMEOUT_NODE,
214
- read: clientCommon.DEFAULT_READ_TIMEOUT_NODE,
215
- write: clientCommon.DEFAULT_WRITE_TIMEOUT_NODE,
216
- },
217
- requester: requesterNodeHttp.createHttpRequester(),
218
- algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],
219
- responsesCache: clientCommon.createNullCache(),
220
- requestsCache: clientCommon.createNullCache(),
221
- hostsCache: clientCommon.createMemoryCache(),
222
- ...options,
223
- });
212
+ // 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.
213
+ function insightsClient(appId, apiKey, region, options) {
214
+ if (!appId || typeof appId !== 'string') {
215
+ throw new Error('`appId` is missing.');
216
+ }
217
+ if (!apiKey || typeof apiKey !== 'string') {
218
+ throw new Error('`apiKey` is missing.');
219
+ }
220
+ if (region && (typeof region !== 'string' || !REGIONS.includes(region))) {
221
+ throw new Error(`\`region\` must be one of the following: ${REGIONS.join(', ')}`);
222
+ }
223
+ return createInsightsClient({
224
+ appId,
225
+ apiKey,
226
+ region,
227
+ timeouts: {
228
+ connect: clientCommon.DEFAULT_CONNECT_TIMEOUT_NODE,
229
+ read: clientCommon.DEFAULT_READ_TIMEOUT_NODE,
230
+ write: clientCommon.DEFAULT_WRITE_TIMEOUT_NODE,
231
+ },
232
+ requester: requesterNodeHttp.createHttpRequester(),
233
+ algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],
234
+ responsesCache: clientCommon.createNullCache(),
235
+ requestsCache: clientCommon.createNullCache(),
236
+ hostsCache: clientCommon.createMemoryCache(),
237
+ ...options,
238
+ });
224
239
  }
225
240
 
226
241
  exports.apiClientVersion = apiClientVersion;