Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions example/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/onepassword/build_number.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SDK_BUILD_NUMBER = "0030001"
SDK_BUILD_NUMBER = "0030101"
Binary file modified src/onepassword/lib/aarch64/libop_uniffi_core.dylib
Binary file not shown.
Binary file modified src/onepassword/lib/aarch64/libop_uniffi_core.so
Binary file not shown.
Binary file modified src/onepassword/lib/x86_64/libop_uniffi_core.dylib
Binary file not shown.
Binary file modified src/onepassword/lib/x86_64/libop_uniffi_core.so
Binary file not shown.
Binary file modified src/onepassword/lib/x86_64/op_uniffi_core.dll
Binary file not shown.
18 changes: 18 additions & 0 deletions src/onepassword/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion src/release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
65 changes: 2 additions & 63 deletions src/release/RELEASE-NOTES
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SDK_VERSION = "0.3.0"
SDK_VERSION = "0.3.1"
Loading