Skip to content

Index.Exists doesn't accept options (and so context) #710

Open
@k20human

Description

@k20human
  • Algolia Client Version: 3.26.1

Description

Currently the function index.Exists 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 ?

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 👍🏻

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions