77from ._audience import Audience
88
99
10- class _ListResponse (TypedDict ):
11- data : List [Audience ]
12- """
13- A list of audience objects
14- """
10+ class Audiences :
1511
12+ class RemoveAudienceResponse (TypedDict ):
13+ """
14+ RemoveAudienceResponse is the type that wraps the response of the audience that was removed
1615
17- class Audiences :
16+ Attributes:
17+ object (str): The object type, "audience"
18+ id (str): The ID of the removed audience
19+ deleted (bool): Whether the audience was deleted
20+ """
1821
19- class ListResponse (_ListResponse ):
22+ object : str
23+ """
24+ The object type, "audience"
25+ """
26+ id : str
27+ """
28+ The ID of the removed audience
29+ """
30+ deleted : bool
31+ """
32+ Whether the audience was deleted
33+ """
34+
35+ class ListResponse (TypedDict ):
2036 """
2137 ListResponse type that wraps a list of audience objects
2238
2339 Attributes:
40+ object (str): The object type, "list"
2441 data (List[Audience]): A list of audience objects
2542 """
2643
44+ object : str
45+ """
46+ The object type, "list"
47+ """
48+ data : List [Audience ]
49+ """
50+ A list of audience objects
51+ """
52+
53+ class CreateAudienceResponse (TypedDict ):
54+ """
55+ CreateAudienceResponse is the type that wraps the response of the audience that was created
56+
57+ Attributes:
58+ object (str): The object type, "audience"
59+ id (str): The ID of the created audience
60+ name (str): The name of the created audience
61+ """
62+
63+ object : str
64+ """
65+ The object type, "audience"
66+ """
67+ id : str
68+ """
69+ The ID of the created audience
70+ """
71+ name : str
72+ """
73+ The name of the created audience
74+ """
75+
2776 class CreateParams (TypedDict ):
2877 name : str
2978 """
3079 The name of the audience.
3180 """
3281
3382 @classmethod
34- def create (cls , params : CreateParams ) -> Audience :
83+ def create (cls , params : CreateParams ) -> CreateAudienceResponse :
3584 """
3685 Create a list of contacts.
3786 see more: https://resend.com/docs/api-reference/audiences/create-audience
@@ -40,10 +89,11 @@ def create(cls, params: CreateParams) -> Audience:
4089 params (CreateParams): The audience creation parameters
4190
4291 Returns:
43- Audience : The new audience object
92+ CreateAudienceResponse : The created audience response
4493 """
94+
4595 path = "/audiences"
46- resp = request .Request [Audience ](
96+ resp = request .Request [Audiences . CreateAudienceResponse ](
4797 path = path , params = cast (Dict [Any , Any ], params ), verb = "post"
4898 ).perform_with_content ()
4999 return resp
@@ -58,7 +108,7 @@ def list(cls) -> ListResponse:
58108 ListResponse: A list of audience objects
59109 """
60110 path = "/audiences/"
61- resp = request .Request [_ListResponse ](
111+ resp = request .Request [Audiences . ListResponse ](
62112 path = path , params = {}, verb = "get"
63113 ).perform_with_content ()
64114 return resp
@@ -82,7 +132,7 @@ def get(cls, id: str) -> Audience:
82132 return resp
83133
84134 @classmethod
85- def remove (cls , id : str ) -> Audience :
135+ def remove (cls , id : str ) -> RemoveAudienceResponse :
86136 """
87137 Delete a single audience.
88138 see more: https://resend.com/docs/api-reference/audiences/delete-audience
@@ -91,10 +141,10 @@ def remove(cls, id: str) -> Audience:
91141 id (str): The audience ID
92142
93143 Returns:
94- Audience : The audience object
144+ RemoveAudienceResponse : The removed audience response
95145 """
96146 path = f"/audiences/{ id } "
97- resp = request .Request [Audience ](
147+ resp = request .Request [Audiences . RemoveAudienceResponse ](
98148 path = path , params = {}, verb = "delete"
99149 ).perform_with_content ()
100150 return resp
0 commit comments