Skip to content

Commit 100f4e7

Browse files
algolia-botraed667bengreenbankshortcuts
committed
feat(clients): add real-time personalization to advanced-personalization [PRED-3870] (generated)
algolia/api-clients-automation#4976 Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com> Co-authored-by: Raed <raed.chammam@algolia.com> Co-authored-by: Ben Greenbank <61185468+bengreenbank@users.noreply.github.com> Co-authored-by: Clément Vannicatte <vannicattec@gmail.com>
1 parent d6ee0f0 commit 100f4e7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1718
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"packages/*"
88
],
99
"scripts": {
10-
"build": "lerna run build --skip-nx-cache --scope '@algolia/requester-testing' --scope '@algolia/logger-console' --scope 'algoliasearch' --scope '@algolia/client-composition' --scope '@algolia/composition' --include-dependencies",
10+
"build": "lerna run build --skip-nx-cache --scope '@algolia/requester-testing' --scope '@algolia/logger-console' --scope 'algoliasearch' --scope '@algolia/client-composition' --scope '@algolia/composition' --scope '@algolia/advanced-personalization' --include-dependencies ",
1111
"clean": "lerna run clean",
1212
"release:publish": "tsc --project scripts/tsconfig.json && node scripts/dist/publish.js",
1313
"test": "lerna run test $*",
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2013-Present Algolia
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<p align="center">
2+
<a href="https://www.algolia.com">
3+
<img alt="Algolia for JavaScript" src="https://raw.githubusercontent.com/algolia/algoliasearch-client-common/master/banners/javascript.png" >
4+
</a>
5+
6+
<h4 align="center">The perfect starting point to integrate <a href="https://algolia.com" target="_blank">Algolia</a> within your JavaScript project</h4>
7+
8+
<p align="center">
9+
<a href="https://npmjs.org/package/@algolia/advanced-personalization"><img src="https://img.shields.io/npm/v/@algolia/advanced-personalization.svg?style=flat-square" alt="NPM version"></img></a>
10+
<a href="http://npm-stat.com/charts.html?package=@algolia/advanced-personalization"><img src="https://img.shields.io/npm/dm/@algolia/advanced-personalization.svg?style=flat-square" alt="NPM downloads"></a>
11+
<a href="https://www.jsdelivr.com/package/npm/@algolia/advanced-personalization"><img src="https://data.jsdelivr.com/v1/package/npm/@algolia/advanced-personalization/badge" alt="jsDelivr Downloads"></img></a>
12+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg?style=flat-square" alt="License"></a>
13+
</p>
14+
</p>
15+
16+
<p align="center">
17+
<a href="https://www.algolia.com/doc/libraries/javascript/" target="_blank">Documentation</a> •
18+
<a href="https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/" target="_blank">InstantSearch</a> •
19+
<a href="https://discourse.algolia.com" target="_blank">Community Forum</a> •
20+
<a href="http://stackoverflow.com/questions/tagged/algolia" target="_blank">Stack Overflow</a> •
21+
<a href="https://github.com/algolia/algoliasearch-client-javascript/issues" target="_blank">Report a bug</a> •
22+
<a href="https://www.algolia.com/doc/libraries/javascript/v5/" target="_blank">FAQ</a> •
23+
<a href="https://alg.li/support" target="_blank">Support</a>
24+
</p>
25+
26+
## ✨ Features
27+
28+
- Thin & **minimal low-level HTTP client** to interact with Algolia's API
29+
- Works both on the **browser** and **node.js**
30+
- **UMD and ESM compatible**, you can use it with any module loader
31+
- Built with TypeScript
32+
33+
## 💡 Getting Started
34+
35+
> [!TIP]
36+
> This API client is already a dependency of [the algoliasearch client](https://www.npmjs.com/package/algoliasearch), you don't need to manually install `@algolia/advanced-personalization` if you already have `algoliasearch` installed.
37+
38+
To get started, you first need to install @algolia/advanced-personalization (or any other available API client package).
39+
All of our clients comes with type definition, and are available for both browser and node environments.
40+
41+
### With a package manager
42+
43+
```bash
44+
yarn add @algolia/advanced-personalization@0.0.1-alpha.0
45+
# or
46+
npm install @algolia/advanced-personalization@0.0.1-alpha.0
47+
# or
48+
pnpm add @algolia/advanced-personalization@0.0.1-alpha.0
49+
```
50+
51+
### Without a package manager
52+
53+
Add the following JavaScript snippet to the <head> of your website:
54+
55+
```html
56+
<script src="https://cdn.jsdelivr.net/npm/@algolia/advanced-personalization@0.0.1-alpha.0/dist/builds/browser.umd.js"></script>
57+
```
58+
59+
### Usage
60+
61+
You can now import the Algolia API client in your project and play with it.
62+
63+
```js
64+
import { advancedPersonalizationClient } from '@algolia/advanced-personalization';
65+
66+
const client = advancedPersonalizationClient('YOUR_APP_ID', 'YOUR_API_KEY');
67+
```
68+
69+
For full documentation, visit the **[Algolia JavaScript API Client](https://www.algolia.com/doc/libraries/javascript/v5/methods/advanced-personalization/)**.
70+
71+
## ❓ Troubleshooting
72+
73+
Encountering an issue? Before reaching out to support, we recommend heading to our [FAQ](https://www.algolia.com/doc/libraries/javascript/v5/) where you will find answers for the most common issues and gotchas with the client. You can also open [a GitHub issue](https://github.com/algolia/api-clients-automation/issues/new?assignees=&labels=&projects=&template=Bug_report.md)
74+
75+
## 📄 License
76+
77+
The Algolia JavaScript API Client is an open-sourced software licensed under the [MIT license](LICENSE).
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// 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.
2+
3+
import { createXhrRequester } from '@algolia/requester-browser-xhr';
4+
5+
import {
6+
createBrowserLocalStorageCache,
7+
createFallbackableCache,
8+
createMemoryCache,
9+
createNullLogger,
10+
} from '@algolia/client-common';
11+
12+
import type { ClientOptions } from '@algolia/client-common';
13+
14+
import { apiClientVersion, createAdvancedPersonalizationClient } from '../src/advancedPersonalizationClient';
15+
16+
import type { Region } from '../src/advancedPersonalizationClient';
17+
import { REGIONS } from '../src/advancedPersonalizationClient';
18+
19+
export type { Region, RegionOptions } from '../src/advancedPersonalizationClient';
20+
21+
export { apiClientVersion } from '../src/advancedPersonalizationClient';
22+
23+
export * from '../model';
24+
25+
export function advancedPersonalizationClient(
26+
appId: string,
27+
apiKey: string,
28+
region: Region,
29+
options?: ClientOptions | undefined,
30+
): AdvancedPersonalizationClient {
31+
if (!appId || typeof appId !== 'string') {
32+
throw new Error('`appId` is missing.');
33+
}
34+
35+
if (!apiKey || typeof apiKey !== 'string') {
36+
throw new Error('`apiKey` is missing.');
37+
}
38+
39+
if (!region || (region && (typeof region !== 'string' || !REGIONS.includes(region)))) {
40+
throw new Error(`\`region\` is required and must be one of the following: ${REGIONS.join(', ')}`);
41+
}
42+
43+
return createAdvancedPersonalizationClient({
44+
appId,
45+
apiKey,
46+
region,
47+
timeouts: {
48+
connect: 1000,
49+
read: 2000,
50+
write: 30000,
51+
},
52+
logger: createNullLogger(),
53+
requester: createXhrRequester(),
54+
algoliaAgents: [{ segment: 'Browser' }],
55+
authMode: 'WithinQueryParameters',
56+
responsesCache: createMemoryCache(),
57+
requestsCache: createMemoryCache({ serializable: false }),
58+
hostsCache: createFallbackableCache({
59+
caches: [createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }), createMemoryCache()],
60+
}),
61+
...options,
62+
});
63+
}
64+
65+
export type AdvancedPersonalizationClient = ReturnType<typeof createAdvancedPersonalizationClient>;
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// 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.
2+
3+
export type AdvancedPersonalizationClient = ReturnType<typeof createAdvancedPersonalizationClient>;
4+
5+
import { createMemoryCache, createNullCache, createNullLogger } from '@algolia/client-common';
6+
import { createFetchRequester } from '@algolia/requester-fetch';
7+
8+
import type { ClientOptions } from '@algolia/client-common';
9+
10+
import { createAdvancedPersonalizationClient } from '../src/advancedPersonalizationClient';
11+
12+
import type { Region } from '../src/advancedPersonalizationClient';
13+
import { REGIONS } from '../src/advancedPersonalizationClient';
14+
15+
export type { Region, RegionOptions } from '../src/advancedPersonalizationClient';
16+
17+
export { apiClientVersion } from '../src/advancedPersonalizationClient';
18+
19+
export * from '../model';
20+
21+
export function advancedPersonalizationClient(
22+
appId: string,
23+
apiKey: string,
24+
region: Region,
25+
options?: ClientOptions | undefined,
26+
): AdvancedPersonalizationClient {
27+
if (!appId || typeof appId !== 'string') {
28+
throw new Error('`appId` is missing.');
29+
}
30+
31+
if (!apiKey || typeof apiKey !== 'string') {
32+
throw new Error('`apiKey` is missing.');
33+
}
34+
35+
if (!region || (region && (typeof region !== 'string' || !REGIONS.includes(region)))) {
36+
throw new Error(`\`region\` is required and must be one of the following: ${REGIONS.join(', ')}`);
37+
}
38+
39+
return {
40+
...createAdvancedPersonalizationClient({
41+
appId,
42+
apiKey,
43+
region,
44+
timeouts: {
45+
connect: 2000,
46+
read: 5000,
47+
write: 30000,
48+
},
49+
logger: createNullLogger(),
50+
requester: createFetchRequester(),
51+
algoliaAgents: [{ segment: 'Fetch' }],
52+
responsesCache: createNullCache(),
53+
requestsCache: createNullCache(),
54+
hostsCache: createMemoryCache(),
55+
...options,
56+
}),
57+
};
58+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// 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.
2+
3+
export type AdvancedPersonalizationClient = ReturnType<typeof createAdvancedPersonalizationClient>;
4+
5+
import { createHttpRequester } from '@algolia/requester-node-http';
6+
7+
import { createMemoryCache, createNullCache, createNullLogger } from '@algolia/client-common';
8+
9+
import type { ClientOptions } from '@algolia/client-common';
10+
11+
import { createAdvancedPersonalizationClient } from '../src/advancedPersonalizationClient';
12+
13+
import type { Region } from '../src/advancedPersonalizationClient';
14+
import { REGIONS } from '../src/advancedPersonalizationClient';
15+
16+
export type { Region, RegionOptions } from '../src/advancedPersonalizationClient';
17+
18+
export { apiClientVersion } from '../src/advancedPersonalizationClient';
19+
20+
export * from '../model';
21+
22+
export function advancedPersonalizationClient(
23+
appId: string,
24+
apiKey: string,
25+
region: Region,
26+
options?: ClientOptions | undefined,
27+
): AdvancedPersonalizationClient {
28+
if (!appId || typeof appId !== 'string') {
29+
throw new Error('`appId` is missing.');
30+
}
31+
32+
if (!apiKey || typeof apiKey !== 'string') {
33+
throw new Error('`apiKey` is missing.');
34+
}
35+
36+
if (!region || (region && (typeof region !== 'string' || !REGIONS.includes(region)))) {
37+
throw new Error(`\`region\` is required and must be one of the following: ${REGIONS.join(', ')}`);
38+
}
39+
40+
return {
41+
...createAdvancedPersonalizationClient({
42+
appId,
43+
apiKey,
44+
region,
45+
timeouts: {
46+
connect: 2000,
47+
read: 5000,
48+
write: 30000,
49+
},
50+
logger: createNullLogger(),
51+
requester: createHttpRequester(),
52+
algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],
53+
responsesCache: createNullCache(),
54+
requestsCache: createNullCache(),
55+
hostsCache: createMemoryCache(),
56+
...options,
57+
}),
58+
};
59+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// 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.
2+
3+
export type AdvancedPersonalizationClient = ReturnType<typeof createAdvancedPersonalizationClient>;
4+
5+
import { createMemoryCache, createNullCache, createNullLogger } from '@algolia/client-common';
6+
import { createFetchRequester } from '@algolia/requester-fetch';
7+
8+
import type { ClientOptions } from '@algolia/client-common';
9+
10+
import { createAdvancedPersonalizationClient } from '../src/advancedPersonalizationClient';
11+
12+
import type { Region } from '../src/advancedPersonalizationClient';
13+
import { REGIONS } from '../src/advancedPersonalizationClient';
14+
15+
export type { Region, RegionOptions } from '../src/advancedPersonalizationClient';
16+
17+
export { apiClientVersion } from '../src/advancedPersonalizationClient';
18+
19+
export * from '../model';
20+
21+
export function advancedPersonalizationClient(
22+
appId: string,
23+
apiKey: string,
24+
region: Region,
25+
options?: ClientOptions | undefined,
26+
): AdvancedPersonalizationClient {
27+
if (!appId || typeof appId !== 'string') {
28+
throw new Error('`appId` is missing.');
29+
}
30+
31+
if (!apiKey || typeof apiKey !== 'string') {
32+
throw new Error('`apiKey` is missing.');
33+
}
34+
35+
if (!region || (region && (typeof region !== 'string' || !REGIONS.includes(region)))) {
36+
throw new Error(`\`region\` is required and must be one of the following: ${REGIONS.join(', ')}`);
37+
}
38+
39+
return {
40+
...createAdvancedPersonalizationClient({
41+
appId,
42+
apiKey,
43+
region,
44+
timeouts: {
45+
connect: 2000,
46+
read: 5000,
47+
write: 30000,
48+
},
49+
logger: createNullLogger(),
50+
requester: createFetchRequester(),
51+
algoliaAgents: [{ segment: 'Worker' }],
52+
responsesCache: createNullCache(),
53+
requestsCache: createNullCache(),
54+
hostsCache: createMemoryCache(),
55+
...options,
56+
}),
57+
};
58+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './dist/node';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('./dist/builds/node.cjs');
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// 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.
2+
3+
export type AcceptedResponse = {
4+
/**
5+
* Status code.
6+
*/
7+
status: number;
8+
9+
/**
10+
* Response message.
11+
*/
12+
message: string;
13+
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// 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.
2+
3+
export type Affinity = {
4+
name: string;
5+
6+
indices: Array<string>;
7+
8+
value: string;
9+
10+
score: number;
11+
12+
lastUpdatedAt: string;
13+
};
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// 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.
2+
3+
/**
4+
* HTTP status code for a bad request error.
5+
*/
6+
export type BadRequest = 400;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// 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.
2+
3+
/**
4+
* Details about the response, such as error messages.
5+
*/
6+
export type BadUserID = 'Invalid userID format';

0 commit comments

Comments
 (0)