8
8
import datetime
9
9
from requests .exceptions import HTTPError
10
10
import onepasswordconnectsdk
11
- from onepasswordconnectsdk .models import FullItem , ItemVault
11
+ from onepasswordconnectsdk .models import Item , ItemVault
12
12
13
13
14
14
ENV_SERVICE_ACCOUNT_JWT_VARIABLE = "OP_CONNECT_TOKEN"
@@ -73,7 +73,7 @@ def get_item(self, item_id: str, vault_id: str):
73
73
f"Unable to retrieve item. Received { response .status_code } \
74
74
for { url } with message: { response .json ().get ('message' )} "
75
75
)
76
- return self .deserialize (response .content , "FullItem " )
76
+ return self .deserialize (response .content , "Item " )
77
77
78
78
def get_item_by_title (self , title : str , vault_id : str ):
79
79
"""Get a specific item by title
@@ -102,7 +102,7 @@ def get_item_by_title(self, title: str, vault_id: str):
102
102
title { title } "
103
103
)
104
104
105
- return self .deserialize (response .content , "list[Item ]" )[0 ]
105
+ return self .deserialize (response .content , "list[SummaryItem ]" )[0 ]
106
106
107
107
def get_items (self , vault_id : str ):
108
108
"""Returns a list of item summaries for the specified vault
@@ -115,7 +115,7 @@ def get_items(self, vault_id: str):
115
115
from the 1Password Connect API
116
116
117
117
Returns:
118
- List[Item ]: A list of summarized items
118
+ List[SummaryItem ]: A list of summarized items
119
119
"""
120
120
url = f"/v1/vaults/{ vault_id } /items"
121
121
@@ -128,7 +128,7 @@ def get_items(self, vault_id: str):
128
128
for { url } with message: { response .json ().get ('message' )} "
129
129
)
130
130
131
- return self .deserialize (response .content , "list[Item ]" )
131
+ return self .deserialize (response .content , "list[SummaryItem ]" )
132
132
133
133
def delete_item (self , item_id : str , vault_id : str ):
134
134
"""Deletes a specified item from a specified vault
@@ -153,19 +153,19 @@ def delete_item(self, item_id: str, vault_id: str):
153
153
for { url } with message: { response .json ().get ('message' )} "
154
154
)
155
155
156
- def create_item (self , vault_id : str , item : FullItem ):
156
+ def create_item (self , vault_id : str , item : Item ):
157
157
"""Creates an item at the specified vault
158
158
159
159
Args:
160
160
vault_id (str): The id of the vault in which add the item to
161
- item (FullItem ): The item to create
161
+ item (Item ): The item to create
162
162
163
163
Raises:
164
164
FailedToRetrieveItemException: Thrown when a HTTP error is returned
165
165
from the 1Password Connect API
166
166
167
167
Returns:
168
- FullItem : The created item
168
+ Item : The created item
169
169
"""
170
170
171
171
url = f"/v1/vaults/{ vault_id } /items"
@@ -178,22 +178,22 @@ def create_item(self, vault_id: str, item: FullItem):
178
178
f"Unable to post item. Received { response .status_code } \
179
179
for { url } with message: { response .json ().get ('message' )} "
180
180
)
181
- return self .deserialize (response .content , "FullItem " )
181
+ return self .deserialize (response .content , "Item " )
182
182
183
- def update_item (self , item_uuid : str , vault_id : str , item : FullItem ):
183
+ def update_item (self , item_uuid : str , vault_id : str , item : Item ):
184
184
"""Update the specified item at the specified vault.
185
185
186
186
Args:
187
187
item_uuid (str): The id of the item in which to update
188
188
vault_id (str): The id of the vault in which to update the item
189
- item (FullItem ): The updated item
189
+ item (Item ): The updated item
190
190
191
191
Raises:
192
192
FailedToRetrieveItemException: Thrown when a HTTP error is returned
193
193
from the 1Password Connect API
194
194
195
195
Returns:
196
- FullItem : The updated item
196
+ Item : The updated item
197
197
"""
198
198
url = f"/v1/vaults/{ vault_id } /items/{ item_uuid } "
199
199
item .id = item_uuid
@@ -207,7 +207,7 @@ def update_item(self, item_uuid: str, vault_id: str, item: FullItem):
207
207
f"Unable to post item. Received { response .status_code } \
208
208
for { url } with message: { response .json ().get ('message' )} "
209
209
)
210
- return self .deserialize (response .content , "FullItem " )
210
+ return self .deserialize (response .content , "Item " )
211
211
212
212
def get_vault (self , vault_id : str ):
213
213
"""Returns the vault with the given vault_id
0 commit comments