sf-queue-sdk 0.2.0b24__tar.gz → 0.2.0b31__tar.gz
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.
- sf_queue_sdk-0.2.0b24/README.md → sf_queue_sdk-0.2.0b31/PKG-INFO +35 -0
- sf_queue_sdk-0.2.0b24/PKG-INFO → sf_queue_sdk-0.2.0b31/README.md +27 -8
- {sf_queue_sdk-0.2.0b24 → sf_queue_sdk-0.2.0b31}/pyproject.toml +1 -1
- {sf_queue_sdk-0.2.0b24 → sf_queue_sdk-0.2.0b31}/queue_sdk/__init__.py +1 -1
- {sf_queue_sdk-0.2.0b24 → sf_queue_sdk-0.2.0b31}/queue_sdk/generated/queue/email/v1/email_pb2.py +10 -10
- {sf_queue_sdk-0.2.0b24 → sf_queue_sdk-0.2.0b31}/queue_sdk/generated/queue/email/v1/email_pb2.pyi +16 -4
- {sf_queue_sdk-0.2.0b24 → sf_queue_sdk-0.2.0b31}/queue_sdk/generated/queue/tool_assignment/v1/tool_assignment_pb2.py +4 -4
- {sf_queue_sdk-0.2.0b24 → sf_queue_sdk-0.2.0b31}/queue_sdk/generated/queue/topic_assignment/v1/topic_assignment_pb2.py +4 -4
- {sf_queue_sdk-0.2.0b24 → sf_queue_sdk-0.2.0b31}/queue_sdk/queues/email_queue.py +43 -5
- {sf_queue_sdk-0.2.0b24 → sf_queue_sdk-0.2.0b31}/queue_sdk/types.py +6 -0
- {sf_queue_sdk-0.2.0b24 → sf_queue_sdk-0.2.0b31}/.gitignore +0 -0
- {sf_queue_sdk-0.2.0b24 → sf_queue_sdk-0.2.0b31}/queue_sdk/client.py +0 -0
- {sf_queue_sdk-0.2.0b24 → sf_queue_sdk-0.2.0b31}/queue_sdk/generated/__init__.py +0 -0
- {sf_queue_sdk-0.2.0b24 → sf_queue_sdk-0.2.0b31}/queue_sdk/generated/queue/tool_assignment/v1/tool_assignment_pb2.pyi +0 -0
- {sf_queue_sdk-0.2.0b24 → sf_queue_sdk-0.2.0b31}/queue_sdk/generated/queue/topic_assignment/v1/topic_assignment_pb2.pyi +0 -0
- {sf_queue_sdk-0.2.0b24 → sf_queue_sdk-0.2.0b31}/queue_sdk/query.py +0 -0
- {sf_queue_sdk-0.2.0b24 → sf_queue_sdk-0.2.0b31}/queue_sdk/queues/__init__.py +0 -0
- {sf_queue_sdk-0.2.0b24 → sf_queue_sdk-0.2.0b31}/queue_sdk/queues/base_queue.py +0 -0
- {sf_queue_sdk-0.2.0b24 → sf_queue_sdk-0.2.0b31}/queue_sdk/queues/pdf_to_image_queue.py +0 -0
- {sf_queue_sdk-0.2.0b24 → sf_queue_sdk-0.2.0b31}/queue_sdk/queues/recommendation_queue.py +0 -0
- {sf_queue_sdk-0.2.0b24 → sf_queue_sdk-0.2.0b31}/queue_sdk/queues/tool_assignment_queue.py +0 -0
- {sf_queue_sdk-0.2.0b24 → sf_queue_sdk-0.2.0b31}/queue_sdk/queues/topic_assignment_queue.py +0 -0
- {sf_queue_sdk-0.2.0b24 → sf_queue_sdk-0.2.0b31}/queue_sdk/redis_client.py +0 -0
- {sf_queue_sdk-0.2.0b24 → sf_queue_sdk-0.2.0b31}/queue_sdk/sanitize.py +0 -0
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sf-queue-sdk
|
|
3
|
+
Version: 0.2.0b31
|
|
4
|
+
Summary: Python SDK for sf-queue - Redis-based queue system
|
|
5
|
+
Requires-Python: >=3.11
|
|
6
|
+
Requires-Dist: redis>=5.0.0
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
|
|
1
9
|
# sf-queue-sdk
|
|
2
10
|
|
|
3
11
|
Python SDK for sf-queue. Enqueues emails via Redis Streams with optional blocking confirmation from the Go consumer service.
|
|
@@ -142,6 +150,8 @@ print(result.error) # error message if all failed
|
|
|
142
150
|
| `button` | `{"text": str, "href": str}` | No | Call-to-action button |
|
|
143
151
|
| `reply_to` | `str` | No | Reply-to email address |
|
|
144
152
|
| `image` | `{"src": str, "alt"?: str, "width"?: int, "height"?: int}` | No | Image in email body |
|
|
153
|
+
| `service` | `str` | No | Service name for routing (e.g. `"sparkles"`). Routes to service-specific credentials, from address, and template. Defaults to the base config when omitted. |
|
|
154
|
+
| `template` | `str` | No | Template name override (e.g. `"sparkles"`). Overrides the service's default template. Falls back to `"studyfetch"` when omitted. |
|
|
145
155
|
|
|
146
156
|
## Optional Fields
|
|
147
157
|
|
|
@@ -162,6 +172,31 @@ client.email.send(
|
|
|
162
172
|
)
|
|
163
173
|
```
|
|
164
174
|
|
|
175
|
+
## Multi-Service Routing
|
|
176
|
+
|
|
177
|
+
Use `service` to route emails through a different service's credentials and branding. The consumer resolves the service name to its configured Resend API key, from address, and default template. Use `template` to override the template for a specific email.
|
|
178
|
+
|
|
179
|
+
```python
|
|
180
|
+
# Send via a different service's email account and template
|
|
181
|
+
client.email.send(
|
|
182
|
+
to="user@example.com",
|
|
183
|
+
preview="Welcome!",
|
|
184
|
+
subject="Welcome!",
|
|
185
|
+
paragraphs=["Welcome to the platform!"],
|
|
186
|
+
service="sparkles",
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
# Override the template for a specific email
|
|
190
|
+
client.email.send(
|
|
191
|
+
to="user@example.com",
|
|
192
|
+
preview="Welcome!",
|
|
193
|
+
subject="Welcome!",
|
|
194
|
+
paragraphs=["Welcome to the platform!"],
|
|
195
|
+
service="sparkles",
|
|
196
|
+
template="sparkles",
|
|
197
|
+
)
|
|
198
|
+
```
|
|
199
|
+
|
|
165
200
|
## Migrating from sendEmail / sendBatchEmail
|
|
166
201
|
|
|
167
202
|
The SDK is a drop-in replacement. Field names match the existing functions:
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: sf-queue-sdk
|
|
3
|
-
Version: 0.2.0b24
|
|
4
|
-
Summary: Python SDK for sf-queue - Redis-based queue system
|
|
5
|
-
Requires-Python: >=3.11
|
|
6
|
-
Requires-Dist: redis>=5.0.0
|
|
7
|
-
Description-Content-Type: text/markdown
|
|
8
|
-
|
|
9
1
|
# sf-queue-sdk
|
|
10
2
|
|
|
11
3
|
Python SDK for sf-queue. Enqueues emails via Redis Streams with optional blocking confirmation from the Go consumer service.
|
|
@@ -150,6 +142,8 @@ print(result.error) # error message if all failed
|
|
|
150
142
|
| `button` | `{"text": str, "href": str}` | No | Call-to-action button |
|
|
151
143
|
| `reply_to` | `str` | No | Reply-to email address |
|
|
152
144
|
| `image` | `{"src": str, "alt"?: str, "width"?: int, "height"?: int}` | No | Image in email body |
|
|
145
|
+
| `service` | `str` | No | Service name for routing (e.g. `"sparkles"`). Routes to service-specific credentials, from address, and template. Defaults to the base config when omitted. |
|
|
146
|
+
| `template` | `str` | No | Template name override (e.g. `"sparkles"`). Overrides the service's default template. Falls back to `"studyfetch"` when omitted. |
|
|
153
147
|
|
|
154
148
|
## Optional Fields
|
|
155
149
|
|
|
@@ -170,6 +164,31 @@ client.email.send(
|
|
|
170
164
|
)
|
|
171
165
|
```
|
|
172
166
|
|
|
167
|
+
## Multi-Service Routing
|
|
168
|
+
|
|
169
|
+
Use `service` to route emails through a different service's credentials and branding. The consumer resolves the service name to its configured Resend API key, from address, and default template. Use `template` to override the template for a specific email.
|
|
170
|
+
|
|
171
|
+
```python
|
|
172
|
+
# Send via a different service's email account and template
|
|
173
|
+
client.email.send(
|
|
174
|
+
to="user@example.com",
|
|
175
|
+
preview="Welcome!",
|
|
176
|
+
subject="Welcome!",
|
|
177
|
+
paragraphs=["Welcome to the platform!"],
|
|
178
|
+
service="sparkles",
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
# Override the template for a specific email
|
|
182
|
+
client.email.send(
|
|
183
|
+
to="user@example.com",
|
|
184
|
+
preview="Welcome!",
|
|
185
|
+
subject="Welcome!",
|
|
186
|
+
paragraphs=["Welcome to the platform!"],
|
|
187
|
+
service="sparkles",
|
|
188
|
+
template="sparkles",
|
|
189
|
+
)
|
|
190
|
+
```
|
|
191
|
+
|
|
173
192
|
## Migrating from sendEmail / sendBatchEmail
|
|
174
193
|
|
|
175
194
|
The SDK is a drop-in replacement. Field names match the existing functions:
|
{sf_queue_sdk-0.2.0b24 → sf_queue_sdk-0.2.0b31}/queue_sdk/generated/queue/email/v1/email_pb2.py
RENAMED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
3
|
# NO CHECKED-IN PROTOBUF GENCODE
|
|
4
4
|
# source: queue/email/v1/email.proto
|
|
5
|
-
# Protobuf Python Version:
|
|
5
|
+
# Protobuf Python Version: 7.34.0
|
|
6
6
|
"""Generated protocol buffer code."""
|
|
7
7
|
from google.protobuf import descriptor as _descriptor
|
|
8
8
|
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
@@ -11,9 +11,9 @@ from google.protobuf import symbol_database as _symbol_database
|
|
|
11
11
|
from google.protobuf.internal import builder as _builder
|
|
12
12
|
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
13
|
_runtime_version.Domain.PUBLIC,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
7,
|
|
15
|
+
34,
|
|
16
|
+
0,
|
|
17
17
|
'',
|
|
18
18
|
'queue/email/v1/email.proto'
|
|
19
19
|
)
|
|
@@ -24,7 +24,7 @@ _sym_db = _symbol_database.Default()
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1aqueue/email/v1/email.proto\x12\x0equeue.email.v1\"5\n\x0b\x45mailButton\x12\x12\n\x04text\x18\x01 \x01(\tR\x04text\x12\x12\n\x04href\x18\x02 \x01(\tR\x04href\"^\n\nEmailImage\x12\x10\n\x03src\x18\x01 \x01(\tR\x03src\x12\x10\n\x03\x61lt\x18\x02 \x01(\tR\x03\x61lt\x12\x14\n\x05width\x18\x03 \x01(\x05R\x05width\x12\x16\n\x06height\x18\x04 \x01(\x05R\x06height\"\
|
|
27
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1aqueue/email/v1/email.proto\x12\x0equeue.email.v1\"5\n\x0b\x45mailButton\x12\x12\n\x04text\x18\x01 \x01(\tR\x04text\x12\x12\n\x04href\x18\x02 \x01(\tR\x04href\"^\n\nEmailImage\x12\x10\n\x03src\x18\x01 \x01(\tR\x03src\x12\x10\n\x03\x61lt\x18\x02 \x01(\tR\x03\x61lt\x12\x14\n\x05width\x18\x03 \x01(\x05R\x05width\x12\x16\n\x06height\x18\x04 \x01(\x05R\x06height\"\xbe\x02\n\x0c\x45mailRequest\x12\x0e\n\x02to\x18\x01 \x01(\tR\x02to\x12\x18\n\x07preview\x18\x02 \x01(\tR\x07preview\x12\x18\n\x07subject\x18\x03 \x01(\tR\x07subject\x12\x1e\n\nparagraphs\x18\x04 \x03(\tR\nparagraphs\x12\x33\n\x06\x62utton\x18\x05 \x01(\x0b\x32\x1b.queue.email.v1.EmailButtonR\x06\x62utton\x12\x19\n\x08reply_to\x18\x06 \x01(\tR\x07replyTo\x12\x30\n\x05image\x18\x07 \x01(\x0b\x32\x1a.queue.email.v1.EmailImageR\x05image\x12\x18\n\x07service\x18\x08 \x01(\tR\x07service\x12\x1a\n\x08template\x18\t \x01(\tR\x08template\x12\x12\n\x04html\x18\n \x01(\tR\x04html\"\xc3\x02\n\x11\x42\x61tchEmailRequest\x12\x0e\n\x02to\x18\x01 \x03(\tR\x02to\x12\x18\n\x07preview\x18\x02 \x01(\tR\x07preview\x12\x18\n\x07subject\x18\x03 \x01(\tR\x07subject\x12\x1e\n\nparagraphs\x18\x04 \x03(\tR\nparagraphs\x12\x33\n\x06\x62utton\x18\x05 \x01(\x0b\x32\x1b.queue.email.v1.EmailButtonR\x06\x62utton\x12\x19\n\x08reply_to\x18\x06 \x01(\tR\x07replyTo\x12\x30\n\x05image\x18\x07 \x01(\x0b\x32\x1a.queue.email.v1.EmailImageR\x05image\x12\x18\n\x07service\x18\x08 \x01(\tR\x07service\x12\x1a\n\x08template\x18\t \x01(\tR\x08template\x12\x12\n\x04html\x18\n \x01(\tR\x04html\"^\n\rEmailResponse\x12\x18\n\x07success\x18\x01 \x01(\x08R\x07success\x12\x1d\n\nmessage_id\x18\x02 \x01(\tR\tmessageId\x12\x14\n\x05\x65rror\x18\x03 \x01(\tR\x05\x65rrorBLZJgithub.com/StudyFetch/sf-queue/packages/go/proto-go/queue/email/v1;emailv1b\x06proto3')
|
|
28
28
|
|
|
29
29
|
_globals = globals()
|
|
30
30
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
@@ -37,9 +37,9 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
|
37
37
|
_globals['_EMAILIMAGE']._serialized_start=101
|
|
38
38
|
_globals['_EMAILIMAGE']._serialized_end=195
|
|
39
39
|
_globals['_EMAILREQUEST']._serialized_start=198
|
|
40
|
-
_globals['_EMAILREQUEST']._serialized_end=
|
|
41
|
-
_globals['_BATCHEMAILREQUEST']._serialized_start=
|
|
42
|
-
_globals['_BATCHEMAILREQUEST']._serialized_end=
|
|
43
|
-
_globals['_EMAILRESPONSE']._serialized_start=
|
|
44
|
-
_globals['_EMAILRESPONSE']._serialized_end=
|
|
40
|
+
_globals['_EMAILREQUEST']._serialized_end=516
|
|
41
|
+
_globals['_BATCHEMAILREQUEST']._serialized_start=519
|
|
42
|
+
_globals['_BATCHEMAILREQUEST']._serialized_end=842
|
|
43
|
+
_globals['_EMAILRESPONSE']._serialized_start=844
|
|
44
|
+
_globals['_EMAILRESPONSE']._serialized_end=938
|
|
45
45
|
# @@protoc_insertion_point(module_scope)
|
{sf_queue_sdk-0.2.0b24 → sf_queue_sdk-0.2.0b31}/queue_sdk/generated/queue/email/v1/email_pb2.pyi
RENAMED
|
@@ -27,7 +27,7 @@ class EmailImage(_message.Message):
|
|
|
27
27
|
def __init__(self, src: _Optional[str] = ..., alt: _Optional[str] = ..., width: _Optional[int] = ..., height: _Optional[int] = ...) -> None: ...
|
|
28
28
|
|
|
29
29
|
class EmailRequest(_message.Message):
|
|
30
|
-
__slots__ = ("to", "preview", "subject", "paragraphs", "button", "reply_to", "image")
|
|
30
|
+
__slots__ = ("to", "preview", "subject", "paragraphs", "button", "reply_to", "image", "service", "template", "html")
|
|
31
31
|
TO_FIELD_NUMBER: _ClassVar[int]
|
|
32
32
|
PREVIEW_FIELD_NUMBER: _ClassVar[int]
|
|
33
33
|
SUBJECT_FIELD_NUMBER: _ClassVar[int]
|
|
@@ -35,6 +35,9 @@ class EmailRequest(_message.Message):
|
|
|
35
35
|
BUTTON_FIELD_NUMBER: _ClassVar[int]
|
|
36
36
|
REPLY_TO_FIELD_NUMBER: _ClassVar[int]
|
|
37
37
|
IMAGE_FIELD_NUMBER: _ClassVar[int]
|
|
38
|
+
SERVICE_FIELD_NUMBER: _ClassVar[int]
|
|
39
|
+
TEMPLATE_FIELD_NUMBER: _ClassVar[int]
|
|
40
|
+
HTML_FIELD_NUMBER: _ClassVar[int]
|
|
38
41
|
to: str
|
|
39
42
|
preview: str
|
|
40
43
|
subject: str
|
|
@@ -42,10 +45,13 @@ class EmailRequest(_message.Message):
|
|
|
42
45
|
button: EmailButton
|
|
43
46
|
reply_to: str
|
|
44
47
|
image: EmailImage
|
|
45
|
-
|
|
48
|
+
service: str
|
|
49
|
+
template: str
|
|
50
|
+
html: str
|
|
51
|
+
def __init__(self, to: _Optional[str] = ..., preview: _Optional[str] = ..., subject: _Optional[str] = ..., paragraphs: _Optional[_Iterable[str]] = ..., button: _Optional[_Union[EmailButton, _Mapping]] = ..., reply_to: _Optional[str] = ..., image: _Optional[_Union[EmailImage, _Mapping]] = ..., service: _Optional[str] = ..., template: _Optional[str] = ..., html: _Optional[str] = ...) -> None: ...
|
|
46
52
|
|
|
47
53
|
class BatchEmailRequest(_message.Message):
|
|
48
|
-
__slots__ = ("to", "preview", "subject", "paragraphs", "button", "reply_to", "image")
|
|
54
|
+
__slots__ = ("to", "preview", "subject", "paragraphs", "button", "reply_to", "image", "service", "template", "html")
|
|
49
55
|
TO_FIELD_NUMBER: _ClassVar[int]
|
|
50
56
|
PREVIEW_FIELD_NUMBER: _ClassVar[int]
|
|
51
57
|
SUBJECT_FIELD_NUMBER: _ClassVar[int]
|
|
@@ -53,6 +59,9 @@ class BatchEmailRequest(_message.Message):
|
|
|
53
59
|
BUTTON_FIELD_NUMBER: _ClassVar[int]
|
|
54
60
|
REPLY_TO_FIELD_NUMBER: _ClassVar[int]
|
|
55
61
|
IMAGE_FIELD_NUMBER: _ClassVar[int]
|
|
62
|
+
SERVICE_FIELD_NUMBER: _ClassVar[int]
|
|
63
|
+
TEMPLATE_FIELD_NUMBER: _ClassVar[int]
|
|
64
|
+
HTML_FIELD_NUMBER: _ClassVar[int]
|
|
56
65
|
to: _containers.RepeatedScalarFieldContainer[str]
|
|
57
66
|
preview: str
|
|
58
67
|
subject: str
|
|
@@ -60,7 +69,10 @@ class BatchEmailRequest(_message.Message):
|
|
|
60
69
|
button: EmailButton
|
|
61
70
|
reply_to: str
|
|
62
71
|
image: EmailImage
|
|
63
|
-
|
|
72
|
+
service: str
|
|
73
|
+
template: str
|
|
74
|
+
html: str
|
|
75
|
+
def __init__(self, to: _Optional[_Iterable[str]] = ..., preview: _Optional[str] = ..., subject: _Optional[str] = ..., paragraphs: _Optional[_Iterable[str]] = ..., button: _Optional[_Union[EmailButton, _Mapping]] = ..., reply_to: _Optional[str] = ..., image: _Optional[_Union[EmailImage, _Mapping]] = ..., service: _Optional[str] = ..., template: _Optional[str] = ..., html: _Optional[str] = ...) -> None: ...
|
|
64
76
|
|
|
65
77
|
class EmailResponse(_message.Message):
|
|
66
78
|
__slots__ = ("success", "message_id", "error")
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
3
|
# NO CHECKED-IN PROTOBUF GENCODE
|
|
4
4
|
# source: queue/tool_assignment/v1/tool_assignment.proto
|
|
5
|
-
# Protobuf Python Version:
|
|
5
|
+
# Protobuf Python Version: 7.34.0
|
|
6
6
|
"""Generated protocol buffer code."""
|
|
7
7
|
from google.protobuf import descriptor as _descriptor
|
|
8
8
|
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
@@ -11,9 +11,9 @@ from google.protobuf import symbol_database as _symbol_database
|
|
|
11
11
|
from google.protobuf.internal import builder as _builder
|
|
12
12
|
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
13
|
_runtime_version.Domain.PUBLIC,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
7,
|
|
15
|
+
34,
|
|
16
|
+
0,
|
|
17
17
|
'',
|
|
18
18
|
'queue/tool_assignment/v1/tool_assignment.proto'
|
|
19
19
|
)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
3
|
# NO CHECKED-IN PROTOBUF GENCODE
|
|
4
4
|
# source: queue/topic_assignment/v1/topic_assignment.proto
|
|
5
|
-
# Protobuf Python Version:
|
|
5
|
+
# Protobuf Python Version: 7.34.0
|
|
6
6
|
"""Generated protocol buffer code."""
|
|
7
7
|
from google.protobuf import descriptor as _descriptor
|
|
8
8
|
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
@@ -11,9 +11,9 @@ from google.protobuf import symbol_database as _symbol_database
|
|
|
11
11
|
from google.protobuf.internal import builder as _builder
|
|
12
12
|
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
13
|
_runtime_version.Domain.PUBLIC,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
7,
|
|
15
|
+
34,
|
|
16
|
+
0,
|
|
17
17
|
'',
|
|
18
18
|
'queue/topic_assignment/v1/topic_assignment.proto'
|
|
19
19
|
)
|
|
@@ -28,9 +28,14 @@ class EmailQueue(BaseQueue):
|
|
|
28
28
|
button: Optional[dict[str, str]] = None,
|
|
29
29
|
reply_to: Optional[str] = None,
|
|
30
30
|
image: Optional[dict[str, Any]] = None,
|
|
31
|
+
service: Optional[str] = None,
|
|
32
|
+
template: Optional[str] = None,
|
|
33
|
+
html: Optional[str] = None,
|
|
31
34
|
) -> SendResult:
|
|
32
35
|
"""Enqueue an email for processing (fire and forget)."""
|
|
33
|
-
payload = self._build_payload(
|
|
36
|
+
payload = self._build_payload(
|
|
37
|
+
to, preview, subject, paragraphs, button, reply_to, image, service, template, html
|
|
38
|
+
)
|
|
34
39
|
message_id = self._enqueue(payload)
|
|
35
40
|
return SendResult(message_id=message_id)
|
|
36
41
|
|
|
@@ -44,9 +49,14 @@ class EmailQueue(BaseQueue):
|
|
|
44
49
|
reply_to: Optional[str] = None,
|
|
45
50
|
image: Optional[dict[str, Any]] = None,
|
|
46
51
|
timeout: Optional[int] = None,
|
|
52
|
+
service: Optional[str] = None,
|
|
53
|
+
template: Optional[str] = None,
|
|
54
|
+
html: Optional[str] = None,
|
|
47
55
|
) -> EmailResponse:
|
|
48
56
|
"""Enqueue an email and wait for processing confirmation."""
|
|
49
|
-
payload = self._build_payload(
|
|
57
|
+
payload = self._build_payload(
|
|
58
|
+
to, preview, subject, paragraphs, button, reply_to, image, service, template, html
|
|
59
|
+
)
|
|
50
60
|
return self._enqueue_and_wait(payload, timeout)
|
|
51
61
|
|
|
52
62
|
def send_batch(
|
|
@@ -58,10 +68,15 @@ class EmailQueue(BaseQueue):
|
|
|
58
68
|
button: Optional[dict[str, str]] = None,
|
|
59
69
|
reply_to: Optional[str] = None,
|
|
60
70
|
image: Optional[dict[str, Any]] = None,
|
|
71
|
+
service: Optional[str] = None,
|
|
72
|
+
template: Optional[str] = None,
|
|
73
|
+
html: Optional[str] = None,
|
|
61
74
|
) -> SendResult:
|
|
62
75
|
"""Enqueue a batch email for processing (fire and forget)."""
|
|
63
76
|
self._validate_batch(to)
|
|
64
|
-
payload = self._build_batch_payload(
|
|
77
|
+
payload = self._build_batch_payload(
|
|
78
|
+
to, preview, subject, paragraphs, button, reply_to, image, service, template, html
|
|
79
|
+
)
|
|
65
80
|
message_id = self._enqueue(payload)
|
|
66
81
|
return SendResult(message_id=message_id)
|
|
67
82
|
|
|
@@ -75,10 +90,15 @@ class EmailQueue(BaseQueue):
|
|
|
75
90
|
reply_to: Optional[str] = None,
|
|
76
91
|
image: Optional[dict[str, Any]] = None,
|
|
77
92
|
timeout: Optional[int] = None,
|
|
93
|
+
service: Optional[str] = None,
|
|
94
|
+
template: Optional[str] = None,
|
|
95
|
+
html: Optional[str] = None,
|
|
78
96
|
) -> BatchEmailResponse:
|
|
79
97
|
"""Enqueue a batch email and wait for processing confirmation."""
|
|
80
98
|
self._validate_batch(to)
|
|
81
|
-
payload = self._build_batch_payload(
|
|
99
|
+
payload = self._build_batch_payload(
|
|
100
|
+
to, preview, subject, paragraphs, button, reply_to, image, service, template, html
|
|
101
|
+
)
|
|
82
102
|
response = self._enqueue_and_wait(payload, timeout)
|
|
83
103
|
|
|
84
104
|
return BatchEmailResponse(
|
|
@@ -100,6 +120,9 @@ class EmailQueue(BaseQueue):
|
|
|
100
120
|
button: Optional[dict[str, str]],
|
|
101
121
|
reply_to: Optional[str],
|
|
102
122
|
image: Optional[dict[str, Any]],
|
|
123
|
+
service: Optional[str] = None,
|
|
124
|
+
template: Optional[str] = None,
|
|
125
|
+
html: Optional[str] = None,
|
|
103
126
|
) -> dict[str, Any]:
|
|
104
127
|
"""Build and sanitize the email payload."""
|
|
105
128
|
payload: dict[str, Any] = {
|
|
@@ -126,6 +149,15 @@ class EmailQueue(BaseQueue):
|
|
|
126
149
|
"height": image.get("height"),
|
|
127
150
|
}
|
|
128
151
|
|
|
152
|
+
if service:
|
|
153
|
+
payload["service"] = service
|
|
154
|
+
|
|
155
|
+
if template:
|
|
156
|
+
payload["template"] = template
|
|
157
|
+
|
|
158
|
+
if html:
|
|
159
|
+
payload["html"] = html
|
|
160
|
+
|
|
129
161
|
return payload
|
|
130
162
|
|
|
131
163
|
def _build_batch_payload(
|
|
@@ -137,16 +169,22 @@ class EmailQueue(BaseQueue):
|
|
|
137
169
|
button: Optional[dict[str, str]],
|
|
138
170
|
reply_to: Optional[str],
|
|
139
171
|
image: Optional[dict[str, Any]],
|
|
172
|
+
service: Optional[str] = None,
|
|
173
|
+
template: Optional[str] = None,
|
|
174
|
+
html: Optional[str] = None,
|
|
140
175
|
) -> dict[str, Any]:
|
|
141
176
|
"""Build and sanitize the batch email payload."""
|
|
142
177
|
payload = self._build_payload(
|
|
143
|
-
to="",
|
|
178
|
+
to="",
|
|
144
179
|
preview=preview,
|
|
145
180
|
subject=subject,
|
|
146
181
|
paragraphs=paragraphs,
|
|
147
182
|
button=button,
|
|
148
183
|
reply_to=reply_to,
|
|
149
184
|
image=image,
|
|
185
|
+
service=service,
|
|
186
|
+
template=template,
|
|
187
|
+
html=html,
|
|
150
188
|
)
|
|
151
189
|
payload["to"] = to
|
|
152
190
|
payload["batch"] = True
|
|
@@ -42,6 +42,9 @@ class EmailData:
|
|
|
42
42
|
button: Optional[EmailButton] = None
|
|
43
43
|
reply_to: Optional[str] = None
|
|
44
44
|
image: Optional[EmailImage] = None
|
|
45
|
+
service: Optional[str] = None
|
|
46
|
+
template: Optional[str] = None
|
|
47
|
+
html: Optional[str] = None
|
|
45
48
|
|
|
46
49
|
|
|
47
50
|
@dataclass
|
|
@@ -55,6 +58,9 @@ class BatchEmailData:
|
|
|
55
58
|
button: Optional[EmailButton] = None
|
|
56
59
|
reply_to: Optional[str] = None
|
|
57
60
|
image: Optional[EmailImage] = None
|
|
61
|
+
service: Optional[str] = None
|
|
62
|
+
template: Optional[str] = None
|
|
63
|
+
html: Optional[str] = None
|
|
58
64
|
|
|
59
65
|
|
|
60
66
|
@dataclass
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|