Skip to content
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

fix(go): explicit usage of browse helpers #3417

Merged
merged 2 commits into from
Jul 25, 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
4 changes: 2 additions & 2 deletions playground/go/ingestion.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ func testIngestion(appID, apiKey string) int {

printResponse(createAuthenticationResponse)

listAuthenticationsResponse, err := ingestionClient.GetAuthentications(
ingestionClient.NewApiGetAuthenticationsRequest().WithItemsPerPage(2),
listAuthenticationsResponse, err := ingestionClient.ListAuthentications(
ingestionClient.NewApiListAuthenticationsRequest().WithItemsPerPage(2),
)
if err != nil {
fmt.Printf("request error with GetAuthentications: %v\n", err)
Expand Down
14 changes: 10 additions & 4 deletions playground/go/search.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"context"
"fmt"

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

res, err := searchClient.WaitForApiKey("test", search.API_KEY_OPERATION_ADD, search.WithContext(context.Background()), search.WithMaxRetries(4))
print(res)
print(err.Error())
err = searchClient.BrowseObjects("test-flag", *search.NewEmptyBrowseParamsObject(), search.WithAggregator(func(res any, err error) {
if err != nil {
panic(err)
}
fmt.Println(len(res.(*search.BrowseResponse).Hits))
}))
if err != nil {
panic(err)
}

/*
response, err := searchClient.AddOrUpdateObject(
Expand Down
7 changes: 0 additions & 7 deletions templates/go/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ type config struct {
maxRetries int
timeout func(int) time.Duration
aggregator func(any, error)
iterableError *IterableError

// -- WaitForApiKey options
apiKey *ApiKey
Expand Down Expand Up @@ -187,12 +186,6 @@ func WithAggregator(aggregator func(any, error)) iterableOption {
})
}

func WithIterableError(iterableError *IterableError) iterableOption {
return iterableOption(func(c *config) {
c.iterableError = iterableError
})
}

// --------- WaitForKey options ---------.

type WaitForApiKeyOption interface {
Expand Down
Loading
Loading