Skip to content

[AutoPR azure-ai-contentsafety] Updated typespecs for sdk gen testing #8417

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions sdk/contentsafety/azure-ai-contentsafety/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"commit": "e8136c11848f05e79597bab310539c506b4af9df",
"repository_url": "https://github.com/test-repo-billy/azure-rest-api-specs",
"typespec_src": "specification/cognitiveservices/ContentSafety",
"@azure-tools/typespec-python": "0.29.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from copy import deepcopy
from typing import Any, TYPE_CHECKING, Union
from typing_extensions import Self

from azure.core import PipelineClient
from azure.core.credentials import AzureKeyCredential
Expand All @@ -29,11 +30,11 @@ class ContentSafetyClient(ContentSafetyClientOperationsMixin): # pylint: disabl
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example:
https://:code:`<resource-name>`.cognitiveservices.azure.com). Required.
:type endpoint: str
:param credential: Credential needed for the client to connect to Azure. Is either a
:param credential: Credential used to authenticate requests to the service. Is either a
AzureKeyCredential type or a TokenCredential type. Required.
:type credential: ~azure.core.credentials.AzureKeyCredential or
~azure.core.credentials.TokenCredential
:keyword api_version: The API version to use for this operation. Default value is "2023-10-01".
:keyword api_version: The API version to use for this operation. Default value is "2024-09-01".
Note that overriding this default value may result in unsupported behavior.
:paramtype api_version: str
"""
Expand Down Expand Up @@ -84,7 +85,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:

request_copy = deepcopy(request)
path_format_arguments = {
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True),
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"),
}

request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
Expand All @@ -93,7 +94,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
def close(self) -> None:
self._client.close()

def __enter__(self) -> "ContentSafetyClient":
def __enter__(self) -> Self:
self._client.__enter__()
return self

Expand All @@ -107,11 +108,11 @@ class BlocklistClient(BlocklistClientOperationsMixin): # pylint: disable=client
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example:
https://:code:`<resource-name>`.cognitiveservices.azure.com). Required.
:type endpoint: str
:param credential: Credential needed for the client to connect to Azure. Is either a
:param credential: Credential used to authenticate requests to the service. Is either a
AzureKeyCredential type or a TokenCredential type. Required.
:type credential: ~azure.core.credentials.AzureKeyCredential or
~azure.core.credentials.TokenCredential
:keyword api_version: The API version to use for this operation. Default value is "2023-10-01".
:keyword api_version: The API version to use for this operation. Default value is "2024-09-01".
Note that overriding this default value may result in unsupported behavior.
:paramtype api_version: str
"""
Expand Down Expand Up @@ -162,7 +163,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:

request_copy = deepcopy(request)
path_format_arguments = {
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True),
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"),
}

request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
Expand All @@ -171,7 +172,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
def close(self) -> None:
self._client.close()

def __enter__(self) -> "BlocklistClient":
def __enter__(self) -> Self:
self._client.__enter__()
return self

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ class ContentSafetyClientConfiguration: # pylint: disable=too-many-instance-att
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example:
https://:code:`<resource-name>`.cognitiveservices.azure.com). Required.
:type endpoint: str
:param credential: Credential needed for the client to connect to Azure. Is either a
:param credential: Credential used to authenticate requests to the service. Is either a
AzureKeyCredential type or a TokenCredential type. Required.
:type credential: ~azure.core.credentials.AzureKeyCredential or
~azure.core.credentials.TokenCredential
:keyword api_version: The API version to use for this operation. Default value is "2023-10-01".
:keyword api_version: The API version to use for this operation. Default value is "2024-09-01".
Note that overriding this default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None:
api_version: str = kwargs.pop("api_version", "2023-10-01")
api_version: str = kwargs.pop("api_version", "2024-09-01")

if endpoint is None:
raise ValueError("Parameter 'endpoint' must not be None.")
Expand Down Expand Up @@ -82,17 +82,17 @@ class BlocklistClientConfiguration: # pylint: disable=too-many-instance-attribu
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example:
https://:code:`<resource-name>`.cognitiveservices.azure.com). Required.
:type endpoint: str
:param credential: Credential needed for the client to connect to Azure. Is either a
:param credential: Credential used to authenticate requests to the service. Is either a
AzureKeyCredential type or a TokenCredential type. Required.
:type credential: ~azure.core.credentials.AzureKeyCredential or
~azure.core.credentials.TokenCredential
:keyword api_version: The API version to use for this operation. Default value is "2023-10-01".
:keyword api_version: The API version to use for this operation. Default value is "2024-09-01".
Note that overriding this default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None:
api_version: str = kwargs.pop("api_version", "2023-10-01")
api_version: str = kwargs.pop("api_version", "2024-09-01")

if endpoint is None:
raise ValueError("Parameter 'endpoint' must not be None.")
Expand Down
Loading