-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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]>
- Loading branch information
1 parent
76b5b03
commit 61a0077
Showing
120 changed files
with
3,668 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2013-Present Algolia | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<p align="center"> | ||
<a href="https://www.algolia.com"> | ||
<img alt="Algolia for JavaScript" src="https://raw.githubusercontent.com/algolia/algoliasearch-client-common/master/banners/javascript.png" > | ||
</a> | ||
|
||
<h4 align="center">The perfect starting point to integrate <a href="https://algolia.com" target="_blank">Algolia</a> within your JavaScript project</h4> | ||
|
||
<p align="center"> | ||
<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> | ||
<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> | ||
<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> | ||
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg?style=flat-square" alt="License"></a> | ||
</p> | ||
</p> | ||
|
||
<p align="center"> | ||
<a href="https://www.algolia.com/doc/libraries/javascript/" target="_blank">Documentation</a> • | ||
<a href="https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/" target="_blank">InstantSearch</a> • | ||
<a href="https://discourse.algolia.com" target="_blank">Community Forum</a> • | ||
<a href="http://stackoverflow.com/questions/tagged/algolia" target="_blank">Stack Overflow</a> • | ||
<a href="https://github.com/algolia/algoliasearch-client-javascript/issues" target="_blank">Report a bug</a> • | ||
<a href="https://www.algolia.com/doc/libraries/javascript/v5/" target="_blank">FAQ</a> • | ||
<a href="https://alg.li/support" target="_blank">Support</a> | ||
</p> | ||
|
||
## ✨ Features | ||
|
||
- Thin & **minimal low-level HTTP client** to interact with Algolia's API | ||
- Works both on the **browser** and **node.js** | ||
- **UMD and ESM compatible**, you can use it with any module loader | ||
- Built with TypeScript | ||
|
||
## 💡 Getting Started | ||
|
||
> [!TIP] | ||
> 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. | ||
To get started, you first need to install @algolia/client-composition (or any other available API client package). | ||
All of our clients comes with type definition, and are available for both browser and node environments. | ||
|
||
### With a package manager | ||
|
||
```bash | ||
yarn add @algolia/[email protected] | ||
# or | ||
npm install @algolia/[email protected] | ||
# or | ||
pnpm add @algolia/[email protected] | ||
``` | ||
|
||
### Without a package manager | ||
|
||
Add the following JavaScript snippet to the <head> of your website: | ||
|
||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/@algolia/[email protected]/dist/builds/browser.umd.js"></script> | ||
``` | ||
|
||
### Usage | ||
|
||
You can now import the Algolia API client in your project and play with it. | ||
|
||
```js | ||
import { compositionClient } from '@algolia/client-composition'; | ||
|
||
const client = compositionClient('YOUR_APP_ID', 'YOUR_API_KEY'); | ||
``` | ||
|
||
For full documentation, visit the **[Algolia JavaScript API Client](https://www.algolia.com/doc/libraries/javascript/v5/methods/composition/)**. | ||
|
||
## ❓ Troubleshooting | ||
|
||
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) | ||
|
||
## 📄 License | ||
|
||
The Algolia JavaScript API Client is an open-sourced software licensed under the [MIT license](LICENSE). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// 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. | ||
|
||
import { createXhrRequester } from '@algolia/requester-browser-xhr'; | ||
|
||
import { | ||
createBrowserLocalStorageCache, | ||
createFallbackableCache, | ||
createMemoryCache, | ||
createNullLogger, | ||
DEFAULT_CONNECT_TIMEOUT_BROWSER, | ||
DEFAULT_READ_TIMEOUT_BROWSER, | ||
DEFAULT_WRITE_TIMEOUT_BROWSER, | ||
} from '@algolia/client-common'; | ||
|
||
import type { ClientOptions } from '@algolia/client-common'; | ||
|
||
import { apiClientVersion, createCompositionClient } from '../src/compositionClient'; | ||
|
||
export { apiClientVersion } from '../src/compositionClient'; | ||
|
||
export * from '../model'; | ||
|
||
export function compositionClient(appId: string, apiKey: string, options?: ClientOptions): CompositionClient { | ||
if (!appId || typeof appId !== 'string') { | ||
throw new Error('`appId` is missing.'); | ||
} | ||
|
||
if (!apiKey || typeof apiKey !== 'string') { | ||
throw new Error('`apiKey` is missing.'); | ||
} | ||
|
||
return createCompositionClient({ | ||
appId, | ||
apiKey, | ||
timeouts: { | ||
connect: DEFAULT_CONNECT_TIMEOUT_BROWSER, | ||
read: DEFAULT_READ_TIMEOUT_BROWSER, | ||
write: DEFAULT_WRITE_TIMEOUT_BROWSER, | ||
}, | ||
logger: createNullLogger(), | ||
requester: createXhrRequester(), | ||
algoliaAgents: [{ segment: 'Browser' }], | ||
authMode: 'WithinQueryParameters', | ||
responsesCache: createMemoryCache(), | ||
requestsCache: createMemoryCache({ serializable: false }), | ||
hostsCache: createFallbackableCache({ | ||
caches: [createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }), createMemoryCache()], | ||
}), | ||
...options, | ||
}); | ||
} | ||
|
||
export type CompositionClient = ReturnType<typeof createCompositionClient>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// 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. | ||
|
||
export type CompositionClient = ReturnType<typeof createCompositionClient>; | ||
|
||
import { | ||
createMemoryCache, | ||
createNullCache, | ||
createNullLogger, | ||
DEFAULT_CONNECT_TIMEOUT_NODE, | ||
DEFAULT_READ_TIMEOUT_NODE, | ||
DEFAULT_WRITE_TIMEOUT_NODE, | ||
} from '@algolia/client-common'; | ||
import { createFetchRequester } from '@algolia/requester-fetch'; | ||
|
||
import type { ClientOptions } from '@algolia/client-common'; | ||
|
||
import { createCompositionClient } from '../src/compositionClient'; | ||
|
||
export { apiClientVersion } from '../src/compositionClient'; | ||
|
||
export * from '../model'; | ||
|
||
export function compositionClient(appId: string, apiKey: string, options?: ClientOptions): CompositionClient { | ||
if (!appId || typeof appId !== 'string') { | ||
throw new Error('`appId` is missing.'); | ||
} | ||
|
||
if (!apiKey || typeof apiKey !== 'string') { | ||
throw new Error('`apiKey` is missing.'); | ||
} | ||
|
||
return { | ||
...createCompositionClient({ | ||
appId, | ||
apiKey, | ||
timeouts: { | ||
connect: DEFAULT_CONNECT_TIMEOUT_NODE, | ||
read: DEFAULT_READ_TIMEOUT_NODE, | ||
write: DEFAULT_WRITE_TIMEOUT_NODE, | ||
}, | ||
logger: createNullLogger(), | ||
algoliaAgents: [{ segment: 'Fetch' }], | ||
requester: createFetchRequester(), | ||
responsesCache: createNullCache(), | ||
requestsCache: createNullCache(), | ||
hostsCache: createMemoryCache(), | ||
...options, | ||
}), | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// 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. | ||
|
||
export type CompositionClient = ReturnType<typeof createCompositionClient>; | ||
|
||
import { createHttpRequester } from '@algolia/requester-node-http'; | ||
|
||
import { | ||
createMemoryCache, | ||
createNullCache, | ||
createNullLogger, | ||
DEFAULT_CONNECT_TIMEOUT_NODE, | ||
DEFAULT_READ_TIMEOUT_NODE, | ||
DEFAULT_WRITE_TIMEOUT_NODE, | ||
} from '@algolia/client-common'; | ||
|
||
import type { ClientOptions } from '@algolia/client-common'; | ||
|
||
import { createCompositionClient } from '../src/compositionClient'; | ||
|
||
export { apiClientVersion } from '../src/compositionClient'; | ||
|
||
export * from '../model'; | ||
|
||
export function compositionClient(appId: string, apiKey: string, options?: ClientOptions): CompositionClient { | ||
if (!appId || typeof appId !== 'string') { | ||
throw new Error('`appId` is missing.'); | ||
} | ||
|
||
if (!apiKey || typeof apiKey !== 'string') { | ||
throw new Error('`apiKey` is missing.'); | ||
} | ||
|
||
return { | ||
...createCompositionClient({ | ||
appId, | ||
apiKey, | ||
timeouts: { | ||
connect: DEFAULT_CONNECT_TIMEOUT_NODE, | ||
read: DEFAULT_READ_TIMEOUT_NODE, | ||
write: DEFAULT_WRITE_TIMEOUT_NODE, | ||
}, | ||
logger: createNullLogger(), | ||
requester: createHttpRequester(), | ||
algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }], | ||
responsesCache: createNullCache(), | ||
requestsCache: createNullCache(), | ||
hostsCache: createMemoryCache(), | ||
...options, | ||
}), | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './dist/node'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('./dist/builds/node.cjs'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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. | ||
|
||
/** | ||
* Type of Composition Batch operation. | ||
*/ | ||
export type Action = 'upsert' | 'delete'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// 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. | ||
|
||
export type AdvancedSyntaxFeatures = 'exactPhrase' | 'excludeWords'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// 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. | ||
|
||
export type AlternativesAsExact = 'ignorePlurals' | 'singleWordSynonym' | 'multiWordsSynonym'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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. | ||
|
||
/** | ||
* 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`. | ||
*/ | ||
export type Anchoring = 'is' | 'startsWith' | 'endsWith' | 'contains'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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. | ||
|
||
import type { Range } from './range'; | ||
|
||
/** | ||
* 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. | ||
*/ | ||
export type AroundPrecision = number | Array<Range>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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. | ||
|
||
import type { AroundRadiusAll } from './aroundRadiusAll'; | ||
|
||
/** | ||
* 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. | ||
*/ | ||
export type AroundRadius = number | AroundRadiusAll; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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. | ||
|
||
/** | ||
* Return all records with a valid `_geoloc` attribute. Don\'t filter by distance. | ||
*/ | ||
export type AroundRadiusAll = 'all'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// 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. | ||
|
||
import type { BannerImage } from './bannerImage'; | ||
import type { BannerLink } from './bannerLink'; | ||
|
||
/** | ||
* a search banner with image and url. | ||
*/ | ||
export type Banner = { | ||
image?: BannerImage; | ||
|
||
link?: BannerLink; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// 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. | ||
|
||
import type { BannerImageUrl } from './bannerImageUrl'; | ||
|
||
/** | ||
* image of a search banner. | ||
*/ | ||
export type BannerImage = { | ||
urls?: Array<BannerImageUrl>; | ||
|
||
title?: string; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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. | ||
|
||
/** | ||
* url for a search banner image. | ||
*/ | ||
export type BannerImageUrl = { | ||
url?: string; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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. | ||
|
||
/** | ||
* link for a banner defined in merchandising studio. | ||
*/ | ||
export type BannerLink = { | ||
url?: string; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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. | ||
|
||
import type { BaseSearchParamsWithoutQuery } from './baseSearchParamsWithoutQuery'; | ||
import type { SearchParamsQuery } from './searchParamsQuery'; | ||
|
||
export type BaseSearchParams = SearchParamsQuery & BaseSearchParamsWithoutQuery; |
Oops, something went wrong.