Skip to content

Commit ef96495

Browse files
ddouglas-msftnatekimball-msftannatisch
authored
Azure.Communication.Email 1.1.0 - 2025-09-01 (#43090)
* generate * fix linting error * more linting * fix pylint * update version * fixes * addressed PR feedback, updated test recordings * updated recordings * set conn_str to not optional * update recordings again with passed api_version * add unknown words to cspell * Address PR feedback * fix lint/docs/mypy errors * fix addl lint errors * address PR feedback * add back mistakenly removed files * address PR feedback * pass decode_url as true to get async auth policy * remove unused namespaces from apiview-properties * remove malgenerated apiview-properties.json in inner directory * adding missing imports * rerecord tests with Python 3.14 * add sanitizer for accept-encoding header --------- Co-authored-by: Nate Kimball <[email protected]> Co-authored-by: antisch <[email protected]>
1 parent 001cb4f commit ef96495

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1690
-2015
lines changed

sdk/communication/azure-communication-email/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Release History
22

3+
## 1.1.0 (2025-09-01)
4+
5+
### Features Added
6+
7+
- Consumers can now provide a value for the `contentId` property when sending emails with attachments.
8+
This allows consumers to reference attachments in the email body using the `cid` scheme. The `contentId` property can be set on the `EmailAttachment` object.
9+
- `EmailClient.begin_send` now supports an optional `operation_id` parameter.
10+
311
## 1.0.1b1 (2024-08-28)
412

513
### Features Added
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"CrossLanguagePackageId": null,
3+
"CrossLanguageDefinitionId": {
4+
"azure.communication.email.EmailClient.begin_send": null,
5+
"azure.communication.email.aio.EmailClient.begin_send": null
6+
}
7+
}

sdk/communication/azure-communication-email/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "python",
44
"TagPrefix": "python/communication/azure-communication-email",
5-
"Tag": "python/communication/azure-communication-email_1fa1cede8e"
5+
"Tag": "python/communication/azure-communication-email_bc87ad827a"
66
}
Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,32 @@
1-
# -------------------------------------------------------------------------
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
23
# Copyright (c) Microsoft Corporation. All rights reserved.
3-
# Licensed under the MIT License. See License.txt in the project root for
4-
# license information.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
57
# --------------------------------------------------------------------------
8+
# pylint: disable=wrong-import-position
9+
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._client import EmailClient # type: ignore
16+
from ._version import VERSION
17+
18+
__version__ = VERSION
19+
20+
try:
21+
from ._patch import __all__ as _patch_all
22+
from ._patch import *
23+
except ImportError:
24+
_patch_all = []
25+
from ._patch import patch_sdk as _patch_sdk
626

7-
from ._email_client import EmailClient
27+
__all__ = [
28+
"EmailClient",
29+
]
30+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
831

9-
__all__ = ["EmailClient"]
32+
_patch_sdk()

sdk/communication/azure-communication-email/azure/communication/email/_api_versions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
class ApiVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta):
1111
V2023_03_31 = "2023-03-31"
1212
V2024_07_01_PREVIEW = "2024-07-01-preview"
13+
V2025_09_01 = "2025-09-01"
1314

1415

15-
DEFAULT_VERSION = ApiVersion.V2024_07_01_PREVIEW
16+
DEFAULT_VERSION = ApiVersion.V2025_09_01
Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,26 @@
77
# --------------------------------------------------------------------------
88

99
from copy import deepcopy
10-
from typing import Any, TYPE_CHECKING
10+
from typing import Any
11+
from typing_extensions import Self
1112

1213
from azure.core import PipelineClient
14+
from azure.core.pipeline import policies
1315
from azure.core.rest import HttpRequest, HttpResponse
1416

15-
from ._configuration import AzureCommunicationEmailServiceConfiguration
16-
from ._serialization import Deserializer, Serializer
17-
from .operations import EmailOperations
17+
from ._configuration import EmailClientConfiguration
18+
from ._operations import _EmailClientOperationsMixin
19+
from ._utils.serialization import Deserializer, Serializer
1820

19-
if TYPE_CHECKING:
20-
# pylint: disable=unused-import,ungrouped-imports
21-
from typing import Dict
2221

23-
24-
class AzureCommunicationEmailService: # pylint: disable=client-accepts-api-version-keyword
22+
class EmailClient(_EmailClientOperationsMixin):
2523
"""Azure Communication Email Service.
2624
27-
:ivar email: EmailOperations operations
28-
:vartype email: azure.communication.email.operations.EmailOperations
2925
:param endpoint: The communication resource, for example
3026
https://my-resource.communication.azure.com. Required.
3127
:type endpoint: str
32-
:keyword api_version: Api Version. Default value is "2024-07-01-preview". Note that overriding
33-
this default value may result in unsupported behavior.
28+
:keyword api_version: Api Version. Default value is "2025-09-01". Note that overriding this
29+
default value may result in unsupported behavior.
3430
:paramtype api_version: str
3531
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
3632
Retry-After header is present.
@@ -40,15 +36,32 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential
4036
self, endpoint: str, **kwargs: Any
4137
) -> None:
4238
_endpoint = "{endpoint}"
43-
self._config = AzureCommunicationEmailServiceConfiguration(endpoint=endpoint, **kwargs)
44-
self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs)
39+
self._config = EmailClientConfiguration(endpoint=endpoint, **kwargs)
40+
41+
_policies = kwargs.pop("policies", None)
42+
if _policies is None:
43+
_policies = [
44+
policies.RequestIdPolicy(**kwargs),
45+
self._config.headers_policy,
46+
self._config.user_agent_policy,
47+
self._config.proxy_policy,
48+
policies.ContentDecodePolicy(**kwargs),
49+
self._config.redirect_policy,
50+
self._config.retry_policy,
51+
self._config.authentication_policy,
52+
self._config.custom_hook_policy,
53+
self._config.logging_policy,
54+
policies.DistributedTracingPolicy(**kwargs),
55+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
56+
self._config.http_logging_policy,
57+
]
58+
self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
4559

4660
self._serialize = Serializer()
4761
self._deserialize = Deserializer()
4862
self._serialize.client_side_validation = False
49-
self.email = EmailOperations(self._client, self._config, self._serialize, self._deserialize)
5063

51-
def send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
64+
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
5265
"""Runs the network request through the client's chained policies.
5366
5467
>>> from azure.core.rest import HttpRequest
@@ -72,17 +85,14 @@ def send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
7285
}
7386

7487
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
75-
return self._client.send_request(request_copy, **kwargs)
88+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
7689

77-
def close(self):
78-
# type: () -> None
90+
def close(self) -> None:
7991
self._client.close()
8092

81-
def __enter__(self):
82-
# type: () -> AzureCommunicationEmailService
93+
def __enter__(self) -> Self:
8394
self._client.__enter__()
8495
return self
8596

86-
def __exit__(self, *exc_details):
87-
# type: (Any) -> None
97+
def __exit__(self, *exc_details: Any) -> None:
8898
self._client.__exit__(*exc_details)
Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,48 +8,44 @@
88

99
from typing import Any
1010

11-
from azure.core.configuration import Configuration
1211
from azure.core.pipeline import policies
1312

1413
from ._version import VERSION
1514

1615

17-
class AzureCommunicationEmailServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
18-
"""Configuration for AzureCommunicationEmailService.
16+
class EmailClientConfiguration: # pylint: disable=too-many-instance-attributes
17+
"""Configuration for EmailClient.
1918
2019
Note that all parameters used to create this instance are saved as instance
2120
attributes.
2221
2322
:param endpoint: The communication resource, for example
2423
https://my-resource.communication.azure.com. Required.
2524
:type endpoint: str
26-
:keyword api_version: Api Version. Default value is "2024-07-01-preview". Note that overriding
27-
this default value may result in unsupported behavior.
25+
:keyword api_version: Api Version. Default value is "2025-09-01". Note that overriding this
26+
default value may result in unsupported behavior.
2827
:paramtype api_version: str
2928
"""
3029

3130
def __init__(self, endpoint: str, **kwargs: Any) -> None:
32-
super(AzureCommunicationEmailServiceConfiguration, self).__init__(**kwargs)
33-
api_version = kwargs.pop("api_version", "2024-07-01-preview") # type: str
31+
api_version: str = kwargs.pop("api_version", "2025-09-01")
3432

3533
if endpoint is None:
3634
raise ValueError("Parameter 'endpoint' must not be None.")
3735

3836
self.endpoint = endpoint
3937
self.api_version = api_version
40-
kwargs.setdefault("sdk_moniker", "azurecommunicationemailservice/{}".format(VERSION))
38+
kwargs.setdefault("sdk_moniker", "emailclient/{}".format(VERSION))
39+
self.polling_interval = kwargs.get("polling_interval", 30)
4140
self._configure(**kwargs)
4241

43-
def _configure(
44-
self, **kwargs # type: Any
45-
):
46-
# type: (...) -> None
42+
def _configure(self, **kwargs: Any) -> None:
4743
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
4844
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
4945
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
5046
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
5147
self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs)
52-
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
5348
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
5449
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
50+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
5551
self.authentication_policy = kwargs.get("authentication_policy")

0 commit comments

Comments
 (0)