Skip to content

Commit 451bda7

Browse files
authored
Merge pull request #181 from 1Password/sdk-core/beta/2025-10-14-3260001c
Make private beta features visible for private beta testers
2 parents 38f0cf8 + e58cd3b commit 451bda7

17 files changed

+628
-31
lines changed

example/desktop_app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ async def main():
88
# Connects to the 1Password desktop app.
99
client = await Client.authenticate(
1010
auth=DesktopAuth(
11-
account_name="YourAccountNameAsItAppearsInTheApp" # Set to your 1Password account name.
11+
account_name="YouAccountNameAsShownInDesktopApp" # Set to your 1Password account name.
1212
),
1313
# Set the following to your own integration name and version.
1414
integration_name="My 1Password Integration",
@@ -22,7 +22,7 @@ async def main():
2222
# [developer-docs.sdk.python.list-vaults]-end
2323

2424
# [developer-docs.sdk.python.list-items]-start
25-
overviews = await client.items.list(vault.id)
25+
overviews = await client.items.list(vault_id=vaults[0].id)
2626
for overview in overviews:
2727
print(overview.title)
2828
# [developer-docs.sdk.python.list-items]-end

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
"DesktopAuth",

src/onepassword/client.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@
22

33
from __future__ import annotations
44
import weakref
5-
from .core import Core, UniffiCore
5+
from .core import UniffiCore
66
from .desktop_core import DesktopCore
77
from .defaults import new_default_config, DesktopAuth
88
from .secrets import Secrets
99
from .items import Items
1010
from .vaults import Vaults
11+
from .groups import Groups
1112

1213

1314
class Client:
1415
secrets: Secrets
1516
items: Items
1617
vaults: Vaults
18+
groups: Groups
1719

1820
@classmethod
1921
async def authenticate(
@@ -37,6 +39,8 @@ async def authenticate(
3739
authenticated_client.secrets = Secrets(client_id, core)
3840
authenticated_client.items = Items(client_id, core)
3941
authenticated_client.vaults = Vaults(client_id, core)
42+
authenticated_client.groups = Groups(client_id, core)
43+
4044
authenticated_client._finalizer = weakref.finalize(
4145
cls, core.release_client, client_id
4246
)

src/onepassword/defaults.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def new_default_config(auth: DesktopAuth | str, integration_name, integration_ve
3232
"osVersion": DEFAULT_OS_VERSION,
3333
"architecture": platform.machine(),
3434
}
35-
if isinstance(auth, str):
35+
if not isinstance(auth, DesktopAuth):
3636
client_config_dict["serviceAccountToken"] = auth
3737

3838
return client_config_dict

src/onepassword/desktop_core.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import base64
66
from pathlib import Path
77
from ctypes import c_uint8, c_size_t, c_int32, POINTER, byref, c_void_p
8-
from .core import UniffiCore
98
from onepassword.errors import raise_typed_exception
109

1110

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 Core
4+
from pydantic import TypeAdapter
5+
from .types import Group, GroupGetParams
6+
7+
8+
class Groups:
9+
"""
10+
The Groups API holds all the operations the SDK client can perform on 1Password groups.
11+
"""
12+
13+
def __init__(self, client_id, core: Core):
14+
self.client_id = client_id
15+
self.core = core
16+
17+
async def get(self, group_id: str, group_params: GroupGetParams) -> Group:
18+
response = await self.core.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: 76 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
# Code generated by op-codegen - DO NO EDIT MANUALLY
22

3-
from typing import Optional, List
3+
from .core import Core
4+
from typing import List
45
from pydantic import TypeAdapter
56
from .items_shares import ItemsShares
67
from .items_files import ItemsFiles
7-
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+
)
817

918

1019
class Items:
1120
"""
1221
The Items API holds all operations the SDK client can perform on 1Password items.
1322
"""
1423

15-
def __init__(self, client_id, core):
24+
def __init__(self, client_id, core: Core):
1625
self.client_id = client_id
1726
self.core = core
1827
self.shares = ItemsShares(client_id, core)
@@ -37,6 +46,30 @@ async def create(self, params: ItemCreateParams) -> Item:
3746
response = TypeAdapter(Item).validate_json(response)
3847
return response
3948

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 self.core.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+
4073
async def get(self, vault_id: str, item_id: str) -> Item:
4174
"""
4275
Get an item by vault and item ID
@@ -56,6 +89,25 @@ async def get(self, vault_id: str, item_id: str) -> Item:
5689
response = TypeAdapter(Item).validate_json(response)
5790
return response
5891

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 self.core.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+
59111
async def put(self, item: Item) -> Item:
60112
"""
61113
Update an existing item.
@@ -93,6 +145,27 @@ async def delete(self, vault_id: str, item_id: str) -> None:
93145

94146
return None
95147

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 self.core.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+
96169
async def archive(self, vault_id: str, item_id: str) -> None:
97170
"""
98171
Archive an item.

src/onepassword/items_files.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Code generated by op-codegen - DO NO EDIT MANUALLY
22

33
from .core import Core
4-
from typing import Optional, List
4+
from typing import List
55
from pydantic import TypeAdapter
66
from .types import DocumentCreateParams, FileAttributes, FileCreateParams, Item
77

88

99
class ItemsFiles:
10-
def __init__(self, client_id, core):
10+
def __init__(self, client_id, core: Core):
1111
self.client_id = client_id
1212
self.core = core
1313

src/onepassword/items_shares.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Code generated by op-codegen - DO NO EDIT MANUALLY
22

3-
from typing import Optional, List
3+
from typing import List
44
from pydantic import TypeAdapter
55
from .types import Item, ItemShareAccountPolicy, ItemShareParams, ValidRecipient
66

1.41 MB
Binary file not shown.

0 commit comments

Comments
 (0)