Skip to content

Commit cb8d69e

Browse files
feat(javascript): generate abtesting v3 alpha client (generated)
algolia/api-clients-automation#4783 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent fd03192 commit cb8d69e

Some content is hidden

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

54 files changed

+1741
-11
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' --scope '@algolia/advanced-personalization' --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' --scope '@algolia/abtesting' --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 $*",

packages/abtesting/LICENSE

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.

packages/abtesting/README.md

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/abtesting"><img src="https://img.shields.io/npm/v/@algolia/abtesting.svg?style=flat-square" alt="NPM version"></img></a>
10+
<a href="http://npm-stat.com/charts.html?package=@algolia/abtesting"><img src="https://img.shields.io/npm/dm/@algolia/abtesting.svg?style=flat-square" alt="NPM downloads"></a>
11+
<a href="https://www.jsdelivr.com/package/npm/@algolia/abtesting"><img src="https://data.jsdelivr.com/v1/package/npm/@algolia/abtesting/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/abtesting` if you already have `algoliasearch` installed.
37+
38+
To get started, you first need to install @algolia/abtesting (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/[email protected]
45+
# or
46+
npm install @algolia/[email protected]
47+
# or
48+
pnpm add @algolia/[email protected]
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/[email protected]/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 { abtestingClient } from '@algolia/abtesting';
65+
66+
const client = abtestingClient('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/abtesting/)**.
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).

packages/abtesting/builds/browser.ts

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, createAbtestingClient } from '../src/abtestingClient';
15+
16+
import type { Region } from '../src/abtestingClient';
17+
import { REGIONS } from '../src/abtestingClient';
18+
19+
export type { Region, RegionOptions } from '../src/abtestingClient';
20+
21+
export { apiClientVersion } from '../src/abtestingClient';
22+
23+
export * from '../model';
24+
25+
export function abtestingClient(
26+
appId: string,
27+
apiKey: string,
28+
region?: Region | undefined,
29+
options?: ClientOptions | undefined,
30+
): AbtestingClient {
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 && (typeof region !== 'string' || !REGIONS.includes(region))) {
40+
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(', ')}`);
41+
}
42+
43+
return createAbtestingClient({
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 AbtestingClient = ReturnType<typeof createAbtestingClient>;

packages/abtesting/builds/fetch.ts

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 AbtestingClient = ReturnType<typeof createAbtestingClient>;
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 { createAbtestingClient } from '../src/abtestingClient';
11+
12+
import type { Region } from '../src/abtestingClient';
13+
import { REGIONS } from '../src/abtestingClient';
14+
15+
export type { Region, RegionOptions } from '../src/abtestingClient';
16+
17+
export { apiClientVersion } from '../src/abtestingClient';
18+
19+
export * from '../model';
20+
21+
export function abtestingClient(
22+
appId: string,
23+
apiKey: string,
24+
region?: Region | undefined,
25+
options?: ClientOptions | undefined,
26+
): AbtestingClient {
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 && (typeof region !== 'string' || !REGIONS.includes(region))) {
36+
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(', ')}`);
37+
}
38+
39+
return {
40+
...createAbtestingClient({
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+
}

packages/abtesting/builds/node.ts

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 AbtestingClient = ReturnType<typeof createAbtestingClient>;
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 { createAbtestingClient } from '../src/abtestingClient';
12+
13+
import type { Region } from '../src/abtestingClient';
14+
import { REGIONS } from '../src/abtestingClient';
15+
16+
export type { Region, RegionOptions } from '../src/abtestingClient';
17+
18+
export { apiClientVersion } from '../src/abtestingClient';
19+
20+
export * from '../model';
21+
22+
export function abtestingClient(
23+
appId: string,
24+
apiKey: string,
25+
region?: Region | undefined,
26+
options?: ClientOptions | undefined,
27+
): AbtestingClient {
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 && (typeof region !== 'string' || !REGIONS.includes(region))) {
37+
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(', ')}`);
38+
}
39+
40+
return {
41+
...createAbtestingClient({
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+
}

packages/abtesting/builds/worker.ts

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 AbtestingClient = ReturnType<typeof createAbtestingClient>;
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 { createAbtestingClient } from '../src/abtestingClient';
11+
12+
import type { Region } from '../src/abtestingClient';
13+
import { REGIONS } from '../src/abtestingClient';
14+
15+
export type { Region, RegionOptions } from '../src/abtestingClient';
16+
17+
export { apiClientVersion } from '../src/abtestingClient';
18+
19+
export * from '../model';
20+
21+
export function abtestingClient(
22+
appId: string,
23+
apiKey: string,
24+
region?: Region | undefined,
25+
options?: ClientOptions | undefined,
26+
): AbtestingClient {
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 && (typeof region !== 'string' || !REGIONS.includes(region))) {
36+
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(', ')}`);
37+
}
38+
39+
return {
40+
...createAbtestingClient({
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+
}

packages/abtesting/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './dist/node';

packages/abtesting/index.js

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');

0 commit comments

Comments
 (0)