Skip to content

Commit

Permalink
enable filter use on get_items
Browse files Browse the repository at this point in the history
  • Loading branch information
ITJamie authored Jul 31, 2023
1 parent 5940698 commit 07de759
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/onepasswordconnectsdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,12 @@ def get_item_by_title(self, title: str, vault_id: str):
item_summary = self.deserialize(response.content, "list[SummaryItem]")[0]
return self.get_item_by_id(item_summary.id, vault_id)

def get_items(self, vault_id: str):
def get_items(self, vault_id: str, filter_query=None):
"""Returns a list of item summaries for the specified vault
Args:
vault_id (str): The id of the vault in which to get the items from
filter_query (str): A optional query statement, eg `title eq foo.bar`
Raises:
FailedToRetrieveItemException: Thrown when a HTTP error is returned
Expand All @@ -197,7 +198,10 @@ def get_items(self, vault_id: str):
Returns:
List[SummaryItem]: A list of summarized items
"""
url = f"/v1/vaults/{vault_id}/items"
if filter_query:
url = f"/v1/vaults/{vault_id}/items?filter={filter_query}"
else:
url = f"/v1/vaults/{vault_id}/items"

response = self.build_request("GET", url)
try:
Expand Down

0 comments on commit 07de759

Please sign in to comment.