poststack 0.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,160 @@
1
+ """Broadcasts resource — mirrors packages/sdk/src/resources/broadcasts.ts."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any, Dict, Mapping, Optional
6
+ from urllib.parse import quote
7
+
8
+ from .._client import AsyncPostStackClient, PostStackClient
9
+
10
+
11
+ class BroadcastsResource:
12
+ def __init__(self, client: PostStackClient) -> None:
13
+ self._client = client
14
+
15
+ def create(
16
+ self, input: Dict[str, Any], *, timeout: Optional[float] = None
17
+ ) -> Dict[str, Any]:
18
+ return self._client.post("/broadcasts", input, timeout=timeout)
19
+
20
+ def list(
21
+ self,
22
+ params: Optional[Mapping[str, Any]] = None,
23
+ *,
24
+ timeout: Optional[float] = None,
25
+ ) -> Dict[str, Any]:
26
+ return self._client.get("/broadcasts", params, timeout=timeout)
27
+
28
+ def get(
29
+ self, id: str, *, timeout: Optional[float] = None
30
+ ) -> Dict[str, Any]:
31
+ return self._client.get(
32
+ f"/broadcasts/{quote(id, safe='')}", timeout=timeout
33
+ )
34
+
35
+ def update(
36
+ self,
37
+ id: str,
38
+ input: Dict[str, Any],
39
+ *,
40
+ timeout: Optional[float] = None,
41
+ ) -> Dict[str, Any]:
42
+ return self._client.patch(
43
+ f"/broadcasts/{quote(id, safe='')}", input, timeout=timeout
44
+ )
45
+
46
+ def send(
47
+ self, id: str, *, timeout: Optional[float] = None
48
+ ) -> Dict[str, Any]:
49
+ return self._client.post(
50
+ f"/broadcasts/{quote(id, safe='')}/send", timeout=timeout
51
+ )
52
+
53
+ def cancel(
54
+ self, id: str, *, timeout: Optional[float] = None
55
+ ) -> Dict[str, Any]:
56
+ return self._client.post(
57
+ f"/broadcasts/{quote(id, safe='')}/cancel", timeout=timeout
58
+ )
59
+
60
+ def send_test(
61
+ self,
62
+ id: str,
63
+ input: Dict[str, Any],
64
+ *,
65
+ timeout: Optional[float] = None,
66
+ ) -> Dict[str, Any]:
67
+ return self._client.post(
68
+ f"/broadcasts/{quote(id, safe='')}/test", input, timeout=timeout
69
+ )
70
+
71
+ def get_variants(
72
+ self, id: str, *, timeout: Optional[float] = None
73
+ ) -> Dict[str, Any]:
74
+ return self._client.get(
75
+ f"/broadcasts/{quote(id, safe='')}/variants", timeout=timeout
76
+ )
77
+
78
+ def get_variant_stats(
79
+ self, id: str, *, timeout: Optional[float] = None
80
+ ) -> Dict[str, Any]:
81
+ return self._client.get(
82
+ f"/broadcasts/{quote(id, safe='')}/variant-stats",
83
+ timeout=timeout,
84
+ )
85
+
86
+
87
+ class AsyncBroadcastsResource:
88
+ def __init__(self, client: AsyncPostStackClient) -> None:
89
+ self._client = client
90
+
91
+ async def create(
92
+ self, input: Dict[str, Any], *, timeout: Optional[float] = None
93
+ ) -> Dict[str, Any]:
94
+ return await self._client.post("/broadcasts", input, timeout=timeout)
95
+
96
+ async def list(
97
+ self,
98
+ params: Optional[Mapping[str, Any]] = None,
99
+ *,
100
+ timeout: Optional[float] = None,
101
+ ) -> Dict[str, Any]:
102
+ return await self._client.get("/broadcasts", params, timeout=timeout)
103
+
104
+ async def get(
105
+ self, id: str, *, timeout: Optional[float] = None
106
+ ) -> Dict[str, Any]:
107
+ return await self._client.get(
108
+ f"/broadcasts/{quote(id, safe='')}", timeout=timeout
109
+ )
110
+
111
+ async def update(
112
+ self,
113
+ id: str,
114
+ input: Dict[str, Any],
115
+ *,
116
+ timeout: Optional[float] = None,
117
+ ) -> Dict[str, Any]:
118
+ return await self._client.patch(
119
+ f"/broadcasts/{quote(id, safe='')}", input, timeout=timeout
120
+ )
121
+
122
+ async def send(
123
+ self, id: str, *, timeout: Optional[float] = None
124
+ ) -> Dict[str, Any]:
125
+ return await self._client.post(
126
+ f"/broadcasts/{quote(id, safe='')}/send", timeout=timeout
127
+ )
128
+
129
+ async def cancel(
130
+ self, id: str, *, timeout: Optional[float] = None
131
+ ) -> Dict[str, Any]:
132
+ return await self._client.post(
133
+ f"/broadcasts/{quote(id, safe='')}/cancel", timeout=timeout
134
+ )
135
+
136
+ async def send_test(
137
+ self,
138
+ id: str,
139
+ input: Dict[str, Any],
140
+ *,
141
+ timeout: Optional[float] = None,
142
+ ) -> Dict[str, Any]:
143
+ return await self._client.post(
144
+ f"/broadcasts/{quote(id, safe='')}/test", input, timeout=timeout
145
+ )
146
+
147
+ async def get_variants(
148
+ self, id: str, *, timeout: Optional[float] = None
149
+ ) -> Dict[str, Any]:
150
+ return await self._client.get(
151
+ f"/broadcasts/{quote(id, safe='')}/variants", timeout=timeout
152
+ )
153
+
154
+ async def get_variant_stats(
155
+ self, id: str, *, timeout: Optional[float] = None
156
+ ) -> Dict[str, Any]:
157
+ return await self._client.get(
158
+ f"/broadcasts/{quote(id, safe='')}/variant-stats",
159
+ timeout=timeout,
160
+ )
@@ -0,0 +1,73 @@
1
+ """Contact properties resource — mirrors packages/sdk/src/resources/contact-properties.ts."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any, Dict, Optional
6
+
7
+ from .._client import AsyncPostStackClient, PostStackClient
8
+
9
+
10
+ class ContactPropertiesResource:
11
+ def __init__(self, client: PostStackClient) -> None:
12
+ self._client = client
13
+
14
+ def list(self, *, timeout: Optional[float] = None) -> Dict[str, Any]:
15
+ return self._client.get("/contact-properties", timeout=timeout)
16
+
17
+ def create(
18
+ self, input: Dict[str, Any], *, timeout: Optional[float] = None
19
+ ) -> Dict[str, Any]:
20
+ return self._client.post(
21
+ "/contact-properties", input, timeout=timeout
22
+ )
23
+
24
+ def update(
25
+ self,
26
+ id: int,
27
+ input: Dict[str, Any],
28
+ *,
29
+ timeout: Optional[float] = None,
30
+ ) -> Dict[str, Any]:
31
+ return self._client.patch(
32
+ f"/contact-properties/{id}", input, timeout=timeout
33
+ )
34
+
35
+ def delete(
36
+ self, id: int, *, timeout: Optional[float] = None
37
+ ) -> Dict[str, Any]:
38
+ return self._client.delete(
39
+ f"/contact-properties/{id}", timeout=timeout
40
+ )
41
+
42
+
43
+ class AsyncContactPropertiesResource:
44
+ def __init__(self, client: AsyncPostStackClient) -> None:
45
+ self._client = client
46
+
47
+ async def list(self, *, timeout: Optional[float] = None) -> Dict[str, Any]:
48
+ return await self._client.get("/contact-properties", timeout=timeout)
49
+
50
+ async def create(
51
+ self, input: Dict[str, Any], *, timeout: Optional[float] = None
52
+ ) -> Dict[str, Any]:
53
+ return await self._client.post(
54
+ "/contact-properties", input, timeout=timeout
55
+ )
56
+
57
+ async def update(
58
+ self,
59
+ id: int,
60
+ input: Dict[str, Any],
61
+ *,
62
+ timeout: Optional[float] = None,
63
+ ) -> Dict[str, Any]:
64
+ return await self._client.patch(
65
+ f"/contact-properties/{id}", input, timeout=timeout
66
+ )
67
+
68
+ async def delete(
69
+ self, id: int, *, timeout: Optional[float] = None
70
+ ) -> Dict[str, Any]:
71
+ return await self._client.delete(
72
+ f"/contact-properties/{id}", timeout=timeout
73
+ )
@@ -0,0 +1,130 @@
1
+ """Contacts resource — mirrors packages/sdk/src/resources/contacts.ts."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any, Dict, Mapping, Optional, Union
6
+ from urllib.parse import quote
7
+
8
+ from .._client import AsyncPostStackClient, PostStackClient
9
+
10
+
11
+ class ContactsResource:
12
+ def __init__(self, client: PostStackClient) -> None:
13
+ self._client = client
14
+
15
+ def create(
16
+ self, input: Dict[str, Any], *, timeout: Optional[float] = None
17
+ ) -> Dict[str, Any]:
18
+ return self._client.post("/contacts", input, timeout=timeout)
19
+
20
+ def list(
21
+ self,
22
+ params: Optional[Mapping[str, Any]] = None,
23
+ *,
24
+ timeout: Optional[float] = None,
25
+ ) -> Dict[str, Any]:
26
+ return self._client.get("/contacts", params, timeout=timeout)
27
+
28
+ def get(
29
+ self, id: str, *, timeout: Optional[float] = None
30
+ ) -> Dict[str, Any]:
31
+ return self._client.get(
32
+ f"/contacts/{quote(id, safe='')}", timeout=timeout
33
+ )
34
+
35
+ def update(
36
+ self,
37
+ id: str,
38
+ input: Dict[str, Any],
39
+ *,
40
+ timeout: Optional[float] = None,
41
+ ) -> Dict[str, Any]:
42
+ return self._client.patch(
43
+ f"/contacts/{quote(id, safe='')}", input, timeout=timeout
44
+ )
45
+
46
+ def delete(
47
+ self, id: str, *, timeout: Optional[float] = None
48
+ ) -> Dict[str, Any]:
49
+ return self._client.delete(
50
+ f"/contacts/{quote(id, safe='')}", timeout=timeout
51
+ )
52
+
53
+ def unsubscribe(
54
+ self, id: str, *, timeout: Optional[float] = None
55
+ ) -> Dict[str, Any]:
56
+ return self._client.post(
57
+ f"/contacts/{quote(id, safe='')}/unsubscribe", timeout=timeout
58
+ )
59
+
60
+ def import_(
61
+ self, input: Dict[str, Any], *, timeout: Optional[float] = None
62
+ ) -> Dict[str, Any]:
63
+ return self._client.post("/contacts/import", input, timeout=timeout)
64
+
65
+ def export_csv(
66
+ self, *, timeout: Optional[float] = None
67
+ ) -> Union[str, Dict[str, Any]]:
68
+ return self._client.get("/contacts/export", timeout=timeout)
69
+
70
+
71
+ class AsyncContactsResource:
72
+ def __init__(self, client: AsyncPostStackClient) -> None:
73
+ self._client = client
74
+
75
+ async def create(
76
+ self, input: Dict[str, Any], *, timeout: Optional[float] = None
77
+ ) -> Dict[str, Any]:
78
+ return await self._client.post("/contacts", input, timeout=timeout)
79
+
80
+ async def list(
81
+ self,
82
+ params: Optional[Mapping[str, Any]] = None,
83
+ *,
84
+ timeout: Optional[float] = None,
85
+ ) -> Dict[str, Any]:
86
+ return await self._client.get("/contacts", params, timeout=timeout)
87
+
88
+ async def get(
89
+ self, id: str, *, timeout: Optional[float] = None
90
+ ) -> Dict[str, Any]:
91
+ return await self._client.get(
92
+ f"/contacts/{quote(id, safe='')}", timeout=timeout
93
+ )
94
+
95
+ async def update(
96
+ self,
97
+ id: str,
98
+ input: Dict[str, Any],
99
+ *,
100
+ timeout: Optional[float] = None,
101
+ ) -> Dict[str, Any]:
102
+ return await self._client.patch(
103
+ f"/contacts/{quote(id, safe='')}", input, timeout=timeout
104
+ )
105
+
106
+ async def delete(
107
+ self, id: str, *, timeout: Optional[float] = None
108
+ ) -> Dict[str, Any]:
109
+ return await self._client.delete(
110
+ f"/contacts/{quote(id, safe='')}", timeout=timeout
111
+ )
112
+
113
+ async def unsubscribe(
114
+ self, id: str, *, timeout: Optional[float] = None
115
+ ) -> Dict[str, Any]:
116
+ return await self._client.post(
117
+ f"/contacts/{quote(id, safe='')}/unsubscribe", timeout=timeout
118
+ )
119
+
120
+ async def import_(
121
+ self, input: Dict[str, Any], *, timeout: Optional[float] = None
122
+ ) -> Dict[str, Any]:
123
+ return await self._client.post(
124
+ "/contacts/import", input, timeout=timeout
125
+ )
126
+
127
+ async def export_csv(
128
+ self, *, timeout: Optional[float] = None
129
+ ) -> Union[str, Dict[str, Any]]:
130
+ return await self._client.get("/contacts/export", timeout=timeout)
@@ -0,0 +1,199 @@
1
+ """Domains resource — mirrors packages/sdk/src/resources/domains.ts."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any, Dict, Mapping, Optional
6
+
7
+ from .._client import AsyncPostStackClient, PostStackClient
8
+
9
+
10
+ class DomainsResource:
11
+ def __init__(self, client: PostStackClient) -> None:
12
+ self._client = client
13
+
14
+ def create(
15
+ self, input: Dict[str, Any], *, timeout: Optional[float] = None
16
+ ) -> Dict[str, Any]:
17
+ return self._client.post("/domains", input, timeout=timeout)
18
+
19
+ def list(
20
+ self,
21
+ params: Optional[Mapping[str, Any]] = None,
22
+ *,
23
+ timeout: Optional[float] = None,
24
+ ) -> Dict[str, Any]:
25
+ return self._client.get("/domains", params, timeout=timeout)
26
+
27
+ def get(
28
+ self, id: int, *, timeout: Optional[float] = None
29
+ ) -> Dict[str, Any]:
30
+ return self._client.get(f"/domains/{id}", timeout=timeout)
31
+
32
+ def verify(
33
+ self, id: int, *, timeout: Optional[float] = None
34
+ ) -> Dict[str, Any]:
35
+ return self._client.post(f"/domains/{id}/verify", timeout=timeout)
36
+
37
+ def update(
38
+ self,
39
+ id: int,
40
+ input: Dict[str, Any],
41
+ *,
42
+ timeout: Optional[float] = None,
43
+ ) -> Dict[str, Any]:
44
+ return self._client.patch(f"/domains/{id}", input, timeout=timeout)
45
+
46
+ def delete(
47
+ self, id: int, *, timeout: Optional[float] = None
48
+ ) -> Dict[str, Any]:
49
+ return self._client.delete(f"/domains/{id}", timeout=timeout)
50
+
51
+ def assign_ip(
52
+ self,
53
+ id: int,
54
+ ip_address_id: int,
55
+ *,
56
+ timeout: Optional[float] = None,
57
+ ) -> Dict[str, Any]:
58
+ return self._client.post(
59
+ f"/domains/{id}/ip",
60
+ {"ipAddressId": ip_address_id},
61
+ timeout=timeout,
62
+ )
63
+
64
+ def unassign_ip(
65
+ self, id: int, *, timeout: Optional[float] = None
66
+ ) -> Dict[str, Any]:
67
+ return self._client.delete(f"/domains/{id}/ip", timeout=timeout)
68
+
69
+ def get_dmarc_reports(
70
+ self,
71
+ id: int,
72
+ params: Optional[Mapping[str, Any]] = None,
73
+ *,
74
+ timeout: Optional[float] = None,
75
+ ) -> Dict[str, Any]:
76
+ return self._client.get(
77
+ f"/domains/{id}/dmarc/reports", params, timeout=timeout
78
+ )
79
+
80
+ def get_dmarc_stats(
81
+ self,
82
+ id: int,
83
+ days: Optional[int] = None,
84
+ *,
85
+ timeout: Optional[float] = None,
86
+ ) -> Dict[str, Any]:
87
+ params = {"days": days} if days is not None else None
88
+ return self._client.get(
89
+ f"/domains/{id}/dmarc/stats", params, timeout=timeout
90
+ )
91
+
92
+ def get_dmarc_sources(
93
+ self,
94
+ id: int,
95
+ days: Optional[int] = None,
96
+ *,
97
+ timeout: Optional[float] = None,
98
+ ) -> Dict[str, Any]:
99
+ params = {"days": days} if days is not None else None
100
+ return self._client.get(
101
+ f"/domains/{id}/dmarc/sources", params, timeout=timeout
102
+ )
103
+
104
+
105
+ class AsyncDomainsResource:
106
+ def __init__(self, client: AsyncPostStackClient) -> None:
107
+ self._client = client
108
+
109
+ async def create(
110
+ self, input: Dict[str, Any], *, timeout: Optional[float] = None
111
+ ) -> Dict[str, Any]:
112
+ return await self._client.post("/domains", input, timeout=timeout)
113
+
114
+ async def list(
115
+ self,
116
+ params: Optional[Mapping[str, Any]] = None,
117
+ *,
118
+ timeout: Optional[float] = None,
119
+ ) -> Dict[str, Any]:
120
+ return await self._client.get("/domains", params, timeout=timeout)
121
+
122
+ async def get(
123
+ self, id: int, *, timeout: Optional[float] = None
124
+ ) -> Dict[str, Any]:
125
+ return await self._client.get(f"/domains/{id}", timeout=timeout)
126
+
127
+ async def verify(
128
+ self, id: int, *, timeout: Optional[float] = None
129
+ ) -> Dict[str, Any]:
130
+ return await self._client.post(f"/domains/{id}/verify", timeout=timeout)
131
+
132
+ async def update(
133
+ self,
134
+ id: int,
135
+ input: Dict[str, Any],
136
+ *,
137
+ timeout: Optional[float] = None,
138
+ ) -> Dict[str, Any]:
139
+ return await self._client.patch(
140
+ f"/domains/{id}", input, timeout=timeout
141
+ )
142
+
143
+ async def delete(
144
+ self, id: int, *, timeout: Optional[float] = None
145
+ ) -> Dict[str, Any]:
146
+ return await self._client.delete(f"/domains/{id}", timeout=timeout)
147
+
148
+ async def assign_ip(
149
+ self,
150
+ id: int,
151
+ ip_address_id: int,
152
+ *,
153
+ timeout: Optional[float] = None,
154
+ ) -> Dict[str, Any]:
155
+ return await self._client.post(
156
+ f"/domains/{id}/ip",
157
+ {"ipAddressId": ip_address_id},
158
+ timeout=timeout,
159
+ )
160
+
161
+ async def unassign_ip(
162
+ self, id: int, *, timeout: Optional[float] = None
163
+ ) -> Dict[str, Any]:
164
+ return await self._client.delete(f"/domains/{id}/ip", timeout=timeout)
165
+
166
+ async def get_dmarc_reports(
167
+ self,
168
+ id: int,
169
+ params: Optional[Mapping[str, Any]] = None,
170
+ *,
171
+ timeout: Optional[float] = None,
172
+ ) -> Dict[str, Any]:
173
+ return await self._client.get(
174
+ f"/domains/{id}/dmarc/reports", params, timeout=timeout
175
+ )
176
+
177
+ async def get_dmarc_stats(
178
+ self,
179
+ id: int,
180
+ days: Optional[int] = None,
181
+ *,
182
+ timeout: Optional[float] = None,
183
+ ) -> Dict[str, Any]:
184
+ params = {"days": days} if days is not None else None
185
+ return await self._client.get(
186
+ f"/domains/{id}/dmarc/stats", params, timeout=timeout
187
+ )
188
+
189
+ async def get_dmarc_sources(
190
+ self,
191
+ id: int,
192
+ days: Optional[int] = None,
193
+ *,
194
+ timeout: Optional[float] = None,
195
+ ) -> Dict[str, Any]:
196
+ params = {"days": days} if days is not None else None
197
+ return await self._client.get(
198
+ f"/domains/{id}/dmarc/sources", params, timeout=timeout
199
+ )
@@ -0,0 +1,53 @@
1
+ """Email validations resource — mirrors packages/sdk/src/resources/email-validations.ts."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any, Dict, List, Optional
6
+
7
+ from .._client import AsyncPostStackClient, PostStackClient
8
+
9
+
10
+ class EmailValidationsResource:
11
+ def __init__(self, client: PostStackClient) -> None:
12
+ self._client = client
13
+
14
+ def validate(
15
+ self, email: str, *, timeout: Optional[float] = None
16
+ ) -> Dict[str, Any]:
17
+ return self._client.post(
18
+ "/email-validations", {"email": email}, timeout=timeout
19
+ )
20
+
21
+ def validate_batch(
22
+ self,
23
+ emails: List[str],
24
+ *,
25
+ timeout: Optional[float] = None,
26
+ ) -> Dict[str, Any]:
27
+ return self._client.post(
28
+ "/email-validations/batch", {"emails": emails}, timeout=timeout
29
+ )
30
+
31
+
32
+ class AsyncEmailValidationsResource:
33
+ def __init__(self, client: AsyncPostStackClient) -> None:
34
+ self._client = client
35
+
36
+ async def validate(
37
+ self, email: str, *, timeout: Optional[float] = None
38
+ ) -> Dict[str, Any]:
39
+ return await self._client.post(
40
+ "/email-validations", {"email": email}, timeout=timeout
41
+ )
42
+
43
+ async def validate_batch(
44
+ self,
45
+ emails: List[str],
46
+ *,
47
+ timeout: Optional[float] = None,
48
+ ) -> Dict[str, Any]:
49
+ return await self._client.post(
50
+ "/email-validations/batch",
51
+ {"emails": emails},
52
+ timeout=timeout,
53
+ )