@algolia/client-personalization 5.0.0-alpha.8 → 5.0.0-alpha.81
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-personalization.cjs.js → client-personalization.cjs} +283 -285
- package/dist/client-personalization.esm.browser.js +466 -514
- package/dist/client-personalization.esm.node.js +283 -283
- package/dist/client-personalization.umd.js +2 -2
- package/dist/model/clientMethodProps.d.ts +78 -78
- package/dist/model/clientMethodProps.d.ts.map +1 -1
- package/dist/model/deleteUserProfileResponse.d.ts +10 -10
- package/dist/model/deleteUserProfileResponse.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/eventScoring.d.ts +14 -14
- package/dist/model/eventScoring.d.ts.map +1 -1
- package/dist/model/facetScoring.d.ts +10 -10
- package/dist/model/facetScoring.d.ts.map +1 -1
- package/dist/model/getUserTokenResponse.d.ts +14 -14
- package/dist/model/getUserTokenResponse.d.ts.map +1 -1
- package/dist/model/index.d.ts +8 -8
- package/dist/model/personalizationStrategyParams.d.ts +16 -16
- package/dist/model/personalizationStrategyParams.d.ts.map +1 -1
- package/dist/model/setPersonalizationStrategyResponse.d.ts +6 -6
- package/dist/model/setPersonalizationStrategyResponse.d.ts.map +1 -1
- package/dist/src/personalizationClient.d.ts +112 -112
- package/dist/src/personalizationClient.d.ts.map +1 -1
- package/index.js +1 -1
- package/model/clientMethodProps.ts +11 -11
- package/model/deleteUserProfileResponse.ts +1 -1
- package/model/errorBase.ts +1 -1
- package/model/eventScoring.ts +1 -1
- package/model/facetScoring.ts +1 -1
- package/model/getUserTokenResponse.ts +1 -1
- package/model/index.ts +1 -1
- package/model/personalizationStrategyParams.ts +1 -1
- package/model/setPersonalizationStrategyResponse.ts +1 -1
- package/package.json +30 -13
package/dist/builds/browser.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ClientOptions } from '@algolia/client-common';
|
|
2
|
-
import type { PersonalizationClient, Region } from '../src/personalizationClient';
|
|
3
|
-
export { apiClientVersion, PersonalizationClient, } from '../src/personalizationClient';
|
|
4
|
-
export * from '../model';
|
|
5
|
-
export declare function personalizationClient(appId: string, apiKey: string, region: Region, options?: ClientOptions): PersonalizationClient;
|
|
1
|
+
import type { ClientOptions } from '@algolia/client-common';
|
|
2
|
+
import type { PersonalizationClient, Region } from '../src/personalizationClient';
|
|
3
|
+
export { apiClientVersion, PersonalizationClient, Region, } from '../src/personalizationClient';
|
|
4
|
+
export * from '../model';
|
|
5
|
+
export declare function personalizationClient(appId: string, apiKey: string, region: Region, options?: ClientOptions): PersonalizationClient;
|
|
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,EACV,qBAAqB,EACrB,MAAM,EACP,MAAM,8BAA8B,CAAC;AAOtC,OAAO,EACL,gBAAgB,EAChB,qBAAqB,
|
|
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,EACV,qBAAqB,EACrB,MAAM,EACP,MAAM,8BAA8B,CAAC;AAOtC,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,MAAM,GACP,MAAM,8BAA8B,CAAC;AACtC,cAAc,UAAU,CAAC;AAEzB,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,aAAa,GACtB,qBAAqB,CA0CvB"}
|
package/dist/builds/node.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ClientOptions } from '@algolia/client-common';
|
|
2
|
-
import type { PersonalizationClient, Region } from '../src/personalizationClient';
|
|
3
|
-
export { apiClientVersion, PersonalizationClient, } from '../src/personalizationClient';
|
|
4
|
-
export * from '../model';
|
|
5
|
-
export declare function personalizationClient(appId: string, apiKey: string, region: Region, options?: ClientOptions): PersonalizationClient;
|
|
1
|
+
import type { ClientOptions } from '@algolia/client-common';
|
|
2
|
+
import type { PersonalizationClient, Region } from '../src/personalizationClient';
|
|
3
|
+
export { apiClientVersion, PersonalizationClient, Region, } from '../src/personalizationClient';
|
|
4
|
+
export * from '../model';
|
|
5
|
+
export declare function personalizationClient(appId: string, apiKey: string, region: Region, options?: ClientOptions): PersonalizationClient;
|
|
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,EACV,qBAAqB,EACrB,MAAM,EACP,MAAM,8BAA8B,CAAC;AAMtC,OAAO,EACL,gBAAgB,EAChB,qBAAqB,
|
|
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,EACV,qBAAqB,EACrB,MAAM,EACP,MAAM,8BAA8B,CAAC;AAMtC,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,MAAM,GACP,MAAM,8BAA8B,CAAC;AACtC,cAAc,UAAU,CAAC;AAEzB,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,aAAa,GACtB,qBAAqB,CAoCvB"}
|
|
@@ -1,295 +1,293 @@
|
|
|
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
|
-
//
|
|
9
|
-
const apiClientVersion = '5.0.0-alpha.
|
|
10
|
-
const REGIONS = ['eu', 'us'];
|
|
11
|
-
function getDefaultHosts(region) {
|
|
12
|
-
const url = 'personalization.{region}.algolia.com'.replace('{region}', region);
|
|
13
|
-
return [{ url, accept: 'readWrite', protocol: 'https' }];
|
|
14
|
-
}
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
16
|
-
function createPersonalizationClient({ 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: 'Personalization',
|
|
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
|
-
* @summary Send requests to the Algolia REST API.
|
|
70
|
-
* @param del - The del object.
|
|
71
|
-
* @param del.path -
|
|
72
|
-
* @param del.parameters - Query parameters to
|
|
73
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
74
|
-
*/
|
|
75
|
-
del({ path, parameters }, requestOptions) {
|
|
76
|
-
if (!path) {
|
|
77
|
-
throw new Error('Parameter `path` is required when calling `del`.');
|
|
78
|
-
}
|
|
79
|
-
const requestPath = '/1{path}'.replace('{path}', path);
|
|
80
|
-
const headers = {};
|
|
81
|
-
const queryParameters = parameters ? parameters : {};
|
|
82
|
-
const request = {
|
|
83
|
-
method: 'DELETE',
|
|
84
|
-
path: requestPath,
|
|
85
|
-
queryParameters,
|
|
86
|
-
headers,
|
|
87
|
-
};
|
|
88
|
-
return transporter.request(request, requestOptions);
|
|
89
|
-
},
|
|
90
|
-
/**
|
|
91
|
-
* Delete the user profile and all its associated data. Returns, as part of the response, a date until which the data can safely be considered as deleted for the given user. This means if you send events for the given user before this date, they will be ignored. Any data received after the deletedUntil date will start building a new user profile. It might take a couple hours for the deletion request to be fully processed.
|
|
92
|
-
*
|
|
93
|
-
* @summary Delete a user profile.
|
|
94
|
-
* @param deleteUserProfile - The deleteUserProfile object.
|
|
95
|
-
* @param deleteUserProfile.userToken - UserToken representing the user for which to fetch the Personalization profile.
|
|
96
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
97
|
-
*/
|
|
98
|
-
deleteUserProfile({ userToken }, requestOptions) {
|
|
99
|
-
if (!userToken) {
|
|
100
|
-
throw new Error('Parameter `userToken` is required when calling `deleteUserProfile`.');
|
|
101
|
-
}
|
|
102
|
-
const requestPath = '/1/profiles/{userToken}'.replace('{userToken}', encodeURIComponent(userToken));
|
|
103
|
-
const headers = {};
|
|
104
|
-
const queryParameters = {};
|
|
105
|
-
const request = {
|
|
106
|
-
method: 'DELETE',
|
|
107
|
-
path: requestPath,
|
|
108
|
-
queryParameters,
|
|
109
|
-
headers,
|
|
110
|
-
};
|
|
111
|
-
return transporter.request(request, requestOptions);
|
|
112
|
-
},
|
|
113
|
-
/**
|
|
114
|
-
* This method allow you to send requests to the Algolia REST API.
|
|
115
|
-
*
|
|
116
|
-
* @summary Send requests to the Algolia REST API.
|
|
117
|
-
* @param get - The get object.
|
|
118
|
-
* @param get.path -
|
|
119
|
-
* @param get.parameters - Query parameters to
|
|
120
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
121
|
-
*/
|
|
122
|
-
get({ path, parameters }, requestOptions) {
|
|
123
|
-
if (!path) {
|
|
124
|
-
throw new Error('Parameter `path` is required when calling `get`.');
|
|
125
|
-
}
|
|
126
|
-
const requestPath = '/1{path}'.replace('{path}', path);
|
|
127
|
-
const headers = {};
|
|
128
|
-
const queryParameters = parameters ? parameters : {};
|
|
129
|
-
const request = {
|
|
130
|
-
method: 'GET',
|
|
131
|
-
path: requestPath,
|
|
132
|
-
queryParameters,
|
|
133
|
-
headers,
|
|
134
|
-
};
|
|
135
|
-
return transporter.request(request, requestOptions);
|
|
136
|
-
},
|
|
137
|
-
/**
|
|
138
|
-
* The strategy contains information on the events and facets that impact user profiles and personalized search results.
|
|
139
|
-
*
|
|
140
|
-
* @summary Get the current strategy.
|
|
141
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
142
|
-
*/
|
|
143
|
-
getPersonalizationStrategy(requestOptions) {
|
|
144
|
-
const requestPath = '/1/strategies/personalization';
|
|
145
|
-
const headers = {};
|
|
146
|
-
const queryParameters = {};
|
|
147
|
-
const request = {
|
|
148
|
-
method: 'GET',
|
|
149
|
-
path: requestPath,
|
|
150
|
-
queryParameters,
|
|
151
|
-
headers,
|
|
152
|
-
};
|
|
153
|
-
return transporter.request(request, requestOptions);
|
|
154
|
-
},
|
|
155
|
-
/**
|
|
156
|
-
* Get the user profile built from Personalization strategy. The profile is structured by facet name used in the strategy. Each facet value is mapped to its score. Each score represents the user affinity for a specific facet value given the userToken past events and the Personalization strategy defined. Scores are bounded to 20. The last processed event timestamp is provided using the ISO 8601 format for debugging purposes.
|
|
157
|
-
*
|
|
158
|
-
* @summary Get a user profile.
|
|
159
|
-
* @param getUserTokenProfile - The getUserTokenProfile object.
|
|
160
|
-
* @param getUserTokenProfile.userToken - UserToken representing the user for which to fetch the Personalization profile.
|
|
161
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
162
|
-
*/
|
|
163
|
-
getUserTokenProfile({ userToken }, requestOptions) {
|
|
164
|
-
if (!userToken) {
|
|
165
|
-
throw new Error('Parameter `userToken` is required when calling `getUserTokenProfile`.');
|
|
166
|
-
}
|
|
167
|
-
const requestPath = '/1/profiles/personalization/{userToken}'.replace('{userToken}', encodeURIComponent(userToken));
|
|
168
|
-
const headers = {};
|
|
169
|
-
const queryParameters = {};
|
|
170
|
-
const request = {
|
|
171
|
-
method: 'GET',
|
|
172
|
-
path: requestPath,
|
|
173
|
-
queryParameters,
|
|
174
|
-
headers,
|
|
175
|
-
};
|
|
176
|
-
return transporter.request(request, requestOptions);
|
|
177
|
-
},
|
|
178
|
-
/**
|
|
179
|
-
* This method allow you to send requests to the Algolia REST API.
|
|
180
|
-
*
|
|
181
|
-
* @summary Send requests to the Algolia REST API.
|
|
182
|
-
* @param post - The post object.
|
|
183
|
-
* @param post.path -
|
|
184
|
-
* @param post.parameters - Query parameters to
|
|
185
|
-
* @param post.body -
|
|
186
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
187
|
-
*/
|
|
188
|
-
post({ path, parameters, body }, requestOptions) {
|
|
189
|
-
if (!path) {
|
|
190
|
-
throw new Error('Parameter `path` is required when calling `post`.');
|
|
191
|
-
}
|
|
192
|
-
const requestPath = '/1{path}'.replace('{path}', path);
|
|
193
|
-
const headers = {};
|
|
194
|
-
const queryParameters = parameters ? parameters : {};
|
|
195
|
-
const request = {
|
|
196
|
-
method: 'POST',
|
|
197
|
-
path: requestPath,
|
|
198
|
-
queryParameters,
|
|
199
|
-
headers,
|
|
200
|
-
data: body ? body : {},
|
|
201
|
-
};
|
|
202
|
-
return transporter.request(request, requestOptions);
|
|
203
|
-
},
|
|
204
|
-
/**
|
|
205
|
-
* This method allow you to send requests to the Algolia REST API.
|
|
206
|
-
*
|
|
207
|
-
* @summary Send requests to the Algolia REST API.
|
|
208
|
-
* @param put - The put object.
|
|
209
|
-
* @param put.path -
|
|
210
|
-
* @param put.parameters - Query parameters to
|
|
211
|
-
* @param put.body -
|
|
212
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
213
|
-
*/
|
|
214
|
-
put({ path, parameters, body }, requestOptions) {
|
|
215
|
-
if (!path) {
|
|
216
|
-
throw new Error('Parameter `path` is required when calling `put`.');
|
|
217
|
-
}
|
|
218
|
-
const requestPath = '/1{path}'.replace('{path}', path);
|
|
219
|
-
const headers = {};
|
|
220
|
-
const queryParameters = parameters ? parameters : {};
|
|
221
|
-
const request = {
|
|
222
|
-
method: 'PUT',
|
|
223
|
-
path: requestPath,
|
|
224
|
-
queryParameters,
|
|
225
|
-
headers,
|
|
226
|
-
data: body ? body : {},
|
|
227
|
-
};
|
|
228
|
-
return transporter.request(request, requestOptions);
|
|
229
|
-
},
|
|
230
|
-
/**
|
|
231
|
-
* A strategy defines the events and facets that impact user profiles and personalized search results.
|
|
232
|
-
*
|
|
233
|
-
* @summary Set a new strategy.
|
|
234
|
-
* @param personalizationStrategyParams - The personalizationStrategyParams object.
|
|
235
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
236
|
-
*/
|
|
237
|
-
setPersonalizationStrategy(personalizationStrategyParams, requestOptions) {
|
|
238
|
-
if (!personalizationStrategyParams) {
|
|
239
|
-
throw new Error('Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.');
|
|
240
|
-
}
|
|
241
|
-
if (!personalizationStrategyParams.eventScoring) {
|
|
242
|
-
throw new Error('Parameter `personalizationStrategyParams.eventScoring` is required when calling `setPersonalizationStrategy`.');
|
|
243
|
-
}
|
|
244
|
-
if (!personalizationStrategyParams.facetScoring) {
|
|
245
|
-
throw new Error('Parameter `personalizationStrategyParams.facetScoring` is required when calling `setPersonalizationStrategy`.');
|
|
246
|
-
}
|
|
247
|
-
if (!personalizationStrategyParams.personalizationImpact) {
|
|
248
|
-
throw new Error('Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.');
|
|
249
|
-
}
|
|
250
|
-
const requestPath = '/1/strategies/personalization';
|
|
251
|
-
const headers = {};
|
|
252
|
-
const queryParameters = {};
|
|
253
|
-
const request = {
|
|
254
|
-
method: 'POST',
|
|
255
|
-
path: requestPath,
|
|
256
|
-
queryParameters,
|
|
257
|
-
headers,
|
|
258
|
-
data: personalizationStrategyParams,
|
|
259
|
-
};
|
|
260
|
-
return transporter.request(request, requestOptions);
|
|
261
|
-
},
|
|
262
|
-
};
|
|
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.81';
|
|
8
|
+
const REGIONS = ['eu', 'us'];
|
|
9
|
+
function getDefaultHosts(region) {
|
|
10
|
+
const url = 'personalization.{region}.algolia.com'.replace('{region}', region);
|
|
11
|
+
return [{ url, accept: 'readWrite', protocol: 'https' }];
|
|
12
|
+
}
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
14
|
+
function createPersonalizationClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }) {
|
|
15
|
+
const auth = clientCommon.createAuth(appIdOption, apiKeyOption, authMode);
|
|
16
|
+
const transporter = clientCommon.createTransporter({
|
|
17
|
+
hosts: getDefaultHosts(regionOption),
|
|
18
|
+
...options,
|
|
19
|
+
algoliaAgent: clientCommon.getAlgoliaAgent({
|
|
20
|
+
algoliaAgents,
|
|
21
|
+
client: 'Personalization',
|
|
22
|
+
version: apiClientVersion,
|
|
23
|
+
}),
|
|
24
|
+
baseHeaders: {
|
|
25
|
+
'content-type': 'text/plain',
|
|
26
|
+
...auth.headers(),
|
|
27
|
+
...options.baseHeaders,
|
|
28
|
+
},
|
|
29
|
+
baseQueryParameters: {
|
|
30
|
+
...auth.queryParameters(),
|
|
31
|
+
...options.baseQueryParameters,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
return {
|
|
35
|
+
transporter,
|
|
36
|
+
/**
|
|
37
|
+
* The `appId` currently in use.
|
|
38
|
+
*/
|
|
39
|
+
appId: appIdOption,
|
|
40
|
+
/**
|
|
41
|
+
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
|
|
42
|
+
*/
|
|
43
|
+
clearCache() {
|
|
44
|
+
return Promise.all([
|
|
45
|
+
transporter.requestsCache.clear(),
|
|
46
|
+
transporter.responsesCache.clear(),
|
|
47
|
+
]).then(() => undefined);
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
|
|
51
|
+
*/
|
|
52
|
+
get _ua() {
|
|
53
|
+
return transporter.algoliaAgent.value;
|
|
54
|
+
},
|
|
55
|
+
/**
|
|
56
|
+
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
|
|
57
|
+
*
|
|
58
|
+
* @param segment - The algolia agent (user-agent) segment to add.
|
|
59
|
+
* @param version - The version of the agent.
|
|
60
|
+
*/
|
|
61
|
+
addAlgoliaAgent(segment, version) {
|
|
62
|
+
transporter.algoliaAgent.add({ segment, version });
|
|
63
|
+
},
|
|
64
|
+
/**
|
|
65
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
66
|
+
*
|
|
67
|
+
* @summary Send requests to the Algolia REST API.
|
|
68
|
+
* @param del - The del object.
|
|
69
|
+
* @param del.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
70
|
+
* @param del.parameters - Query parameters to apply to the current query.
|
|
71
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
72
|
+
*/
|
|
73
|
+
del({ path, parameters }, requestOptions) {
|
|
74
|
+
if (!path) {
|
|
75
|
+
throw new Error('Parameter `path` is required when calling `del`.');
|
|
76
|
+
}
|
|
77
|
+
const requestPath = '/1{path}'.replace('{path}', path);
|
|
78
|
+
const headers = {};
|
|
79
|
+
const queryParameters = parameters ? parameters : {};
|
|
80
|
+
const request = {
|
|
81
|
+
method: 'DELETE',
|
|
82
|
+
path: requestPath,
|
|
83
|
+
queryParameters,
|
|
84
|
+
headers,
|
|
85
|
+
};
|
|
86
|
+
return transporter.request(request, requestOptions);
|
|
87
|
+
},
|
|
88
|
+
/**
|
|
89
|
+
* Delete the user profile and all its associated data. Returns, as part of the response, a date until which the data can safely be considered as deleted for the given user. This means if you send events for the given user before this date, they will be ignored. Any data received after the deletedUntil date will start building a new user profile. It might take a couple hours for the deletion request to be fully processed.
|
|
90
|
+
*
|
|
91
|
+
* @summary Delete a user profile.
|
|
92
|
+
* @param deleteUserProfile - The deleteUserProfile object.
|
|
93
|
+
* @param deleteUserProfile.userToken - UserToken representing the user for which to fetch the Personalization profile.
|
|
94
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
95
|
+
*/
|
|
96
|
+
deleteUserProfile({ userToken }, requestOptions) {
|
|
97
|
+
if (!userToken) {
|
|
98
|
+
throw new Error('Parameter `userToken` is required when calling `deleteUserProfile`.');
|
|
99
|
+
}
|
|
100
|
+
const requestPath = '/1/profiles/{userToken}'.replace('{userToken}', encodeURIComponent(userToken));
|
|
101
|
+
const headers = {};
|
|
102
|
+
const queryParameters = {};
|
|
103
|
+
const request = {
|
|
104
|
+
method: 'DELETE',
|
|
105
|
+
path: requestPath,
|
|
106
|
+
queryParameters,
|
|
107
|
+
headers,
|
|
108
|
+
};
|
|
109
|
+
return transporter.request(request, requestOptions);
|
|
110
|
+
},
|
|
111
|
+
/**
|
|
112
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
113
|
+
*
|
|
114
|
+
* @summary Send requests to the Algolia REST API.
|
|
115
|
+
* @param get - The get object.
|
|
116
|
+
* @param get.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
117
|
+
* @param get.parameters - Query parameters to apply to the current query.
|
|
118
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
119
|
+
*/
|
|
120
|
+
get({ path, parameters }, requestOptions) {
|
|
121
|
+
if (!path) {
|
|
122
|
+
throw new Error('Parameter `path` is required when calling `get`.');
|
|
123
|
+
}
|
|
124
|
+
const requestPath = '/1{path}'.replace('{path}', path);
|
|
125
|
+
const headers = {};
|
|
126
|
+
const queryParameters = parameters ? parameters : {};
|
|
127
|
+
const request = {
|
|
128
|
+
method: 'GET',
|
|
129
|
+
path: requestPath,
|
|
130
|
+
queryParameters,
|
|
131
|
+
headers,
|
|
132
|
+
};
|
|
133
|
+
return transporter.request(request, requestOptions);
|
|
134
|
+
},
|
|
135
|
+
/**
|
|
136
|
+
* The strategy contains information on the events and facets that impact user profiles and personalized search results.
|
|
137
|
+
*
|
|
138
|
+
* @summary Get the current strategy.
|
|
139
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
140
|
+
*/
|
|
141
|
+
getPersonalizationStrategy(requestOptions) {
|
|
142
|
+
const requestPath = '/1/strategies/personalization';
|
|
143
|
+
const headers = {};
|
|
144
|
+
const queryParameters = {};
|
|
145
|
+
const request = {
|
|
146
|
+
method: 'GET',
|
|
147
|
+
path: requestPath,
|
|
148
|
+
queryParameters,
|
|
149
|
+
headers,
|
|
150
|
+
};
|
|
151
|
+
return transporter.request(request, requestOptions);
|
|
152
|
+
},
|
|
153
|
+
/**
|
|
154
|
+
* Get the user profile built from Personalization strategy. The profile is structured by facet name used in the strategy. Each facet value is mapped to its score. Each score represents the user affinity for a specific facet value given the userToken past events and the Personalization strategy defined. Scores are bounded to 20. The last processed event timestamp is provided using the ISO 8601 format for debugging purposes.
|
|
155
|
+
*
|
|
156
|
+
* @summary Get a user profile.
|
|
157
|
+
* @param getUserTokenProfile - The getUserTokenProfile object.
|
|
158
|
+
* @param getUserTokenProfile.userToken - UserToken representing the user for which to fetch the Personalization profile.
|
|
159
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
160
|
+
*/
|
|
161
|
+
getUserTokenProfile({ userToken }, requestOptions) {
|
|
162
|
+
if (!userToken) {
|
|
163
|
+
throw new Error('Parameter `userToken` is required when calling `getUserTokenProfile`.');
|
|
164
|
+
}
|
|
165
|
+
const requestPath = '/1/profiles/personalization/{userToken}'.replace('{userToken}', encodeURIComponent(userToken));
|
|
166
|
+
const headers = {};
|
|
167
|
+
const queryParameters = {};
|
|
168
|
+
const request = {
|
|
169
|
+
method: 'GET',
|
|
170
|
+
path: requestPath,
|
|
171
|
+
queryParameters,
|
|
172
|
+
headers,
|
|
173
|
+
};
|
|
174
|
+
return transporter.request(request, requestOptions);
|
|
175
|
+
},
|
|
176
|
+
/**
|
|
177
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
178
|
+
*
|
|
179
|
+
* @summary Send requests to the Algolia REST API.
|
|
180
|
+
* @param post - The post object.
|
|
181
|
+
* @param post.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
182
|
+
* @param post.parameters - Query parameters to apply to the current query.
|
|
183
|
+
* @param post.body - Parameters to send with the custom request.
|
|
184
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
185
|
+
*/
|
|
186
|
+
post({ path, parameters, body }, requestOptions) {
|
|
187
|
+
if (!path) {
|
|
188
|
+
throw new Error('Parameter `path` is required when calling `post`.');
|
|
189
|
+
}
|
|
190
|
+
const requestPath = '/1{path}'.replace('{path}', path);
|
|
191
|
+
const headers = {};
|
|
192
|
+
const queryParameters = parameters ? parameters : {};
|
|
193
|
+
const request = {
|
|
194
|
+
method: 'POST',
|
|
195
|
+
path: requestPath,
|
|
196
|
+
queryParameters,
|
|
197
|
+
headers,
|
|
198
|
+
data: body ? body : {},
|
|
199
|
+
};
|
|
200
|
+
return transporter.request(request, requestOptions);
|
|
201
|
+
},
|
|
202
|
+
/**
|
|
203
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
204
|
+
*
|
|
205
|
+
* @summary Send requests to the Algolia REST API.
|
|
206
|
+
* @param put - The put object.
|
|
207
|
+
* @param put.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
208
|
+
* @param put.parameters - Query parameters to apply to the current query.
|
|
209
|
+
* @param put.body - Parameters to send with the custom request.
|
|
210
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
211
|
+
*/
|
|
212
|
+
put({ path, parameters, body }, requestOptions) {
|
|
213
|
+
if (!path) {
|
|
214
|
+
throw new Error('Parameter `path` is required when calling `put`.');
|
|
215
|
+
}
|
|
216
|
+
const requestPath = '/1{path}'.replace('{path}', path);
|
|
217
|
+
const headers = {};
|
|
218
|
+
const queryParameters = parameters ? parameters : {};
|
|
219
|
+
const request = {
|
|
220
|
+
method: 'PUT',
|
|
221
|
+
path: requestPath,
|
|
222
|
+
queryParameters,
|
|
223
|
+
headers,
|
|
224
|
+
data: body ? body : {},
|
|
225
|
+
};
|
|
226
|
+
return transporter.request(request, requestOptions);
|
|
227
|
+
},
|
|
228
|
+
/**
|
|
229
|
+
* A strategy defines the events and facets that impact user profiles and personalized search results.
|
|
230
|
+
*
|
|
231
|
+
* @summary Set a new strategy.
|
|
232
|
+
* @param personalizationStrategyParams - The personalizationStrategyParams object.
|
|
233
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
234
|
+
*/
|
|
235
|
+
setPersonalizationStrategy(personalizationStrategyParams, requestOptions) {
|
|
236
|
+
if (!personalizationStrategyParams) {
|
|
237
|
+
throw new Error('Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.');
|
|
238
|
+
}
|
|
239
|
+
if (!personalizationStrategyParams.eventScoring) {
|
|
240
|
+
throw new Error('Parameter `personalizationStrategyParams.eventScoring` is required when calling `setPersonalizationStrategy`.');
|
|
241
|
+
}
|
|
242
|
+
if (!personalizationStrategyParams.facetScoring) {
|
|
243
|
+
throw new Error('Parameter `personalizationStrategyParams.facetScoring` is required when calling `setPersonalizationStrategy`.');
|
|
244
|
+
}
|
|
245
|
+
if (!personalizationStrategyParams.personalizationImpact) {
|
|
246
|
+
throw new Error('Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.');
|
|
247
|
+
}
|
|
248
|
+
const requestPath = '/1/strategies/personalization';
|
|
249
|
+
const headers = {};
|
|
250
|
+
const queryParameters = {};
|
|
251
|
+
const request = {
|
|
252
|
+
method: 'POST',
|
|
253
|
+
path: requestPath,
|
|
254
|
+
queryParameters,
|
|
255
|
+
headers,
|
|
256
|
+
data: personalizationStrategyParams,
|
|
257
|
+
};
|
|
258
|
+
return transporter.request(request, requestOptions);
|
|
259
|
+
},
|
|
260
|
+
};
|
|
263
261
|
}
|
|
264
262
|
|
|
265
|
-
//
|
|
266
|
-
function personalizationClient(appId, apiKey, region, options) {
|
|
267
|
-
if (!appId || typeof appId !== 'string') {
|
|
268
|
-
throw new Error('`appId` is missing.');
|
|
269
|
-
}
|
|
270
|
-
if (!apiKey || typeof apiKey !== 'string') {
|
|
271
|
-
throw new Error('`apiKey` is missing.');
|
|
272
|
-
}
|
|
273
|
-
if (!region ||
|
|
274
|
-
(region && (typeof region !== 'string' || !REGIONS.includes(region)))) {
|
|
275
|
-
throw new Error(`\`region\` is required and must be one of the following: ${REGIONS.join(', ')}`);
|
|
276
|
-
}
|
|
277
|
-
return createPersonalizationClient({
|
|
278
|
-
appId,
|
|
279
|
-
apiKey,
|
|
280
|
-
region,
|
|
281
|
-
timeouts: {
|
|
282
|
-
connect: clientCommon.DEFAULT_CONNECT_TIMEOUT_NODE,
|
|
283
|
-
read: clientCommon.DEFAULT_READ_TIMEOUT_NODE,
|
|
284
|
-
write: clientCommon.DEFAULT_WRITE_TIMEOUT_NODE,
|
|
285
|
-
},
|
|
286
|
-
requester: requesterNodeHttp.createHttpRequester(),
|
|
287
|
-
algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],
|
|
288
|
-
responsesCache: clientCommon.createNullCache(),
|
|
289
|
-
requestsCache: clientCommon.createNullCache(),
|
|
290
|
-
hostsCache: clientCommon.createMemoryCache(),
|
|
291
|
-
...options,
|
|
292
|
-
});
|
|
263
|
+
// 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.
|
|
264
|
+
function personalizationClient(appId, apiKey, region, options) {
|
|
265
|
+
if (!appId || typeof appId !== 'string') {
|
|
266
|
+
throw new Error('`appId` is missing.');
|
|
267
|
+
}
|
|
268
|
+
if (!apiKey || typeof apiKey !== 'string') {
|
|
269
|
+
throw new Error('`apiKey` is missing.');
|
|
270
|
+
}
|
|
271
|
+
if (!region ||
|
|
272
|
+
(region && (typeof region !== 'string' || !REGIONS.includes(region)))) {
|
|
273
|
+
throw new Error(`\`region\` is required and must be one of the following: ${REGIONS.join(', ')}`);
|
|
274
|
+
}
|
|
275
|
+
return createPersonalizationClient({
|
|
276
|
+
appId,
|
|
277
|
+
apiKey,
|
|
278
|
+
region,
|
|
279
|
+
timeouts: {
|
|
280
|
+
connect: clientCommon.DEFAULT_CONNECT_TIMEOUT_NODE,
|
|
281
|
+
read: clientCommon.DEFAULT_READ_TIMEOUT_NODE,
|
|
282
|
+
write: clientCommon.DEFAULT_WRITE_TIMEOUT_NODE,
|
|
283
|
+
},
|
|
284
|
+
requester: requesterNodeHttp.createHttpRequester(),
|
|
285
|
+
algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],
|
|
286
|
+
responsesCache: clientCommon.createNullCache(),
|
|
287
|
+
requestsCache: clientCommon.createNullCache(),
|
|
288
|
+
hostsCache: clientCommon.createMemoryCache(),
|
|
289
|
+
...options,
|
|
290
|
+
});
|
|
293
291
|
}
|
|
294
292
|
|
|
295
293
|
exports.apiClientVersion = apiClientVersion;
|