Skip to content

Commit ed9e145

Browse files
authored
fix(go): explicit usage of browse helpers (#3417)
1 parent e0459e3 commit ed9e145

File tree

4 files changed

+139
-88
lines changed

4 files changed

+139
-88
lines changed

playground/go/ingestion.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ func testIngestion(appID, apiKey string) int {
3333

3434
printResponse(createAuthenticationResponse)
3535

36-
listAuthenticationsResponse, err := ingestionClient.GetAuthentications(
37-
ingestionClient.NewApiGetAuthenticationsRequest().WithItemsPerPage(2),
36+
listAuthenticationsResponse, err := ingestionClient.ListAuthentications(
37+
ingestionClient.NewApiListAuthenticationsRequest().WithItemsPerPage(2),
3838
)
3939
if err != nil {
4040
fmt.Printf("request error with GetAuthentications: %v\n", err)

playground/go/search.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package main
22

33
import (
4-
"context"
4+
"fmt"
55

66
"github.com/algolia/algoliasearch-client-go/v4/algolia/search"
77
)
@@ -13,9 +13,15 @@ func testSearch(appID, apiKey string) int {
1313
panic(err)
1414
}
1515

16-
res, err := searchClient.WaitForApiKey("test", search.API_KEY_OPERATION_ADD, search.WithContext(context.Background()), search.WithMaxRetries(4))
17-
print(res)
18-
print(err.Error())
16+
err = searchClient.BrowseObjects("test-flag", *search.NewEmptyBrowseParamsObject(), search.WithAggregator(func(res any, err error) {
17+
if err != nil {
18+
panic(err)
19+
}
20+
fmt.Println(len(res.(*search.BrowseResponse).Hits))
21+
}))
22+
if err != nil {
23+
panic(err)
24+
}
1925

2026
/*
2127
response, err := searchClient.AddOrUpdateObject(

templates/go/api.mustache

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ type config struct {
4343
maxRetries int
4444
timeout func(int) time.Duration
4545
aggregator func(any, error)
46-
iterableError *IterableError
4746

4847
// -- WaitForApiKey options
4948
apiKey *ApiKey
@@ -187,12 +186,6 @@ func WithAggregator(aggregator func(any, error)) iterableOption {
187186
})
188187
}
189188

190-
func WithIterableError(iterableError *IterableError) iterableOption {
191-
return iterableOption(func(c *config) {
192-
c.iterableError = iterableError
193-
})
194-
}
195-
196189
// --------- WaitForKey options ---------.
197190

198191
type WaitForApiKeyOption interface {

0 commit comments

Comments
 (0)