1Password / onepassword-sdk-go

https://developer.1password.com/docs/sdks/
MIT License
60 stars 6 forks source link

Add client.Items.ListByTags(string[] tags) #154

Open davidolrik opened 2 weeks ago

davidolrik commented 2 weeks ago

Use Case

I would like to find all items in a vault that has a specific list of tags.

items, err := client.Items.ListByTags(string[]{"tag1", "tag2"})

This would save me from fetching all items in the vault.

Requirements and desired behavior

No response

Additional information

No response

MOmarMiraj commented 2 weeks ago

Hey @davidolrik ! This looks like something that is indeed useful for the SDKs.

We will consider adding this to the SDKs in the future.

hculea commented 12 hours ago

@davidolrik also worth calling out: such filtering still needs to happen client-side, since everything in 1Password is end-to-end encrypted. So even if the SDK would expose such utility functions, these would be no more performant than fetching and decrypting all the items and searching through them.

You can already achieve this today by client.Items.ListAll which returns the item overviews containing the item tags already, which you then can filter in your code.