diff --git a/website/docs/gettingStarted.mdx b/website/docs/gettingStarted.mdx new file mode 100644 index 0000000000..a47ddf6529 --- /dev/null +++ b/website/docs/gettingStarted.mdx @@ -0,0 +1,97 @@ +--- +title: Getting started +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + + +## Installation + +To get started, you first need to install `algoliasearch` (or any other available API client package) + +```bash +yarn add @experimental-api-clients-automation/algoliasearch +``` + +Or use a specific package to reduce bundle size: + +```bash +yarn add @experimental-api-clients-automation/client-search +``` + +You can find the full list of available packages [here](https://www.npmjs.com/org/experimental-api-clients-automation). + +### Without a package manager + +Add the JavaScript to your `` + +```html + +``` + +## Using the client + +Then you need to import the correct package, depending on your choice: + +```js +import { algoliasearch } from 'algoliasearch'; + +const client = algoliasearch(appId, apiKey); + +// And access analytics or personalization client +const analyticsClient = client.initAnalytics(analyticsAppId, analyticsApiKey); +const personalizationCilent = client.initPersonalization(personalizationAppId, personalizationApiKey, 'eu'); +``` + +```js +import { searchApi } from '@algolia/client-search'; + +const client = searchApi(appId, apiKey); +``` + +It is possible to customize the client by passing optional parameters: + +```js +const client = searchApi(appId, apiKey, { + requester: customRequester(), + hosts: [{ + url: 'my.custom.host.net', + accept: 'read', + protocol: 'https', + }] +}) +``` + +Once the client is setup, you can enjoy all of Algolia API ! + +```js +const res = await client.search({ + indexName: 'my-index', + searchParams: { query: 'words to query' }, +}); + +console.log('Search result', res.hits); +``` + + +Or with the `personalization` client + +```js +const res = await personalizationCilent.getUserTokenProfile({ + userToken: 'token', +}); + +console.log('User scores', res.scores); +``` + + + diff --git a/website/docs/introduction.md b/website/docs/introduction.md index 9e4832f744..0fa85fca6c 100644 --- a/website/docs/introduction.md +++ b/website/docs/introduction.md @@ -4,20 +4,22 @@ title: Introduction # Introduction -API Clients Automation by Algolia +This documentation hosts informations about the [Generated Algolia API clients](https://github.com/algolia/api-clients-automation) -## Available specs +## Contributing -- [A/B Testing specs](/specs/abtesting) -- [analytics specs](/specs/analytics) -- [insights specs](/specs/insights) -- [personalization specs](/specs/personalization) -- [query-suggestions specs](/specs/query-suggestions) -- [recommend specs](/specs/recommend) -- [search specs](/specs/search) -- [sources specs](/specs/sources) -- [predict specs](/specs/predict) +To contribute to the repository, make sure to take a look at our guidelines and recommendations: -## Repository +- [Setup the repository tooling](/docs/setupRepository): to install our tooling. +- [Add a new client](/docs/addNewClient): to add a new client spec to generate. +- [Support a new language](/docs/addNewLanguage): to add a new supported language to the API clients. -[API Clients Automation](https://github.com/algolia/api-clients-automation) +CLI commands can be found at [CLI > specs commands](/docs/specsCommands) and [CLI > generation commands](/docs/generationCommands) + +## Testing + +Generated clients can be tested via the [Common Test Suite](/docs/commonTestSuite) or the [playground](/docs/playground) + +## Feedbacks + +Any feedbacks can be reported using [GitHub issues](https://github.com/algolia/api-clients-automation/issues) diff --git a/website/docs/setupRepository.md b/website/docs/setupRepository.md index 97b7822337..313d0c35f2 100644 --- a/website/docs/setupRepository.md +++ b/website/docs/setupRepository.md @@ -48,21 +48,6 @@ Stops `dev` container and clean the built image yarn docker:clean ``` -## Contributing - -To contribute to the repository, take a look at our guidelines and recommendations: - -- [Add a new client](/docs/addNewClient): to add a new client spec to generate. -- [Support a new language](/docs/addNewLanguage): to add a new supported language to the API clients. - -CLI commands can be found at [CLI > specs commands](/docs/specsCommands) and [CLI > generation commands](/docs/generationCommands) - -## Testing - -Generated clients can be tested via the [Common Test Suite](/docs/commonTestSuite) or the [playground](/docs/playground) - -You can make changes locally and run commands through the docker container. - ## Troubleshooting :::caution diff --git a/website/sidebars.js b/website/sidebars.js index 0757b3db60..99129c5be0 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -6,7 +6,7 @@ const sidebars = { { type: 'category', label: 'Getting Started', - items: ['introduction'], + items: ['introduction', 'gettingStarted'], }, { type: 'category',