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
1617
1718from ._configuration import BlocklistClientConfiguration , ContentSafetyClientConfiguration
1819from ._operations import BlocklistClientOperationsMixin , ContentSafetyClientOperationsMixin
19- from ._serialization import Deserializer , Serializer
20+ from ._utils . serialization import Deserializer , Serializer
2021
2122if TYPE_CHECKING :
22- # pylint: disable=unused-import,ungrouped-imports
2323 from azure .core .credentials import TokenCredential
2424
2525
26- class ContentSafetyClient (ContentSafetyClientOperationsMixin ): # pylint: disable=client-accepts-api-version-keyword
26+ class ContentSafetyClient (ContentSafetyClientOperationsMixin ):
2727 """ContentSafetyClient.
2828
2929 :param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example:
30- https://:code:` <resource-name>` .cognitiveservices.azure.com). Required.
30+ https://<resource-name>.cognitiveservices.azure.com). Required.
3131 :type endpoint: str
32- :param credential: Credential needed for the client to connect to Azure . Is either a
33- AzureKeyCredential type or a TokenCredential type. Required.
32+ :param credential: Credential used to authenticate requests to the service . Is either a key
33+ credential type or a token credential type. Required.
3434 :type credential: ~azure.core.credentials.AzureKeyCredential or
3535 ~azure.core.credentials.TokenCredential
36- :keyword api_version: The API version to use for this operation. Default value is "2023-10 -01".
36+ :keyword api_version: The API version to use for this operation. Default value is "2024-09 -01".
3737 Note that overriding this default value may result in unsupported behavior.
3838 :paramtype api_version: str
3939 """
4040
4141 def __init__ (self , endpoint : str , credential : Union [AzureKeyCredential , "TokenCredential" ], ** kwargs : Any ) -> None :
4242 _endpoint = "{endpoint}/contentsafety"
4343 self ._config = ContentSafetyClientConfiguration (endpoint = endpoint , credential = credential , ** kwargs )
44+
4445 _policies = kwargs .pop ("policies" , None )
4546 if _policies is None :
4647 _policies = [
@@ -84,7 +85,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
8485
8586 request_copy = deepcopy (request )
8687 path_format_arguments = {
87- "endpoint" : self ._serialize .url ("self._config.endpoint" , self ._config .endpoint , "str" , skip_quote = True ),
88+ "endpoint" : self ._serialize .url ("self._config.endpoint" , self ._config .endpoint , "str" ),
8889 }
8990
9091 request_copy .url = self ._client .format_url (request_copy .url , ** path_format_arguments )
@@ -93,32 +94,33 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
9394 def close (self ) -> None :
9495 self ._client .close ()
9596
96- def __enter__ (self ) -> "ContentSafetyClient" :
97+ def __enter__ (self ) -> Self :
9798 self ._client .__enter__ ()
9899 return self
99100
100101 def __exit__ (self , * exc_details : Any ) -> None :
101102 self ._client .__exit__ (* exc_details )
102103
103104
104- class BlocklistClient (BlocklistClientOperationsMixin ): # pylint: disable=client-accepts-api-version-keyword
105+ class BlocklistClient (BlocklistClientOperationsMixin ):
105106 """BlocklistClient.
106107
107108 :param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example:
108- https://:code:` <resource-name>` .cognitiveservices.azure.com). Required.
109+ https://<resource-name>.cognitiveservices.azure.com). Required.
109110 :type endpoint: str
110- :param credential: Credential needed for the client to connect to Azure . Is either a
111- AzureKeyCredential type or a TokenCredential type. Required.
111+ :param credential: Credential used to authenticate requests to the service . Is either a key
112+ credential type or a token credential type. Required.
112113 :type credential: ~azure.core.credentials.AzureKeyCredential or
113114 ~azure.core.credentials.TokenCredential
114- :keyword api_version: The API version to use for this operation. Default value is "2023-10 -01".
115+ :keyword api_version: The API version to use for this operation. Default value is "2024-09 -01".
115116 Note that overriding this default value may result in unsupported behavior.
116117 :paramtype api_version: str
117118 """
118119
119120 def __init__ (self , endpoint : str , credential : Union [AzureKeyCredential , "TokenCredential" ], ** kwargs : Any ) -> None :
120121 _endpoint = "{endpoint}/contentsafety"
121122 self ._config = BlocklistClientConfiguration (endpoint = endpoint , credential = credential , ** kwargs )
123+
122124 _policies = kwargs .pop ("policies" , None )
123125 if _policies is None :
124126 _policies = [
@@ -162,7 +164,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
162164
163165 request_copy = deepcopy (request )
164166 path_format_arguments = {
165- "endpoint" : self ._serialize .url ("self._config.endpoint" , self ._config .endpoint , "str" , skip_quote = True ),
167+ "endpoint" : self ._serialize .url ("self._config.endpoint" , self ._config .endpoint , "str" ),
166168 }
167169
168170 request_copy .url = self ._client .format_url (request_copy .url , ** path_format_arguments )
@@ -171,7 +173,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
171173 def close (self ) -> None :
172174 self ._client .close ()
173175
174- def __enter__ (self ) -> "BlocklistClient" :
176+ def __enter__ (self ) -> Self :
175177 self ._client .__enter__ ()
176178 return self
177179
0 commit comments