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.
- poststack/__init__.py +159 -0
- poststack/_client.py +333 -0
- poststack/_errors.py +33 -0
- poststack/resources/__init__.py +59 -0
- poststack/resources/api_keys.py +63 -0
- poststack/resources/broadcasts.py +160 -0
- poststack/resources/contact_properties.py +73 -0
- poststack/resources/contacts.py +130 -0
- poststack/resources/domains.py +199 -0
- poststack/resources/email_validations.py +53 -0
- poststack/resources/emails.py +124 -0
- poststack/resources/mailboxes.py +157 -0
- poststack/resources/segments.py +156 -0
- poststack/resources/signup_forms.py +124 -0
- poststack/resources/subscription_topics.py +119 -0
- poststack/resources/suppressions.py +60 -0
- poststack/resources/templates.py +160 -0
- poststack/resources/webhooks.py +139 -0
- poststack/resources/workflows.py +192 -0
- poststack/types.py +511 -0
- poststack-0.4.0.dist-info/METADATA +155 -0
- poststack-0.4.0.dist-info/RECORD +24 -0
- poststack-0.4.0.dist-info/WHEEL +4 -0
- poststack-0.4.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""Suppressions resource — mirrors packages/sdk/src/resources/suppressions.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 SuppressionsResource:
|
|
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("/suppressions", params, timeout=timeout)
|
|
22
|
+
|
|
23
|
+
def add(
|
|
24
|
+
self, input: Dict[str, Any], *, timeout: Optional[float] = None
|
|
25
|
+
) -> Dict[str, Any]:
|
|
26
|
+
return self._client.post("/suppressions", input, timeout=timeout)
|
|
27
|
+
|
|
28
|
+
def remove(
|
|
29
|
+
self, email: str, *, timeout: Optional[float] = None
|
|
30
|
+
) -> Dict[str, Any]:
|
|
31
|
+
return self._client.delete(
|
|
32
|
+
f"/suppressions/{quote(email, safe='')}", timeout=timeout
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class AsyncSuppressionsResource:
|
|
37
|
+
def __init__(self, client: AsyncPostStackClient) -> None:
|
|
38
|
+
self._client = client
|
|
39
|
+
|
|
40
|
+
async def list(
|
|
41
|
+
self,
|
|
42
|
+
params: Optional[Mapping[str, Any]] = None,
|
|
43
|
+
*,
|
|
44
|
+
timeout: Optional[float] = None,
|
|
45
|
+
) -> Dict[str, Any]:
|
|
46
|
+
return await self._client.get("/suppressions", params, timeout=timeout)
|
|
47
|
+
|
|
48
|
+
async def add(
|
|
49
|
+
self, input: Dict[str, Any], *, timeout: Optional[float] = None
|
|
50
|
+
) -> Dict[str, Any]:
|
|
51
|
+
return await self._client.post(
|
|
52
|
+
"/suppressions", input, timeout=timeout
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
async def remove(
|
|
56
|
+
self, email: str, *, timeout: Optional[float] = None
|
|
57
|
+
) -> Dict[str, Any]:
|
|
58
|
+
return await self._client.delete(
|
|
59
|
+
f"/suppressions/{quote(email, safe='')}", timeout=timeout
|
|
60
|
+
)
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"""Templates resource — mirrors packages/sdk/src/resources/templates.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 TemplatesResource:
|
|
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("/templates", 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("/templates", 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"/templates/{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"/templates/{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"/templates/{quote(id, safe='')}", timeout=timeout
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
def publish(
|
|
54
|
+
self, id: str, *, timeout: Optional[float] = None
|
|
55
|
+
) -> Dict[str, Any]:
|
|
56
|
+
return self._client.post(
|
|
57
|
+
f"/templates/{quote(id, safe='')}/publish", timeout=timeout
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
def unpublish(
|
|
61
|
+
self, id: str, *, timeout: Optional[float] = None
|
|
62
|
+
) -> Dict[str, Any]:
|
|
63
|
+
return self._client.post(
|
|
64
|
+
f"/templates/{quote(id, safe='')}/unpublish", timeout=timeout
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
def duplicate(
|
|
68
|
+
self, id: str, *, timeout: Optional[float] = None
|
|
69
|
+
) -> Dict[str, Any]:
|
|
70
|
+
return self._client.post(
|
|
71
|
+
f"/templates/{quote(id, safe='')}/duplicate", timeout=timeout
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
def get_presets(self, *, timeout: Optional[float] = None) -> Dict[str, Any]:
|
|
75
|
+
return self._client.get("/templates/presets", timeout=timeout)
|
|
76
|
+
|
|
77
|
+
def use_preset(
|
|
78
|
+
self, preset_id: str, *, timeout: Optional[float] = None
|
|
79
|
+
) -> Dict[str, Any]:
|
|
80
|
+
return self._client.post(
|
|
81
|
+
f"/templates/presets/{quote(preset_id, safe='')}/use",
|
|
82
|
+
timeout=timeout,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class AsyncTemplatesResource:
|
|
87
|
+
def __init__(self, client: AsyncPostStackClient) -> None:
|
|
88
|
+
self._client = client
|
|
89
|
+
|
|
90
|
+
async def create(
|
|
91
|
+
self, input: Dict[str, Any], *, timeout: Optional[float] = None
|
|
92
|
+
) -> Dict[str, Any]:
|
|
93
|
+
return await self._client.post("/templates", input, timeout=timeout)
|
|
94
|
+
|
|
95
|
+
async def list(
|
|
96
|
+
self,
|
|
97
|
+
params: Optional[Mapping[str, Any]] = None,
|
|
98
|
+
*,
|
|
99
|
+
timeout: Optional[float] = None,
|
|
100
|
+
) -> Dict[str, Any]:
|
|
101
|
+
return await self._client.get("/templates", params, timeout=timeout)
|
|
102
|
+
|
|
103
|
+
async def get(
|
|
104
|
+
self, id: str, *, timeout: Optional[float] = None
|
|
105
|
+
) -> Dict[str, Any]:
|
|
106
|
+
return await self._client.get(
|
|
107
|
+
f"/templates/{quote(id, safe='')}", timeout=timeout
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
async def update(
|
|
111
|
+
self,
|
|
112
|
+
id: str,
|
|
113
|
+
input: Dict[str, Any],
|
|
114
|
+
*,
|
|
115
|
+
timeout: Optional[float] = None,
|
|
116
|
+
) -> Dict[str, Any]:
|
|
117
|
+
return await self._client.patch(
|
|
118
|
+
f"/templates/{quote(id, safe='')}", input, timeout=timeout
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
async def delete(
|
|
122
|
+
self, id: str, *, timeout: Optional[float] = None
|
|
123
|
+
) -> Dict[str, Any]:
|
|
124
|
+
return await self._client.delete(
|
|
125
|
+
f"/templates/{quote(id, safe='')}", timeout=timeout
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
async def publish(
|
|
129
|
+
self, id: str, *, timeout: Optional[float] = None
|
|
130
|
+
) -> Dict[str, Any]:
|
|
131
|
+
return await self._client.post(
|
|
132
|
+
f"/templates/{quote(id, safe='')}/publish", timeout=timeout
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
async def unpublish(
|
|
136
|
+
self, id: str, *, timeout: Optional[float] = None
|
|
137
|
+
) -> Dict[str, Any]:
|
|
138
|
+
return await self._client.post(
|
|
139
|
+
f"/templates/{quote(id, safe='')}/unpublish", timeout=timeout
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
async def duplicate(
|
|
143
|
+
self, id: str, *, timeout: Optional[float] = None
|
|
144
|
+
) -> Dict[str, Any]:
|
|
145
|
+
return await self._client.post(
|
|
146
|
+
f"/templates/{quote(id, safe='')}/duplicate", timeout=timeout
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
async def get_presets(
|
|
150
|
+
self, *, timeout: Optional[float] = None
|
|
151
|
+
) -> Dict[str, Any]:
|
|
152
|
+
return await self._client.get("/templates/presets", timeout=timeout)
|
|
153
|
+
|
|
154
|
+
async def use_preset(
|
|
155
|
+
self, preset_id: str, *, timeout: Optional[float] = None
|
|
156
|
+
) -> Dict[str, Any]:
|
|
157
|
+
return await self._client.post(
|
|
158
|
+
f"/templates/presets/{quote(preset_id, safe='')}/use",
|
|
159
|
+
timeout=timeout,
|
|
160
|
+
)
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"""Webhooks resource — mirrors packages/sdk/src/resources/webhooks.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 WebhooksResource:
|
|
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("/webhooks", input, timeout=timeout)
|
|
18
|
+
|
|
19
|
+
def get(
|
|
20
|
+
self, id: int, *, timeout: Optional[float] = None
|
|
21
|
+
) -> Dict[str, Any]:
|
|
22
|
+
return self._client.get(f"/webhooks/{id}", timeout=timeout)
|
|
23
|
+
|
|
24
|
+
def list(
|
|
25
|
+
self,
|
|
26
|
+
params: Optional[Mapping[str, Any]] = None,
|
|
27
|
+
*,
|
|
28
|
+
timeout: Optional[float] = None,
|
|
29
|
+
) -> Dict[str, Any]:
|
|
30
|
+
return self._client.get("/webhooks", params, 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"/webhooks/{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"/webhooks/{id}", timeout=timeout)
|
|
45
|
+
|
|
46
|
+
def test(
|
|
47
|
+
self, id: int, *, timeout: Optional[float] = None
|
|
48
|
+
) -> Dict[str, Any]:
|
|
49
|
+
return self._client.post(f"/webhooks/{id}/test", timeout=timeout)
|
|
50
|
+
|
|
51
|
+
def get_deliveries(
|
|
52
|
+
self,
|
|
53
|
+
id: int,
|
|
54
|
+
params: Optional[Mapping[str, Any]] = None,
|
|
55
|
+
*,
|
|
56
|
+
timeout: Optional[float] = None,
|
|
57
|
+
) -> Dict[str, Any]:
|
|
58
|
+
return self._client.get(
|
|
59
|
+
f"/webhooks/{id}/deliveries", params, timeout=timeout
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
def replay(
|
|
63
|
+
self,
|
|
64
|
+
id: int,
|
|
65
|
+
delivery_id: int,
|
|
66
|
+
*,
|
|
67
|
+
timeout: Optional[float] = None,
|
|
68
|
+
) -> Dict[str, Any]:
|
|
69
|
+
return self._client.post(
|
|
70
|
+
f"/webhooks/{id}/deliveries/{delivery_id}/replay",
|
|
71
|
+
timeout=timeout,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class AsyncWebhooksResource:
|
|
76
|
+
def __init__(self, client: AsyncPostStackClient) -> None:
|
|
77
|
+
self._client = client
|
|
78
|
+
|
|
79
|
+
async def create(
|
|
80
|
+
self, input: Dict[str, Any], *, timeout: Optional[float] = None
|
|
81
|
+
) -> Dict[str, Any]:
|
|
82
|
+
return await self._client.post("/webhooks", input, timeout=timeout)
|
|
83
|
+
|
|
84
|
+
async def get(
|
|
85
|
+
self, id: int, *, timeout: Optional[float] = None
|
|
86
|
+
) -> Dict[str, Any]:
|
|
87
|
+
return await self._client.get(f"/webhooks/{id}", timeout=timeout)
|
|
88
|
+
|
|
89
|
+
async def list(
|
|
90
|
+
self,
|
|
91
|
+
params: Optional[Mapping[str, Any]] = None,
|
|
92
|
+
*,
|
|
93
|
+
timeout: Optional[float] = None,
|
|
94
|
+
) -> Dict[str, Any]:
|
|
95
|
+
return await self._client.get("/webhooks", params, timeout=timeout)
|
|
96
|
+
|
|
97
|
+
async def update(
|
|
98
|
+
self,
|
|
99
|
+
id: int,
|
|
100
|
+
input: Dict[str, Any],
|
|
101
|
+
*,
|
|
102
|
+
timeout: Optional[float] = None,
|
|
103
|
+
) -> Dict[str, Any]:
|
|
104
|
+
return await self._client.patch(
|
|
105
|
+
f"/webhooks/{id}", input, timeout=timeout
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
async def delete(
|
|
109
|
+
self, id: int, *, timeout: Optional[float] = None
|
|
110
|
+
) -> Dict[str, Any]:
|
|
111
|
+
return await self._client.delete(f"/webhooks/{id}", timeout=timeout)
|
|
112
|
+
|
|
113
|
+
async def test(
|
|
114
|
+
self, id: int, *, timeout: Optional[float] = None
|
|
115
|
+
) -> Dict[str, Any]:
|
|
116
|
+
return await self._client.post(f"/webhooks/{id}/test", timeout=timeout)
|
|
117
|
+
|
|
118
|
+
async def get_deliveries(
|
|
119
|
+
self,
|
|
120
|
+
id: int,
|
|
121
|
+
params: Optional[Mapping[str, Any]] = None,
|
|
122
|
+
*,
|
|
123
|
+
timeout: Optional[float] = None,
|
|
124
|
+
) -> Dict[str, Any]:
|
|
125
|
+
return await self._client.get(
|
|
126
|
+
f"/webhooks/{id}/deliveries", params, timeout=timeout
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
async def replay(
|
|
130
|
+
self,
|
|
131
|
+
id: int,
|
|
132
|
+
delivery_id: int,
|
|
133
|
+
*,
|
|
134
|
+
timeout: Optional[float] = None,
|
|
135
|
+
) -> Dict[str, Any]:
|
|
136
|
+
return await self._client.post(
|
|
137
|
+
f"/webhooks/{id}/deliveries/{delivery_id}/replay",
|
|
138
|
+
timeout=timeout,
|
|
139
|
+
)
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"""Workflows resource — mirrors packages/sdk/src/resources/workflows.ts."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any, Dict, Optional
|
|
6
|
+
from urllib.parse import quote
|
|
7
|
+
|
|
8
|
+
from .._client import AsyncPostStackClient, PostStackClient
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class WorkflowsResource:
|
|
12
|
+
def __init__(self, client: PostStackClient) -> None:
|
|
13
|
+
self._client = client
|
|
14
|
+
|
|
15
|
+
def list(self, *, timeout: Optional[float] = None) -> Dict[str, Any]:
|
|
16
|
+
return self._client.get("/workflows", timeout=timeout)
|
|
17
|
+
|
|
18
|
+
def create(
|
|
19
|
+
self, input: Dict[str, Any], *, timeout: Optional[float] = None
|
|
20
|
+
) -> Dict[str, Any]:
|
|
21
|
+
return self._client.post("/workflows", input, timeout=timeout)
|
|
22
|
+
|
|
23
|
+
def get(
|
|
24
|
+
self, id: str, *, timeout: Optional[float] = None
|
|
25
|
+
) -> Dict[str, Any]:
|
|
26
|
+
return self._client.get(
|
|
27
|
+
f"/workflows/{quote(id, safe='')}", timeout=timeout
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
def delete(
|
|
31
|
+
self, id: str, *, timeout: Optional[float] = None
|
|
32
|
+
) -> Dict[str, Any]:
|
|
33
|
+
return self._client.delete(
|
|
34
|
+
f"/workflows/{quote(id, safe='')}", timeout=timeout
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
def add_step(
|
|
38
|
+
self,
|
|
39
|
+
id: str,
|
|
40
|
+
input: Dict[str, Any],
|
|
41
|
+
*,
|
|
42
|
+
timeout: Optional[float] = None,
|
|
43
|
+
) -> Dict[str, Any]:
|
|
44
|
+
return self._client.post(
|
|
45
|
+
f"/workflows/{quote(id, safe='')}/steps", input, timeout=timeout
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
def remove_step(
|
|
49
|
+
self,
|
|
50
|
+
id: str,
|
|
51
|
+
step_id: int,
|
|
52
|
+
*,
|
|
53
|
+
timeout: Optional[float] = None,
|
|
54
|
+
) -> Dict[str, Any]:
|
|
55
|
+
return self._client.delete(
|
|
56
|
+
f"/workflows/{quote(id, safe='')}/steps/{step_id}",
|
|
57
|
+
timeout=timeout,
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
def update_step(
|
|
61
|
+
self,
|
|
62
|
+
id: str,
|
|
63
|
+
step_id: int,
|
|
64
|
+
input: Dict[str, Any],
|
|
65
|
+
*,
|
|
66
|
+
timeout: Optional[float] = None,
|
|
67
|
+
) -> Dict[str, Any]:
|
|
68
|
+
return self._client.patch(
|
|
69
|
+
f"/workflows/{quote(id, safe='')}/steps/{step_id}",
|
|
70
|
+
input,
|
|
71
|
+
timeout=timeout,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
def activate(
|
|
75
|
+
self, id: str, *, timeout: Optional[float] = None
|
|
76
|
+
) -> Dict[str, Any]:
|
|
77
|
+
return self._client.post(
|
|
78
|
+
f"/workflows/{quote(id, safe='')}/activate", timeout=timeout
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
def pause(
|
|
82
|
+
self, id: str, *, timeout: Optional[float] = None
|
|
83
|
+
) -> Dict[str, Any]:
|
|
84
|
+
return self._client.post(
|
|
85
|
+
f"/workflows/{quote(id, safe='')}/pause", timeout=timeout
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
def trigger(
|
|
89
|
+
self,
|
|
90
|
+
id: str,
|
|
91
|
+
input: Dict[str, Any],
|
|
92
|
+
*,
|
|
93
|
+
timeout: Optional[float] = None,
|
|
94
|
+
) -> Dict[str, Any]:
|
|
95
|
+
return self._client.post(
|
|
96
|
+
f"/workflows/{quote(id, safe='')}/trigger",
|
|
97
|
+
input,
|
|
98
|
+
timeout=timeout,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class AsyncWorkflowsResource:
|
|
103
|
+
def __init__(self, client: AsyncPostStackClient) -> None:
|
|
104
|
+
self._client = client
|
|
105
|
+
|
|
106
|
+
async def list(self, *, timeout: Optional[float] = None) -> Dict[str, Any]:
|
|
107
|
+
return await self._client.get("/workflows", timeout=timeout)
|
|
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("/workflows", input, timeout=timeout)
|
|
113
|
+
|
|
114
|
+
async def get(
|
|
115
|
+
self, id: str, *, timeout: Optional[float] = None
|
|
116
|
+
) -> Dict[str, Any]:
|
|
117
|
+
return await self._client.get(
|
|
118
|
+
f"/workflows/{quote(id, safe='')}", timeout=timeout
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
async def delete(
|
|
122
|
+
self, id: str, *, timeout: Optional[float] = None
|
|
123
|
+
) -> Dict[str, Any]:
|
|
124
|
+
return await self._client.delete(
|
|
125
|
+
f"/workflows/{quote(id, safe='')}", timeout=timeout
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
async def add_step(
|
|
129
|
+
self,
|
|
130
|
+
id: str,
|
|
131
|
+
input: Dict[str, Any],
|
|
132
|
+
*,
|
|
133
|
+
timeout: Optional[float] = None,
|
|
134
|
+
) -> Dict[str, Any]:
|
|
135
|
+
return await self._client.post(
|
|
136
|
+
f"/workflows/{quote(id, safe='')}/steps",
|
|
137
|
+
input,
|
|
138
|
+
timeout=timeout,
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
async def remove_step(
|
|
142
|
+
self,
|
|
143
|
+
id: str,
|
|
144
|
+
step_id: int,
|
|
145
|
+
*,
|
|
146
|
+
timeout: Optional[float] = None,
|
|
147
|
+
) -> Dict[str, Any]:
|
|
148
|
+
return await self._client.delete(
|
|
149
|
+
f"/workflows/{quote(id, safe='')}/steps/{step_id}",
|
|
150
|
+
timeout=timeout,
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
async def update_step(
|
|
154
|
+
self,
|
|
155
|
+
id: str,
|
|
156
|
+
step_id: int,
|
|
157
|
+
input: Dict[str, Any],
|
|
158
|
+
*,
|
|
159
|
+
timeout: Optional[float] = None,
|
|
160
|
+
) -> Dict[str, Any]:
|
|
161
|
+
return await self._client.patch(
|
|
162
|
+
f"/workflows/{quote(id, safe='')}/steps/{step_id}",
|
|
163
|
+
input,
|
|
164
|
+
timeout=timeout,
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
async def activate(
|
|
168
|
+
self, id: str, *, timeout: Optional[float] = None
|
|
169
|
+
) -> Dict[str, Any]:
|
|
170
|
+
return await self._client.post(
|
|
171
|
+
f"/workflows/{quote(id, safe='')}/activate", timeout=timeout
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
async def pause(
|
|
175
|
+
self, id: str, *, timeout: Optional[float] = None
|
|
176
|
+
) -> Dict[str, Any]:
|
|
177
|
+
return await self._client.post(
|
|
178
|
+
f"/workflows/{quote(id, safe='')}/pause", timeout=timeout
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
async def trigger(
|
|
182
|
+
self,
|
|
183
|
+
id: str,
|
|
184
|
+
input: Dict[str, Any],
|
|
185
|
+
*,
|
|
186
|
+
timeout: Optional[float] = None,
|
|
187
|
+
) -> Dict[str, Any]:
|
|
188
|
+
return await self._client.post(
|
|
189
|
+
f"/workflows/{quote(id, safe='')}/trigger",
|
|
190
|
+
input,
|
|
191
|
+
timeout=timeout,
|
|
192
|
+
)
|