Open tim-hub opened 6 months ago
Hum, good catch, I agree, we can improve it and ensure we have the right types.
I'm working to include a Generics type hint to improve the Request
class in this PR #107
What do you think @drish?
@tim-hub yeah I think returning the type Email
for all methods ended up not being the best typing UI since the Email object will not be entirely populated depending on the response. Will update that
I am not sure whether it is a future plan to change the email send respons type, however, the python sdk response type and the real RESTful api response type is a bit misleading.
At
batch
send response. https://github.com/resend/resend-python/blob/752fe35b8ae61f033f1f4aab92ae8ab67acf10ed/resend/emails/_batch.py#L11https://github.com/resend/resend-python/blob/752fe35b8ae61f033f1f4aab92ae8ab67acf10ed/resend/emails/_batch.py#L20-L25
https://github.com/resend/resend-python/blob/752fe35b8ae61f033f1f4aab92ae8ab67acf10ed/resend/emails/_email.py#L57-L65
It is useding
List[Email]
as response, however, that is not the real structure of what the response is.The real response has
id
onlyhttps://resend.com/docs/api-reference/emails/send-email
Suggestion:
Created a different response type class like