Skip to content

Commit

Permalink
Update core to version 010d4339
Browse files Browse the repository at this point in the history
  • Loading branch information
1PasswordSDKBot committed Jan 1, 2025
1 parent 5aedbae commit e29f54c
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 2 deletions.
38 changes: 37 additions & 1 deletion src/onepassword/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from .core import _invoke, _invoke_sync

Check failure on line 3 in src/onepassword/items.py

View workflow job for this annotation

GitHub Actions / Lint

Ruff (F401)

src/onepassword/items.py:3:28: F401 `.core._invoke_sync` imported but unused
from json import loads
from .iterator import SDKIterator
from .types import Item, ItemOverview
from .types import Item, ItemOverview, ItemsGetAllResponse


class Items:
Expand Down Expand Up @@ -48,6 +48,26 @@ async def get(self, vault_id, item_id):
)
return Item.model_validate_json(response)

async def get_all(self, vault_id, item_ids):
"""
Get items by vault and their item IDs.
"""
response = await _invoke(
{
"invocation": {
"clientId": self.client_id,
"parameters": {
"name": "ItemsGetAll",
"parameters": {
"vault_id": vault_id,
"item_ids": [o.model_dump(by_alias=True) for o in item_ids],
},
},
}
}
)
return ItemsGetAllResponse.model_validate_json(response)

async def put(self, item):
"""
Update an existing item.
Expand Down Expand Up @@ -81,6 +101,22 @@ async def delete(self, vault_id, item_id):
}
)

async def archive(self, vault_id, item_id):
"""
Archive an item.
"""
await _invoke(
{
"invocation": {
"clientId": self.client_id,
"parameters": {
"name": "ItemsArchive",
"parameters": {"vault_id": vault_id, "item_id": item_id},
},
}
}
)

async def list_all(self, vault_id):
"""
List all items
Expand Down
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.
24 changes: 23 additions & 1 deletion src/onepassword/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@

from enum import Enum
from pydantic import BaseModel, ConfigDict, Field
from typing import List, Literal, Optional, Union
from typing import Generic, List, Literal, Optional, TypeVar, Union

E = TypeVar("E")
T = TypeVar("T")


class GeneratePasswordResponse(BaseModel):
Expand Down Expand Up @@ -56,6 +59,8 @@ class ItemFieldType(str, Enum):
PHONE = "Phone"
URL = "Url"
TOTP = "Totp"
EMAIL = "Email"
REFERENCE = "Reference"
UNSUPPORTED = "Unsupported"


Expand Down Expand Up @@ -256,6 +261,23 @@ class ItemOverview(BaseModel):
"""


class Response(BaseModel, Generic[T, E]):
content: Optional[T] = Field(default=None)
error: Optional[E] = Field(default=None)


class ItemsGetAllError(str, Enum):
ITEMNOTFOUND = "itemNotFound"


class ItemsGetAllResponse(BaseModel):
model_config = ConfigDict(populate_by_name=True)

individual_responses: List[Response[Item, ItemsGetAllError]] = Field(
alias="individualResponses"
)


class OtpFieldDetails(BaseModel):
"""
Additional attributes for OTP fields.
Expand Down

0 comments on commit e29f54c

Please sign in to comment.