Skip to content

Commit 6accb0a

Browse files
committed
Also reformat the get item invocation
1 parent 3d3e3f6 commit 6accb0a

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

example/example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ async def main():
1717

1818
# Connects to 1Password.
1919
client = await Client.authenticate(
20-
auth="",
20+
auth="AgHouUoF1O06H1z9hJjQofEveT3ITHGYmTEvCucRNtokepcEC7vLiq5L95Dc42Fwljzj5tsqWRujsUHOkyuLPOnn_BrJu0H81x2CBKnerwMdlgc",
2121
# Set the following to your own integration name and version.
2222
integration_name="My 1Password Integration",
2323
integration_version="v1.0.0",
2424
)
2525
# [developer-docs.sdk.python.client-initialization]-end
2626

27-
secret = await client.secrets.resolve("op://test/AcmeCorp/credential")
27+
secret = await client.items.get("54jd5fopcp34u2rqqypee6uofm", "it76yngyalveqbmbbz4ijhwnrq")
2828
print(f"Secret resolved: {secret}")
2929

3030
if __name__ == "__main__":

src/onepassword/items.py

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

3+
import json
34
from .core import _invoke, _invoke_sync
45
from typing import Optional, List
56
from pydantic import TypeAdapter
@@ -43,18 +44,20 @@ async def get(self, vault_id: str, item_id: str) -> Item:
4344
Get an item by vault and item ID
4445
"""
4546
response = await _invoke(
46-
{
47-
"invocation": {
48-
"clientId": self.client_id,
49-
"parameters": {
50-
"name": "ItemsGet",
51-
"parameters": {"vault_id": vault_id, "item_id": item_id},
52-
},
53-
}
54-
}
47+
{
48+
"ffiMethod": "invoke",
49+
"payload": {
50+
"name": "ItemsGet",
51+
"parameters": {"vault_id": vault_id, "item_id": item_id}
52+
}
53+
}
5554
)
5655

57-
response = TypeAdapter(Item).validate_json(response)
56+
print(response)
57+
58+
actual_item = json.loads(response)
59+
60+
response = TypeAdapter(Item).validate_json(actual_item)
5861
return response
5962

6063
async def put(self, item: Item) -> Item:

src/onepassword/secrets.py

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

3+
import json
34
from .core import _invoke, _invoke_sync
45
from typing import Optional, List
56
from pydantic import TypeAdapter
@@ -29,7 +30,10 @@ async def resolve(self, secret_reference: str) -> str:
2930
}
3031
)
3132

32-
response = TypeAdapter(str).validate_json(response)
33+
actual_item = json.loads(response)
34+
35+
36+
response = TypeAdapter(str).validate_json(actual_item)
3337
return response
3438

3539
async def resolve_all(self, secret_references: List[str]) -> ResolveAllResponse:

0 commit comments

Comments
 (0)