From 42226ca1fd6a0e6e198180c3b271a5565964522c Mon Sep 17 00:00:00 2001 From: Thomas Raffray Date: Tue, 17 Oct 2023 11:10:18 +0200 Subject: [PATCH] chore(go): update documentation --- website/docs/clients/installation.mdx | 9 ++++++++ website/docs/clients/migration-guides/go.md | 25 ++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/website/docs/clients/installation.mdx b/website/docs/clients/installation.mdx index 446f6b5fbb..60c2e767c9 100644 --- a/website/docs/clients/installation.mdx +++ b/website/docs/clients/installation.mdx @@ -111,6 +111,15 @@ dependencies { In multiplatform projects, add Algolia API client dependency to `commonMain`, and choose an [engine](https://ktor.io/docs/http-client-engines.html) for each target. + + + +First, install the Algolia API Go Client via the `go get` command: + +```bash +go get github.com/algolia/algoliasearch-client-go/v4 +``` + diff --git a/website/docs/clients/migration-guides/go.md b/website/docs/clients/migration-guides/go.md index 96f9472561..8dac60b3bc 100644 --- a/website/docs/clients/migration-guides/go.md +++ b/website/docs/clients/migration-guides/go.md @@ -9,5 +9,28 @@ Prior to the `initIndex` removal stated in the [common breaking changes](/docs/c That also mean you need to explicit the type you want to be returned from your queries, when it applies. ```go -// TBD +import ( + "github.com/algolia/algoliasearch-client-go/v4/algolia/search" +) + +indexName := "" +appID := "" +apiKey := "" + +searchClient := search.NewClient(appID, apiKey) + +results, err := searchClient.Search( + searchClient.NewApiSearchRequest( + search.NewSearchMethodParams( + []search.SearchQuery{ + search.SearchForHitsAsSearchQuery( + search.NewSearchForHits( + indexName, + search.WithSearchForHitsQuery(""), + ), + ), + }, + ), + ), +) ```