algolia / algolia/algoliasearch-client-go
Index.Exists doesn't accept options (and so context)
- Dominant language
- Go
- Stars
- 200
- Forks
- 60
- PR merge metrics
- No merged PRs in 30d
Description
- Algolia Client Version: 3.26.1
### Description
Currently the function [index.Exists](https://github.com/algolia/algoliasearch-client-go/blob/15d0de75e06af571cff6db73e340f000bf5d278f/algolia/search/index.go#L107) doesn't accept options like other functions.
We use `opts` to pass the current context. With a custom `Requester` (`http.client`) it's allow us to do tracing.
Without opts we can trace correctly this `Exists` function 😞
Is it possible to add `opts` on `Exists` function, like this ?
```go
func (i *Index) Exists(opts ...interface{}) (bool, error) {
_, err := i.GetSettings(opts)
if err == nil {
return true, nil
}
if _, ok := errs.IsAlgoliaErrWithCode(err, http.StatusNotFound); ok {
return false, nil
}
return false, err
}
```
I can create a PR to fix this 👍🏻
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in algolia/search/index.go at Index.Exists and compare its signature with other functions that accept options. Check how Exists delegates to GetSettings and how opts reach the custom Requester; done means Exists accepts and forwards options while preserving its existing true, false, and error behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100