66from resend .api_keys ._api_key import ApiKey
77
88
9- class _ListResponse (TypedDict ):
10- data : List [ApiKey ]
11- """
12- A list of API key objects
13- """
14-
15-
169class ApiKeys :
1710
18- class ListResponse (_ListResponse ):
11+ class ListResponse (TypedDict ):
1912 """
2013 ListResponse type that wraps a list of API key objects
2114
2215 Attributes:
2316 data (List[Dict[str, Any]]): A list of API key objects
2417 """
2518
19+ data : List [ApiKey ]
20+ """
21+ A list of API key objects
22+ """
23+
24+ class CreateApiKeyResponse (TypedDict ):
25+ """
26+ CreateApiKeyResponse is the type that wraps the response of the API key that was created
27+
28+ Attributes:
29+ id (str): The ID of the created API key
30+ token (str): The token of the created API key
31+ """
32+
33+ id : str
34+ """
35+ The ID of the created API key
36+ """
37+ token : str
38+ """
39+ The token of the created API key
40+ """
41+
2642 class CreateParams (TypedDict ):
2743 name : str
2844 """
@@ -41,7 +57,7 @@ class CreateParams(TypedDict):
4157 """
4258
4359 @classmethod
44- def create (cls , params : CreateParams ) -> ApiKey :
60+ def create (cls , params : CreateParams ) -> CreateApiKeyResponse :
4561 """
4662 Add a new API key to authenticate communications with Resend.
4763 see more: https://resend.com/docs/api-reference/api-keys/create-api-key
@@ -50,10 +66,10 @@ def create(cls, params: CreateParams) -> ApiKey:
5066 params (CreateParams): The API key creation parameters
5167
5268 Returns:
53- ApiKey : The new API key object
69+ CreateApiKeyResponse : The created API key response with id and token
5470 """
5571 path = "/api-keys"
56- resp = request .Request [ApiKey ](
72+ resp = request .Request [ApiKeys . CreateApiKeyResponse ](
5773 path = path , params = cast (Dict [Any , Any ], params ), verb = "post"
5874 ).perform_with_content ()
5975 return resp
@@ -68,7 +84,7 @@ def list(cls) -> ListResponse:
6884 ListResponse: A list of API key objects
6985 """
7086 path = "/api-keys"
71- resp = request .Request [_ListResponse ](
87+ resp = request .Request [ApiKeys . ListResponse ](
7288 path = path , params = {}, verb = "get"
7389 ).perform_with_content ()
7490 return resp
0 commit comments