@algolia/client-insights 5.2.2 → 5.2.4-beta.2

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 (86) hide show
  1. package/README.md +2 -2
  2. package/dist/browser.d.ts +598 -0
  3. package/dist/builds/browser.js +255 -0
  4. package/dist/builds/browser.js.map +1 -0
  5. package/dist/builds/browser.min.js +2 -0
  6. package/dist/builds/browser.min.js.map +1 -0
  7. package/dist/builds/browser.umd.js +12 -0
  8. package/dist/builds/node.cjs +273 -0
  9. package/dist/builds/node.cjs.map +1 -0
  10. package/dist/builds/node.js +253 -0
  11. package/dist/builds/node.js.map +1 -0
  12. package/dist/node.d.cts +598 -0
  13. package/dist/node.d.ts +598 -0
  14. package/dist/src/insightsClient.cjs +240 -0
  15. package/dist/src/insightsClient.cjs.map +1 -0
  16. package/dist/src/insightsClient.js +213 -0
  17. package/dist/src/insightsClient.js.map +1 -0
  18. package/index.d.ts +1 -1
  19. package/index.js +1 -1
  20. package/package.json +27 -27
  21. package/dist/builds/browser.d.ts +0 -22
  22. package/dist/builds/browser.d.ts.map +0 -1
  23. package/dist/builds/node.d.ts +0 -22
  24. package/dist/builds/node.d.ts.map +0 -1
  25. package/dist/client-insights.cjs +0 -240
  26. package/dist/client-insights.esm.browser.js +0 -914
  27. package/dist/client-insights.esm.node.js +0 -237
  28. package/dist/client-insights.umd.js +0 -2
  29. package/dist/model/addToCartEvent.d.ts +0 -2
  30. package/dist/model/addToCartEvent.d.ts.map +0 -1
  31. package/dist/model/addedToCartObjectIDs.d.ts +0 -45
  32. package/dist/model/addedToCartObjectIDs.d.ts.map +0 -1
  33. package/dist/model/addedToCartObjectIDsAfterSearch.d.ts +0 -49
  34. package/dist/model/addedToCartObjectIDsAfterSearch.d.ts.map +0 -1
  35. package/dist/model/clickEvent.d.ts +0 -2
  36. package/dist/model/clickEvent.d.ts.map +0 -1
  37. package/dist/model/clickedFilters.d.ts +0 -32
  38. package/dist/model/clickedFilters.d.ts.map +0 -1
  39. package/dist/model/clickedObjectIDs.d.ts +0 -32
  40. package/dist/model/clickedObjectIDs.d.ts.map +0 -1
  41. package/dist/model/clickedObjectIDsAfterSearch.d.ts +0 -40
  42. package/dist/model/clickedObjectIDsAfterSearch.d.ts.map +0 -1
  43. package/dist/model/clientMethodProps.d.ts +0 -70
  44. package/dist/model/clientMethodProps.d.ts.map +0 -1
  45. package/dist/model/conversionEvent.d.ts +0 -2
  46. package/dist/model/conversionEvent.d.ts.map +0 -1
  47. package/dist/model/convertedFilters.d.ts +0 -29
  48. package/dist/model/convertedFilters.d.ts.map +0 -1
  49. package/dist/model/convertedObjectIDs.d.ts +0 -32
  50. package/dist/model/convertedObjectIDs.d.ts.map +0 -1
  51. package/dist/model/convertedObjectIDsAfterSearch.d.ts +0 -36
  52. package/dist/model/convertedObjectIDsAfterSearch.d.ts.map +0 -1
  53. package/dist/model/discount.d.ts +0 -5
  54. package/dist/model/discount.d.ts.map +0 -1
  55. package/dist/model/errorBase.d.ts +0 -7
  56. package/dist/model/errorBase.d.ts.map +0 -1
  57. package/dist/model/eventsItems.d.ts +0 -14
  58. package/dist/model/eventsItems.d.ts.map +0 -1
  59. package/dist/model/eventsResponse.d.ts +0 -14
  60. package/dist/model/eventsResponse.d.ts.map +0 -1
  61. package/dist/model/index.d.ts +0 -28
  62. package/dist/model/index.d.ts.map +0 -1
  63. package/dist/model/insightsEvents.d.ts +0 -8
  64. package/dist/model/insightsEvents.d.ts.map +0 -1
  65. package/dist/model/objectData.d.ts +0 -11
  66. package/dist/model/objectData.d.ts.map +0 -1
  67. package/dist/model/objectDataAfterSearch.d.ts +0 -15
  68. package/dist/model/objectDataAfterSearch.d.ts.map +0 -1
  69. package/dist/model/price.d.ts +0 -5
  70. package/dist/model/price.d.ts.map +0 -1
  71. package/dist/model/purchaseEvent.d.ts +0 -2
  72. package/dist/model/purchaseEvent.d.ts.map +0 -1
  73. package/dist/model/purchasedObjectIDs.d.ts +0 -45
  74. package/dist/model/purchasedObjectIDs.d.ts.map +0 -1
  75. package/dist/model/purchasedObjectIDsAfterSearch.d.ts +0 -45
  76. package/dist/model/purchasedObjectIDsAfterSearch.d.ts.map +0 -1
  77. package/dist/model/value.d.ts +0 -5
  78. package/dist/model/value.d.ts.map +0 -1
  79. package/dist/model/viewEvent.d.ts +0 -2
  80. package/dist/model/viewEvent.d.ts.map +0 -1
  81. package/dist/model/viewedFilters.d.ts +0 -32
  82. package/dist/model/viewedFilters.d.ts.map +0 -1
  83. package/dist/model/viewedObjectIDs.d.ts +0 -32
  84. package/dist/model/viewedObjectIDs.d.ts.map +0 -1
  85. package/dist/src/insightsClient.d.ts +0 -85
  86. package/dist/src/insightsClient.d.ts.map +0 -1
@@ -0,0 +1,273 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // builds/node.ts
21
+ var node_exports = {};
22
+ __export(node_exports, {
23
+ apiClientVersion: () => apiClientVersion,
24
+ insightsClient: () => insightsClient
25
+ });
26
+ module.exports = __toCommonJS(node_exports);
27
+ var import_client_common2 = require("@algolia/client-common");
28
+ var import_requester_node_http = require("@algolia/requester-node-http");
29
+
30
+ // src/insightsClient.ts
31
+ var import_client_common = require("@algolia/client-common");
32
+ var apiClientVersion = "5.2.4";
33
+ var REGIONS = ["de", "us"];
34
+ function getDefaultHosts(region) {
35
+ const url = !region ? "insights.algolia.io" : "insights.{region}.algolia.io".replace("{region}", region);
36
+ return [{ url, accept: "readWrite", protocol: "https" }];
37
+ }
38
+ function createInsightsClient({
39
+ appId: appIdOption,
40
+ apiKey: apiKeyOption,
41
+ authMode,
42
+ algoliaAgents,
43
+ region: regionOption,
44
+ ...options
45
+ }) {
46
+ const auth = (0, import_client_common.createAuth)(appIdOption, apiKeyOption, authMode);
47
+ const transporter = (0, import_client_common.createTransporter)({
48
+ hosts: getDefaultHosts(regionOption),
49
+ ...options,
50
+ algoliaAgent: (0, import_client_common.getAlgoliaAgent)({
51
+ algoliaAgents,
52
+ client: "Insights",
53
+ version: apiClientVersion
54
+ }),
55
+ baseHeaders: {
56
+ "content-type": "text/plain",
57
+ ...auth.headers(),
58
+ ...options.baseHeaders
59
+ },
60
+ baseQueryParameters: {
61
+ ...auth.queryParameters(),
62
+ ...options.baseQueryParameters
63
+ }
64
+ });
65
+ return {
66
+ transporter,
67
+ /**
68
+ * The `appId` currently in use.
69
+ */
70
+ appId: appIdOption,
71
+ /**
72
+ * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
73
+ */
74
+ clearCache() {
75
+ return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
76
+ },
77
+ /**
78
+ * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
79
+ */
80
+ get _ua() {
81
+ return transporter.algoliaAgent.value;
82
+ },
83
+ /**
84
+ * Adds a `segment` to the `x-algolia-agent` sent with every requests.
85
+ *
86
+ * @param segment - The algolia agent (user-agent) segment to add.
87
+ * @param version - The version of the agent.
88
+ */
89
+ addAlgoliaAgent(segment, version) {
90
+ transporter.algoliaAgent.add({ segment, version });
91
+ },
92
+ /**
93
+ * This method allow you to send requests to the Algolia REST API.
94
+ *
95
+ * @param customDelete - The customDelete object.
96
+ * @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
97
+ * @param customDelete.parameters - Query parameters to apply to the current query.
98
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
99
+ */
100
+ customDelete({ path, parameters }, requestOptions) {
101
+ if (!path) {
102
+ throw new Error("Parameter `path` is required when calling `customDelete`.");
103
+ }
104
+ const requestPath = "/{path}".replace("{path}", path);
105
+ const headers = {};
106
+ const queryParameters = parameters ? parameters : {};
107
+ const request = {
108
+ method: "DELETE",
109
+ path: requestPath,
110
+ queryParameters,
111
+ headers
112
+ };
113
+ return transporter.request(request, requestOptions);
114
+ },
115
+ /**
116
+ * This method allow you to send requests to the Algolia REST API.
117
+ *
118
+ * @param customGet - The customGet object.
119
+ * @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
120
+ * @param customGet.parameters - Query parameters to apply to the current query.
121
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
122
+ */
123
+ customGet({ path, parameters }, requestOptions) {
124
+ if (!path) {
125
+ throw new Error("Parameter `path` is required when calling `customGet`.");
126
+ }
127
+ const requestPath = "/{path}".replace("{path}", path);
128
+ const headers = {};
129
+ const queryParameters = parameters ? parameters : {};
130
+ const request = {
131
+ method: "GET",
132
+ path: requestPath,
133
+ queryParameters,
134
+ headers
135
+ };
136
+ return transporter.request(request, requestOptions);
137
+ },
138
+ /**
139
+ * This method allow you to send requests to the Algolia REST API.
140
+ *
141
+ * @param customPost - The customPost object.
142
+ * @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
143
+ * @param customPost.parameters - Query parameters to apply to the current query.
144
+ * @param customPost.body - Parameters to send with the custom request.
145
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
146
+ */
147
+ customPost({ path, parameters, body }, requestOptions) {
148
+ if (!path) {
149
+ throw new Error("Parameter `path` is required when calling `customPost`.");
150
+ }
151
+ const requestPath = "/{path}".replace("{path}", path);
152
+ const headers = {};
153
+ const queryParameters = parameters ? parameters : {};
154
+ const request = {
155
+ method: "POST",
156
+ path: requestPath,
157
+ queryParameters,
158
+ headers,
159
+ data: body ? body : {}
160
+ };
161
+ return transporter.request(request, requestOptions);
162
+ },
163
+ /**
164
+ * This method allow you to send requests to the Algolia REST API.
165
+ *
166
+ * @param customPut - The customPut object.
167
+ * @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
168
+ * @param customPut.parameters - Query parameters to apply to the current query.
169
+ * @param customPut.body - Parameters to send with the custom request.
170
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
171
+ */
172
+ customPut({ path, parameters, body }, requestOptions) {
173
+ if (!path) {
174
+ throw new Error("Parameter `path` is required when calling `customPut`.");
175
+ }
176
+ const requestPath = "/{path}".replace("{path}", path);
177
+ const headers = {};
178
+ const queryParameters = parameters ? parameters : {};
179
+ const request = {
180
+ method: "PUT",
181
+ path: requestPath,
182
+ queryParameters,
183
+ headers,
184
+ data: body ? body : {}
185
+ };
186
+ return transporter.request(request, requestOptions);
187
+ },
188
+ /**
189
+ * Deletes all events related to the specified user token from events metrics and analytics. The deletion is asynchronous, and processed within 48 hours. To delete a personalization user profile, see `Delete a user profile` in the Personalization API.
190
+ *
191
+ * @param deleteUserToken - The deleteUserToken object.
192
+ * @param deleteUserToken.userToken - User token for which to delete all associated events.
193
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
194
+ */
195
+ deleteUserToken({ userToken }, requestOptions) {
196
+ if (!userToken) {
197
+ throw new Error("Parameter `userToken` is required when calling `deleteUserToken`.");
198
+ }
199
+ const requestPath = "/1/usertokens/{userToken}".replace("{userToken}", encodeURIComponent(userToken));
200
+ const headers = {};
201
+ const queryParameters = {};
202
+ const request = {
203
+ method: "DELETE",
204
+ path: requestPath,
205
+ queryParameters,
206
+ headers
207
+ };
208
+ return transporter.request(request, requestOptions);
209
+ },
210
+ /**
211
+ * Sends 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.
212
+ *
213
+ * @param insightsEvents - The insightsEvents object.
214
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
215
+ */
216
+ pushEvents(insightsEvents, requestOptions) {
217
+ if (!insightsEvents) {
218
+ throw new Error("Parameter `insightsEvents` is required when calling `pushEvents`.");
219
+ }
220
+ if (!insightsEvents.events) {
221
+ throw new Error("Parameter `insightsEvents.events` is required when calling `pushEvents`.");
222
+ }
223
+ const requestPath = "/1/events";
224
+ const headers = {};
225
+ const queryParameters = {};
226
+ const request = {
227
+ method: "POST",
228
+ path: requestPath,
229
+ queryParameters,
230
+ headers,
231
+ data: insightsEvents
232
+ };
233
+ return transporter.request(request, requestOptions);
234
+ }
235
+ };
236
+ }
237
+
238
+ // builds/node.ts
239
+ function insightsClient(appId, apiKey, region, options) {
240
+ if (!appId || typeof appId !== "string") {
241
+ throw new Error("`appId` is missing.");
242
+ }
243
+ if (!apiKey || typeof apiKey !== "string") {
244
+ throw new Error("`apiKey` is missing.");
245
+ }
246
+ if (region && (typeof region !== "string" || !REGIONS.includes(region))) {
247
+ throw new Error(`\`region\` must be one of the following: ${REGIONS.join(", ")}`);
248
+ }
249
+ return {
250
+ ...createInsightsClient({
251
+ appId,
252
+ apiKey,
253
+ region,
254
+ timeouts: {
255
+ connect: import_client_common2.DEFAULT_CONNECT_TIMEOUT_NODE,
256
+ read: import_client_common2.DEFAULT_READ_TIMEOUT_NODE,
257
+ write: import_client_common2.DEFAULT_WRITE_TIMEOUT_NODE
258
+ },
259
+ requester: (0, import_requester_node_http.createHttpRequester)(),
260
+ algoliaAgents: [{ segment: "Node.js", version: process.versions.node }],
261
+ responsesCache: (0, import_client_common2.createNullCache)(),
262
+ requestsCache: (0, import_client_common2.createNullCache)(),
263
+ hostsCache: (0, import_client_common2.createMemoryCache)(),
264
+ ...options
265
+ })
266
+ };
267
+ }
268
+ // Annotate the CommonJS export names for ESM import in node:
269
+ 0 && (module.exports = {
270
+ apiClientVersion,
271
+ insightsClient
272
+ });
273
+ //# sourceMappingURL=node.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../builds/node.ts","../../src/insightsClient.ts"],"sourcesContent":["// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport type { ClientOptions } from '@algolia/client-common';\nimport {\n createMemoryCache,\n createNullCache,\n DEFAULT_CONNECT_TIMEOUT_NODE,\n DEFAULT_READ_TIMEOUT_NODE,\n DEFAULT_WRITE_TIMEOUT_NODE,\n} from '@algolia/client-common';\nimport { createHttpRequester } from '@algolia/requester-node-http';\n\nimport type { Region } from '../src/insightsClient';\nimport { createInsightsClient, REGIONS } from '../src/insightsClient';\n\nexport { apiClientVersion, Region } from '../src/insightsClient';\nexport * from '../model';\n\n/**\n * The client type.\n */\nexport type InsightsClient = ReturnType<typeof insightsClient>;\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function insightsClient(appId: string, apiKey: string, region?: Region, options?: ClientOptions) {\n if (!appId || typeof appId !== 'string') {\n throw new Error('`appId` is missing.');\n }\n\n if (!apiKey || typeof apiKey !== 'string') {\n throw new Error('`apiKey` is missing.');\n }\n\n if (region && (typeof region !== 'string' || !REGIONS.includes(region))) {\n throw new Error(`\\`region\\` must be one of the following: ${REGIONS.join(', ')}`);\n }\n\n return {\n ...createInsightsClient({\n appId,\n apiKey,\n region,\n timeouts: {\n connect: DEFAULT_CONNECT_TIMEOUT_NODE,\n read: DEFAULT_READ_TIMEOUT_NODE,\n write: DEFAULT_WRITE_TIMEOUT_NODE,\n },\n requester: createHttpRequester(),\n algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],\n responsesCache: createNullCache(),\n requestsCache: createNullCache(),\n hostsCache: createMemoryCache(),\n ...options,\n }),\n };\n}\n","// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport { createAuth, createTransporter, getAlgoliaAgent } from '@algolia/client-common';\nimport type {\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n} from '@algolia/client-common';\n\nimport type {\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteUserTokenProps,\n} from '../model/clientMethodProps';\nimport type { EventsResponse } from '../model/eventsResponse';\nimport type { InsightsEvents } from '../model/insightsEvents';\n\nexport const apiClientVersion = '5.2.4';\n\nexport const REGIONS = ['de', 'us'] as const;\nexport type Region = (typeof REGIONS)[number];\n\nfunction getDefaultHosts(region?: Region): Host[] {\n const url = !region ? 'insights.algolia.io' : 'insights.{region}.algolia.io'.replace('{region}', region);\n\n return [{ url, accept: 'readWrite', protocol: 'https' }];\n}\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function createInsightsClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n region: regionOption,\n ...options\n}: CreateClientOptions & { region?: Region }) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n const transporter = createTransporter({\n hosts: getDefaultHosts(regionOption),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'Insights',\n version: apiClientVersion,\n }),\n baseHeaders: {\n 'content-type': 'text/plain',\n ...auth.headers(),\n ...options.baseHeaders,\n },\n baseQueryParameters: {\n ...auth.queryParameters(),\n ...options.baseQueryParameters,\n },\n });\n\n return {\n transporter,\n\n /**\n * The `appId` currently in use.\n */\n appId: appIdOption,\n\n /**\n * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string): void {\n transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customDelete`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customGet`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPost`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPut`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Deletes all events related to the specified user token from events metrics and analytics. The deletion is asynchronous, and processed within 48 hours. To delete a personalization user profile, see `Delete a user profile` in the Personalization API.\n *\n * @param deleteUserToken - The deleteUserToken object.\n * @param deleteUserToken.userToken - User token for which to delete all associated events.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteUserToken({ userToken }: DeleteUserTokenProps, requestOptions?: RequestOptions): Promise<void> {\n if (!userToken) {\n throw new Error('Parameter `userToken` is required when calling `deleteUserToken`.');\n }\n\n const requestPath = '/1/usertokens/{userToken}'.replace('{userToken}', encodeURIComponent(userToken));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Sends 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.\n *\n * @param insightsEvents - The insightsEvents object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n pushEvents(insightsEvents: InsightsEvents, requestOptions?: RequestOptions): Promise<EventsResponse> {\n if (!insightsEvents) {\n throw new Error('Parameter `insightsEvents` is required when calling `pushEvents`.');\n }\n\n if (!insightsEvents.events) {\n throw new Error('Parameter `insightsEvents.events` is required when calling `pushEvents`.');\n }\n\n const requestPath = '/1/events';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: insightsEvents,\n };\n\n return transporter.request(request, requestOptions);\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,IAAAA,wBAMO;AACP,iCAAoC;;;ACRpC,2BAA+D;AAoBxD,IAAM,mBAAmB;AAEzB,IAAM,UAAU,CAAC,MAAM,IAAI;AAGlC,SAAS,gBAAgB,QAAyB;AAChD,QAAM,MAAM,CAAC,SAAS,wBAAwB,+BAA+B,QAAQ,YAAY,MAAM;AAEvG,SAAO,CAAC,EAAE,KAAK,QAAQ,aAAa,UAAU,QAAQ,CAAC;AACzD;AAGO,SAAS,qBAAqB;AAAA,EACnC,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,GAAG;AACL,GAA8C;AAC5C,QAAM,WAAO,iCAAW,aAAa,cAAc,QAAQ;AAC3D,QAAM,kBAAc,wCAAkB;AAAA,IACpC,OAAO,gBAAgB,YAAY;AAAA,IACnC,GAAG;AAAA,IACH,kBAAc,sCAAgB;AAAA,MAC5B;AAAA,MACA,QAAQ;AAAA,MACR,SAAS;AAAA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,MACA;AAAA,MACA,UAAU;AAAA,QACR,SAAS;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,MACA,eAAW,gDAAoB;AAAA,MAC/B,eAAe,CAAC,EAAE,SAAS,WAAW,SAAS,QAAQ,SAAS,KAAK,CAAC;AAAA,MACtE,oBAAgB,uCAAgB;AAAA,MAChC,mBAAe,uCAAgB;AAAA,MAC/B,gBAAY,yCAAkB;AAAA,MAC9B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;","names":["import_client_common"]}
@@ -0,0 +1,253 @@
1
+ // builds/node.ts
2
+ import {
3
+ createMemoryCache,
4
+ createNullCache,
5
+ DEFAULT_CONNECT_TIMEOUT_NODE,
6
+ DEFAULT_READ_TIMEOUT_NODE,
7
+ DEFAULT_WRITE_TIMEOUT_NODE
8
+ } from "@algolia/client-common";
9
+ import { createHttpRequester } from "@algolia/requester-node-http";
10
+
11
+ // src/insightsClient.ts
12
+ import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
13
+ var apiClientVersion = "5.2.4";
14
+ var REGIONS = ["de", "us"];
15
+ function getDefaultHosts(region) {
16
+ const url = !region ? "insights.algolia.io" : "insights.{region}.algolia.io".replace("{region}", region);
17
+ return [{ url, accept: "readWrite", protocol: "https" }];
18
+ }
19
+ function createInsightsClient({
20
+ appId: appIdOption,
21
+ apiKey: apiKeyOption,
22
+ authMode,
23
+ algoliaAgents,
24
+ region: regionOption,
25
+ ...options
26
+ }) {
27
+ const auth = createAuth(appIdOption, apiKeyOption, authMode);
28
+ const transporter = createTransporter({
29
+ hosts: getDefaultHosts(regionOption),
30
+ ...options,
31
+ algoliaAgent: getAlgoliaAgent({
32
+ algoliaAgents,
33
+ client: "Insights",
34
+ version: apiClientVersion
35
+ }),
36
+ baseHeaders: {
37
+ "content-type": "text/plain",
38
+ ...auth.headers(),
39
+ ...options.baseHeaders
40
+ },
41
+ baseQueryParameters: {
42
+ ...auth.queryParameters(),
43
+ ...options.baseQueryParameters
44
+ }
45
+ });
46
+ return {
47
+ transporter,
48
+ /**
49
+ * The `appId` currently in use.
50
+ */
51
+ appId: appIdOption,
52
+ /**
53
+ * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
54
+ */
55
+ clearCache() {
56
+ return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
57
+ },
58
+ /**
59
+ * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
60
+ */
61
+ get _ua() {
62
+ return transporter.algoliaAgent.value;
63
+ },
64
+ /**
65
+ * Adds a `segment` to the `x-algolia-agent` sent with every requests.
66
+ *
67
+ * @param segment - The algolia agent (user-agent) segment to add.
68
+ * @param version - The version of the agent.
69
+ */
70
+ addAlgoliaAgent(segment, version) {
71
+ transporter.algoliaAgent.add({ segment, version });
72
+ },
73
+ /**
74
+ * This method allow you to send requests to the Algolia REST API.
75
+ *
76
+ * @param customDelete - The customDelete object.
77
+ * @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
78
+ * @param customDelete.parameters - Query parameters to apply to the current query.
79
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
80
+ */
81
+ customDelete({ path, parameters }, requestOptions) {
82
+ if (!path) {
83
+ throw new Error("Parameter `path` is required when calling `customDelete`.");
84
+ }
85
+ const requestPath = "/{path}".replace("{path}", path);
86
+ const headers = {};
87
+ const queryParameters = parameters ? parameters : {};
88
+ const request = {
89
+ method: "DELETE",
90
+ path: requestPath,
91
+ queryParameters,
92
+ headers
93
+ };
94
+ return transporter.request(request, requestOptions);
95
+ },
96
+ /**
97
+ * This method allow you to send requests to the Algolia REST API.
98
+ *
99
+ * @param customGet - The customGet object.
100
+ * @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
101
+ * @param customGet.parameters - Query parameters to apply to the current query.
102
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
103
+ */
104
+ customGet({ path, parameters }, requestOptions) {
105
+ if (!path) {
106
+ throw new Error("Parameter `path` is required when calling `customGet`.");
107
+ }
108
+ const requestPath = "/{path}".replace("{path}", path);
109
+ const headers = {};
110
+ const queryParameters = parameters ? parameters : {};
111
+ const request = {
112
+ method: "GET",
113
+ path: requestPath,
114
+ queryParameters,
115
+ headers
116
+ };
117
+ return transporter.request(request, requestOptions);
118
+ },
119
+ /**
120
+ * This method allow you to send requests to the Algolia REST API.
121
+ *
122
+ * @param customPost - The customPost object.
123
+ * @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
124
+ * @param customPost.parameters - Query parameters to apply to the current query.
125
+ * @param customPost.body - Parameters to send with the custom request.
126
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
127
+ */
128
+ customPost({ path, parameters, body }, requestOptions) {
129
+ if (!path) {
130
+ throw new Error("Parameter `path` is required when calling `customPost`.");
131
+ }
132
+ const requestPath = "/{path}".replace("{path}", path);
133
+ const headers = {};
134
+ const queryParameters = parameters ? parameters : {};
135
+ const request = {
136
+ method: "POST",
137
+ path: requestPath,
138
+ queryParameters,
139
+ headers,
140
+ data: body ? body : {}
141
+ };
142
+ return transporter.request(request, requestOptions);
143
+ },
144
+ /**
145
+ * This method allow you to send requests to the Algolia REST API.
146
+ *
147
+ * @param customPut - The customPut object.
148
+ * @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
149
+ * @param customPut.parameters - Query parameters to apply to the current query.
150
+ * @param customPut.body - Parameters to send with the custom request.
151
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
152
+ */
153
+ customPut({ path, parameters, body }, requestOptions) {
154
+ if (!path) {
155
+ throw new Error("Parameter `path` is required when calling `customPut`.");
156
+ }
157
+ const requestPath = "/{path}".replace("{path}", path);
158
+ const headers = {};
159
+ const queryParameters = parameters ? parameters : {};
160
+ const request = {
161
+ method: "PUT",
162
+ path: requestPath,
163
+ queryParameters,
164
+ headers,
165
+ data: body ? body : {}
166
+ };
167
+ return transporter.request(request, requestOptions);
168
+ },
169
+ /**
170
+ * Deletes all events related to the specified user token from events metrics and analytics. The deletion is asynchronous, and processed within 48 hours. To delete a personalization user profile, see `Delete a user profile` in the Personalization API.
171
+ *
172
+ * @param deleteUserToken - The deleteUserToken object.
173
+ * @param deleteUserToken.userToken - User token for which to delete all associated events.
174
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
175
+ */
176
+ deleteUserToken({ userToken }, requestOptions) {
177
+ if (!userToken) {
178
+ throw new Error("Parameter `userToken` is required when calling `deleteUserToken`.");
179
+ }
180
+ const requestPath = "/1/usertokens/{userToken}".replace("{userToken}", encodeURIComponent(userToken));
181
+ const headers = {};
182
+ const queryParameters = {};
183
+ const request = {
184
+ method: "DELETE",
185
+ path: requestPath,
186
+ queryParameters,
187
+ headers
188
+ };
189
+ return transporter.request(request, requestOptions);
190
+ },
191
+ /**
192
+ * Sends 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.
193
+ *
194
+ * @param insightsEvents - The insightsEvents object.
195
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
196
+ */
197
+ pushEvents(insightsEvents, requestOptions) {
198
+ if (!insightsEvents) {
199
+ throw new Error("Parameter `insightsEvents` is required when calling `pushEvents`.");
200
+ }
201
+ if (!insightsEvents.events) {
202
+ throw new Error("Parameter `insightsEvents.events` is required when calling `pushEvents`.");
203
+ }
204
+ const requestPath = "/1/events";
205
+ const headers = {};
206
+ const queryParameters = {};
207
+ const request = {
208
+ method: "POST",
209
+ path: requestPath,
210
+ queryParameters,
211
+ headers,
212
+ data: insightsEvents
213
+ };
214
+ return transporter.request(request, requestOptions);
215
+ }
216
+ };
217
+ }
218
+
219
+ // builds/node.ts
220
+ function insightsClient(appId, apiKey, region, options) {
221
+ if (!appId || typeof appId !== "string") {
222
+ throw new Error("`appId` is missing.");
223
+ }
224
+ if (!apiKey || typeof apiKey !== "string") {
225
+ throw new Error("`apiKey` is missing.");
226
+ }
227
+ if (region && (typeof region !== "string" || !REGIONS.includes(region))) {
228
+ throw new Error(`\`region\` must be one of the following: ${REGIONS.join(", ")}`);
229
+ }
230
+ return {
231
+ ...createInsightsClient({
232
+ appId,
233
+ apiKey,
234
+ region,
235
+ timeouts: {
236
+ connect: DEFAULT_CONNECT_TIMEOUT_NODE,
237
+ read: DEFAULT_READ_TIMEOUT_NODE,
238
+ write: DEFAULT_WRITE_TIMEOUT_NODE
239
+ },
240
+ requester: createHttpRequester(),
241
+ algoliaAgents: [{ segment: "Node.js", version: process.versions.node }],
242
+ responsesCache: createNullCache(),
243
+ requestsCache: createNullCache(),
244
+ hostsCache: createMemoryCache(),
245
+ ...options
246
+ })
247
+ };
248
+ }
249
+ export {
250
+ apiClientVersion,
251
+ insightsClient
252
+ };
253
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../builds/node.ts","../../src/insightsClient.ts"],"sourcesContent":["// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport type { ClientOptions } from '@algolia/client-common';\nimport {\n createMemoryCache,\n createNullCache,\n DEFAULT_CONNECT_TIMEOUT_NODE,\n DEFAULT_READ_TIMEOUT_NODE,\n DEFAULT_WRITE_TIMEOUT_NODE,\n} from '@algolia/client-common';\nimport { createHttpRequester } from '@algolia/requester-node-http';\n\nimport type { Region } from '../src/insightsClient';\nimport { createInsightsClient, REGIONS } from '../src/insightsClient';\n\nexport { apiClientVersion, Region } from '../src/insightsClient';\nexport * from '../model';\n\n/**\n * The client type.\n */\nexport type InsightsClient = ReturnType<typeof insightsClient>;\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function insightsClient(appId: string, apiKey: string, region?: Region, options?: ClientOptions) {\n if (!appId || typeof appId !== 'string') {\n throw new Error('`appId` is missing.');\n }\n\n if (!apiKey || typeof apiKey !== 'string') {\n throw new Error('`apiKey` is missing.');\n }\n\n if (region && (typeof region !== 'string' || !REGIONS.includes(region))) {\n throw new Error(`\\`region\\` must be one of the following: ${REGIONS.join(', ')}`);\n }\n\n return {\n ...createInsightsClient({\n appId,\n apiKey,\n region,\n timeouts: {\n connect: DEFAULT_CONNECT_TIMEOUT_NODE,\n read: DEFAULT_READ_TIMEOUT_NODE,\n write: DEFAULT_WRITE_TIMEOUT_NODE,\n },\n requester: createHttpRequester(),\n algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],\n responsesCache: createNullCache(),\n requestsCache: createNullCache(),\n hostsCache: createMemoryCache(),\n ...options,\n }),\n };\n}\n","// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport { createAuth, createTransporter, getAlgoliaAgent } from '@algolia/client-common';\nimport type {\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n} from '@algolia/client-common';\n\nimport type {\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteUserTokenProps,\n} from '../model/clientMethodProps';\nimport type { EventsResponse } from '../model/eventsResponse';\nimport type { InsightsEvents } from '../model/insightsEvents';\n\nexport const apiClientVersion = '5.2.4';\n\nexport const REGIONS = ['de', 'us'] as const;\nexport type Region = (typeof REGIONS)[number];\n\nfunction getDefaultHosts(region?: Region): Host[] {\n const url = !region ? 'insights.algolia.io' : 'insights.{region}.algolia.io'.replace('{region}', region);\n\n return [{ url, accept: 'readWrite', protocol: 'https' }];\n}\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function createInsightsClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n region: regionOption,\n ...options\n}: CreateClientOptions & { region?: Region }) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n const transporter = createTransporter({\n hosts: getDefaultHosts(regionOption),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'Insights',\n version: apiClientVersion,\n }),\n baseHeaders: {\n 'content-type': 'text/plain',\n ...auth.headers(),\n ...options.baseHeaders,\n },\n baseQueryParameters: {\n ...auth.queryParameters(),\n ...options.baseQueryParameters,\n },\n });\n\n return {\n transporter,\n\n /**\n * The `appId` currently in use.\n */\n appId: appIdOption,\n\n /**\n * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string): void {\n transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customDelete`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customGet`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPost`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPut`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Deletes all events related to the specified user token from events metrics and analytics. The deletion is asynchronous, and processed within 48 hours. To delete a personalization user profile, see `Delete a user profile` in the Personalization API.\n *\n * @param deleteUserToken - The deleteUserToken object.\n * @param deleteUserToken.userToken - User token for which to delete all associated events.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteUserToken({ userToken }: DeleteUserTokenProps, requestOptions?: RequestOptions): Promise<void> {\n if (!userToken) {\n throw new Error('Parameter `userToken` is required when calling `deleteUserToken`.');\n }\n\n const requestPath = '/1/usertokens/{userToken}'.replace('{userToken}', encodeURIComponent(userToken));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Sends 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.\n *\n * @param insightsEvents - The insightsEvents object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n pushEvents(insightsEvents: InsightsEvents, requestOptions?: RequestOptions): Promise<EventsResponse> {\n if (!insightsEvents) {\n throw new Error('Parameter `insightsEvents` is required when calling `pushEvents`.');\n }\n\n if (!insightsEvents.events) {\n throw new Error('Parameter `insightsEvents.events` is required when calling `pushEvents`.');\n }\n\n const requestPath = '/1/events';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: insightsEvents,\n };\n\n return transporter.request(request, requestOptions);\n },\n };\n}\n"],"mappings":";AAGA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,2BAA2B;;;ACRpC,SAAS,YAAY,mBAAmB,uBAAuB;AAoBxD,IAAM,mBAAmB;AAEzB,IAAM,UAAU,C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