77from ._audience import Audience
88
99
10- class _ListResponse (TypedDict ):
11- data : List [Audience ]
12- """
13- A list of audience objects
14- """
15-
16-
1710class Audiences :
1811
19- class ListResponse (_ListResponse ):
12+ class ListResponse (TypedDict ):
2013 """
2114 ListResponse type that wraps a list of audience objects
2215
2316 Attributes:
2417 data (List[Audience]): A list of audience objects
2518 """
2619
20+ data : List [Audience ]
21+ """
22+ A list of audience objects
23+ """
24+
25+ class CreateAudienceResponse (TypedDict ):
26+ """
27+ CreateAudienceResponse is the type that wraps the response of the audience that was created
28+
29+ Attributes:
30+ id (str): The ID of the created audience
31+ name (str): The name of the created audience
32+ created_at (str): When the audience was created
33+ """
34+
35+ id : str
36+ """
37+ The ID of the created audience
38+ """
39+ name : str
40+ """
41+ The name of the created audience
42+ """
43+ created_at : str
44+ """
45+ When the audience was created
46+ """
47+
2748 class CreateParams (TypedDict ):
2849 name : str
2950 """
3051 The name of the audience.
3152 """
3253
3354 @classmethod
34- def create (cls , params : CreateParams ) -> Audience :
55+ def create (cls , params : CreateParams ) -> CreateAudienceResponse :
3556 """
3657 Create a list of contacts.
3758 see more: https://resend.com/docs/api-reference/audiences/create-audience
@@ -40,10 +61,11 @@ def create(cls, params: CreateParams) -> Audience:
4061 params (CreateParams): The audience creation parameters
4162
4263 Returns:
43- Audience : The new audience object
64+ CreateAudienceResponse : The created audience response
4465 """
66+
4567 path = "/audiences"
46- resp = request .Request [Audience ](
68+ resp = request .Request [Audiences . CreateAudienceResponse ](
4769 path = path , params = cast (Dict [Any , Any ], params ), verb = "post"
4870 ).perform_with_content ()
4971 return resp
@@ -58,7 +80,7 @@ def list(cls) -> ListResponse:
5880 ListResponse: A list of audience objects
5981 """
6082 path = "/audiences/"
61- resp = request .Request [_ListResponse ](
83+ resp = request .Request [Audiences . ListResponse ](
6284 path = path , params = {}, verb = "get"
6385 ).perform_with_content ()
6486 return resp
0 commit comments