Skip to content

Commit ab08a28

Browse files
committed
add unused archive function
1 parent 56cc481 commit ab08a28

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

examples/index.mjs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,8 @@ try {
185185
// [developer-docs.sdk.js.generate-random-password]-end
186186
shareItem(client, item.vaultId, item.id);
187187
// [developer-docs.sdk.js.delete-item]-start
188-
// Delete / archive a item from your vault.
188+
// Delete an item from your vault.
189189
await client.items.delete(item.vaultId, item.id);
190-
// or to archive: await client.items.archive(item.vaultId, item.id)
191190
// [developer-docs.sdk.js.delete-item]-end
192191

193192
async function shareItem(client, vaultId, itemId) {
@@ -222,3 +221,13 @@ async function shareItem(client, vaultId, itemId) {
222221
console.log(share_link);
223222
// [developer-docs.sdk.js.item-share-create-share]-end
224223
}
224+
// NOTE: this is in a separate function to avoid creating a new item
225+
// NOTE: just for the sake of archiving it. This is because the SDK
226+
// NOTE: only works with active items, so archiving and then deleting
227+
// NOTE: is not yet possible.
228+
async function archiveItem(vaultId, itemId){
229+
// [developer-docs.sdk.js.archive-item]-start
230+
// Archive an item from your vault.
231+
await client.items.archive(vaultId, itemId);
232+
// [developer-docs.sdk.js.archive-item]-end
233+
}

0 commit comments

Comments
 (0)