|
1 | 1 | from typing import ( |
2 | 2 | Any, |
3 | 3 | Dict, |
4 | | - List, |
5 | 4 | Optional, |
6 | 5 | ) |
7 | | -from warnings import warn |
8 | 6 |
|
9 | 7 | from easypost.easypost_object import convert_to_easypost_object |
10 | | -from easypost.models import ( |
11 | | - ApiKey, |
12 | | - User, |
13 | | -) |
| 8 | +from easypost.models import User |
14 | 9 | from easypost.requestor import ( |
15 | 10 | RequestMethod, |
16 | 11 | Requestor, |
@@ -67,45 +62,6 @@ def retrieve_me(self) -> User: |
67 | 62 |
|
68 | 63 | return convert_to_easypost_object(response=response) |
69 | 64 |
|
70 | | - def all_api_keys(self) -> Dict[str, Any]: |
71 | | - """Retrieve a list of all API keys.""" |
72 | | - warn( |
73 | | - 'This method is deprecated, use the "all" function of "api_keys" on the client instead.', |
74 | | - DeprecationWarning, |
75 | | - stacklevel=2, |
76 | | - ) |
77 | | - |
78 | | - url = "/api_keys" |
79 | | - |
80 | | - response = Requestor(self._client).request(method=RequestMethod.GET, url=url) |
81 | | - |
82 | | - return convert_to_easypost_object(response=response) |
83 | | - |
84 | | - def api_keys(self, id: str) -> List[ApiKey]: |
85 | | - """Retrieve a list of API keys (works for the authenticated User or a child User).""" |
86 | | - warn( |
87 | | - 'This method is deprecated, use the "retrieve_api_keys_for_user" function ' |
88 | | - 'of "api_keys" on the client instead.', |
89 | | - DeprecationWarning, |
90 | | - stacklevel=2, |
91 | | - ) |
92 | | - |
93 | | - api_keys = self.all_api_keys() |
94 | | - my_api_keys = [] |
95 | | - |
96 | | - if api_keys["id"] == id: |
97 | | - # This function was called on the authenticated user |
98 | | - my_api_keys = api_keys["keys"] |
99 | | - else: |
100 | | - # This function was called on a child user (authenticated as parent, only return |
101 | | - # this child user's details). |
102 | | - for child in api_keys["children"]: |
103 | | - if child.id == id: |
104 | | - my_api_keys = child.keys |
105 | | - break |
106 | | - |
107 | | - return my_api_keys |
108 | | - |
109 | 65 | def update_brand(self, id: str, **params) -> User: |
110 | 66 | """Update a User's Brand.""" |
111 | 67 | url = self._instance_url(self._model_class, id) + "/brand" |
|
0 commit comments