Skip to content

Commit 1256a90

Browse files
authored
Merge pull request #133 from 1Password/sdk-core/2024-11-20-5bbc96e0
Release candidate 0.1.4
2 parents b4370b8 + 1195ffc commit 1256a90

19 files changed

+149
-70
lines changed

example/example.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ async def main():
3232
print(item.title)
3333
# [developer-docs.sdk.python.list-items]-end
3434

35+
# [developer-docs.sdk.python.validate-secret-reference]-start
36+
# Validate secret reference to ensure no syntax errors
37+
try:
38+
Secrets.validate_secret_reference("op://vault/item/field")
39+
except Exception as error:
40+
print(error)
41+
# [developer-docs.sdk.python.validate-secret-reference]-end
42+
3543
# [developer-docs.sdk.python.resolve-secret]-start
3644
# Retrieves a secret from 1Password. Takes a secret reference as input and returns the secret to which it points.
3745
value = await client.secrets.resolve("op://vault/item/field")
@@ -42,25 +50,25 @@ async def main():
4250
# Create an Item and add it to your vault.
4351
to_create = ItemCreateParams(
4452
title="MyName",
45-
category="Login",
53+
category=ItemCategory.LOGIN,
4654
vault_id="7turaasywpymt3jecxoxk5roli",
4755
fields=[
4856
ItemField(
4957
id="username",
5058
title="username",
51-
field_type="Text",
59+
field_type=ItemFieldType.TEXT,
5260
value="mynameisjeff",
5361
),
5462
ItemField(
5563
id="password",
5664
title="password",
57-
field_type="Concealed",
65+
field_type=ItemFieldType.CONCEALED,
5866
value="jeff",
5967
),
6068
ItemField(
6169
id="onetimepassword",
6270
title="one-time-password",
63-
field_type="Totp",
71+
field_type=ItemFieldType.TOTP,
6472
section_id="totpsection",
6573
value="otpauth://totp/my-example-otp?secret=jncrjgbdjnrncbjsr&issuer=1Password",
6674
),
@@ -74,7 +82,7 @@ async def main():
7482
Website(
7583
label="my custom website",
7684
url="https://example.com",
77-
autofill_behavior="AnywhereOnWebsite",
85+
autofill_behavior=AutofillBehavior.NEVER,
7886
)
7987
],
8088
)
@@ -115,7 +123,7 @@ async def main():
115123
Website(
116124
label="my custom website 2",
117125
url="https://example2.com",
118-
autofill_behavior="Never",
126+
autofill_behavior=AutofillBehavior.NEVER,
119127
),
120128
)
121129
updated_item = await client.items.put(item)

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def get_shared_library_data_to_include():
6969
"Programming Language :: Python :: 3.10",
7070
"Programming Language :: Python :: 3.11",
7171
"Programming Language :: Python :: 3.12",
72+
"Programming Language :: Python :: 3.13"
7273
"License :: OSI Approved :: MIT License",
7374
],
7475
cmdclass={"bdist_wheel": bdist_wheel},

src/onepassword/build_number.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
SDK_BUILD_NUMBER = "0010301"
1+
SDK_BUILD_NUMBER = "0010401"

src/onepassword/core.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ async def _init_client(client_config):
2323
async def _invoke(invoke_config):
2424
return await core.invoke(json.dumps(invoke_config))
2525

26+
2627
# Invoke calls specified business logic from the SDK core.
2728
def _invoke_sync(invoke_config):
2829
return core.invoke_sync(json.dumps(invoke_config))

src/onepassword/items.py

Lines changed: 2 additions & 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 .core import _invoke
3+
from .core import _invoke, _invoke_sync
44
from json import loads
55
from .iterator import SDKIterator
66
from .types import Item, ItemOverview
@@ -96,6 +96,7 @@ async def list_all(self, vault_id):
9696
}
9797
}
9898
)
99+
99100
response_data = loads(response)
100101

101102
objects = [ItemOverview.model_validate(data) for data in response_data]
453 KB
Binary file not shown.
763 KB
Binary file not shown.

src/onepassword/lib/aarch64/op_uniffi_core.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,8 @@ def _uniffi_check_api_checksums(lib):
481481
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
482482
if lib.uniffi_op_uniffi_core_checksum_func_invoke() != 29143:
483483
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
484+
if lib.uniffi_op_uniffi_core_checksum_func_invoke_sync() != 49373:
485+
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
484486
if lib.uniffi_op_uniffi_core_checksum_func_release_client() != 57155:
485487
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
486488

@@ -496,6 +498,11 @@ def _uniffi_check_api_checksums(lib):
496498
_UniffiRustBuffer,
497499
)
498500
_UniffiLib.uniffi_op_uniffi_core_fn_func_invoke.restype = ctypes.c_void_p
501+
_UniffiLib.uniffi_op_uniffi_core_fn_func_invoke_sync.argtypes = (
502+
_UniffiRustBuffer,
503+
ctypes.POINTER(_UniffiRustCallStatus),
504+
)
505+
_UniffiLib.uniffi_op_uniffi_core_fn_func_invoke_sync.restype = _UniffiRustBuffer
499506
_UniffiLib.uniffi_op_uniffi_core_fn_func_release_client.argtypes = (
500507
_UniffiRustBuffer,
501508
ctypes.POINTER(_UniffiRustCallStatus),
@@ -775,6 +782,9 @@ def _uniffi_check_api_checksums(lib):
775782
_UniffiLib.uniffi_op_uniffi_core_checksum_func_invoke.argtypes = (
776783
)
777784
_UniffiLib.uniffi_op_uniffi_core_checksum_func_invoke.restype = ctypes.c_uint16
785+
_UniffiLib.uniffi_op_uniffi_core_checksum_func_invoke_sync.argtypes = (
786+
)
787+
_UniffiLib.uniffi_op_uniffi_core_checksum_func_invoke_sync.restype = ctypes.c_uint16
778788
_UniffiLib.uniffi_op_uniffi_core_checksum_func_release_client.argtypes = (
779789
)
780790
_UniffiLib.uniffi_op_uniffi_core_checksum_func_release_client.restype = ctypes.c_uint16
@@ -949,6 +959,13 @@ def invoke(invocation: "str"):
949959
_UniffiConverterTypeError,
950960
)
951961

962+
def invoke_sync(invocation: "str") -> "str":
963+
_UniffiConverterString.check_lower(invocation)
964+
965+
return _UniffiConverterString.lift(_rust_call_with_error(_UniffiConverterTypeError,_UniffiLib.uniffi_op_uniffi_core_fn_func_invoke_sync,
966+
_UniffiConverterString.lower(invocation)))
967+
968+
952969
def release_client(client_id: "str"):
953970
_UniffiConverterString.check_lower(client_id)
954971

@@ -961,6 +978,7 @@ def release_client(client_id: "str"):
961978
"Error",
962979
"init_client",
963980
"invoke",
981+
"invoke_sync",
964982
"release_client",
965983
]
966984

621 KB
Binary file not shown.
801 KB
Binary file not shown.

0 commit comments

Comments
 (0)