Skip to content

Commit 61a0077

Browse files
algolia-bote-krebsshortcutsmillotp
committed
feat(specs): add composition API (generated)
algolia/api-clients-automation#4056 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Emmanuel Krebs <[email protected]> Co-authored-by: shortcuts <[email protected]> Co-authored-by: Pierre Millot <[email protected]>
1 parent 76b5b03 commit 61a0077

File tree

120 files changed

+3668
-1
lines changed

Some content is hidden

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

120 files changed

+3668
-1
lines changed

bundlesize.config.json

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
"path": "packages/client-analytics/dist/builds/browser.umd.js",
1717
"maxSize": "4.85KB"
1818
},
19+
{
20+
"path": "packages/client-composition/dist/builds/browser.umd.js",
21+
"maxSize": "4.05KB"
22+
},
1923
{
2024
"path": "packages/client-insights/dist/builds/browser.umd.js",
2125
"maxSize": "3.90KB"

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"packages/*"
77
],
88
"scripts": {
9-
"build": "lerna run build --scope '@algolia/requester-testing' --scope '@algolia/logger-console' --scope 'algoliasearch' --include-dependencies",
9+
"build": "lerna run build --scope '@algolia/requester-testing' --scope '@algolia/logger-console' --scope 'algoliasearch' --scope '@algolia/client-composition' --include-dependencies",
1010
"clean": "lerna run clean",
1111
"release:bump": "lerna version ${0:-patch} --no-changelog --no-git-tag-version --no-push --exact --force-publish --yes",
1212
"release:publish": "tsc --project scripts/tsconfig.json && node scripts/dist/scripts/publish.js",

packages/client-composition/LICENSE

+21
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/client-composition/README.md

+77
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/client-composition"><img src="https://img.shields.io/npm/v/@algolia/client-composition.svg?style=flat-square" alt="NPM version"></img></a>
10+
<a href="http://npm-stat.com/charts.html?package=@algolia/client-composition"><img src="https://img.shields.io/npm/dm/@algolia/client-composition.svg?style=flat-square" alt="NPM downloads"></a>
11+
<a href="https://www.jsdelivr.com/package/npm/@algolia/client-composition"><img src="https://data.jsdelivr.com/v1/package/npm/@algolia/client-composition/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/client-composition` if you already have `algoliasearch` installed.
37+
38+
To get started, you first need to install @algolia/client-composition (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 { compositionClient } from '@algolia/client-composition';
65+
66+
const client = compositionClient('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/composition/)**.
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).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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+
DEFAULT_CONNECT_TIMEOUT_BROWSER,
11+
DEFAULT_READ_TIMEOUT_BROWSER,
12+
DEFAULT_WRITE_TIMEOUT_BROWSER,
13+
} from '@algolia/client-common';
14+
15+
import type { ClientOptions } from '@algolia/client-common';
16+
17+
import { apiClientVersion, createCompositionClient } from '../src/compositionClient';
18+
19+
export { apiClientVersion } from '../src/compositionClient';
20+
21+
export * from '../model';
22+
23+
export function compositionClient(appId: string, apiKey: string, options?: ClientOptions): CompositionClient {
24+
if (!appId || typeof appId !== 'string') {
25+
throw new Error('`appId` is missing.');
26+
}
27+
28+
if (!apiKey || typeof apiKey !== 'string') {
29+
throw new Error('`apiKey` is missing.');
30+
}
31+
32+
return createCompositionClient({
33+
appId,
34+
apiKey,
35+
timeouts: {
36+
connect: DEFAULT_CONNECT_TIMEOUT_BROWSER,
37+
read: DEFAULT_READ_TIMEOUT_BROWSER,
38+
write: DEFAULT_WRITE_TIMEOUT_BROWSER,
39+
},
40+
logger: createNullLogger(),
41+
requester: createXhrRequester(),
42+
algoliaAgents: [{ segment: 'Browser' }],
43+
authMode: 'WithinQueryParameters',
44+
responsesCache: createMemoryCache(),
45+
requestsCache: createMemoryCache({ serializable: false }),
46+
hostsCache: createFallbackableCache({
47+
caches: [createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }), createMemoryCache()],
48+
}),
49+
...options,
50+
});
51+
}
52+
53+
export type CompositionClient = ReturnType<typeof createCompositionClient>;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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 CompositionClient = ReturnType<typeof createCompositionClient>;
4+
5+
import {
6+
createMemoryCache,
7+
createNullCache,
8+
createNullLogger,
9+
DEFAULT_CONNECT_TIMEOUT_NODE,
10+
DEFAULT_READ_TIMEOUT_NODE,
11+
DEFAULT_WRITE_TIMEOUT_NODE,
12+
} from '@algolia/client-common';
13+
import { createFetchRequester } from '@algolia/requester-fetch';
14+
15+
import type { ClientOptions } from '@algolia/client-common';
16+
17+
import { createCompositionClient } from '../src/compositionClient';
18+
19+
export { apiClientVersion } from '../src/compositionClient';
20+
21+
export * from '../model';
22+
23+
export function compositionClient(appId: string, apiKey: string, options?: ClientOptions): CompositionClient {
24+
if (!appId || typeof appId !== 'string') {
25+
throw new Error('`appId` is missing.');
26+
}
27+
28+
if (!apiKey || typeof apiKey !== 'string') {
29+
throw new Error('`apiKey` is missing.');
30+
}
31+
32+
return {
33+
...createCompositionClient({
34+
appId,
35+
apiKey,
36+
timeouts: {
37+
connect: DEFAULT_CONNECT_TIMEOUT_NODE,
38+
read: DEFAULT_READ_TIMEOUT_NODE,
39+
write: DEFAULT_WRITE_TIMEOUT_NODE,
40+
},
41+
logger: createNullLogger(),
42+
algoliaAgents: [{ segment: 'Fetch' }],
43+
requester: createFetchRequester(),
44+
responsesCache: createNullCache(),
45+
requestsCache: createNullCache(),
46+
hostsCache: createMemoryCache(),
47+
...options,
48+
}),
49+
};
50+
}
+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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 CompositionClient = ReturnType<typeof createCompositionClient>;
4+
5+
import { createHttpRequester } from '@algolia/requester-node-http';
6+
7+
import {
8+
createMemoryCache,
9+
createNullCache,
10+
createNullLogger,
11+
DEFAULT_CONNECT_TIMEOUT_NODE,
12+
DEFAULT_READ_TIMEOUT_NODE,
13+
DEFAULT_WRITE_TIMEOUT_NODE,
14+
} from '@algolia/client-common';
15+
16+
import type { ClientOptions } from '@algolia/client-common';
17+
18+
import { createCompositionClient } from '../src/compositionClient';
19+
20+
export { apiClientVersion } from '../src/compositionClient';
21+
22+
export * from '../model';
23+
24+
export function compositionClient(appId: string, apiKey: string, options?: ClientOptions): CompositionClient {
25+
if (!appId || typeof appId !== 'string') {
26+
throw new Error('`appId` is missing.');
27+
}
28+
29+
if (!apiKey || typeof apiKey !== 'string') {
30+
throw new Error('`apiKey` is missing.');
31+
}
32+
33+
return {
34+
...createCompositionClient({
35+
appId,
36+
apiKey,
37+
timeouts: {
38+
connect: DEFAULT_CONNECT_TIMEOUT_NODE,
39+
read: DEFAULT_READ_TIMEOUT_NODE,
40+
write: DEFAULT_WRITE_TIMEOUT_NODE,
41+
},
42+
logger: createNullLogger(),
43+
requester: createHttpRequester(),
44+
algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],
45+
responsesCache: createNullCache(),
46+
requestsCache: createNullCache(),
47+
hostsCache: createMemoryCache(),
48+
...options,
49+
}),
50+
};
51+
}
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './dist/node';

packages/client-composition/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('./dist/builds/node.cjs');
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+
* Type of Composition Batch operation.
5+
*/
6+
export type Action = 'upsert' | 'delete';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
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 AdvancedSyntaxFeatures = 'exactPhrase' | 'excludeWords';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
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 AlternativesAsExact = 'ignorePlurals' | 'singleWordSynonym' | 'multiWordsSynonym';
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+
* Which part of the search query the pattern should match: - `startsWith`. The pattern must match the beginning of the query. - `endsWith`. The pattern must match the end of the query. - `is`. The pattern must match the query exactly. - `contains`. The pattern must match anywhere in the query. Empty queries are only allowed as patterns with `anchoring: is`.
5+
*/
6+
export type Anchoring = 'is' | 'startsWith' | 'endsWith' | 'contains';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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 type { Range } from './range';
4+
5+
/**
6+
* Precision of a coordinate-based search in meters to group results with similar distances. The Geo ranking criterion considers all matches within the same range of distances to be equal.
7+
*/
8+
export type AroundPrecision = number | Array<Range>;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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 type { AroundRadiusAll } from './aroundRadiusAll';
4+
5+
/**
6+
* Maximum radius for a search around a central location. This parameter works in combination with the `aroundLatLng` and `aroundLatLngViaIP` parameters. By default, the search radius is determined automatically from the density of hits around the central location. The search radius is small if there are many hits close to the central coordinates.
7+
*/
8+
export type AroundRadius = number | AroundRadiusAll;
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+
* Return all records with a valid `_geoloc` attribute. Don\'t filter by distance.
5+
*/
6+
export type AroundRadiusAll = 'all';
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+
import type { BannerImage } from './bannerImage';
4+
import type { BannerLink } from './bannerLink';
5+
6+
/**
7+
* a search banner with image and url.
8+
*/
9+
export type Banner = {
10+
image?: BannerImage;
11+
12+
link?: BannerLink;
13+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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 type { BannerImageUrl } from './bannerImageUrl';
4+
5+
/**
6+
* image of a search banner.
7+
*/
8+
export type BannerImage = {
9+
urls?: Array<BannerImageUrl>;
10+
11+
title?: string;
12+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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+
* url for a search banner image.
5+
*/
6+
export type BannerImageUrl = {
7+
url?: string;
8+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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+
* link for a banner defined in merchandising studio.
5+
*/
6+
export type BannerLink = {
7+
url?: string;
8+
};
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+
import type { BaseSearchParamsWithoutQuery } from './baseSearchParamsWithoutQuery';
4+
import type { SearchParamsQuery } from './searchParamsQuery';
5+
6+
export type BaseSearchParams = SearchParamsQuery & BaseSearchParamsWithoutQuery;

0 commit comments

Comments
 (0)