Skip to content

Commit 6796b20

Browse files
committed
Use custom serialization and deserialization functions for API functions
1 parent ec6dc8d commit 6796b20

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/onepassword/items.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ async def create(self, params):
2828
},
2929
}
3030
)
31-
return Item(**loads(response))
31+
return Item.model_validate_json(response)
3232

3333
async def get(self, vault_id, item_id):
3434
"""
@@ -46,7 +46,7 @@ async def get(self, vault_id, item_id):
4646
},
4747
}
4848
)
49-
return Item(**loads(response))
49+
return Item.model_validate_json(response)
5050

5151
async def put(self, item):
5252
"""
@@ -63,7 +63,7 @@ async def put(self, item):
6363
},
6464
}
6565
)
66-
return Item(**loads(response))
66+
return Item.model_validate_json(response)
6767

6868
async def delete(self, vault_id, item_id):
6969
"""
@@ -100,6 +100,6 @@ async def list_all(self, vault_id):
100100
)
101101
response_data = loads(response)
102102

103-
objects = [ItemOverview(**data) for data in response_data]
103+
objects = [ItemOverview.model_validate(data) for data in response_data]
104104

105-
return SDKIterator(objects)
105+
return SDKIterator(objects)

src/onepassword/vaults.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ async def list_all(self):
2525
)
2626
response_data = loads(response)
2727

28-
objects = [VaultOverview(**data) for data in response_data]
28+
objects = [VaultOverview.model_validate(data) for data in response_data]
2929

30-
return SDKIterator(objects)
30+
return SDKIterator(objects)

0 commit comments

Comments
 (0)