Skip to content

Commit 0b8d817

Browse files
committed
Add item archiving example
1 parent 1c42731 commit 0b8d817

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

example/example.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,21 @@ async def main():
168168
await share_item(created_item.vault_id, updated_item.id, client)
169169

170170
# [developer-docs.sdk.python.delete-item]-start
171-
# Delete / archive a item from your vault.
171+
# Delete a item from your vault.
172172
await client.items.delete(created_item.vault_id, updated_item.id)
173-
# or to archive: await client.items.archive(created_item.vault_id, updated_item.id)
174173
# [developer-docs.sdk.python.delete-item]-end
175174

175+
## NOTE: this is in a separate function to avoid creating a new item
176+
## NOTE: just for the sake of archiving it. This is because the SDK
177+
## NOTE: only works with active items, so archiving and then deleting
178+
## NOTE: is not yet possible.
179+
async def archive_item(vault_id: str, item_id: str, client: Client):
180+
# [developer-docs.sdk.python.archive-item]-start
181+
# Delete a item from your vault.
182+
await client.items.archive(vault_id, item_id)
183+
# [developer-docs.sdk.python.archive-item]-end
184+
185+
176186
async def share_item(vault_id: str, item_id: str, client: Client):
177187
# [developer-docs.sdk.python.item-share-get-item]-start
178188
item = await client.items.get(vault_id, item_id)

0 commit comments

Comments
 (0)