Skip to content

Commit

Permalink
Merge pull request #76 from ITJamie/patch-2
Browse files Browse the repository at this point in the history
enable filter use on get_items
  • Loading branch information
volodymyrZotov authored Sep 5, 2023
2 parents 012e08d + dd54141 commit 56a6f3e
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. `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 is None:
url = f"/v1/vaults/{vault_id}/items"
else:
url = f"/v1/vaults/{vault_id}/items?filter={filter_query}"

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

0 comments on commit 56a6f3e

Please sign in to comment.