Skip to content

Commit dee7990

Browse files
committed
Update examples and README.md
1 parent a878f22 commit dee7990

File tree

2 files changed

+44
-5
lines changed

2 files changed

+44
-5
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,24 +87,28 @@ Operations:
8787
- [x] [Create items](https://developer.1password.com/docs/sdks/manage-items#create-an-item)
8888
- [x] [Update items](https://developer.1password.com/docs/sdks/manage-items#update-an-item)
8989
- [x] [Delete items](https://developer.1password.com/docs/sdks/manage-items#delete-an-item)
90+
- [x] Archive items
9091
- [x] [List items](https://developer.1password.com/docs/sdks/list-vaults-items/)
91-
- [x] Add & update tags on items
92+
- [x] Share items
9293
- [x] Generate PIN, random and memorable passwords
9394

9495
Field types:
9596
- [x] API Keys
9697
- [x] Passwords
9798
- [x] Concealed fields
9899
- [x] Text fields
99-
- [ ] Notes
100-
- [x] SSH private keys (partially supported: supported in resolving secret references, not yet supported in item create/get/update)
101-
- [ ] SSH public keys, fingerprint and key type
100+
- [x] Notes
101+
- [x] SSH private keys, public keys, fingerprint and key type (partially supported: supported in resolving secret references, not yet supported in item create/get/update)
102102
- [x] One-time passwords
103103
- [x] URLs
104104
- [x] Websites (used to suggest and autofill logins)
105105
- [x] Phone numbers
106106
- [x] Credit card types
107107
- [x] Credit card numbers
108+
- [x] Emails
109+
- [x] References to other items
110+
- [ ] Address
111+
- [ ] Date / MM/YY
108112
- [ ] Files attachments and Document items
109113

110114
### Vault management

example/example.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,46 @@ async def main():
165165
print(random_password)
166166
# [developer-docs.sdk.python.generate-random-password]-end
167167

168+
await share_item(created_item.vault_id, updated_item.id, client)
169+
168170
# [developer-docs.sdk.python.delete-item]-start
169-
# Delete a item from your vault.
171+
# Delete / archive a item from your vault.
170172
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)
171174
# [developer-docs.sdk.python.delete-item]-end
172175

176+
async def share_item(vault_id: str, item_id: str, client: Client):
177+
# [developer-docs.sdk.python.item-share-get-item]-start
178+
item = await client.items.get(vault_id, item_id)
179+
print(item)
180+
# [developer-docs.sdk.python.item-share-get-item]-end
181+
182+
# [developer-docs.sdk.python.item-share-get-account-policy]-start
183+
policy = await client.items.shares.get_account_policy(item.vault_id, item.id)
184+
print(policy)
185+
# [developer-docs.sdk.python.item-share-get-account-policy]-end
186+
187+
# [developer-docs.sdk.python.item-share-validate-recipients]-start
188+
valid_recipients = await client.items.shares.validate_recipients(
189+
policy, ["agilebits.com"]
190+
)
191+
192+
print(valid_recipients)
193+
# [developer-docs.sdk.python.item-share-validate-recipients]-end
194+
195+
# [developer-docs.sdk.python.item-share-create-share]-start
196+
share_link = await client.items.shares.create(
197+
item,
198+
policy,
199+
ItemShareParams(
200+
recipients = valid_recipients,
201+
expireAfter= ItemShareDuration.ONEHOUR,
202+
oneTimeOnly= False,
203+
),
204+
)
205+
206+
print(share_link)
207+
# [developer-docs.sdk.python.item-share-create-share]-end
173208

174209
if __name__ == "__main__":
175210
asyncio.run(main())

0 commit comments

Comments
 (0)