@algolia/client-insights 5.0.0-alpha.6 → 5.0.0-alpha.60
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.
- package/dist/builds/browser.d.ts +5 -5
- package/dist/builds/browser.d.ts.map +1 -1
- package/dist/builds/node.d.ts +5 -5
- package/dist/builds/node.d.ts.map +1 -1
- package/dist/client-insights.cjs.js +214 -214
- package/dist/client-insights.esm.browser.js +397 -445
- package/dist/client-insights.esm.node.js +214 -214
- package/dist/client-insights.umd.js +2 -2
- package/dist/model/clientMethodProps.d.ts +60 -60
- package/dist/model/clientMethodProps.d.ts.map +1 -1
- package/dist/model/errorBase.d.ts +6 -6
- package/dist/model/errorBase.d.ts.map +1 -1
- package/dist/model/eventType.d.ts +1 -1
- package/dist/model/eventType.d.ts.map +1 -1
- package/dist/model/index.d.ts +6 -6
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/insightEvent.d.ts +39 -39
- package/dist/model/insightEvent.d.ts.map +1 -1
- package/dist/model/insightEvents.d.ts +10 -10
- package/dist/model/insightEvents.d.ts.map +1 -1
- package/dist/model/pushEventsResponse.d.ts +6 -6
- package/dist/model/pushEventsResponse.d.ts.map +1 -1
- package/dist/src/insightsClient.d.ts +85 -85
- package/dist/src/insightsClient.d.ts.map +1 -1
- package/model/clientMethodProps.ts +1 -1
- package/model/errorBase.ts +1 -1
- package/model/eventType.ts +1 -1
- package/model/index.ts +1 -1
- package/model/insightEvent.ts +1 -1
- package/model/insightEvents.ts +1 -1
- package/model/pushEventsResponse.ts +1 -1
- package/package.json +31 -13
package/dist/builds/browser.d.ts
CHANGED
|
@@ -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":["
|
|
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"}
|
package/dist/builds/node.d.ts
CHANGED
|
@@ -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":["
|
|
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"}
|
|
@@ -5,222 +5,222 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var clientCommon = require('@algolia/client-common');
|
|
6
6
|
var requesterNodeHttp = require('@algolia/requester-node-http');
|
|
7
7
|
|
|
8
|
-
//
|
|
9
|
-
const apiClientVersion = '5.0.0-alpha.
|
|
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
|
-
};
|
|
8
|
+
// 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.
|
|
9
|
+
const apiClientVersion = '5.0.0-alpha.60';
|
|
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
|
+
};
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
//
|
|
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
|
-
});
|
|
197
|
+
// 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.
|
|
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
|
+
});
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
exports.apiClientVersion = apiClientVersion;
|