From 842d37ffba9c78f25806947d7b15a39dbabb9dbe Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 13 Sep 2019 05:29:34 +0800 Subject: [PATCH] [AutoPR cognitiveservices/data-plane/SpellCheck] Fix SpellCheck Swagger Specification (#7048) * Generated from 33d64b558114a9a861b82dc17518e359758d1688 Fix SpellCheck Swagger Specification * Packaging update of azure-cognitiveservices-language-spellcheck --- .../README.rst | 2 +- .../language/spellcheck/__init__.py | 7 +- .../language/spellcheck/_configuration.py | 48 +++ .../spellcheck/_spell_check_client.py | 45 +++ .../language/spellcheck/models/__init__.py | 54 +-- .../language/spellcheck/models/_models.py | 378 ++++++++++++++++++ .../language/spellcheck/models/_models_py3.py | 378 ++++++++++++++++++ ..._enums.py => _spell_check_client_enums.py} | 6 + .../language/spellcheck/models/answer.py | 48 --- .../language/spellcheck/models/answer_py3.py | 48 --- .../language/spellcheck/models/error.py | 72 ---- .../language/spellcheck/models/error_py3.py | 72 ---- .../spellcheck/models/error_response.py | 61 --- .../spellcheck/models/error_response_py3.py | 61 --- .../spellcheck/models/identifiable.py | 49 --- .../spellcheck/models/identifiable_py3.py | 49 --- .../language/spellcheck/models/response.py | 49 --- .../spellcheck/models/response_base.py | 41 -- .../spellcheck/models/response_base_py3.py | 41 -- .../spellcheck/models/response_py3.py | 49 --- .../language/spellcheck/models/spell_check.py | 47 --- .../spellcheck/models/spell_check_py3.py | 47 --- .../models/spelling_flagged_token.py | 60 --- .../models/spelling_flagged_token_py3.py | 60 --- .../models/spelling_token_suggestion.py | 47 --- .../models/spelling_token_suggestion_py3.py | 47 --- .../spellcheck/operations/__init__.py | 16 + .../_spell_check_client_operations.py} | 85 +--- .../setup.py | 1 - 29 files changed, 922 insertions(+), 1046 deletions(-) create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/_configuration.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/_spell_check_client.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/_models.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/_models_py3.py rename sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/{spell_check_api_enums.py => _spell_check_client_enums.py} (95%) delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/answer.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/answer_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/error.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/error_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/error_response.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/error_response_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/identifiable.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/identifiable_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/response.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/response_base.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/response_base_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/response_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/spell_check.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/spell_check_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/spelling_flagged_token.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/spelling_flagged_token_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/spelling_token_suggestion.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/spelling_token_suggestion_py3.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/operations/__init__.py rename sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/{spell_check_api.py => operations/_spell_check_client_operations.py} (89%) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/README.rst b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/README.rst index e5227404db14..1a3ffe66f69f 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/README.rst +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/README.rst @@ -3,7 +3,7 @@ Microsoft Azure SDK for Python This is the Microsoft Azure Cognitive Services Spellcheck Client Library. -This package has been tested with Python 2.7, 3.4, 3.5, 3.6 and 3.7. +This package has been tested with Python 2.7, 3.5, 3.6 and 3.7. For a more complete set of Azure libraries, see the `azure `__ bundle package. diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/__init__.py index 314694094846..e257f9ba9a8d 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/__init__.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/__init__.py @@ -9,10 +9,11 @@ # regenerated. # -------------------------------------------------------------------------- -from .spell_check_api import SpellCheckAPI -from .version import VERSION +from ._configuration import SpellCheckClientConfiguration +from ._spell_check_client import SpellCheckClient +__all__ = ['SpellCheckClient', 'SpellCheckClientConfiguration'] -__all__ = ['SpellCheckAPI'] +from .version import VERSION __version__ = VERSION diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/_configuration.py b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/_configuration.py new file mode 100644 index 000000000000..6fe33475210c --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/_configuration.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest import Configuration + +from .version import VERSION + + +class SpellCheckClientConfiguration(Configuration): + """Configuration for SpellCheckClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param endpoint: Supported Cognitive Services endpoints (protocol and + hostname, for example: "https://westus.api.cognitive.microsoft.com", + "https://api.cognitive.microsoft.com"). + :type endpoint: str + :param credentials: Subscription credentials which uniquely identify + client subscription. + :type credentials: None + """ + + def __init__( + self, endpoint, credentials): + + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + base_url = '{Endpoint}/bing/v7.0' + + super(SpellCheckClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-cognitiveservices-language-spellcheck/{}'.format(VERSION)) + + self.endpoint = endpoint + self.credentials = credentials diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/_spell_check_client.py b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/_spell_check_client.py new file mode 100644 index 000000000000..93cef00f7ef8 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/_spell_check_client.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import SpellCheckClientConfiguration +from .operations import SpellCheckClientOperationsMixin +from . import models + + +class SpellCheckClient(SpellCheckClientOperationsMixin, SDKClient): + """The Spell Check API - V7 lets you check a text string for spelling and grammar errors. + + :ivar config: Configuration for client. + :vartype config: SpellCheckClientConfiguration + + :param endpoint: Supported Cognitive Services endpoints (protocol and + hostname, for example: "https://westus.api.cognitive.microsoft.com", + "https://api.cognitive.microsoft.com"). + :type endpoint: str + :param credentials: Subscription credentials which uniquely identify + client subscription. + :type credentials: None + """ + + def __init__( + self, endpoint, credentials): + + self.config = SpellCheckClientConfiguration(endpoint, credentials) + super(SpellCheckClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '1.0' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/__init__.py index c8c11052420f..bd3579e44235 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/__init__.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/__init__.py @@ -10,44 +10,46 @@ # -------------------------------------------------------------------------- try: - from .spelling_token_suggestion_py3 import SpellingTokenSuggestion - from .spelling_flagged_token_py3 import SpellingFlaggedToken - from .spell_check_py3 import SpellCheck - from .answer_py3 import Answer - from .response_py3 import Response - from .identifiable_py3 import Identifiable - from .error_py3 import Error - from .error_response_py3 import ErrorResponse, ErrorResponseException - from .response_base_py3 import ResponseBase + from ._models_py3 import Answer + from ._models_py3 import Error + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import Identifiable + from ._models_py3 import Response + from ._models_py3 import ResponseBase + from ._models_py3 import SpellCheck + from ._models_py3 import SpellingFlaggedToken + from ._models_py3 import SpellingTokenSuggestion except (SyntaxError, ImportError): - from .spelling_token_suggestion import SpellingTokenSuggestion - from .spelling_flagged_token import SpellingFlaggedToken - from .spell_check import SpellCheck - from .answer import Answer - from .response import Response - from .identifiable import Identifiable - from .error import Error - from .error_response import ErrorResponse, ErrorResponseException - from .response_base import ResponseBase -from .spell_check_api_enums import ( - ErrorType, + from ._models import Answer + from ._models import Error + from ._models import ErrorResponse, ErrorResponseException + from ._models import Identifiable + from ._models import Response + from ._models import ResponseBase + from ._models import SpellCheck + from ._models import SpellingFlaggedToken + from ._models import SpellingTokenSuggestion +from ._spell_check_client_enums import ( + ActionType, ErrorCode, ErrorSubCode, - ActionType, + ErrorType, + Mode, ) __all__ = [ - 'SpellingTokenSuggestion', - 'SpellingFlaggedToken', - 'SpellCheck', 'Answer', - 'Response', - 'Identifiable', 'Error', 'ErrorResponse', 'ErrorResponseException', + 'Identifiable', + 'Response', 'ResponseBase', + 'SpellCheck', + 'SpellingFlaggedToken', + 'SpellingTokenSuggestion', 'ErrorType', 'ErrorCode', 'ErrorSubCode', 'ActionType', + 'Mode', ] diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/_models.py b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/_models.py new file mode 100644 index 000000000000..5615b3bb55a4 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/_models.py @@ -0,0 +1,378 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ResponseBase(Model): + """ResponseBase. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: Identifiable + + All required parameters must be populated in order to send to Azure. + + :param _type: Required. Constant filled by server. + :type _type: str + """ + + _validation = { + '_type': {'required': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + } + + _subtype_map = { + '_type': {'Identifiable': 'Identifiable'} + } + + def __init__(self, **kwargs): + super(ResponseBase, self).__init__(**kwargs) + self._type = None + + +class Identifiable(ResponseBase): + """Defines the identity of a resource. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: Response + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param _type: Required. Constant filled by server. + :type _type: str + :ivar id: A String identifier. + :vartype id: str + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + } + + _subtype_map = { + '_type': {'Response': 'Response'} + } + + def __init__(self, **kwargs): + super(Identifiable, self).__init__(**kwargs) + self.id = None + self._type = 'Identifiable' + + +class Response(Identifiable): + """Defines a response. All schemas that could be returned at the root of a + response should inherit from this. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: Answer, ErrorResponse + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param _type: Required. Constant filled by server. + :type _type: str + :ivar id: A String identifier. + :vartype id: str + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + } + + _subtype_map = { + '_type': {'Answer': 'Answer', 'ErrorResponse': 'ErrorResponse'} + } + + def __init__(self, **kwargs): + super(Response, self).__init__(**kwargs) + self._type = 'Response' + + +class Answer(Response): + """Answer. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: SpellCheck + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param _type: Required. Constant filled by server. + :type _type: str + :ivar id: A String identifier. + :vartype id: str + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + } + + _subtype_map = { + '_type': {'SpellCheck': 'SpellCheck'} + } + + def __init__(self, **kwargs): + super(Answer, self).__init__(**kwargs) + self._type = 'Answer' + + +class Error(Model): + """Defines the error that occurred. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. The error code that identifies the category of + error. Possible values include: 'None', 'ServerError', 'InvalidRequest', + 'RateLimitExceeded', 'InvalidAuthorization', 'InsufficientAuthorization'. + Default value: "None" . + :type code: str or + ~azure.cognitiveservices.language.spellcheck.models.ErrorCode + :ivar sub_code: The error code that further helps to identify the error. + Possible values include: 'UnexpectedError', 'ResourceError', + 'NotImplemented', 'ParameterMissing', 'ParameterInvalidValue', + 'HttpNotAllowed', 'Blocked', 'AuthorizationMissing', + 'AuthorizationRedundancy', 'AuthorizationDisabled', 'AuthorizationExpired' + :vartype sub_code: str or + ~azure.cognitiveservices.language.spellcheck.models.ErrorSubCode + :param message: Required. A description of the error. + :type message: str + :ivar more_details: A description that provides additional information + about the error. + :vartype more_details: str + :ivar parameter: The parameter in the request that caused the error. + :vartype parameter: str + :ivar value: The parameter's value in the request that was not valid. + :vartype value: str + """ + + _validation = { + 'code': {'required': True}, + 'sub_code': {'readonly': True}, + 'message': {'required': True}, + 'more_details': {'readonly': True}, + 'parameter': {'readonly': True}, + 'value': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'sub_code': {'key': 'subCode', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'more_details': {'key': 'moreDetails', 'type': 'str'}, + 'parameter': {'key': 'parameter', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Error, self).__init__(**kwargs) + self.code = kwargs.get('code', "None") + self.sub_code = None + self.message = kwargs.get('message', None) + self.more_details = None + self.parameter = None + self.value = None + + +class ErrorResponse(Response): + """The top-level response that represents a failed request. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param _type: Required. Constant filled by server. + :type _type: str + :ivar id: A String identifier. + :vartype id: str + :param errors: Required. A list of errors that describe the reasons why + the request failed. + :type errors: + list[~azure.cognitiveservices.language.spellcheck.models.Error] + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'errors': {'required': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'errors': {'key': 'errors', 'type': '[Error]'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.errors = kwargs.get('errors', None) + self._type = 'ErrorResponse' + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class SpellCheck(Answer): + """SpellCheck. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param _type: Required. Constant filled by server. + :type _type: str + :ivar id: A String identifier. + :vartype id: str + :param flagged_tokens: Required. + :type flagged_tokens: + list[~azure.cognitiveservices.language.spellcheck.models.SpellingFlaggedToken] + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'flagged_tokens': {'required': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'flagged_tokens': {'key': 'flaggedTokens', 'type': '[SpellingFlaggedToken]'}, + } + + def __init__(self, **kwargs): + super(SpellCheck, self).__init__(**kwargs) + self.flagged_tokens = kwargs.get('flagged_tokens', None) + self._type = 'SpellCheck' + + +class SpellingFlaggedToken(Model): + """SpellingFlaggedToken. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param offset: Required. + :type offset: int + :param token: Required. + :type token: str + :param type: Required. Possible values include: 'UnknownToken', + 'RepeatedToken'. Default value: "UnknownToken" . + :type type: str or + ~azure.cognitiveservices.language.spellcheck.models.ErrorType + :ivar suggestions: + :vartype suggestions: + list[~azure.cognitiveservices.language.spellcheck.models.SpellingTokenSuggestion] + :ivar ping_url_suffix: + :vartype ping_url_suffix: str + """ + + _validation = { + 'offset': {'required': True}, + 'token': {'required': True}, + 'type': {'required': True}, + 'suggestions': {'readonly': True}, + 'ping_url_suffix': {'readonly': True}, + } + + _attribute_map = { + 'offset': {'key': 'offset', 'type': 'int'}, + 'token': {'key': 'token', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'suggestions': {'key': 'suggestions', 'type': '[SpellingTokenSuggestion]'}, + 'ping_url_suffix': {'key': 'pingUrlSuffix', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SpellingFlaggedToken, self).__init__(**kwargs) + self.offset = kwargs.get('offset', None) + self.token = kwargs.get('token', None) + self.type = kwargs.get('type', "UnknownToken") + self.suggestions = None + self.ping_url_suffix = None + + +class SpellingTokenSuggestion(Model): + """SpellingTokenSuggestion. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param suggestion: Required. + :type suggestion: str + :ivar score: + :vartype score: float + :ivar ping_url_suffix: + :vartype ping_url_suffix: str + """ + + _validation = { + 'suggestion': {'required': True}, + 'score': {'readonly': True}, + 'ping_url_suffix': {'readonly': True}, + } + + _attribute_map = { + 'suggestion': {'key': 'suggestion', 'type': 'str'}, + 'score': {'key': 'score', 'type': 'float'}, + 'ping_url_suffix': {'key': 'pingUrlSuffix', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SpellingTokenSuggestion, self).__init__(**kwargs) + self.suggestion = kwargs.get('suggestion', None) + self.score = None + self.ping_url_suffix = None diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/_models_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/_models_py3.py new file mode 100644 index 000000000000..89eaa6f36b8e --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/_models_py3.py @@ -0,0 +1,378 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ResponseBase(Model): + """ResponseBase. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: Identifiable + + All required parameters must be populated in order to send to Azure. + + :param _type: Required. Constant filled by server. + :type _type: str + """ + + _validation = { + '_type': {'required': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + } + + _subtype_map = { + '_type': {'Identifiable': 'Identifiable'} + } + + def __init__(self, **kwargs) -> None: + super(ResponseBase, self).__init__(**kwargs) + self._type = None + + +class Identifiable(ResponseBase): + """Defines the identity of a resource. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: Response + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param _type: Required. Constant filled by server. + :type _type: str + :ivar id: A String identifier. + :vartype id: str + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + } + + _subtype_map = { + '_type': {'Response': 'Response'} + } + + def __init__(self, **kwargs) -> None: + super(Identifiable, self).__init__(**kwargs) + self.id = None + self._type = 'Identifiable' + + +class Response(Identifiable): + """Defines a response. All schemas that could be returned at the root of a + response should inherit from this. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: Answer, ErrorResponse + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param _type: Required. Constant filled by server. + :type _type: str + :ivar id: A String identifier. + :vartype id: str + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + } + + _subtype_map = { + '_type': {'Answer': 'Answer', 'ErrorResponse': 'ErrorResponse'} + } + + def __init__(self, **kwargs) -> None: + super(Response, self).__init__(**kwargs) + self._type = 'Response' + + +class Answer(Response): + """Answer. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: SpellCheck + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param _type: Required. Constant filled by server. + :type _type: str + :ivar id: A String identifier. + :vartype id: str + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + } + + _subtype_map = { + '_type': {'SpellCheck': 'SpellCheck'} + } + + def __init__(self, **kwargs) -> None: + super(Answer, self).__init__(**kwargs) + self._type = 'Answer' + + +class Error(Model): + """Defines the error that occurred. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. The error code that identifies the category of + error. Possible values include: 'None', 'ServerError', 'InvalidRequest', + 'RateLimitExceeded', 'InvalidAuthorization', 'InsufficientAuthorization'. + Default value: "None" . + :type code: str or + ~azure.cognitiveservices.language.spellcheck.models.ErrorCode + :ivar sub_code: The error code that further helps to identify the error. + Possible values include: 'UnexpectedError', 'ResourceError', + 'NotImplemented', 'ParameterMissing', 'ParameterInvalidValue', + 'HttpNotAllowed', 'Blocked', 'AuthorizationMissing', + 'AuthorizationRedundancy', 'AuthorizationDisabled', 'AuthorizationExpired' + :vartype sub_code: str or + ~azure.cognitiveservices.language.spellcheck.models.ErrorSubCode + :param message: Required. A description of the error. + :type message: str + :ivar more_details: A description that provides additional information + about the error. + :vartype more_details: str + :ivar parameter: The parameter in the request that caused the error. + :vartype parameter: str + :ivar value: The parameter's value in the request that was not valid. + :vartype value: str + """ + + _validation = { + 'code': {'required': True}, + 'sub_code': {'readonly': True}, + 'message': {'required': True}, + 'more_details': {'readonly': True}, + 'parameter': {'readonly': True}, + 'value': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'sub_code': {'key': 'subCode', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'more_details': {'key': 'moreDetails', 'type': 'str'}, + 'parameter': {'key': 'parameter', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, *, message: str, code="None", **kwargs) -> None: + super(Error, self).__init__(**kwargs) + self.code = code + self.sub_code = None + self.message = message + self.more_details = None + self.parameter = None + self.value = None + + +class ErrorResponse(Response): + """The top-level response that represents a failed request. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param _type: Required. Constant filled by server. + :type _type: str + :ivar id: A String identifier. + :vartype id: str + :param errors: Required. A list of errors that describe the reasons why + the request failed. + :type errors: + list[~azure.cognitiveservices.language.spellcheck.models.Error] + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'errors': {'required': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'errors': {'key': 'errors', 'type': '[Error]'}, + } + + def __init__(self, *, errors, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.errors = errors + self._type = 'ErrorResponse' + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class SpellCheck(Answer): + """SpellCheck. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param _type: Required. Constant filled by server. + :type _type: str + :ivar id: A String identifier. + :vartype id: str + :param flagged_tokens: Required. + :type flagged_tokens: + list[~azure.cognitiveservices.language.spellcheck.models.SpellingFlaggedToken] + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'flagged_tokens': {'required': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'flagged_tokens': {'key': 'flaggedTokens', 'type': '[SpellingFlaggedToken]'}, + } + + def __init__(self, *, flagged_tokens, **kwargs) -> None: + super(SpellCheck, self).__init__(**kwargs) + self.flagged_tokens = flagged_tokens + self._type = 'SpellCheck' + + +class SpellingFlaggedToken(Model): + """SpellingFlaggedToken. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param offset: Required. + :type offset: int + :param token: Required. + :type token: str + :param type: Required. Possible values include: 'UnknownToken', + 'RepeatedToken'. Default value: "UnknownToken" . + :type type: str or + ~azure.cognitiveservices.language.spellcheck.models.ErrorType + :ivar suggestions: + :vartype suggestions: + list[~azure.cognitiveservices.language.spellcheck.models.SpellingTokenSuggestion] + :ivar ping_url_suffix: + :vartype ping_url_suffix: str + """ + + _validation = { + 'offset': {'required': True}, + 'token': {'required': True}, + 'type': {'required': True}, + 'suggestions': {'readonly': True}, + 'ping_url_suffix': {'readonly': True}, + } + + _attribute_map = { + 'offset': {'key': 'offset', 'type': 'int'}, + 'token': {'key': 'token', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'suggestions': {'key': 'suggestions', 'type': '[SpellingTokenSuggestion]'}, + 'ping_url_suffix': {'key': 'pingUrlSuffix', 'type': 'str'}, + } + + def __init__(self, *, offset: int, token: str, type="UnknownToken", **kwargs) -> None: + super(SpellingFlaggedToken, self).__init__(**kwargs) + self.offset = offset + self.token = token + self.type = type + self.suggestions = None + self.ping_url_suffix = None + + +class SpellingTokenSuggestion(Model): + """SpellingTokenSuggestion. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param suggestion: Required. + :type suggestion: str + :ivar score: + :vartype score: float + :ivar ping_url_suffix: + :vartype ping_url_suffix: str + """ + + _validation = { + 'suggestion': {'required': True}, + 'score': {'readonly': True}, + 'ping_url_suffix': {'readonly': True}, + } + + _attribute_map = { + 'suggestion': {'key': 'suggestion', 'type': 'str'}, + 'score': {'key': 'score', 'type': 'float'}, + 'ping_url_suffix': {'key': 'pingUrlSuffix', 'type': 'str'}, + } + + def __init__(self, *, suggestion: str, **kwargs) -> None: + super(SpellingTokenSuggestion, self).__init__(**kwargs) + self.suggestion = suggestion + self.score = None + self.ping_url_suffix = None diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/spell_check_api_enums.py b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/_spell_check_client_enums.py similarity index 95% rename from sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/spell_check_api_enums.py rename to sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/_spell_check_client_enums.py index 35e88466a5e8..f77041272a16 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/spell_check_api_enums.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/_spell_check_client_enums.py @@ -47,3 +47,9 @@ class ActionType(str, Enum): edit = "Edit" load = "Load" + + +class Mode(str, Enum): + + proof = "proof" + spell = "spell" diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/answer.py b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/answer.py deleted file mode 100644 index b957e138ffb0..000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/answer.py +++ /dev/null @@ -1,48 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .response import Response - - -class Answer(Response): - """Answer. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: SpellCheck - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :param _type: Required. Constant filled by server. - :type _type: str - :ivar id: A String identifier. - :vartype id: str - """ - - _validation = { - '_type': {'required': True}, - 'id': {'readonly': True}, - } - - _attribute_map = { - '_type': {'key': '_type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - } - - _subtype_map = { - '_type': {'SpellCheck': 'SpellCheck'} - } - - def __init__(self, **kwargs): - super(Answer, self).__init__(**kwargs) - self._type = 'Answer' diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/answer_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/answer_py3.py deleted file mode 100644 index 2e899d349612..000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/answer_py3.py +++ /dev/null @@ -1,48 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .response import Response - - -class Answer(Response): - """Answer. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: SpellCheck - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :param _type: Required. Constant filled by server. - :type _type: str - :ivar id: A String identifier. - :vartype id: str - """ - - _validation = { - '_type': {'required': True}, - 'id': {'readonly': True}, - } - - _attribute_map = { - '_type': {'key': '_type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - } - - _subtype_map = { - '_type': {'SpellCheck': 'SpellCheck'} - } - - def __init__(self, **kwargs) -> None: - super(Answer, self).__init__(**kwargs) - self._type = 'Answer' diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/error.py b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/error.py deleted file mode 100644 index 47dd14240756..000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/error.py +++ /dev/null @@ -1,72 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class Error(Model): - """Defines the error that occurred. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. The error code that identifies the category of - error. Possible values include: 'None', 'ServerError', 'InvalidRequest', - 'RateLimitExceeded', 'InvalidAuthorization', 'InsufficientAuthorization'. - Default value: "None" . - :type code: str or - ~azure.cognitiveservices.language.spellcheck.models.ErrorCode - :ivar sub_code: The error code that further helps to identify the error. - Possible values include: 'UnexpectedError', 'ResourceError', - 'NotImplemented', 'ParameterMissing', 'ParameterInvalidValue', - 'HttpNotAllowed', 'Blocked', 'AuthorizationMissing', - 'AuthorizationRedundancy', 'AuthorizationDisabled', 'AuthorizationExpired' - :vartype sub_code: str or - ~azure.cognitiveservices.language.spellcheck.models.ErrorSubCode - :param message: Required. A description of the error. - :type message: str - :ivar more_details: A description that provides additional information - about the error. - :vartype more_details: str - :ivar parameter: The parameter in the request that caused the error. - :vartype parameter: str - :ivar value: The parameter's value in the request that was not valid. - :vartype value: str - """ - - _validation = { - 'code': {'required': True}, - 'sub_code': {'readonly': True}, - 'message': {'required': True}, - 'more_details': {'readonly': True}, - 'parameter': {'readonly': True}, - 'value': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'sub_code': {'key': 'subCode', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'more_details': {'key': 'moreDetails', 'type': 'str'}, - 'parameter': {'key': 'parameter', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(Error, self).__init__(**kwargs) - self.code = kwargs.get('code', "None") - self.sub_code = None - self.message = kwargs.get('message', None) - self.more_details = None - self.parameter = None - self.value = None diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/error_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/error_py3.py deleted file mode 100644 index 5b542c491006..000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/error_py3.py +++ /dev/null @@ -1,72 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class Error(Model): - """Defines the error that occurred. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. The error code that identifies the category of - error. Possible values include: 'None', 'ServerError', 'InvalidRequest', - 'RateLimitExceeded', 'InvalidAuthorization', 'InsufficientAuthorization'. - Default value: "None" . - :type code: str or - ~azure.cognitiveservices.language.spellcheck.models.ErrorCode - :ivar sub_code: The error code that further helps to identify the error. - Possible values include: 'UnexpectedError', 'ResourceError', - 'NotImplemented', 'ParameterMissing', 'ParameterInvalidValue', - 'HttpNotAllowed', 'Blocked', 'AuthorizationMissing', - 'AuthorizationRedundancy', 'AuthorizationDisabled', 'AuthorizationExpired' - :vartype sub_code: str or - ~azure.cognitiveservices.language.spellcheck.models.ErrorSubCode - :param message: Required. A description of the error. - :type message: str - :ivar more_details: A description that provides additional information - about the error. - :vartype more_details: str - :ivar parameter: The parameter in the request that caused the error. - :vartype parameter: str - :ivar value: The parameter's value in the request that was not valid. - :vartype value: str - """ - - _validation = { - 'code': {'required': True}, - 'sub_code': {'readonly': True}, - 'message': {'required': True}, - 'more_details': {'readonly': True}, - 'parameter': {'readonly': True}, - 'value': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'sub_code': {'key': 'subCode', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'more_details': {'key': 'moreDetails', 'type': 'str'}, - 'parameter': {'key': 'parameter', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__(self, *, message: str, code="None", **kwargs) -> None: - super(Error, self).__init__(**kwargs) - self.code = code - self.sub_code = None - self.message = message - self.more_details = None - self.parameter = None - self.value = None diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/error_response.py b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/error_response.py deleted file mode 100644 index 23f7f77779b9..000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/error_response.py +++ /dev/null @@ -1,61 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .response import Response -from msrest.exceptions import HttpOperationError - - -class ErrorResponse(Response): - """The top-level response that represents a failed request. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :param _type: Required. Constant filled by server. - :type _type: str - :ivar id: A String identifier. - :vartype id: str - :param errors: Required. A list of errors that describe the reasons why - the request failed. - :type errors: - list[~azure.cognitiveservices.language.spellcheck.models.Error] - """ - - _validation = { - '_type': {'required': True}, - 'id': {'readonly': True}, - 'errors': {'required': True}, - } - - _attribute_map = { - '_type': {'key': '_type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'errors': {'key': 'errors', 'type': '[Error]'}, - } - - def __init__(self, **kwargs): - super(ErrorResponse, self).__init__(**kwargs) - self.errors = kwargs.get('errors', None) - self._type = 'ErrorResponse' - - -class ErrorResponseException(HttpOperationError): - """Server responsed with exception of type: 'ErrorResponse'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/error_response_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/error_response_py3.py deleted file mode 100644 index 7c3804f78124..000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/error_response_py3.py +++ /dev/null @@ -1,61 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .response import Response -from msrest.exceptions import HttpOperationError - - -class ErrorResponse(Response): - """The top-level response that represents a failed request. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :param _type: Required. Constant filled by server. - :type _type: str - :ivar id: A String identifier. - :vartype id: str - :param errors: Required. A list of errors that describe the reasons why - the request failed. - :type errors: - list[~azure.cognitiveservices.language.spellcheck.models.Error] - """ - - _validation = { - '_type': {'required': True}, - 'id': {'readonly': True}, - 'errors': {'required': True}, - } - - _attribute_map = { - '_type': {'key': '_type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'errors': {'key': 'errors', 'type': '[Error]'}, - } - - def __init__(self, *, errors, **kwargs) -> None: - super(ErrorResponse, self).__init__(**kwargs) - self.errors = errors - self._type = 'ErrorResponse' - - -class ErrorResponseException(HttpOperationError): - """Server responsed with exception of type: 'ErrorResponse'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/identifiable.py b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/identifiable.py deleted file mode 100644 index 513e53d238bb..000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/identifiable.py +++ /dev/null @@ -1,49 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .response_base import ResponseBase - - -class Identifiable(ResponseBase): - """Defines the identity of a resource. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: Response - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :param _type: Required. Constant filled by server. - :type _type: str - :ivar id: A String identifier. - :vartype id: str - """ - - _validation = { - '_type': {'required': True}, - 'id': {'readonly': True}, - } - - _attribute_map = { - '_type': {'key': '_type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - } - - _subtype_map = { - '_type': {'Response': 'Response'} - } - - def __init__(self, **kwargs): - super(Identifiable, self).__init__(**kwargs) - self.id = None - self._type = 'Identifiable' diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/identifiable_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/identifiable_py3.py deleted file mode 100644 index c87dc0347e3d..000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/identifiable_py3.py +++ /dev/null @@ -1,49 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .response_base import ResponseBase - - -class Identifiable(ResponseBase): - """Defines the identity of a resource. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: Response - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :param _type: Required. Constant filled by server. - :type _type: str - :ivar id: A String identifier. - :vartype id: str - """ - - _validation = { - '_type': {'required': True}, - 'id': {'readonly': True}, - } - - _attribute_map = { - '_type': {'key': '_type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - } - - _subtype_map = { - '_type': {'Response': 'Response'} - } - - def __init__(self, **kwargs) -> None: - super(Identifiable, self).__init__(**kwargs) - self.id = None - self._type = 'Identifiable' diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/response.py b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/response.py deleted file mode 100644 index 638d4692f623..000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/response.py +++ /dev/null @@ -1,49 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .identifiable import Identifiable - - -class Response(Identifiable): - """Defines a response. All schemas that could be returned at the root of a - response should inherit from this. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: Answer, ErrorResponse - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :param _type: Required. Constant filled by server. - :type _type: str - :ivar id: A String identifier. - :vartype id: str - """ - - _validation = { - '_type': {'required': True}, - 'id': {'readonly': True}, - } - - _attribute_map = { - '_type': {'key': '_type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - } - - _subtype_map = { - '_type': {'Answer': 'Answer', 'ErrorResponse': 'ErrorResponse'} - } - - def __init__(self, **kwargs): - super(Response, self).__init__(**kwargs) - self._type = 'Response' diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/response_base.py b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/response_base.py deleted file mode 100644 index 5a09ce0f95d6..000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/response_base.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class ResponseBase(Model): - """ResponseBase. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: Identifiable - - All required parameters must be populated in order to send to Azure. - - :param _type: Required. Constant filled by server. - :type _type: str - """ - - _validation = { - '_type': {'required': True}, - } - - _attribute_map = { - '_type': {'key': '_type', 'type': 'str'}, - } - - _subtype_map = { - '_type': {'Identifiable': 'Identifiable'} - } - - def __init__(self, **kwargs): - super(ResponseBase, self).__init__(**kwargs) - self._type = None diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/response_base_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/response_base_py3.py deleted file mode 100644 index 0ac9762f5cd7..000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/response_base_py3.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class ResponseBase(Model): - """ResponseBase. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: Identifiable - - All required parameters must be populated in order to send to Azure. - - :param _type: Required. Constant filled by server. - :type _type: str - """ - - _validation = { - '_type': {'required': True}, - } - - _attribute_map = { - '_type': {'key': '_type', 'type': 'str'}, - } - - _subtype_map = { - '_type': {'Identifiable': 'Identifiable'} - } - - def __init__(self, **kwargs) -> None: - super(ResponseBase, self).__init__(**kwargs) - self._type = None diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/response_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/response_py3.py deleted file mode 100644 index d936df09e664..000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/response_py3.py +++ /dev/null @@ -1,49 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .identifiable import Identifiable - - -class Response(Identifiable): - """Defines a response. All schemas that could be returned at the root of a - response should inherit from this. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: Answer, ErrorResponse - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :param _type: Required. Constant filled by server. - :type _type: str - :ivar id: A String identifier. - :vartype id: str - """ - - _validation = { - '_type': {'required': True}, - 'id': {'readonly': True}, - } - - _attribute_map = { - '_type': {'key': '_type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - } - - _subtype_map = { - '_type': {'Answer': 'Answer', 'ErrorResponse': 'ErrorResponse'} - } - - def __init__(self, **kwargs) -> None: - super(Response, self).__init__(**kwargs) - self._type = 'Response' diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/spell_check.py b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/spell_check.py deleted file mode 100644 index 945fc3c50cad..000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/spell_check.py +++ /dev/null @@ -1,47 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .answer import Answer - - -class SpellCheck(Answer): - """SpellCheck. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :param _type: Required. Constant filled by server. - :type _type: str - :ivar id: A String identifier. - :vartype id: str - :param flagged_tokens: Required. - :type flagged_tokens: - list[~azure.cognitiveservices.language.spellcheck.models.SpellingFlaggedToken] - """ - - _validation = { - '_type': {'required': True}, - 'id': {'readonly': True}, - 'flagged_tokens': {'required': True}, - } - - _attribute_map = { - '_type': {'key': '_type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'flagged_tokens': {'key': 'flaggedTokens', 'type': '[SpellingFlaggedToken]'}, - } - - def __init__(self, **kwargs): - super(SpellCheck, self).__init__(**kwargs) - self.flagged_tokens = kwargs.get('flagged_tokens', None) - self._type = 'SpellCheck' diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/spell_check_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/spell_check_py3.py deleted file mode 100644 index 24f5476e812b..000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/spell_check_py3.py +++ /dev/null @@ -1,47 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .answer import Answer - - -class SpellCheck(Answer): - """SpellCheck. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :param _type: Required. Constant filled by server. - :type _type: str - :ivar id: A String identifier. - :vartype id: str - :param flagged_tokens: Required. - :type flagged_tokens: - list[~azure.cognitiveservices.language.spellcheck.models.SpellingFlaggedToken] - """ - - _validation = { - '_type': {'required': True}, - 'id': {'readonly': True}, - 'flagged_tokens': {'required': True}, - } - - _attribute_map = { - '_type': {'key': '_type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'flagged_tokens': {'key': 'flaggedTokens', 'type': '[SpellingFlaggedToken]'}, - } - - def __init__(self, *, flagged_tokens, **kwargs) -> None: - super(SpellCheck, self).__init__(**kwargs) - self.flagged_tokens = flagged_tokens - self._type = 'SpellCheck' diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/spelling_flagged_token.py b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/spelling_flagged_token.py deleted file mode 100644 index db39f1f969ff..000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/spelling_flagged_token.py +++ /dev/null @@ -1,60 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class SpellingFlaggedToken(Model): - """SpellingFlaggedToken. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :param offset: Required. - :type offset: int - :param token: Required. - :type token: str - :param type: Required. Possible values include: 'UnknownToken', - 'RepeatedToken'. Default value: "UnknownToken" . - :type type: str or - ~azure.cognitiveservices.language.spellcheck.models.ErrorType - :ivar suggestions: - :vartype suggestions: - list[~azure.cognitiveservices.language.spellcheck.models.SpellingTokenSuggestion] - :ivar ping_url_suffix: - :vartype ping_url_suffix: str - """ - - _validation = { - 'offset': {'required': True}, - 'token': {'required': True}, - 'type': {'required': True}, - 'suggestions': {'readonly': True}, - 'ping_url_suffix': {'readonly': True}, - } - - _attribute_map = { - 'offset': {'key': 'offset', 'type': 'int'}, - 'token': {'key': 'token', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'suggestions': {'key': 'suggestions', 'type': '[SpellingTokenSuggestion]'}, - 'ping_url_suffix': {'key': 'pingUrlSuffix', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SpellingFlaggedToken, self).__init__(**kwargs) - self.offset = kwargs.get('offset', None) - self.token = kwargs.get('token', None) - self.type = kwargs.get('type', "UnknownToken") - self.suggestions = None - self.ping_url_suffix = None diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/spelling_flagged_token_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/spelling_flagged_token_py3.py deleted file mode 100644 index 6df12e3ae6dd..000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/spelling_flagged_token_py3.py +++ /dev/null @@ -1,60 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class SpellingFlaggedToken(Model): - """SpellingFlaggedToken. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :param offset: Required. - :type offset: int - :param token: Required. - :type token: str - :param type: Required. Possible values include: 'UnknownToken', - 'RepeatedToken'. Default value: "UnknownToken" . - :type type: str or - ~azure.cognitiveservices.language.spellcheck.models.ErrorType - :ivar suggestions: - :vartype suggestions: - list[~azure.cognitiveservices.language.spellcheck.models.SpellingTokenSuggestion] - :ivar ping_url_suffix: - :vartype ping_url_suffix: str - """ - - _validation = { - 'offset': {'required': True}, - 'token': {'required': True}, - 'type': {'required': True}, - 'suggestions': {'readonly': True}, - 'ping_url_suffix': {'readonly': True}, - } - - _attribute_map = { - 'offset': {'key': 'offset', 'type': 'int'}, - 'token': {'key': 'token', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'suggestions': {'key': 'suggestions', 'type': '[SpellingTokenSuggestion]'}, - 'ping_url_suffix': {'key': 'pingUrlSuffix', 'type': 'str'}, - } - - def __init__(self, *, offset: int, token: str, type="UnknownToken", **kwargs) -> None: - super(SpellingFlaggedToken, self).__init__(**kwargs) - self.offset = offset - self.token = token - self.type = type - self.suggestions = None - self.ping_url_suffix = None diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/spelling_token_suggestion.py b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/spelling_token_suggestion.py deleted file mode 100644 index f0ac6d00c30d..000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/spelling_token_suggestion.py +++ /dev/null @@ -1,47 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class SpellingTokenSuggestion(Model): - """SpellingTokenSuggestion. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :param suggestion: Required. - :type suggestion: str - :ivar score: - :vartype score: float - :ivar ping_url_suffix: - :vartype ping_url_suffix: str - """ - - _validation = { - 'suggestion': {'required': True}, - 'score': {'readonly': True}, - 'ping_url_suffix': {'readonly': True}, - } - - _attribute_map = { - 'suggestion': {'key': 'suggestion', 'type': 'str'}, - 'score': {'key': 'score', 'type': 'float'}, - 'ping_url_suffix': {'key': 'pingUrlSuffix', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SpellingTokenSuggestion, self).__init__(**kwargs) - self.suggestion = kwargs.get('suggestion', None) - self.score = None - self.ping_url_suffix = None diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/spelling_token_suggestion_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/spelling_token_suggestion_py3.py deleted file mode 100644 index f27ef9faab31..000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/models/spelling_token_suggestion_py3.py +++ /dev/null @@ -1,47 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class SpellingTokenSuggestion(Model): - """SpellingTokenSuggestion. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :param suggestion: Required. - :type suggestion: str - :ivar score: - :vartype score: float - :ivar ping_url_suffix: - :vartype ping_url_suffix: str - """ - - _validation = { - 'suggestion': {'required': True}, - 'score': {'readonly': True}, - 'ping_url_suffix': {'readonly': True}, - } - - _attribute_map = { - 'suggestion': {'key': 'suggestion', 'type': 'str'}, - 'score': {'key': 'score', 'type': 'float'}, - 'ping_url_suffix': {'key': 'pingUrlSuffix', 'type': 'str'}, - } - - def __init__(self, *, suggestion: str, **kwargs) -> None: - super(SpellingTokenSuggestion, self).__init__(**kwargs) - self.suggestion = suggestion - self.score = None - self.ping_url_suffix = None diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/operations/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/operations/__init__.py new file mode 100644 index 000000000000..973541eca818 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/operations/__init__.py @@ -0,0 +1,16 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._spell_check_client_operations import SpellCheckClientOperationsMixin + +__all__ = [ + 'SpellCheckClientOperationsMixin', +] diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/spell_check_api.py b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/operations/_spell_check_client_operations.py similarity index 89% rename from sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/spell_check_api.py rename to sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/operations/_spell_check_client_operations.py index 4d59f6dc8f92..c74387ab185c 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/spell_check_api.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/operations/_spell_check_client_operations.py @@ -9,62 +9,11 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import SDKClient -from msrest import Configuration, Serializer, Deserializer -from .version import VERSION from msrest.pipeline import ClientRawResponse -from . import models +from .. import models -class SpellCheckAPIConfiguration(Configuration): - """Configuration for SpellCheckAPI - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credentials: Subscription credentials which uniquely identify - client subscription. - :type credentials: None - :param str base_url: Service URL - """ - - def __init__( - self, credentials, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") - if not base_url: - base_url = 'https://api.cognitive.microsoft.com/bing/v7.0' - - super(SpellCheckAPIConfiguration, self).__init__(base_url) - - self.add_user_agent('azure-cognitiveservices-language-spellcheck/{}'.format(VERSION)) - - self.credentials = credentials - - -class SpellCheckAPI(SDKClient): - """The Spell Check API - V7 lets you check a text string for spelling and grammar errors. - - :ivar config: Configuration for client. - :vartype config: SpellCheckAPIConfiguration - - :param credentials: Subscription credentials which uniquely identify - client subscription. - :type credentials: None - :param str base_url: Service URL - """ - - def __init__( - self, credentials, base_url=None): - - self.config = SpellCheckAPIConfiguration(credentials, base_url) - super(SpellCheckAPI, self).__init__(self.config.credentials, self.config) - - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '1.0' - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - +class SpellCheckClientOperationsMixin(object): def spell_checker( self, text, accept_language=None, pragma=None, user_agent=None, client_id=None, client_ip=None, location=None, action_type=None, app_name=None, country_code=None, client_machine_name=None, doc_id=None, market=None, session_id=None, set_lang=None, user_id=None, mode=None, pre_context_text=None, post_context_text=None, custom_headers=None, raw=False, **operation_config): @@ -266,7 +215,8 @@ def spell_checker( mistakes. 2) Spell—Finds most spelling mistakes but does not find some of the grammar errors that Proof catches (for example, capitalization and repeated words). Possible values include: 'proof', 'spell' - :type mode: str + :type mode: str or + ~azure.cognitiveservices.language.spellcheck.models.Mode :param pre_context_text: A string that gives context to the text string. For example, the text string petal is valid. However, if you set preContextText to bike, the context changes and the text string @@ -302,6 +252,10 @@ def spell_checker( # Construct URL url = self.spell_checker.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} @@ -323,10 +277,17 @@ def spell_checker( query_parameters['SetLang'] = self._serialize.query("set_lang", set_lang, 'str') if user_id is not None: query_parameters['UserId'] = self._serialize.query("user_id", user_id, 'str') + if mode is not None: + query_parameters['Mode'] = self._serialize.query("mode", mode, 'str') + if pre_context_text is not None: + query_parameters['PreContextText'] = self._serialize.query("pre_context_text", pre_context_text, 'str') + if post_context_text is not None: + query_parameters['PostContextText'] = self._serialize.query("post_context_text", post_context_text, 'str') + query_parameters['Text'] = self._serialize.query("text", text, 'str') # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/x-www-form-urlencoded' + header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) header_parameters['X-BingApis-SDK'] = self._serialize.header("x_bing_apis_sdk", x_bing_apis_sdk, 'str') @@ -343,24 +304,14 @@ def spell_checker( if location is not None: header_parameters['X-Search-Location'] = self._serialize.header("location", location, 'str') - # Construct form data - form_data_content = { - 'Text': text, - 'Mode': mode, - 'PreContextText': pre_context_text, - 'PostContextText': post_context_text, - } - # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send_formdata( - request, header_parameters, form_data_content, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) deserialized = None - if response.status_code == 200: deserialized = self._deserialize('SpellCheck', response) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/setup.py b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/setup.py index 4023e495fb34..a01c8939af72 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/setup.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/setup.py @@ -64,7 +64,6 @@ 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7',