Skip to content

Commit 52ba1e1

Browse files
authored
docs: cleanup duplicated guides (#3138)
1 parent 6f2ab62 commit 52ba1e1

File tree

16 files changed

+123
-367
lines changed

16 files changed

+123
-367
lines changed

website/docs/clients/guides/send-data-to-algolia.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ To push data to Algolia, you need an Application ID and a valid API key with the
1515

1616
## Setting up the API client
1717

18-
> [Make sure to also read the `installation` page](/docs/clients/installation).
18+
> [Make sure to also read the `usage` page](/docs/clients/usage).
1919
2020
<TabsLanguage>
2121
<TabItem value="javascript">

website/docs/clients/introduction.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ title: Introduction
44

55
# Introduction
66

7-
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).
7+
This section holds information about [the generated Algolia API clients](https://github.com/algolia/api-clients-automation).
8+
9+
If you wish to contribute, please see [the contributing page](/docs/contributing/introduction).
810

911
## Repositories
1012

@@ -13,8 +15,8 @@ Generated code in production can be find on repository of the clients.
1315
- [C#](https://github.com/algolia/algoliasearch-client-csharp/tree/next)
1416
- [Dart](https://github.com/algolia/algoliasearch-client-dart/)
1517
- [Go](https://github.com/algolia/algoliasearch-client-go/tree/next/)
16-
- [Java](https://github.com/algolia/algoliasearch-client-java/tree/next/)
1718
- [JavaScript](https://github.com/algolia/algoliasearch-client-javascript/tree/next/)
19+
- [Java](https://github.com/algolia/algoliasearch-client-java/tree/next/)
1820
- [Kotlin](https://github.com/algolia/algoliasearch-client-kotlin/tree/next/)
1921
- [PHP](https://github.com/algolia/algoliasearch-client-php/tree/next/)
2022
- [Python](https://github.com/algolia/algoliasearch-client-python/tree/next)
@@ -23,13 +25,12 @@ Generated code in production can be find on repository of the clients.
2325

2426
## Usage
2527

26-
See [the installation](/docs/clients/installation) page.
28+
See [the usage](/docs/clients/usage) page.
2729

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

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

32-
To report feedbacks, please use:
34+
## Feedbacks
3335

34-
- [GitHub issues](https://github.com/algolia/api-clients-automation/issues)
35-
- [#api-clients-beta-testers slack channel](https://algolia.slack.com/archives/C0341QDM3EG)
36+
Please use [GitHub issues](https://github.com/algolia/api-clients-automation/issues)

website/docs/clients/migration-guides/csharp.md

Lines changed: 0 additions & 52 deletions
This file was deleted.

website/docs/clients/migration-guides/go.md

Lines changed: 0 additions & 36 deletions
This file was deleted.

website/docs/clients/migration-guides/index.mdx

Lines changed: 82 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -51,27 +51,54 @@ const searchResults = await client.search({
5151
```py
5252
from algoliasearch.search.client import SearchClient
5353

54-
client = SearchClient.create("YOUR_APP_ID", "YOUR_API_KEY")
54+
client = SearchClient("YOUR_APP_ID", "YOUR_API_KEY")
55+
56+
# using a raw dict
57+
58+
search_resp = await client.search(search_method_params={"requests": [{"indexName": "nvim"}]})
59+
60+
# using the given models
61+
62+
from algoliasearch.search.models.search_method_params import SearchMethodParams
63+
from algoliasearch.search.models.search_for_hits import SearchForHits
64+
from algoliasearch.search.models.search_query import SearchQuery
65+
66+
search_resp = await client.search(
67+
search_method_params=SearchMethodParams(
68+
requests=[
69+
SearchQuery(SearchForHits(index_name="nvim")),
70+
],
71+
),
72+
)
5573

56-
searchResults = await client.search(search_method_params={"requests": [{"indexName": "nvim"}]})
74+
print(search_resp.to_json())
5775
```
5876

5977
</TabItem>
6078
<TabItem value="php">
6179

6280
```php
63-
$client = Algolia\AlgoliaSearch\Api\SearchClient::create(
81+
use Algolia\AlgoliaSearch\Api\SearchClient;
82+
83+
$client = SearchClient::create(
6484
'<YOUR_APP_ID>',
6585
'<YOUR_API_KEY>'
6686
);
6787

68-
$client->search([
88+
// only query string
89+
$searchResults = $client->search([
90+
'requests' => [
91+
['indexName' => '<YOUR_INDEX_NAME>', 'query' =>'<YOUR_QUERY>'],
92+
],
93+
]);
94+
95+
$searchResults2 = $client->search([
6996
'requests' => [
7097
[
71-
'indexName' => '<YOUR_INDEX_NAME>',
98+
'indexName' => '<YOUR_INDEX_NAME>',
7299
'query' => '<YOUR_QUERY>',
73100
'attributesToRetrieve' => ['firstname', 'lastname'],
74-
'hitsPerPage': 50,
101+
'hitsPerPage' => 50,
75102
],
76103
],
77104
]);
@@ -101,6 +128,51 @@ client.search(
101128
);
102129
```
103130

131+
</TabItem>
132+
<TabItem value="kotlin">
133+
134+
```kotlin
135+
import com.algolia.client.api.SearchClient
136+
import com.algolia.client.model.search.*
137+
138+
val client = SearchClient("<YOUR_APP_ID>", "<YOUR_API_KEY>")
139+
val response = client.search(
140+
SearchMethodParams(
141+
requests = listOf(SearchForHits(indexName = "<YOUR_INDEX_NAME>", query = "<YOUR_QUERY>"))
142+
)
143+
)
144+
```
145+
146+
</TabItem>
147+
<TabItem value="go">
148+
149+
```go
150+
import (
151+
"github.com/algolia/algoliasearch-client-go/v4/algolia/search"
152+
)
153+
154+
indexName := "<INDEX_NAME>"
155+
appID := "<APPLICATION_ID>"
156+
apiKey := "<API_KEY>"
157+
158+
searchClient, _ := search.NewClient(appID, apiKey)
159+
160+
results, err := searchClient.Search(
161+
searchClient.NewApiSearchRequest(
162+
search.NewSearchMethodParams(
163+
[]search.SearchQuery{
164+
search.SearchForHitsAsSearchQuery(
165+
search.NewSearchForHits(
166+
indexName,
167+
search.WithSearchForHitsQuery("<YOUR_QUERY>"),
168+
),
169+
),
170+
},
171+
),
172+
),
173+
)
174+
```
175+
104176
</TabItem>
105177
<TabItem value="csharp">
106178

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

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

113-
client.Search<Hit>(new SearchMethodParams([
114-
new SearchQuery(new SearchForHits("<YOUR_INDEX_NAME>")
115-
{
116-
Query = "<YOUR_QUERY>",
117-
AttributesToRetrieve = ["firstname", "lastname"],
118-
HitsPerPage = 50
119-
})
120-
]));
185+
client.Search<YOUR_RECORD_TYPE_CLASS>(new SearchMethodParams(new List<SearchQuery>
186+
{
187+
new(new SearchForHits("<YOUR_INDEX>") { Query = "<YOUR_QUERY>" })
188+
}));
121189
```
122190

123191
</TabItem>
@@ -759,10 +827,5 @@ foreach (var synonym in browseSynonyms)
759827

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

762-
- [Go migration guide](/docs/clients/migration-guides/go)
763-
- [Java migration guide](/docs/clients/migration-guides/java)
764830
- [JavaScript migration guide](/docs/clients/migration-guides/javascript)
765-
- [Kotlin migration guide](/docs/clients/migration-guides/kotlin)
766831
- [PHP migration guide](/docs/clients/migration-guides/php)
767-
- [Python migration guide](/docs/clients/migration-guides/python)
768-
- [C# migration guide](/docs/clients/migration-guides/csharp)

website/docs/clients/migration-guides/java.md

Lines changed: 0 additions & 29 deletions
This file was deleted.

website/docs/clients/migration-guides/javascript.md

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6,47 +6,3 @@ title: JavaScript
66
|-----------|:---------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
77
| `search` | `searchClient` | Exported clients are suffixed by `Client`. |
88
| `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) |
9-
10-
### Usage
11-
12-
To get started, first install the `algoliasearch` client.
13-
14-
```bash
15-
yarn add algoliasearch@alpha
16-
# or
17-
npm install algoliasearch@alpha
18-
```
19-
20-
You can continue this guide on [our installation page](/docs/clients/installation).
21-
22-
### Methods targeting an `indexName`
23-
24-
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.
25-
26-
```js
27-
import { algoliasearch } from 'algoliasearch';
28-
29-
const client = algoliasearch('<YOUR_APP_ID>', '<YOUR_API_KEY>');
30-
31-
// only query string
32-
const searchResults = await client.search({
33-
requests: [
34-
{
35-
indexName: '<YOUR_INDEX_NAME>',
36-
query: '<YOUR_QUERY>',
37-
},
38-
],
39-
});
40-
41-
// with params
42-
const searchResults2 = await client.search({
43-
requests: [
44-
{
45-
indexName: '<YOUR_INDEX_NAME>',
46-
query: '<YOUR_QUERY>',
47-
attributesToRetrieve: ['firstname', 'lastname'],
48-
hitsPerPage: 50,
49-
},
50-
],
51-
});
52-
```

website/docs/clients/migration-guides/kotlin.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)