88
99from copy import deepcopy
1010from typing import Any , TYPE_CHECKING , Union
11+ from typing_extensions import Self
1112
1213from azure .core import PipelineClient
1314from azure .core .credentials import AzureKeyCredential
2223 # pylint: disable=unused-import,ungrouped-imports
2324 from azure .core .credentials import TokenCredential
2425
25- class NotificationMessagesClient (NotificationMessagesClientOperationsMixin ): # pylint: disable=client-accepts-api-version-keyword
26+
27+ class NotificationMessagesClient (
28+ NotificationMessagesClientOperationsMixin
29+ ): # pylint: disable=client-accepts-api-version-keyword
2630 """NotificationMessagesClient.
2731
2832 :param endpoint: The communication resource, for example
2933 https://my-resource.communication.azure.com. Required.
3034 :type endpoint: str
31- :param credential: Credential needed for the client to connect to Azure . Is either a
35+ :param credential: Credential used to authenticate requests to the service . Is either a
3236 TokenCredential type or a AzureKeyCredential type. Required.
3337 :type credential: ~azure.core.credentials.TokenCredential or
3438 ~azure.core.credentials.AzureKeyCredential
35- :keyword api_version: The API version to use for this operation. Default value is "2024-02-01 ".
39+ :keyword api_version: The API version to use for this operation. Default value is "2024-08-30 ".
3640 Note that overriding this default value may result in unsupported behavior.
3741 :paramtype api_version: str
3842 """
3943
40- def __init__ (
41- self ,
42- endpoint : str ,
43- credential : Union ["TokenCredential" , AzureKeyCredential ],
44- ** kwargs : Any
45- ) -> None :
46- _endpoint = '{endpoint}'
44+ def __init__ (self , endpoint : str , credential : Union ["TokenCredential" , AzureKeyCredential ], ** kwargs : Any ) -> None :
45+ _endpoint = "{endpoint}"
4746 self ._config = NotificationMessagesClientConfiguration (endpoint = endpoint , credential = credential , ** kwargs )
48- _policies = kwargs .pop (' policies' , None )
47+ _policies = kwargs .pop (" policies" , None )
4948 if _policies is None :
50- _policies = [policies .RequestIdPolicy (** kwargs ),self ._config .headers_policy ,
51- self ._config .user_agent_policy ,self ._config .proxy_policy ,
52- policies .ContentDecodePolicy (** kwargs ),
53- self ._config .redirect_policy ,self ._config .retry_policy ,
54- self ._config .authentication_policy ,
55- self ._config .custom_hook_policy ,self ._config .logging_policy ,
56- policies .DistributedTracingPolicy (** kwargs ),
57- policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
58- self ._config .http_logging_policy ]
49+ _policies = [
50+ policies .RequestIdPolicy (** kwargs ),
51+ self ._config .headers_policy ,
52+ self ._config .user_agent_policy ,
53+ self ._config .proxy_policy ,
54+ policies .ContentDecodePolicy (** kwargs ),
55+ self ._config .redirect_policy ,
56+ self ._config .retry_policy ,
57+ self ._config .authentication_policy ,
58+ self ._config .custom_hook_policy ,
59+ self ._config .logging_policy ,
60+ policies .DistributedTracingPolicy (** kwargs ),
61+ policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
62+ self ._config .http_logging_policy ,
63+ ]
5964 self ._client : PipelineClient = PipelineClient (base_url = _endpoint , policies = _policies , ** kwargs )
6065
61-
6266 self ._serialize = Serializer ()
6367 self ._deserialize = Deserializer ()
6468 self ._serialize .client_side_validation = False
6569
66-
67- def send_request (
68- self ,
69- request : HttpRequest , * , stream : bool = False ,
70- ** kwargs : Any
71- ) -> HttpResponse :
70+ def send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
7271 """Runs the network request through the client's chained policies.
7372
7473 >>> from azure.core.rest import HttpRequest
@@ -88,7 +87,7 @@ def send_request(
8887
8988 request_copy = deepcopy (request )
9089 path_format_arguments = {
91- "endpoint" : self ._serialize .url ("self._config.endpoint" , self ._config .endpoint , ' str' , skip_quote = True ),
90+ "endpoint" : self ._serialize .url ("self._config.endpoint" , self ._config .endpoint , " str" , skip_quote = True ),
9291 }
9392
9493 request_copy .url = self ._client .format_url (request_copy .url , ** path_format_arguments )
@@ -97,56 +96,56 @@ def send_request(
9796 def close (self ) -> None :
9897 self ._client .close ()
9998
100- def __enter__ (self ) -> "NotificationMessagesClient" :
99+ def __enter__ (self ) -> Self :
101100 self ._client .__enter__ ()
102101 return self
103102
104103 def __exit__ (self , * exc_details : Any ) -> None :
105104 self ._client .__exit__ (* exc_details )
105+
106+
106107class MessageTemplateClient (MessageTemplateClientOperationsMixin ): # pylint: disable=client-accepts-api-version-keyword
107108 """MessageTemplateClient.
108109
109110 :param endpoint: The communication resource, for example
110111 https://my-resource.communication.azure.com. Required.
111112 :type endpoint: str
112- :param credential: Credential needed for the client to connect to Azure . Is either a
113+ :param credential: Credential used to authenticate requests to the service . Is either a
113114 TokenCredential type or a AzureKeyCredential type. Required.
114115 :type credential: ~azure.core.credentials.TokenCredential or
115116 ~azure.core.credentials.AzureKeyCredential
116- :keyword api_version: The API version to use for this operation. Default value is "2024-02-01 ".
117+ :keyword api_version: The API version to use for this operation. Default value is "2024-08-30 ".
117118 Note that overriding this default value may result in unsupported behavior.
118119 :paramtype api_version: str
119120 """
120121
121- def __init__ (
122- self ,
123- endpoint : str ,
124- credential : Union ["TokenCredential" , AzureKeyCredential ],
125- ** kwargs : Any
126- ) -> None :
127- _endpoint = '{endpoint}'
122+ def __init__ (self , endpoint : str , credential : Union ["TokenCredential" , AzureKeyCredential ], ** kwargs : Any ) -> None :
123+ _endpoint = "{endpoint}"
128124 self ._config = MessageTemplateClientConfiguration (endpoint = endpoint , credential = credential , ** kwargs )
129- _policies = kwargs .pop (' policies' , None )
125+ _policies = kwargs .pop (" policies" , None )
130126 if _policies is None :
131- _policies = [policies .RequestIdPolicy (** kwargs ),self ._config .headers_policy ,self ._config .user_agent_policy ,
132- self ._config .proxy_policy ,policies .ContentDecodePolicy (** kwargs ),self ._config .redirect_policy ,
133- self ._config .retry_policy ,self ._config .authentication_policy ,self ._config .custom_hook_policy ,
134- self ._config .logging_policy ,policies .DistributedTracingPolicy (** kwargs ),
135- policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
136- self ._config .http_logging_policy ]
127+ _policies = [
128+ policies .RequestIdPolicy (** kwargs ),
129+ self ._config .headers_policy ,
130+ self ._config .user_agent_policy ,
131+ self ._config .proxy_policy ,
132+ policies .ContentDecodePolicy (** kwargs ),
133+ self ._config .redirect_policy ,
134+ self ._config .retry_policy ,
135+ self ._config .authentication_policy ,
136+ self ._config .custom_hook_policy ,
137+ self ._config .logging_policy ,
138+ policies .DistributedTracingPolicy (** kwargs ),
139+ policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
140+ self ._config .http_logging_policy ,
141+ ]
137142 self ._client : PipelineClient = PipelineClient (base_url = _endpoint , policies = _policies , ** kwargs )
138143
139-
140144 self ._serialize = Serializer ()
141145 self ._deserialize = Deserializer ()
142146 self ._serialize .client_side_validation = False
143147
144-
145- def send_request (
146- self ,
147- request : HttpRequest , * , stream : bool = False ,
148- ** kwargs : Any
149- ) -> HttpResponse :
148+ def send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
150149 """Runs the network request through the client's chained policies.
151150
152151 >>> from azure.core.rest import HttpRequest
@@ -166,7 +165,7 @@ def send_request(
166165
167166 request_copy = deepcopy (request )
168167 path_format_arguments = {
169- "endpoint" : self ._serialize .url ("self._config.endpoint" , self ._config .endpoint , ' str' , skip_quote = True ),
168+ "endpoint" : self ._serialize .url ("self._config.endpoint" , self ._config .endpoint , " str" , skip_quote = True ),
170169 }
171170
172171 request_copy .url = self ._client .format_url (request_copy .url , ** path_format_arguments )
@@ -175,7 +174,7 @@ def send_request(
175174 def close (self ) -> None :
176175 self ._client .close ()
177176
178- def __enter__ (self ) -> "MessageTemplateClient" :
177+ def __enter__ (self ) -> Self :
179178 self ._client .__enter__ ()
180179 return self
181180
0 commit comments