diff --git a/example/example.py b/example/example.py index a2f3b29..aa7a83b 100644 --- a/example/example.py +++ b/example/example.py @@ -27,7 +27,7 @@ async def main(): # [developer-docs.sdk.python.list-vaults]-start vaults = await client.vaults.list() for vault in vaults: - print(vault.title) + print(vault) # [developer-docs.sdk.python.list-vaults]-end # [developer-docs.sdk.python.list-items]-start @@ -53,7 +53,7 @@ async def main(): print(error) # [developer-docs.sdk.python.validate-secret-reference]-end - vault_id= os.getenv("OP_VAULT_ID") + vault_id = os.getenv("OP_VAULT_ID") if vault_id is None: raise Exception("OP_VAULT_ID environment variable is not set") @@ -104,7 +104,9 @@ async def main(): # [developer-docs.sdk.python.resolve-secret]-start # Retrieves a secret from 1Password. Takes a secret reference as input and returns the secret to which it points. - value = await client.secrets.resolve(f"op://{created_item.vault_id}/{created_item.id}/username") + value = await client.secrets.resolve( + f"op://{created_item.vault_id}/{created_item.id}/username" + ) print(value) # [developer-docs.sdk.python.resolve-secret]-end diff --git a/src/onepassword/build_number.py b/src/onepassword/build_number.py index 01889e4..896c6cb 100644 --- a/src/onepassword/build_number.py +++ b/src/onepassword/build_number.py @@ -1 +1 @@ -SDK_BUILD_NUMBER = "0030001" +SDK_BUILD_NUMBER = "0030101" diff --git a/src/onepassword/lib/aarch64/libop_uniffi_core.dylib b/src/onepassword/lib/aarch64/libop_uniffi_core.dylib index ef3b866..aed0646 100755 Binary files a/src/onepassword/lib/aarch64/libop_uniffi_core.dylib and b/src/onepassword/lib/aarch64/libop_uniffi_core.dylib differ diff --git a/src/onepassword/lib/aarch64/libop_uniffi_core.so b/src/onepassword/lib/aarch64/libop_uniffi_core.so index 45f4bc0..bb1a6aa 100755 Binary files a/src/onepassword/lib/aarch64/libop_uniffi_core.so and b/src/onepassword/lib/aarch64/libop_uniffi_core.so differ diff --git a/src/onepassword/lib/x86_64/libop_uniffi_core.dylib b/src/onepassword/lib/x86_64/libop_uniffi_core.dylib index d8d8e23..06a99e3 100755 Binary files a/src/onepassword/lib/x86_64/libop_uniffi_core.dylib and b/src/onepassword/lib/x86_64/libop_uniffi_core.dylib differ diff --git a/src/onepassword/lib/x86_64/libop_uniffi_core.so b/src/onepassword/lib/x86_64/libop_uniffi_core.so index d2e9455..1680d0e 100755 Binary files a/src/onepassword/lib/x86_64/libop_uniffi_core.so and b/src/onepassword/lib/x86_64/libop_uniffi_core.so differ diff --git a/src/onepassword/lib/x86_64/op_uniffi_core.dll b/src/onepassword/lib/x86_64/op_uniffi_core.dll index 93257d4..3d15fa3 100644 Binary files a/src/onepassword/lib/x86_64/op_uniffi_core.dll and b/src/onepassword/lib/x86_64/op_uniffi_core.dll differ diff --git a/src/onepassword/types.py b/src/onepassword/types.py index ded9b2c..37d2e33 100644 --- a/src/onepassword/types.py +++ b/src/onepassword/types.py @@ -976,6 +976,8 @@ class VaultOverview(BaseModel): Represents a decrypted 1Password vault. """ + model_config = ConfigDict(populate_by_name=True) + id: str """ The vault's ID @@ -984,6 +986,22 @@ class VaultOverview(BaseModel): """ The vault's title """ + created_at: Annotated[ + datetime, + BeforeValidator(parse_rfc3339), + PlainSerializer(serialize_datetime_data), + ] = Field(alias="createdAt") + """ + The time the vault was created at + """ + updated_at: Annotated[ + datetime, + BeforeValidator(parse_rfc3339), + PlainSerializer(serialize_datetime_data), + ] = Field(alias="updatedAt") + """ + The time the vault was updated at + """ class ItemListFilterByStateInner(BaseModel): diff --git a/src/release/README.md b/src/release/README.md index 8c6d468..ab88ca0 100644 --- a/src/release/README.md +++ b/src/release/README.md @@ -4,7 +4,7 @@ Before running this script, the user must make sure that they have the write per Run this make command to install all dependencies required for the Python SDK release process. ``` -release/install-dependencies +make release/install-dependencies ``` Step 1. Make any changes to the SDK as required on a feature branch or main branch. diff --git a/src/release/RELEASE-NOTES b/src/release/RELEASE-NOTES index f0801b8..113e69e 100644 --- a/src/release/RELEASE-NOTES +++ b/src/release/RELEASE-NOTES @@ -1,66 +1,5 @@ -# 1Password Python SDK v0.3.0 +# 1Password Python SDK v0.3.1 ## NEW -- **Support for item states**: You can now fetch an item's state using the SDK. `ItemOverview` exposes one of two states: `Active` or `Archived`. - - `Active`: An item located inside a vault. (Default) - - `Archived`: An item that has been moved to the Archive. 1Password doesn't include archived items in search results or suggest them when you fill in apps and browsers. You can keep archived items as long as you'd like. -- **Filtering listed items by state**: You can now filter the results of the item list function by item state. - -## FIXED - -- **Deleting Archived Items:** The SDK now supports deleting items from the archive. - -## ⚠️ BREAKING CHANGES ⚠️ -This release contains breaking changes for two functions in the Python SDK. - -**Vault listing** - -* The function name has changed from `list_all` to `list`. To use this in your code, replace: -```python -vaults = await client.vaults.list_all(vault_id) -``` -with: -```python -vaults = await client.vaults.list(vault_id) -``` - -* The return type of the vault listing function has changed from `SDKIterator[VaultOverview]` to `List[VaultOverview]`. To use this in your code, replace: - -```python -async for vault in vaults: - # using vault overview -``` -with: -```python -for vault in vaults: - # using vault overview -``` -**Item listing** - -* The function name has changed from `ListAll` to `List`. To use this in your code, replace: -```python -overviews = await client.items.list_all(vault_id) -``` -with: -```python -overviews = await client.items.list(vault_id, ItemListFilter( - content=ItemListFilterByStateInner( - active=True, - archived=True, - ) - )) -``` - -* The return type of the item listing function has changed from `SDKIterator[ItemOverview]` to `List[ItemOverview]`. To use this in your code, replace: -```python -async for overview in overviews: - # using item overview -``` -with: -```python -for overview in overviews: - # using item overview -``` - -This does not affect any code that's already deployed, and will not take effect in your codebase until you choose to update to version 0.3.0 or later of the 1Password Python SDK. +- `VaultOverview` now includes `created_at` and `updated_at` fields that show when the vault was created and last updated. diff --git a/version.py b/version.py index b263713..d97f823 100644 --- a/version.py +++ b/version.py @@ -1 +1 @@ -SDK_VERSION = "0.3.0" +SDK_VERSION = "0.3.1"