Skip to content

Commit f234dcd

Browse files
Update core to version 3260001c
1 parent c29275d commit f234dcd

File tree

11 files changed

+644
-10
lines changed

11 files changed

+644
-10
lines changed

src/onepassword/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from .secrets import Secrets
88
from .items import Items
99
from .vaults import Vaults
10+
from .groups import Groups
1011

1112

1213
import sys
@@ -18,6 +19,7 @@
1819
"Secrets",
1920
"Items",
2021
"Vaults",
22+
"Groups",
2123
"DEFAULT_INTEGRATION_NAME",
2224
"DEFAULT_INTEGRATION_VERSION",
2325
]

src/onepassword/client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
from .secrets import Secrets
88
from .items import Items
99
from .vaults import Vaults
10+
from .groups import Groups
1011

1112

1213
class Client:
1314
secrets: Secrets
1415
items: Items
1516
vaults: Vaults
17+
groups: Groups
1618

1719
@classmethod
1820
async def authenticate(
@@ -31,6 +33,7 @@ async def authenticate(
3133
authenticated_client.secrets = Secrets(client_id)
3234
authenticated_client.items = Items(client_id)
3335
authenticated_client.vaults = Vaults(client_id)
36+
authenticated_client.groups = Groups(client_id)
3437
authenticated_client._finalizer = weakref.finalize(
3538
cls, _release_client, client_id
3639
)

src/onepassword/groups.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Code generated by op-codegen - DO NO EDIT MANUALLY
2+
3+
from .core import _invoke, _invoke_sync
4+
from typing import Optional, List
5+
from pydantic import TypeAdapter
6+
from .types import Group, GroupGetParams
7+
8+
9+
class Groups:
10+
"""
11+
The Groups API holds all the operations the SDK client can perform on 1Password groups.
12+
"""
13+
14+
def __init__(self, client_id):
15+
self.client_id = client_id
16+
17+
async def get(self, group_id: str, group_params: GroupGetParams) -> Group:
18+
response = await _invoke(
19+
{
20+
"invocation": {
21+
"clientId": self.client_id,
22+
"parameters": {
23+
"name": "GroupsGet",
24+
"parameters": {
25+
"group_id": group_id,
26+
"group_params": group_params.model_dump(by_alias=True),
27+
},
28+
},
29+
}
30+
}
31+
)
32+
33+
response = TypeAdapter(Group).validate_json(response)
34+
return response

src/onepassword/items.py

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,15 @@
55
from pydantic import TypeAdapter
66
from .items_shares import ItemsShares
77
from .items_files import ItemsFiles
8-
from .types import Item, ItemCreateParams, ItemListFilter, ItemOverview
8+
from .types import (
9+
Item,
10+
ItemCreateParams,
11+
ItemListFilter,
12+
ItemOverview,
13+
ItemsDeleteAllResponse,
14+
ItemsGetAllResponse,
15+
ItemsUpdateAllResponse,
16+
)
917

1018

1119
class Items:
@@ -38,6 +46,30 @@ async def create(self, params: ItemCreateParams) -> Item:
3846
response = TypeAdapter(Item).validate_json(response)
3947
return response
4048

49+
async def create_all(
50+
self, vault_id: str, params: List[ItemCreateParams]
51+
) -> ItemsUpdateAllResponse:
52+
"""
53+
Create items in batch, within a single vault.
54+
"""
55+
response = await _invoke(
56+
{
57+
"invocation": {
58+
"clientId": self.client_id,
59+
"parameters": {
60+
"name": "ItemsCreateAll",
61+
"parameters": {
62+
"vault_id": vault_id,
63+
"params": [o.model_dump(by_alias=True) for o in params],
64+
},
65+
},
66+
}
67+
}
68+
)
69+
70+
response = TypeAdapter(ItemsUpdateAllResponse).validate_json(response)
71+
return response
72+
4173
async def get(self, vault_id: str, item_id: str) -> Item:
4274
"""
4375
Get an item by vault and item ID
@@ -57,6 +89,25 @@ async def get(self, vault_id: str, item_id: str) -> Item:
5789
response = TypeAdapter(Item).validate_json(response)
5890
return response
5991

92+
async def get_all(self, vault_id: str, item_ids: List[str]) -> ItemsGetAllResponse:
93+
"""
94+
Get items by vault and their item IDs.
95+
"""
96+
response = await _invoke(
97+
{
98+
"invocation": {
99+
"clientId": self.client_id,
100+
"parameters": {
101+
"name": "ItemsGetAll",
102+
"parameters": {"vault_id": vault_id, "item_ids": item_ids},
103+
},
104+
}
105+
}
106+
)
107+
108+
response = TypeAdapter(ItemsGetAllResponse).validate_json(response)
109+
return response
110+
60111
async def put(self, item: Item) -> Item:
61112
"""
62113
Update an existing item.
@@ -94,6 +145,27 @@ async def delete(self, vault_id: str, item_id: str) -> None:
94145

95146
return None
96147

148+
async def delete_all(
149+
self, vault_id: str, item_ids: List[str]
150+
) -> ItemsDeleteAllResponse:
151+
"""
152+
Create items in batch, within a single vault.
153+
"""
154+
response = await _invoke(
155+
{
156+
"invocation": {
157+
"clientId": self.client_id,
158+
"parameters": {
159+
"name": "ItemsDeleteAll",
160+
"parameters": {"vault_id": vault_id, "item_ids": item_ids},
161+
},
162+
}
163+
}
164+
)
165+
166+
response = TypeAdapter(ItemsDeleteAllResponse).validate_json(response)
167+
return response
168+
97169
async def archive(self, vault_id: str, item_id: str) -> None:
98170
"""
99171
Archive an item.
1.51 MB
Binary file not shown.
2.14 MB
Binary file not shown.
1.36 MB
Binary file not shown.
1.88 MB
Binary file not shown.
1.25 MB
Binary file not shown.

0 commit comments

Comments
 (0)