emercury-smtp-sdk 1.0.0__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.
Files changed (52) hide show
  1. emercury_smtp_sdk-1.0.0/LICENSE +21 -0
  2. emercury_smtp_sdk-1.0.0/PKG-INFO +89 -0
  3. emercury_smtp_sdk-1.0.0/README.md +61 -0
  4. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/__init__.py +110 -0
  5. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/api/__init__.py +5 -0
  6. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/api/email_api.py +342 -0
  7. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/api/statistics_api.py +710 -0
  8. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/api_client.py +805 -0
  9. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/api_response.py +21 -0
  10. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/configuration.py +627 -0
  11. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/exceptions.py +219 -0
  12. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/__init__.py +46 -0
  13. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/api_error_detail.py +94 -0
  14. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/api_request_metadata.py +91 -0
  15. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/api_status.py +109 -0
  16. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/bounce_webhook_data.py +124 -0
  17. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/complaint_webhook.py +110 -0
  18. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/complaint_webhook_data.py +138 -0
  19. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/delivered_webhook.py +110 -0
  20. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/delivered_webhook_data.py +124 -0
  21. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/email_address.py +90 -0
  22. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/email_content_part.py +93 -0
  23. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/email_content_type.py +41 -0
  24. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/error_response.py +98 -0
  25. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/hard_bounce_webhook.py +110 -0
  26. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/hard_bounce_webhook_data.py +129 -0
  27. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/hard_bounce_webhook_discriminator.py +122 -0
  28. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/legacy_webhook_signature.py +125 -0
  29. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/outbound_listing.py +101 -0
  30. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/outbound_listing_item.py +104 -0
  31. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/outbound_listing_response.py +97 -0
  32. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/outbound_overview.py +98 -0
  33. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/outbound_overview_response.py +97 -0
  34. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/outbound_status_code.py +47 -0
  35. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/pagination.py +94 -0
  36. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/queued_email.py +97 -0
  37. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/recipient.py +102 -0
  38. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/send_email_request.py +114 -0
  39. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/send_email_response.py +97 -0
  40. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/soft_bounce_webhook.py +110 -0
  41. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/soft_bounce_webhook_data.py +129 -0
  42. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/models/soft_bounce_webhook_discriminator.py +122 -0
  43. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/py.typed +0 -0
  44. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk/rest.py +264 -0
  45. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk.egg-info/PKG-INFO +89 -0
  46. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk.egg-info/SOURCES.txt +50 -0
  47. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk.egg-info/dependency_links.txt +1 -0
  48. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk.egg-info/requires.txt +7 -0
  49. emercury_smtp_sdk-1.0.0/emercury_smtp_sdk.egg-info/top_level.txt +1 -0
  50. emercury_smtp_sdk-1.0.0/pyproject.toml +57 -0
  51. emercury_smtp_sdk-1.0.0/setup.cfg +4 -0
  52. emercury_smtp_sdk-1.0.0/tests/test_email_api.py +46 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Emercury
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,89 @@
1
+ Metadata-Version: 2.4
2
+ Name: emercury-smtp-sdk
3
+ Version: 1.0.0
4
+ Summary: Official Python SDK for the Emercury SMTP API
5
+ Author-email: Emercury <support@emercury.net>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://www.emercury.net
8
+ Keywords: emercury,smtp,email,transactional-email,api-client,sdk
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Typing :: Typed
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Requires-Python: >=3.10
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: urllib3<3.0.0,>=2.1.0
22
+ Requires-Dist: python-dateutil>=2.8.2
23
+ Requires-Dist: pydantic<3.0,>=2.11
24
+ Requires-Dist: typing-extensions>=4.7.1
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest<10.0,>=8.0; extra == "dev"
27
+ Dynamic: license-file
28
+
29
+ # Emercury SMTP SDK for Python
30
+
31
+ The official Python client for sending transactional email and reading outbound delivery statistics through the
32
+ stable Emercury SMTP API.
33
+
34
+ ## Installation
35
+
36
+ ```bash
37
+ pip install emercury-smtp-sdk
38
+ ```
39
+
40
+ ## Send an email
41
+
42
+ ```python
43
+ import os
44
+ import uuid
45
+
46
+ from emercury_smtp_sdk import (
47
+ ApiClient,
48
+ Configuration,
49
+ EmailAddress,
50
+ EmailApi,
51
+ EmailContentPart,
52
+ EmailContentType,
53
+ SendEmailRequest,
54
+ )
55
+
56
+ configuration = Configuration()
57
+ configuration.api_key["ApiTokenAuth"] = os.environ["EMERCURY_API_TOKEN"]
58
+
59
+ email = SendEmailRequest(
60
+ var_from=EmailAddress(email="sender@example.com", name="Example"),
61
+ to=EmailAddress(email="recipient@example.net"),
62
+ subject="Hello from Emercury",
63
+ contents=[EmailContentPart(
64
+ content_type=EmailContentType.TEXT_SLASH_PLAIN,
65
+ content="Your transactional email is ready.",
66
+ )],
67
+ )
68
+
69
+ with ApiClient(configuration) as api_client:
70
+ result = EmailApi(api_client).send_email(
71
+ email,
72
+ idempotency_key=str(uuid.uuid4()),
73
+ )
74
+ ```
75
+
76
+ Use a unique idempotency key when a send may be retried. The same key and normalized payload return the original
77
+ response for 24 hours; reusing a key with a different payload returns `409 Conflict`.
78
+
79
+ ## API reference
80
+
81
+ - [Email API](docs/EmailApi.md)
82
+ - [Statistics API](docs/StatisticsApi.md)
83
+ - [Models](docs)
84
+
85
+ All requests default to `https://api.smtp.emercury.net`. Set `Configuration.host` when a different endpoint is
86
+ required.
87
+
88
+ This package is generated from the official Emercury SMTP OpenAPI contract. Generated client code and reference
89
+ documentation should not be edited manually.
@@ -0,0 +1,61 @@
1
+ # Emercury SMTP SDK for Python
2
+
3
+ The official Python client for sending transactional email and reading outbound delivery statistics through the
4
+ stable Emercury SMTP API.
5
+
6
+ ## Installation
7
+
8
+ ```bash
9
+ pip install emercury-smtp-sdk
10
+ ```
11
+
12
+ ## Send an email
13
+
14
+ ```python
15
+ import os
16
+ import uuid
17
+
18
+ from emercury_smtp_sdk import (
19
+ ApiClient,
20
+ Configuration,
21
+ EmailAddress,
22
+ EmailApi,
23
+ EmailContentPart,
24
+ EmailContentType,
25
+ SendEmailRequest,
26
+ )
27
+
28
+ configuration = Configuration()
29
+ configuration.api_key["ApiTokenAuth"] = os.environ["EMERCURY_API_TOKEN"]
30
+
31
+ email = SendEmailRequest(
32
+ var_from=EmailAddress(email="sender@example.com", name="Example"),
33
+ to=EmailAddress(email="recipient@example.net"),
34
+ subject="Hello from Emercury",
35
+ contents=[EmailContentPart(
36
+ content_type=EmailContentType.TEXT_SLASH_PLAIN,
37
+ content="Your transactional email is ready.",
38
+ )],
39
+ )
40
+
41
+ with ApiClient(configuration) as api_client:
42
+ result = EmailApi(api_client).send_email(
43
+ email,
44
+ idempotency_key=str(uuid.uuid4()),
45
+ )
46
+ ```
47
+
48
+ Use a unique idempotency key when a send may be retried. The same key and normalized payload return the original
49
+ response for 24 hours; reusing a key with a different payload returns `409 Conflict`.
50
+
51
+ ## API reference
52
+
53
+ - [Email API](docs/EmailApi.md)
54
+ - [Statistics API](docs/StatisticsApi.md)
55
+ - [Models](docs)
56
+
57
+ All requests default to `https://api.smtp.emercury.net`. Set `Configuration.host` when a different endpoint is
58
+ required.
59
+
60
+ This package is generated from the official Emercury SMTP OpenAPI contract. Generated client code and reference
61
+ documentation should not be edited manually.
@@ -0,0 +1,110 @@
1
+ # coding: utf-8
2
+
3
+ # flake8: noqa
4
+
5
+ """
6
+ Emercury SMTP API
7
+
8
+ Send transactional email, inspect outbound delivery statistics, and receive signed delivery webhooks. All client operations use the stable `/api/v1` contract. Legacy unversioned endpoints are intentionally omitted from generated SDKs.
9
+
10
+ The version of the OpenAPI document: 1.0.0
11
+ Contact: support@emercury.net
12
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
13
+
14
+ Do not edit the class manually.
15
+ """ # noqa: E501
16
+
17
+
18
+ __version__ = "1.0.0"
19
+
20
+ # Define package exports
21
+ __all__ = [
22
+ "EmailApi",
23
+ "StatisticsApi",
24
+ "ApiResponse",
25
+ "ApiClient",
26
+ "Configuration",
27
+ "OpenApiException",
28
+ "ApiTypeError",
29
+ "ApiValueError",
30
+ "ApiKeyError",
31
+ "ApiAttributeError",
32
+ "ApiException",
33
+ "ApiErrorDetail",
34
+ "ApiRequestMetadata",
35
+ "ApiStatus",
36
+ "BounceWebhookData",
37
+ "ComplaintWebhook",
38
+ "ComplaintWebhookData",
39
+ "DeliveredWebhook",
40
+ "DeliveredWebhookData",
41
+ "EmailAddress",
42
+ "EmailContentPart",
43
+ "EmailContentType",
44
+ "ErrorResponse",
45
+ "HardBounceWebhook",
46
+ "HardBounceWebhookData",
47
+ "HardBounceWebhookDiscriminator",
48
+ "LegacyWebhookSignature",
49
+ "OutboundListing",
50
+ "OutboundListingItem",
51
+ "OutboundListingResponse",
52
+ "OutboundOverview",
53
+ "OutboundOverviewResponse",
54
+ "OutboundStatusCode",
55
+ "Pagination",
56
+ "QueuedEmail",
57
+ "Recipient",
58
+ "SendEmailRequest",
59
+ "SendEmailResponse",
60
+ "SoftBounceWebhook",
61
+ "SoftBounceWebhookData",
62
+ "SoftBounceWebhookDiscriminator",
63
+ ]
64
+
65
+ # import apis into sdk package
66
+ from emercury_smtp_sdk.api.email_api import EmailApi as EmailApi
67
+ from emercury_smtp_sdk.api.statistics_api import StatisticsApi as StatisticsApi
68
+
69
+ # import ApiClient
70
+ from emercury_smtp_sdk.api_response import ApiResponse as ApiResponse
71
+ from emercury_smtp_sdk.api_client import ApiClient as ApiClient
72
+ from emercury_smtp_sdk.configuration import Configuration as Configuration
73
+ from emercury_smtp_sdk.exceptions import OpenApiException as OpenApiException
74
+ from emercury_smtp_sdk.exceptions import ApiTypeError as ApiTypeError
75
+ from emercury_smtp_sdk.exceptions import ApiValueError as ApiValueError
76
+ from emercury_smtp_sdk.exceptions import ApiKeyError as ApiKeyError
77
+ from emercury_smtp_sdk.exceptions import ApiAttributeError as ApiAttributeError
78
+ from emercury_smtp_sdk.exceptions import ApiException as ApiException
79
+
80
+ # import models into sdk package
81
+ from emercury_smtp_sdk.models.api_error_detail import ApiErrorDetail as ApiErrorDetail
82
+ from emercury_smtp_sdk.models.api_request_metadata import ApiRequestMetadata as ApiRequestMetadata
83
+ from emercury_smtp_sdk.models.api_status import ApiStatus as ApiStatus
84
+ from emercury_smtp_sdk.models.bounce_webhook_data import BounceWebhookData as BounceWebhookData
85
+ from emercury_smtp_sdk.models.complaint_webhook import ComplaintWebhook as ComplaintWebhook
86
+ from emercury_smtp_sdk.models.complaint_webhook_data import ComplaintWebhookData as ComplaintWebhookData
87
+ from emercury_smtp_sdk.models.delivered_webhook import DeliveredWebhook as DeliveredWebhook
88
+ from emercury_smtp_sdk.models.delivered_webhook_data import DeliveredWebhookData as DeliveredWebhookData
89
+ from emercury_smtp_sdk.models.email_address import EmailAddress as EmailAddress
90
+ from emercury_smtp_sdk.models.email_content_part import EmailContentPart as EmailContentPart
91
+ from emercury_smtp_sdk.models.email_content_type import EmailContentType as EmailContentType
92
+ from emercury_smtp_sdk.models.error_response import ErrorResponse as ErrorResponse
93
+ from emercury_smtp_sdk.models.hard_bounce_webhook import HardBounceWebhook as HardBounceWebhook
94
+ from emercury_smtp_sdk.models.hard_bounce_webhook_data import HardBounceWebhookData as HardBounceWebhookData
95
+ from emercury_smtp_sdk.models.hard_bounce_webhook_discriminator import HardBounceWebhookDiscriminator as HardBounceWebhookDiscriminator
96
+ from emercury_smtp_sdk.models.legacy_webhook_signature import LegacyWebhookSignature as LegacyWebhookSignature
97
+ from emercury_smtp_sdk.models.outbound_listing import OutboundListing as OutboundListing
98
+ from emercury_smtp_sdk.models.outbound_listing_item import OutboundListingItem as OutboundListingItem
99
+ from emercury_smtp_sdk.models.outbound_listing_response import OutboundListingResponse as OutboundListingResponse
100
+ from emercury_smtp_sdk.models.outbound_overview import OutboundOverview as OutboundOverview
101
+ from emercury_smtp_sdk.models.outbound_overview_response import OutboundOverviewResponse as OutboundOverviewResponse
102
+ from emercury_smtp_sdk.models.outbound_status_code import OutboundStatusCode as OutboundStatusCode
103
+ from emercury_smtp_sdk.models.pagination import Pagination as Pagination
104
+ from emercury_smtp_sdk.models.queued_email import QueuedEmail as QueuedEmail
105
+ from emercury_smtp_sdk.models.recipient import Recipient as Recipient
106
+ from emercury_smtp_sdk.models.send_email_request import SendEmailRequest as SendEmailRequest
107
+ from emercury_smtp_sdk.models.send_email_response import SendEmailResponse as SendEmailResponse
108
+ from emercury_smtp_sdk.models.soft_bounce_webhook import SoftBounceWebhook as SoftBounceWebhook
109
+ from emercury_smtp_sdk.models.soft_bounce_webhook_data import SoftBounceWebhookData as SoftBounceWebhookData
110
+ from emercury_smtp_sdk.models.soft_bounce_webhook_discriminator import SoftBounceWebhookDiscriminator as SoftBounceWebhookDiscriminator
@@ -0,0 +1,5 @@
1
+ # flake8: noqa
2
+
3
+ # import apis into api package
4
+ from emercury_smtp_sdk.api.email_api import EmailApi
5
+ from emercury_smtp_sdk.api.statistics_api import StatisticsApi
@@ -0,0 +1,342 @@
1
+ """
2
+ Emercury SMTP API
3
+
4
+ Send transactional email, inspect outbound delivery statistics, and receive signed delivery webhooks. All client operations use the stable `/api/v1` contract. Legacy unversioned endpoints are intentionally omitted from generated SDKs.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: support@emercury.net
8
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
9
+
10
+ Do not edit the class manually.
11
+ """ # noqa: E501
12
+
13
+
14
+ import warnings
15
+ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
+ from typing import Any, Dict, List, Optional, Tuple, Union
17
+ from typing_extensions import Annotated
18
+
19
+ from pydantic import Field
20
+ from typing import Optional
21
+ from typing_extensions import Annotated
22
+ from emercury_smtp_sdk.models.send_email_request import SendEmailRequest
23
+ from emercury_smtp_sdk.models.send_email_response import SendEmailResponse
24
+
25
+ from emercury_smtp_sdk.api_client import ApiClient, RequestSerialized
26
+ from emercury_smtp_sdk.api_response import ApiResponse
27
+ from emercury_smtp_sdk.rest import RESTResponseType
28
+
29
+
30
+ class EmailApi:
31
+ """NOTE: This class is auto generated by OpenAPI Generator
32
+ Ref: https://openapi-generator.tech
33
+
34
+ Do not edit the class manually.
35
+ """
36
+
37
+ def __init__(self, api_client=None) -> None:
38
+ if api_client is None:
39
+ api_client = ApiClient.get_default()
40
+ self.api_client = api_client
41
+
42
+
43
+ @validate_call
44
+ def send_email(
45
+ self,
46
+ send_email_request: SendEmailRequest,
47
+ idempotency_key: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True, max_length=255)]], Field(description="Unique retry key scoped to the authenticated API token. Retained for 24 hours. Use a UUID or another collision-resistant value. ")] = None,
48
+ _request_timeout: Union[
49
+ None,
50
+ Annotated[StrictFloat, Field(gt=0)],
51
+ Tuple[
52
+ Annotated[StrictFloat, Field(gt=0)],
53
+ Annotated[StrictFloat, Field(gt=0)]
54
+ ]
55
+ ] = None,
56
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
57
+ _content_type: Optional[StrictStr] = None,
58
+ _headers: Optional[Dict[StrictStr, Any]] = None,
59
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
60
+ ) -> SendEmailResponse:
61
+ """Queue a single email
62
+
63
+ Validates and queues one email for asynchronous delivery. The sender address must use a verified sending domain. Supply a unique `Idempotency-Key` when a request may be retried. For 24 hours, the same API token, key, and normalized payload return the original response without queueing another message. Reusing the key with a different payload returns `409 Conflict`. SDKs should retry connection failures and `5xx` responses only when they supplied an idempotency key; validation, authentication, authorization, and conflict responses must not be retried.
64
+
65
+ :param send_email_request: (required)
66
+ :type send_email_request: SendEmailRequest
67
+ :param idempotency_key: Unique retry key scoped to the authenticated API token. Retained for 24 hours. Use a UUID or another collision-resistant value.
68
+ :type idempotency_key: str
69
+ :param _request_timeout: timeout setting for this request. If one
70
+ number provided, it will be total request
71
+ timeout. It can also be a pair (tuple) of
72
+ (connection, read) timeouts.
73
+ :type _request_timeout: int, tuple(int, int), optional
74
+ :param _request_auth: set to override the auth_settings for an a single
75
+ request; this effectively ignores the
76
+ authentication in the spec for a single request.
77
+ :type _request_auth: dict, optional
78
+ :param _content_type: force content-type for the request.
79
+ :type _content_type: str, Optional
80
+ :param _headers: set to override the headers for a single
81
+ request; this effectively ignores the headers
82
+ in the spec for a single request.
83
+ :type _headers: dict, optional
84
+ :param _host_index: set to override the host_index for a single
85
+ request; this effectively ignores the host_index
86
+ in the spec for a single request.
87
+ :type _host_index: int, optional
88
+ :return: Returns the result object.
89
+ """ # noqa: E501
90
+
91
+ _param = self._send_email_serialize(
92
+ send_email_request=send_email_request,
93
+ idempotency_key=idempotency_key,
94
+ _request_auth=_request_auth,
95
+ _content_type=_content_type,
96
+ _headers=_headers,
97
+ _host_index=_host_index
98
+ )
99
+
100
+ _response_types_map: Dict[str, Optional[str]] = {
101
+ '202': "SendEmailResponse",
102
+ '400': "ErrorResponse",
103
+ '401': "ErrorResponse",
104
+ '403': "ErrorResponse",
105
+ '409': "ErrorResponse",
106
+ '500': "ErrorResponse",
107
+ }
108
+ response_data = self.api_client.call_api(
109
+ *_param,
110
+ _request_timeout=_request_timeout
111
+ )
112
+ response_data.read()
113
+ return self.api_client.response_deserialize(
114
+ response_data=response_data,
115
+ response_types_map=_response_types_map,
116
+ ).data
117
+
118
+
119
+ @validate_call
120
+ def send_email_with_http_info(
121
+ self,
122
+ send_email_request: SendEmailRequest,
123
+ idempotency_key: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True, max_length=255)]], Field(description="Unique retry key scoped to the authenticated API token. Retained for 24 hours. Use a UUID or another collision-resistant value. ")] = None,
124
+ _request_timeout: Union[
125
+ None,
126
+ Annotated[StrictFloat, Field(gt=0)],
127
+ Tuple[
128
+ Annotated[StrictFloat, Field(gt=0)],
129
+ Annotated[StrictFloat, Field(gt=0)]
130
+ ]
131
+ ] = None,
132
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
133
+ _content_type: Optional[StrictStr] = None,
134
+ _headers: Optional[Dict[StrictStr, Any]] = None,
135
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
136
+ ) -> ApiResponse[SendEmailResponse]:
137
+ """Queue a single email
138
+
139
+ Validates and queues one email for asynchronous delivery. The sender address must use a verified sending domain. Supply a unique `Idempotency-Key` when a request may be retried. For 24 hours, the same API token, key, and normalized payload return the original response without queueing another message. Reusing the key with a different payload returns `409 Conflict`. SDKs should retry connection failures and `5xx` responses only when they supplied an idempotency key; validation, authentication, authorization, and conflict responses must not be retried.
140
+
141
+ :param send_email_request: (required)
142
+ :type send_email_request: SendEmailRequest
143
+ :param idempotency_key: Unique retry key scoped to the authenticated API token. Retained for 24 hours. Use a UUID or another collision-resistant value.
144
+ :type idempotency_key: str
145
+ :param _request_timeout: timeout setting for this request. If one
146
+ number provided, it will be total request
147
+ timeout. It can also be a pair (tuple) of
148
+ (connection, read) timeouts.
149
+ :type _request_timeout: int, tuple(int, int), optional
150
+ :param _request_auth: set to override the auth_settings for an a single
151
+ request; this effectively ignores the
152
+ authentication in the spec for a single request.
153
+ :type _request_auth: dict, optional
154
+ :param _content_type: force content-type for the request.
155
+ :type _content_type: str, Optional
156
+ :param _headers: set to override the headers for a single
157
+ request; this effectively ignores the headers
158
+ in the spec for a single request.
159
+ :type _headers: dict, optional
160
+ :param _host_index: set to override the host_index for a single
161
+ request; this effectively ignores the host_index
162
+ in the spec for a single request.
163
+ :type _host_index: int, optional
164
+ :return: Returns the result object.
165
+ """ # noqa: E501
166
+
167
+ _param = self._send_email_serialize(
168
+ send_email_request=send_email_request,
169
+ idempotency_key=idempotency_key,
170
+ _request_auth=_request_auth,
171
+ _content_type=_content_type,
172
+ _headers=_headers,
173
+ _host_index=_host_index
174
+ )
175
+
176
+ _response_types_map: Dict[str, Optional[str]] = {
177
+ '202': "SendEmailResponse",
178
+ '400': "ErrorResponse",
179
+ '401': "ErrorResponse",
180
+ '403': "ErrorResponse",
181
+ '409': "ErrorResponse",
182
+ '500': "ErrorResponse",
183
+ }
184
+ response_data = self.api_client.call_api(
185
+ *_param,
186
+ _request_timeout=_request_timeout
187
+ )
188
+ response_data.read()
189
+ return self.api_client.response_deserialize(
190
+ response_data=response_data,
191
+ response_types_map=_response_types_map,
192
+ )
193
+
194
+
195
+ @validate_call
196
+ def send_email_without_preload_content(
197
+ self,
198
+ send_email_request: SendEmailRequest,
199
+ idempotency_key: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True, max_length=255)]], Field(description="Unique retry key scoped to the authenticated API token. Retained for 24 hours. Use a UUID or another collision-resistant value. ")] = None,
200
+ _request_timeout: Union[
201
+ None,
202
+ Annotated[StrictFloat, Field(gt=0)],
203
+ Tuple[
204
+ Annotated[StrictFloat, Field(gt=0)],
205
+ Annotated[StrictFloat, Field(gt=0)]
206
+ ]
207
+ ] = None,
208
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
209
+ _content_type: Optional[StrictStr] = None,
210
+ _headers: Optional[Dict[StrictStr, Any]] = None,
211
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
212
+ ) -> RESTResponseType:
213
+ """Queue a single email
214
+
215
+ Validates and queues one email for asynchronous delivery. The sender address must use a verified sending domain. Supply a unique `Idempotency-Key` when a request may be retried. For 24 hours, the same API token, key, and normalized payload return the original response without queueing another message. Reusing the key with a different payload returns `409 Conflict`. SDKs should retry connection failures and `5xx` responses only when they supplied an idempotency key; validation, authentication, authorization, and conflict responses must not be retried.
216
+
217
+ :param send_email_request: (required)
218
+ :type send_email_request: SendEmailRequest
219
+ :param idempotency_key: Unique retry key scoped to the authenticated API token. Retained for 24 hours. Use a UUID or another collision-resistant value.
220
+ :type idempotency_key: str
221
+ :param _request_timeout: timeout setting for this request. If one
222
+ number provided, it will be total request
223
+ timeout. It can also be a pair (tuple) of
224
+ (connection, read) timeouts.
225
+ :type _request_timeout: int, tuple(int, int), optional
226
+ :param _request_auth: set to override the auth_settings for an a single
227
+ request; this effectively ignores the
228
+ authentication in the spec for a single request.
229
+ :type _request_auth: dict, optional
230
+ :param _content_type: force content-type for the request.
231
+ :type _content_type: str, Optional
232
+ :param _headers: set to override the headers for a single
233
+ request; this effectively ignores the headers
234
+ in the spec for a single request.
235
+ :type _headers: dict, optional
236
+ :param _host_index: set to override the host_index for a single
237
+ request; this effectively ignores the host_index
238
+ in the spec for a single request.
239
+ :type _host_index: int, optional
240
+ :return: Returns the result object.
241
+ """ # noqa: E501
242
+
243
+ _param = self._send_email_serialize(
244
+ send_email_request=send_email_request,
245
+ idempotency_key=idempotency_key,
246
+ _request_auth=_request_auth,
247
+ _content_type=_content_type,
248
+ _headers=_headers,
249
+ _host_index=_host_index
250
+ )
251
+
252
+ _response_types_map: Dict[str, Optional[str]] = {
253
+ '202': "SendEmailResponse",
254
+ '400': "ErrorResponse",
255
+ '401': "ErrorResponse",
256
+ '403': "ErrorResponse",
257
+ '409': "ErrorResponse",
258
+ '500': "ErrorResponse",
259
+ }
260
+ response_data = self.api_client.call_api(
261
+ *_param,
262
+ _request_timeout=_request_timeout
263
+ )
264
+ return response_data.response
265
+
266
+
267
+ def _send_email_serialize(
268
+ self,
269
+ send_email_request,
270
+ idempotency_key,
271
+ _request_auth,
272
+ _content_type,
273
+ _headers,
274
+ _host_index,
275
+ ) -> RequestSerialized:
276
+
277
+ _host = None
278
+
279
+ _collection_formats: Dict[str, str] = {
280
+ }
281
+
282
+ _path_params: Dict[str, str] = {}
283
+ _query_params: List[Tuple[str, str]] = []
284
+ _header_params: Dict[str, Optional[str]] = _headers or {}
285
+ _form_params: List[Tuple[str, str]] = []
286
+ _files: Dict[
287
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
288
+ ] = {}
289
+ _body_params: Optional[bytes] = None
290
+
291
+ # process the path parameters
292
+ # process the query parameters
293
+ # process the header parameters
294
+ if idempotency_key is not None:
295
+ _header_params['Idempotency-Key'] = idempotency_key
296
+ # process the form parameters
297
+ # process the body parameter
298
+ if send_email_request is not None:
299
+ _body_params = send_email_request
300
+
301
+
302
+ # set the HTTP header `Accept`
303
+ if 'Accept' not in _header_params:
304
+ _header_params['Accept'] = self.api_client.select_header_accept(
305
+ [
306
+ 'application/json'
307
+ ]
308
+ )
309
+
310
+ # set the HTTP header `Content-Type`
311
+ if _content_type:
312
+ _header_params['Content-Type'] = _content_type
313
+ else:
314
+ _default_content_type = (
315
+ self.api_client.select_header_content_type(
316
+ [
317
+ 'application/json'
318
+ ]
319
+ )
320
+ )
321
+ if _default_content_type is not None:
322
+ _header_params['Content-Type'] = _default_content_type
323
+
324
+ # authentication setting
325
+ _auth_settings: List[str] = [
326
+ 'ApiTokenAuth'
327
+ ]
328
+
329
+ return self.api_client.param_serialize(
330
+ method='POST',
331
+ resource_path='/api/v1/mail/send',
332
+ path_params=_path_params,
333
+ query_params=_query_params,
334
+ header_params=_header_params,
335
+ body=_body_params,
336
+ post_params=_form_params,
337
+ files=_files,
338
+ auth_settings=_auth_settings,
339
+ collection_formats=_collection_formats,
340
+ _host=_host,
341
+ _request_auth=_request_auth
342
+ )