@@ -57,6 +57,29 @@ class CreateApiKeyResponse(BaseResponse):
5757 The token of the created API key
5858 """
5959
60+ class DeleteApiKeyResponse (BaseResponse ):
61+ """
62+ DeleteApiKeyResponse is the type that wraps the deleted API key response.
63+
64+ Attributes:
65+ object (str): The object type, always "api_key"
66+ id (str): The ID of the deleted API key
67+ deleted (bool): Whether the API key was deleted
68+ """
69+
70+ object : str
71+ """
72+ The object type, always "api_key"
73+ """
74+ id : str
75+ """
76+ The ID of the deleted API key
77+ """
78+ deleted : bool
79+ """
80+ Whether the API key was deleted
81+ """
82+
6083 class ListParams (TypedDict ):
6184 limit : NotRequired [int ]
6285 """
@@ -134,7 +157,7 @@ def list(cls, params: Optional[ListParams] = None) -> ListResponse:
134157 return resp
135158
136159 @classmethod
137- def remove (cls , api_key_id : str ) -> None :
160+ def remove (cls , api_key_id : str ) -> DeleteApiKeyResponse :
138161 """
139162 Remove an existing API key.
140163 see more: https://resend.com/docs/api-reference/api-keys/delete-api-key
@@ -143,13 +166,13 @@ def remove(cls, api_key_id: str) -> None:
143166 api_key_id (str): The ID of the API key to remove
144167
145168 Returns:
146- None
169+ DeleteApiKeyResponse: The deleted API key response
147170 """
148171 path = f"/api-keys/{ api_key_id } "
149-
150- # This would raise if failed
151- request . Request [ None ]( path = path , params = {}, verb = "delete" ). perform ()
152- return None
172+ resp = request . Request [ ApiKeys . DeleteApiKeyResponse ](
173+ path = path , params = {}, verb = "delete"
174+ ). perform_with_content ()
175+ return resp
153176
154177 @classmethod
155178 async def create_async (cls , params : CreateParams ) -> CreateApiKeyResponse :
@@ -190,7 +213,7 @@ async def list_async(cls, params: Optional[ListParams] = None) -> ListResponse:
190213 return resp
191214
192215 @classmethod
193- async def remove_async (cls , api_key_id : str ) -> None :
216+ async def remove_async (cls , api_key_id : str ) -> DeleteApiKeyResponse :
194217 """
195218 Remove an existing API key (async).
196219 see more: https://resend.com/docs/api-reference/api-keys/delete-api-key
@@ -199,10 +222,10 @@ async def remove_async(cls, api_key_id: str) -> None:
199222 api_key_id (str): The ID of the API key to remove
200223
201224 Returns:
202- None
225+ DeleteApiKeyResponse: The deleted API key response
203226 """
204227 path = f"/api-keys/{ api_key_id } "
205-
206- # This would raise if failed
207- await AsyncRequest [ None ]( path = path , params = {}, verb = "delete" ). perform ()
208- return None
228+ resp = await AsyncRequest [ ApiKeys . DeleteApiKeyResponse ](
229+ path = path , params = {}, verb = "delete"
230+ ). perform_with_content ()
231+ return resp
0 commit comments