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,124 @@
1
+ """Emails resource — mirrors packages/sdk/src/resources/emails.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 EmailsResource:
12
+ def __init__(self, client: PostStackClient) -> None:
13
+ self._client = client
14
+
15
+ def send(
16
+ self, input: Dict[str, Any], *, timeout: Optional[float] = None
17
+ ) -> Dict[str, Any]:
18
+ return self._client.post("/emails", input, timeout=timeout)
19
+
20
+ def batch(
21
+ self, input: Dict[str, Any], *, timeout: Optional[float] = None
22
+ ) -> Dict[str, Any]:
23
+ return self._client.post("/emails/batch", input, timeout=timeout)
24
+
25
+ def get(self, id: str, *, timeout: Optional[float] = None) -> Dict[str, Any]:
26
+ return self._client.get(f"/emails/{quote(id, safe='')}", timeout=timeout)
27
+
28
+ def list(
29
+ self,
30
+ params: Optional[Mapping[str, Any]] = None,
31
+ *,
32
+ timeout: Optional[float] = None,
33
+ ) -> Dict[str, Any]:
34
+ return self._client.get("/emails", params, timeout=timeout)
35
+
36
+ def reschedule(
37
+ self, id: str, scheduled_at: str, *, timeout: Optional[float] = None
38
+ ) -> Dict[str, Any]:
39
+ return self._client.patch(
40
+ f"/emails/{quote(id, safe='')}",
41
+ {"scheduled_at": scheduled_at},
42
+ timeout=timeout,
43
+ )
44
+
45
+ def cancel(
46
+ self, id: str, *, timeout: Optional[float] = None
47
+ ) -> Dict[str, Any]:
48
+ return self._client.post(
49
+ f"/emails/{quote(id, safe='')}/cancel", timeout=timeout
50
+ )
51
+
52
+ def get_events(
53
+ self, id: str, *, timeout: Optional[float] = None
54
+ ) -> Dict[str, Any]:
55
+ return self._client.get(
56
+ f"/emails/{quote(id, safe='')}/events", timeout=timeout
57
+ )
58
+
59
+ def get_insights(
60
+ self, id: str, *, timeout: Optional[float] = None
61
+ ) -> Dict[str, Any]:
62
+ return self._client.get(
63
+ f"/emails/{quote(id, safe='')}/insights", timeout=timeout
64
+ )
65
+
66
+
67
+ class AsyncEmailsResource:
68
+ def __init__(self, client: AsyncPostStackClient) -> None:
69
+ self._client = client
70
+
71
+ async def send(
72
+ self, input: Dict[str, Any], *, timeout: Optional[float] = None
73
+ ) -> Dict[str, Any]:
74
+ return await self._client.post("/emails", input, timeout=timeout)
75
+
76
+ async def batch(
77
+ self, input: Dict[str, Any], *, timeout: Optional[float] = None
78
+ ) -> Dict[str, Any]:
79
+ return await self._client.post("/emails/batch", input, timeout=timeout)
80
+
81
+ async def get(
82
+ self, id: str, *, timeout: Optional[float] = None
83
+ ) -> Dict[str, Any]:
84
+ return await self._client.get(
85
+ f"/emails/{quote(id, safe='')}", timeout=timeout
86
+ )
87
+
88
+ async def list(
89
+ self,
90
+ params: Optional[Mapping[str, Any]] = None,
91
+ *,
92
+ timeout: Optional[float] = None,
93
+ ) -> Dict[str, Any]:
94
+ return await self._client.get("/emails", params, timeout=timeout)
95
+
96
+ async def reschedule(
97
+ self, id: str, scheduled_at: str, *, timeout: Optional[float] = None
98
+ ) -> Dict[str, Any]:
99
+ return await self._client.patch(
100
+ f"/emails/{quote(id, safe='')}",
101
+ {"scheduled_at": scheduled_at},
102
+ timeout=timeout,
103
+ )
104
+
105
+ async def cancel(
106
+ self, id: str, *, timeout: Optional[float] = None
107
+ ) -> Dict[str, Any]:
108
+ return await self._client.post(
109
+ f"/emails/{quote(id, safe='')}/cancel", timeout=timeout
110
+ )
111
+
112
+ async def get_events(
113
+ self, id: str, *, timeout: Optional[float] = None
114
+ ) -> Dict[str, Any]:
115
+ return await self._client.get(
116
+ f"/emails/{quote(id, safe='')}/events", timeout=timeout
117
+ )
118
+
119
+ async def get_insights(
120
+ self, id: str, *, timeout: Optional[float] = None
121
+ ) -> Dict[str, Any]:
122
+ return await self._client.get(
123
+ f"/emails/{quote(id, safe='')}/insights", timeout=timeout
124
+ )
@@ -0,0 +1,157 @@
1
+ """Mailboxes resource — mirrors packages/sdk/src/resources/mailboxes.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 MailboxesResource:
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("/mailboxes", 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("/mailboxes", 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"/mailboxes/{id}", timeout=timeout)
31
+
32
+ def update(
33
+ self,
34
+ id: int,
35
+ input: Dict[str, Any],
36
+ *,
37
+ timeout: Optional[float] = None,
38
+ ) -> Dict[str, Any]:
39
+ return self._client.patch(f"/mailboxes/{id}", input, timeout=timeout)
40
+
41
+ def delete(
42
+ self, id: int, *, timeout: Optional[float] = None
43
+ ) -> Dict[str, Any]:
44
+ return self._client.delete(f"/mailboxes/{id}", timeout=timeout)
45
+
46
+ def change_password(
47
+ self,
48
+ id: int,
49
+ password: str,
50
+ *,
51
+ timeout: Optional[float] = None,
52
+ ) -> Dict[str, Any]:
53
+ return self._client.post(
54
+ f"/mailboxes/{id}/password",
55
+ {"password": password},
56
+ timeout=timeout,
57
+ )
58
+
59
+ def create_alias(
60
+ self, input: Dict[str, Any], *, timeout: Optional[float] = None
61
+ ) -> Dict[str, Any]:
62
+ return self._client.post(
63
+ "/mailboxes/aliases", input, timeout=timeout
64
+ )
65
+
66
+ def list_aliases(
67
+ self,
68
+ params: Optional[Mapping[str, Any]] = None,
69
+ *,
70
+ timeout: Optional[float] = None,
71
+ ) -> Dict[str, Any]:
72
+ return self._client.get(
73
+ "/mailboxes/aliases", params, timeout=timeout
74
+ )
75
+
76
+ def delete_alias(
77
+ self, id: int, *, timeout: Optional[float] = None
78
+ ) -> Dict[str, Any]:
79
+ return self._client.delete(
80
+ f"/mailboxes/aliases/{id}", timeout=timeout
81
+ )
82
+
83
+
84
+ class AsyncMailboxesResource:
85
+ def __init__(self, client: AsyncPostStackClient) -> None:
86
+ self._client = client
87
+
88
+ async def create(
89
+ self, input: Dict[str, Any], *, timeout: Optional[float] = None
90
+ ) -> Dict[str, Any]:
91
+ return await self._client.post("/mailboxes", input, timeout=timeout)
92
+
93
+ async def list(
94
+ self,
95
+ params: Optional[Mapping[str, Any]] = None,
96
+ *,
97
+ timeout: Optional[float] = None,
98
+ ) -> Dict[str, Any]:
99
+ return await self._client.get("/mailboxes", params, timeout=timeout)
100
+
101
+ async def get(
102
+ self, id: int, *, timeout: Optional[float] = None
103
+ ) -> Dict[str, Any]:
104
+ return await self._client.get(f"/mailboxes/{id}", timeout=timeout)
105
+
106
+ async def update(
107
+ self,
108
+ id: int,
109
+ input: Dict[str, Any],
110
+ *,
111
+ timeout: Optional[float] = None,
112
+ ) -> Dict[str, Any]:
113
+ return await self._client.patch(
114
+ f"/mailboxes/{id}", input, timeout=timeout
115
+ )
116
+
117
+ async def delete(
118
+ self, id: int, *, timeout: Optional[float] = None
119
+ ) -> Dict[str, Any]:
120
+ return await self._client.delete(f"/mailboxes/{id}", timeout=timeout)
121
+
122
+ async def change_password(
123
+ self,
124
+ id: int,
125
+ password: str,
126
+ *,
127
+ timeout: Optional[float] = None,
128
+ ) -> Dict[str, Any]:
129
+ return await self._client.post(
130
+ f"/mailboxes/{id}/password",
131
+ {"password": password},
132
+ timeout=timeout,
133
+ )
134
+
135
+ async def create_alias(
136
+ self, input: Dict[str, Any], *, timeout: Optional[float] = None
137
+ ) -> Dict[str, Any]:
138
+ return await self._client.post(
139
+ "/mailboxes/aliases", input, timeout=timeout
140
+ )
141
+
142
+ async def list_aliases(
143
+ self,
144
+ params: Optional[Mapping[str, Any]] = None,
145
+ *,
146
+ timeout: Optional[float] = None,
147
+ ) -> Dict[str, Any]:
148
+ return await self._client.get(
149
+ "/mailboxes/aliases", params, timeout=timeout
150
+ )
151
+
152
+ async def delete_alias(
153
+ self, id: int, *, timeout: Optional[float] = None
154
+ ) -> Dict[str, Any]:
155
+ return await self._client.delete(
156
+ f"/mailboxes/aliases/{id}", timeout=timeout
157
+ )
@@ -0,0 +1,156 @@
1
+ """Segments resource — mirrors packages/sdk/src/resources/segments.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 SegmentsResource:
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("/segments", 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("/segments", 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"/segments/{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"/segments/{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"/segments/{quote(id, safe='')}", timeout=timeout
51
+ )
52
+
53
+ def add_contacts(
54
+ self,
55
+ id: str,
56
+ input: Dict[str, Any],
57
+ *,
58
+ timeout: Optional[float] = None,
59
+ ) -> Dict[str, Any]:
60
+ return self._client.post(
61
+ f"/segments/{quote(id, safe='')}/contacts",
62
+ input,
63
+ timeout=timeout,
64
+ )
65
+
66
+ def remove_contact(
67
+ self,
68
+ id: str,
69
+ contact_id: str,
70
+ *,
71
+ timeout: Optional[float] = None,
72
+ ) -> Dict[str, Any]:
73
+ return self._client.delete(
74
+ f"/segments/{quote(id, safe='')}/contacts/{quote(contact_id, safe='')}",
75
+ timeout=timeout,
76
+ )
77
+
78
+ def preview_rules(
79
+ self, input: Dict[str, Any], *, timeout: Optional[float] = None
80
+ ) -> Dict[str, Any]:
81
+ return self._client.post("/segments/preview", input, timeout=timeout)
82
+
83
+
84
+ class AsyncSegmentsResource:
85
+ def __init__(self, client: AsyncPostStackClient) -> None:
86
+ self._client = client
87
+
88
+ async def create(
89
+ self, input: Dict[str, Any], *, timeout: Optional[float] = None
90
+ ) -> Dict[str, Any]:
91
+ return await self._client.post("/segments", input, timeout=timeout)
92
+
93
+ async def list(
94
+ self,
95
+ params: Optional[Mapping[str, Any]] = None,
96
+ *,
97
+ timeout: Optional[float] = None,
98
+ ) -> Dict[str, Any]:
99
+ return await self._client.get("/segments", params, timeout=timeout)
100
+
101
+ async def get(
102
+ self, id: str, *, timeout: Optional[float] = None
103
+ ) -> Dict[str, Any]:
104
+ return await self._client.get(
105
+ f"/segments/{quote(id, safe='')}", timeout=timeout
106
+ )
107
+
108
+ async def update(
109
+ self,
110
+ id: str,
111
+ input: Dict[str, Any],
112
+ *,
113
+ timeout: Optional[float] = None,
114
+ ) -> Dict[str, Any]:
115
+ return await self._client.patch(
116
+ f"/segments/{quote(id, safe='')}", input, timeout=timeout
117
+ )
118
+
119
+ async def delete(
120
+ self, id: str, *, timeout: Optional[float] = None
121
+ ) -> Dict[str, Any]:
122
+ return await self._client.delete(
123
+ f"/segments/{quote(id, safe='')}", timeout=timeout
124
+ )
125
+
126
+ async def add_contacts(
127
+ self,
128
+ id: str,
129
+ input: Dict[str, Any],
130
+ *,
131
+ timeout: Optional[float] = None,
132
+ ) -> Dict[str, Any]:
133
+ return await self._client.post(
134
+ f"/segments/{quote(id, safe='')}/contacts",
135
+ input,
136
+ timeout=timeout,
137
+ )
138
+
139
+ async def remove_contact(
140
+ self,
141
+ id: str,
142
+ contact_id: str,
143
+ *,
144
+ timeout: Optional[float] = None,
145
+ ) -> Dict[str, Any]:
146
+ return await self._client.delete(
147
+ f"/segments/{quote(id, safe='')}/contacts/{quote(contact_id, safe='')}",
148
+ timeout=timeout,
149
+ )
150
+
151
+ async def preview_rules(
152
+ self, input: Dict[str, Any], *, timeout: Optional[float] = None
153
+ ) -> Dict[str, Any]:
154
+ return await self._client.post(
155
+ "/segments/preview", input, timeout=timeout
156
+ )
@@ -0,0 +1,124 @@
1
+ """Signup forms resource — mirrors packages/sdk/src/resources/signup-forms.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 SignupFormsResource:
12
+ def __init__(self, client: PostStackClient) -> None:
13
+ self._client = client
14
+
15
+ def list(
16
+ self,
17
+ params: Optional[Mapping[str, Any]] = None,
18
+ *,
19
+ timeout: Optional[float] = None,
20
+ ) -> Dict[str, Any]:
21
+ return self._client.get("/signup-forms", params, timeout=timeout)
22
+
23
+ def create(
24
+ self, input: Dict[str, Any], *, timeout: Optional[float] = None
25
+ ) -> Dict[str, Any]:
26
+ return self._client.post("/signup-forms", input, 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"/signup-forms/{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"/signup-forms/{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"/signup-forms/{quote(id, safe='')}", timeout=timeout
51
+ )
52
+
53
+ def submit(
54
+ self,
55
+ id: str,
56
+ input: Dict[str, Any],
57
+ *,
58
+ timeout: Optional[float] = None,
59
+ ) -> Dict[str, Any]:
60
+ return self._client.post(
61
+ f"/signup-forms/{quote(id, safe='')}/submit",
62
+ input,
63
+ timeout=timeout,
64
+ )
65
+
66
+
67
+ class AsyncSignupFormsResource:
68
+ def __init__(self, client: AsyncPostStackClient) -> None:
69
+ self._client = client
70
+
71
+ async def list(
72
+ self,
73
+ params: Optional[Mapping[str, Any]] = None,
74
+ *,
75
+ timeout: Optional[float] = None,
76
+ ) -> Dict[str, Any]:
77
+ return await self._client.get(
78
+ "/signup-forms", params, timeout=timeout
79
+ )
80
+
81
+ async def create(
82
+ self, input: Dict[str, Any], *, timeout: Optional[float] = None
83
+ ) -> Dict[str, Any]:
84
+ return await self._client.post(
85
+ "/signup-forms", input, timeout=timeout
86
+ )
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"/signup-forms/{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"/signup-forms/{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"/signup-forms/{quote(id, safe='')}", timeout=timeout
111
+ )
112
+
113
+ async def submit(
114
+ self,
115
+ id: str,
116
+ input: Dict[str, Any],
117
+ *,
118
+ timeout: Optional[float] = None,
119
+ ) -> Dict[str, Any]:
120
+ return await self._client.post(
121
+ f"/signup-forms/{quote(id, safe='')}/submit",
122
+ input,
123
+ timeout=timeout,
124
+ )
@@ -0,0 +1,119 @@
1
+ """Subscription topics resource — mirrors packages/sdk/src/resources/subscription-topics.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 SubscriptionTopicsResource:
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("/subscription-topics", 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
+ "/subscription-topics", input, timeout=timeout
22
+ )
23
+
24
+ def delete(
25
+ self, id: int, *, timeout: Optional[float] = None
26
+ ) -> Dict[str, Any]:
27
+ return self._client.delete(
28
+ f"/subscription-topics/{id}", timeout=timeout
29
+ )
30
+
31
+ def get_contact_subscriptions(
32
+ self, contact_id: int, *, timeout: Optional[float] = None
33
+ ) -> Dict[str, Any]:
34
+ return self._client.get(
35
+ f"/subscription-topics/contacts/{contact_id}/subscriptions",
36
+ timeout=timeout,
37
+ )
38
+
39
+ def subscribe(
40
+ self,
41
+ contact_id: int,
42
+ topic_id: int,
43
+ *,
44
+ timeout: Optional[float] = None,
45
+ ) -> Dict[str, Any]:
46
+ return self._client.post(
47
+ f"/subscription-topics/contacts/{contact_id}/subscriptions",
48
+ {"topic_id": topic_id},
49
+ timeout=timeout,
50
+ )
51
+
52
+ def unsubscribe(
53
+ self,
54
+ contact_id: int,
55
+ topic_id: int,
56
+ *,
57
+ timeout: Optional[float] = None,
58
+ ) -> Dict[str, Any]:
59
+ return self._client.delete(
60
+ f"/subscription-topics/contacts/{contact_id}/subscriptions/{topic_id}",
61
+ timeout=timeout,
62
+ )
63
+
64
+
65
+ class AsyncSubscriptionTopicsResource:
66
+ def __init__(self, client: AsyncPostStackClient) -> None:
67
+ self._client = client
68
+
69
+ async def list(self, *, timeout: Optional[float] = None) -> Dict[str, Any]:
70
+ return await self._client.get(
71
+ "/subscription-topics", timeout=timeout
72
+ )
73
+
74
+ async def create(
75
+ self, input: Dict[str, Any], *, timeout: Optional[float] = None
76
+ ) -> Dict[str, Any]:
77
+ return await self._client.post(
78
+ "/subscription-topics", input, timeout=timeout
79
+ )
80
+
81
+ async def delete(
82
+ self, id: int, *, timeout: Optional[float] = None
83
+ ) -> Dict[str, Any]:
84
+ return await self._client.delete(
85
+ f"/subscription-topics/{id}", timeout=timeout
86
+ )
87
+
88
+ async def get_contact_subscriptions(
89
+ self, contact_id: int, *, timeout: Optional[float] = None
90
+ ) -> Dict[str, Any]:
91
+ return await self._client.get(
92
+ f"/subscription-topics/contacts/{contact_id}/subscriptions",
93
+ timeout=timeout,
94
+ )
95
+
96
+ async def subscribe(
97
+ self,
98
+ contact_id: int,
99
+ topic_id: int,
100
+ *,
101
+ timeout: Optional[float] = None,
102
+ ) -> Dict[str, Any]:
103
+ return await self._client.post(
104
+ f"/subscription-topics/contacts/{contact_id}/subscriptions",
105
+ {"topic_id": topic_id},
106
+ timeout=timeout,
107
+ )
108
+
109
+ async def unsubscribe(
110
+ self,
111
+ contact_id: int,
112
+ topic_id: int,
113
+ *,
114
+ timeout: Optional[float] = None,
115
+ ) -> Dict[str, Any]:
116
+ return await self._client.delete(
117
+ f"/subscription-topics/contacts/{contact_id}/subscriptions/{topic_id}",
118
+ timeout=timeout,
119
+ )