Skip to content

docs: cleanup duplicated guides #3138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion website/docs/clients/guides/send-data-to-algolia.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ To push data to Algolia, you need an Application ID and a valid API key with the

## Setting up the API client

> [Make sure to also read the `installation` page](/docs/clients/installation).
> [Make sure to also read the `usage` page](/docs/clients/usage).

<TabsLanguage>
<TabItem value="javascript">
Expand Down
17 changes: 9 additions & 8 deletions website/docs/clients/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ title: Introduction

# Introduction

This section hosts informations about the [usage of the API clients](https://github.com/algolia/api-clients-automation). For informations regarding the automation and how to contribute, see [the automation page](/docs/contributing/introduction).
This section holds information about [the generated Algolia API clients](https://github.com/algolia/api-clients-automation).

If you wish to contribute, please see [the contributing page](/docs/contributing/introduction).

## Repositories

Expand All @@ -13,8 +15,8 @@ Generated code in production can be find on repository of the clients.
- [C#](https://github.com/algolia/algoliasearch-client-csharp/tree/next)
- [Dart](https://github.com/algolia/algoliasearch-client-dart/)
- [Go](https://github.com/algolia/algoliasearch-client-go/tree/next/)
- [Java](https://github.com/algolia/algoliasearch-client-java/tree/next/)
- [JavaScript](https://github.com/algolia/algoliasearch-client-javascript/tree/next/)
- [Java](https://github.com/algolia/algoliasearch-client-java/tree/next/)
Comment on lines 18 to +19
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alphabetically java is before javascript

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because of the capital S it's before

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah but nowhere else in the codebase we have that

- [Kotlin](https://github.com/algolia/algoliasearch-client-kotlin/tree/next/)
- [PHP](https://github.com/algolia/algoliasearch-client-php/tree/next/)
- [Python](https://github.com/algolia/algoliasearch-client-python/tree/next)
Expand All @@ -23,13 +25,12 @@ Generated code in production can be find on repository of the clients.

## Usage

See [the installation](/docs/clients/installation) page.
See [the usage](/docs/clients/usage) page.

You can also check the [playground](/docs/contributing/testing/playground) if you'd like to test clients locally.
## Example

## Feedbacks
Code snippets are available for every APIs, clients and endpoints, [browse our OpenAPI specs](/specs/search).

To report feedbacks, please use:
## Feedbacks

- [GitHub issues](https://github.com/algolia/api-clients-automation/issues)
- [#api-clients-beta-testers slack channel](https://algolia.slack.com/archives/C0341QDM3EG)
Please use [GitHub issues](https://github.com/algolia/api-clients-automation/issues)
52 changes: 0 additions & 52 deletions website/docs/clients/migration-guides/csharp.md

This file was deleted.

36 changes: 0 additions & 36 deletions website/docs/clients/migration-guides/go.md

This file was deleted.

101 changes: 82 additions & 19 deletions website/docs/clients/migration-guides/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,54 @@ const searchResults = await client.search({
```py
from algoliasearch.search.client import SearchClient

client = SearchClient.create("YOUR_APP_ID", "YOUR_API_KEY")
client = SearchClient("YOUR_APP_ID", "YOUR_API_KEY")

# using a raw dict

search_resp = await client.search(search_method_params={"requests": [{"indexName": "nvim"}]})

# using the given models

from algoliasearch.search.models.search_method_params import SearchMethodParams
from algoliasearch.search.models.search_for_hits import SearchForHits
from algoliasearch.search.models.search_query import SearchQuery

search_resp = await client.search(
search_method_params=SearchMethodParams(
requests=[
SearchQuery(SearchForHits(index_name="nvim")),
],
),
)

searchResults = await client.search(search_method_params={"requests": [{"indexName": "nvim"}]})
print(search_resp.to_json())
```

</TabItem>
<TabItem value="php">

```php
$client = Algolia\AlgoliaSearch\Api\SearchClient::create(
use Algolia\AlgoliaSearch\Api\SearchClient;

$client = SearchClient::create(
'<YOUR_APP_ID>',
'<YOUR_API_KEY>'
);

$client->search([
// only query string
$searchResults = $client->search([
'requests' => [
['indexName' => '<YOUR_INDEX_NAME>', 'query' =>'<YOUR_QUERY>'],
],
]);

$searchResults2 = $client->search([
'requests' => [
[
'indexName' => '<YOUR_INDEX_NAME>',
'indexName' => '<YOUR_INDEX_NAME>',
'query' => '<YOUR_QUERY>',
'attributesToRetrieve' => ['firstname', 'lastname'],
'hitsPerPage': 50,
'hitsPerPage' => 50,
],
],
]);
Expand Down Expand Up @@ -101,6 +128,51 @@ client.search(
);
```

</TabItem>
<TabItem value="kotlin">

```kotlin
import com.algolia.client.api.SearchClient
import com.algolia.client.model.search.*

val client = SearchClient("<YOUR_APP_ID>", "<YOUR_API_KEY>")
val response = client.search(
SearchMethodParams(
requests = listOf(SearchForHits(indexName = "<YOUR_INDEX_NAME>", query = "<YOUR_QUERY>"))
)
)
```

</TabItem>
<TabItem value="go">

```go
import (
"github.com/algolia/algoliasearch-client-go/v4/algolia/search"
)

indexName := "<INDEX_NAME>"
appID := "<APPLICATION_ID>"
apiKey := "<API_KEY>"

searchClient, _ := search.NewClient(appID, apiKey)

results, err := searchClient.Search(
searchClient.NewApiSearchRequest(
search.NewSearchMethodParams(
[]search.SearchQuery{
search.SearchForHitsAsSearchQuery(
search.NewSearchForHits(
indexName,
search.WithSearchForHitsQuery("<YOUR_QUERY>"),
),
),
},
),
),
)
```

</TabItem>
<TabItem value="csharp">

Expand All @@ -110,14 +182,10 @@ using Algolia.Search.Models.Search;

var client = new SearchClient("<YOUR_APP_ID>", "<YOUR_API_KEY>");

client.Search<Hit>(new SearchMethodParams([
new SearchQuery(new SearchForHits("<YOUR_INDEX_NAME>")
{
Query = "<YOUR_QUERY>",
AttributesToRetrieve = ["firstname", "lastname"],
HitsPerPage = 50
})
]));
client.Search<YOUR_RECORD_TYPE_CLASS>(new SearchMethodParams(new List<SearchQuery>
{
new(new SearchForHits("<YOUR_INDEX>") { Query = "<YOUR_QUERY>" })
}));
```

</TabItem>
Expand Down Expand Up @@ -759,10 +827,5 @@ foreach (var synonym in browseSynonyms)

You can find specific client breaking changes in their own section:

- [Go migration guide](/docs/clients/migration-guides/go)
- [Java migration guide](/docs/clients/migration-guides/java)
- [JavaScript migration guide](/docs/clients/migration-guides/javascript)
- [Kotlin migration guide](/docs/clients/migration-guides/kotlin)
- [PHP migration guide](/docs/clients/migration-guides/php)
- [Python migration guide](/docs/clients/migration-guides/python)
- [C# migration guide](/docs/clients/migration-guides/csharp)
29 changes: 0 additions & 29 deletions website/docs/clients/migration-guides/java.md

This file was deleted.

44 changes: 0 additions & 44 deletions website/docs/clients/migration-guides/javascript.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +6,3 @@ title: JavaScript
|-----------|:---------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `search` | `searchClient` | Exported clients are suffixed by `Client`. |
| `destroy` | **removed** | This method has not been implemented in the new clients, if you feel the need for it, [please open an issue](https://github.com/algolia/api-clients-automation/issues/new?assignees=&labels=&template=Feature_request.md) |

### Usage

To get started, first install the `algoliasearch` client.

```bash
yarn add algoliasearch@alpha
# or
npm install algoliasearch@alpha
```

You can continue this guide on [our installation page](/docs/clients/installation).

### Methods targeting an `indexName`

Prior to the `initIndex` removal stated in the [common breaking changes](/docs/clients/migration-guides/#common-breaking-changes), all methods previously available at the `initIndex` level requires the `indexName` to be sent with the query.

```js
import { algoliasearch } from 'algoliasearch';

const client = algoliasearch('<YOUR_APP_ID>', '<YOUR_API_KEY>');

// only query string
const searchResults = await client.search({
requests: [
{
indexName: '<YOUR_INDEX_NAME>',
query: '<YOUR_QUERY>',
},
],
});

// with params
const searchResults2 = await client.search({
requests: [
{
indexName: '<YOUR_INDEX_NAME>',
query: '<YOUR_QUERY>',
attributesToRetrieve: ['firstname', 'lastname'],
hitsPerPage: 50,
},
],
});
```
21 changes: 0 additions & 21 deletions website/docs/clients/migration-guides/kotlin.md

This file was deleted.

Loading
Loading