diff --git a/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/__init__.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/__init__.py new file mode 100644 index 000000000000..c8e80e7ccef3 --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/__init__.py @@ -0,0 +1,18 @@ +# 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 .custom_image_search_client import CustomImageSearchClient +from .version import VERSION + +__all__ = ['CustomImageSearchClient'] + +__version__ = VERSION + diff --git a/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/custom_image_search_client.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/custom_image_search_client.py new file mode 100644 index 000000000000..2a22d6c15958 --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/custom_image_search_client.py @@ -0,0 +1,72 @@ +# 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 Configuration, Serializer, Deserializer +from .version import VERSION +from .operations.custom_instance_operations import CustomInstanceOperations +from . import models + + +class CustomImageSearchClientConfiguration(Configuration): + """Configuration for CustomImageSearchClient + 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/bingcustomsearch/v7.0' + + super(CustomImageSearchClientConfiguration, self).__init__(base_url) + + self.add_user_agent('azure-cognitiveservices-search-customimagesearch/{}'.format(VERSION)) + + self.credentials = credentials + + +class CustomImageSearchClient(SDKClient): + """The Bing Custom Image Search API lets you send an image search query to Bing and get back image search results customized to meet your custom search definition. + + :ivar config: Configuration for client. + :vartype config: CustomImageSearchClientConfiguration + + :ivar custom_instance: CustomInstance operations + :vartype custom_instance: azure.cognitiveservices.search.customimagesearch.operations.CustomInstanceOperations + + :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 = CustomImageSearchClientConfiguration(credentials, base_url) + super(CustomImageSearchClient, 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) + + self.custom_instance = CustomInstanceOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/__init__.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/__init__.py new file mode 100644 index 000000000000..aeb132ecd661 --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/__init__.py @@ -0,0 +1,80 @@ +# 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. +# -------------------------------------------------------------------------- + +try: + from .image_object_py3 import ImageObject + from .images_py3 import Images + from .search_results_answer_py3 import SearchResultsAnswer + from .query_py3 import Query + from .answer_py3 import Answer + from .media_object_py3 import MediaObject + from .response_py3 import Response + from .thing_py3 import Thing + from .creative_work_py3 import CreativeWork + from .identifiable_py3 import Identifiable + from .error_py3 import Error + from .error_response_py3 import ErrorResponse, ErrorResponseException + from .web_page_py3 import WebPage + from .response_base_py3 import ResponseBase +except (SyntaxError, ImportError): + from .image_object import ImageObject + from .images import Images + from .search_results_answer import SearchResultsAnswer + from .query import Query + from .answer import Answer + from .media_object import MediaObject + from .response import Response + from .thing import Thing + from .creative_work import CreativeWork + from .identifiable import Identifiable + from .error import Error + from .error_response import ErrorResponse, ErrorResponseException + from .web_page import WebPage + from .response_base import ResponseBase +from .custom_image_search_client_enums import ( + ErrorCode, + ErrorSubCode, + ImageAspect, + ImageColor, + Freshness, + ImageContent, + ImageType, + ImageLicense, + SafeSearch, + ImageSize, +) + +__all__ = [ + 'ImageObject', + 'Images', + 'SearchResultsAnswer', + 'Query', + 'Answer', + 'MediaObject', + 'Response', + 'Thing', + 'CreativeWork', + 'Identifiable', + 'Error', + 'ErrorResponse', 'ErrorResponseException', + 'WebPage', + 'ResponseBase', + 'ErrorCode', + 'ErrorSubCode', + 'ImageAspect', + 'ImageColor', + 'Freshness', + 'ImageContent', + 'ImageType', + 'ImageLicense', + 'SafeSearch', + 'ImageSize', +] diff --git a/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/answer.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/answer.py new file mode 100644 index 000000000000..d3c464d0ffc7 --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/answer.py @@ -0,0 +1,56 @@ +# 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): + """Defines an answer. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: SearchResultsAnswer + + 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 + :ivar read_link: The URL that returns this resource. + :vartype read_link: str + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'read_link': {'readonly': True}, + 'web_search_url': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'read_link': {'key': 'readLink', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + } + + _subtype_map = { + '_type': {'SearchResultsAnswer': 'SearchResultsAnswer'} + } + + def __init__(self, **kwargs): + super(Answer, self).__init__(**kwargs) + self._type = 'Answer' diff --git a/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/answer_py3.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/answer_py3.py new file mode 100644 index 000000000000..9a2bf4ec4acb --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/answer_py3.py @@ -0,0 +1,56 @@ +# 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_py3 import Response + + +class Answer(Response): + """Defines an answer. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: SearchResultsAnswer + + 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 + :ivar read_link: The URL that returns this resource. + :vartype read_link: str + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'read_link': {'readonly': True}, + 'web_search_url': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'read_link': {'key': 'readLink', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + } + + _subtype_map = { + '_type': {'SearchResultsAnswer': 'SearchResultsAnswer'} + } + + def __init__(self, **kwargs) -> None: + super(Answer, self).__init__(**kwargs) + self._type = 'Answer' diff --git a/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/creative_work.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/creative_work.py new file mode 100644 index 000000000000..83e710546837 --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/creative_work.py @@ -0,0 +1,99 @@ +# 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 .thing import Thing + + +class CreativeWork(Thing): + """The most generic kind of creative work, including books, movies, + photographs, software programs, etc. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: MediaObject, WebPage + + 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 + :ivar read_link: The URL that returns this resource. + :vartype read_link: str + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + :ivar name: The name of the thing represented by this object. + :vartype name: str + :ivar url: The URL to get more information about the thing represented by + this object. + :vartype url: str + :ivar image: An image of the item. + :vartype image: + ~azure.cognitiveservices.search.customimagesearch.models.ImageObject + :ivar description: A short description of the item. + :vartype description: str + :ivar alternate_name: An alias for the item + :vartype alternate_name: str + :ivar bing_id: An ID that uniquely identifies this item. + :vartype bing_id: str + :ivar thumbnail_url: The URL to a thumbnail of the item. + :vartype thumbnail_url: str + :ivar provider: The source of the creative work. + :vartype provider: + list[~azure.cognitiveservices.search.customimagesearch.models.Thing] + :ivar text: Text content of this creative work + :vartype text: str + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'read_link': {'readonly': True}, + 'web_search_url': {'readonly': True}, + 'name': {'readonly': True}, + 'url': {'readonly': True}, + 'image': {'readonly': True}, + 'description': {'readonly': True}, + 'alternate_name': {'readonly': True}, + 'bing_id': {'readonly': True}, + 'thumbnail_url': {'readonly': True}, + 'provider': {'readonly': True}, + 'text': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'read_link': {'key': 'readLink', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'image': {'key': 'image', 'type': 'ImageObject'}, + 'description': {'key': 'description', 'type': 'str'}, + 'alternate_name': {'key': 'alternateName', 'type': 'str'}, + 'bing_id': {'key': 'bingId', 'type': 'str'}, + 'thumbnail_url': {'key': 'thumbnailUrl', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': '[Thing]'}, + 'text': {'key': 'text', 'type': 'str'}, + } + + _subtype_map = { + '_type': {'MediaObject': 'MediaObject', 'WebPage': 'WebPage'} + } + + def __init__(self, **kwargs): + super(CreativeWork, self).__init__(**kwargs) + self.thumbnail_url = None + self.provider = None + self.text = None + self._type = 'CreativeWork' diff --git a/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/creative_work_py3.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/creative_work_py3.py new file mode 100644 index 000000000000..94ef5e360fc7 --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/creative_work_py3.py @@ -0,0 +1,99 @@ +# 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 .thing_py3 import Thing + + +class CreativeWork(Thing): + """The most generic kind of creative work, including books, movies, + photographs, software programs, etc. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: MediaObject, WebPage + + 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 + :ivar read_link: The URL that returns this resource. + :vartype read_link: str + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + :ivar name: The name of the thing represented by this object. + :vartype name: str + :ivar url: The URL to get more information about the thing represented by + this object. + :vartype url: str + :ivar image: An image of the item. + :vartype image: + ~azure.cognitiveservices.search.customimagesearch.models.ImageObject + :ivar description: A short description of the item. + :vartype description: str + :ivar alternate_name: An alias for the item + :vartype alternate_name: str + :ivar bing_id: An ID that uniquely identifies this item. + :vartype bing_id: str + :ivar thumbnail_url: The URL to a thumbnail of the item. + :vartype thumbnail_url: str + :ivar provider: The source of the creative work. + :vartype provider: + list[~azure.cognitiveservices.search.customimagesearch.models.Thing] + :ivar text: Text content of this creative work + :vartype text: str + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'read_link': {'readonly': True}, + 'web_search_url': {'readonly': True}, + 'name': {'readonly': True}, + 'url': {'readonly': True}, + 'image': {'readonly': True}, + 'description': {'readonly': True}, + 'alternate_name': {'readonly': True}, + 'bing_id': {'readonly': True}, + 'thumbnail_url': {'readonly': True}, + 'provider': {'readonly': True}, + 'text': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'read_link': {'key': 'readLink', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'image': {'key': 'image', 'type': 'ImageObject'}, + 'description': {'key': 'description', 'type': 'str'}, + 'alternate_name': {'key': 'alternateName', 'type': 'str'}, + 'bing_id': {'key': 'bingId', 'type': 'str'}, + 'thumbnail_url': {'key': 'thumbnailUrl', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': '[Thing]'}, + 'text': {'key': 'text', 'type': 'str'}, + } + + _subtype_map = { + '_type': {'MediaObject': 'MediaObject', 'WebPage': 'WebPage'} + } + + def __init__(self, **kwargs) -> None: + super(CreativeWork, self).__init__(**kwargs) + self.thumbnail_url = None + self.provider = None + self.text = None + self._type = 'CreativeWork' diff --git a/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/custom_image_search_client_enums.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/custom_image_search_client_enums.py new file mode 100644 index 000000000000..94e2847c058c --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/custom_image_search_client_enums.py @@ -0,0 +1,113 @@ +# 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 enum import Enum + + +class ErrorCode(str, Enum): + + none = "None" + server_error = "ServerError" + invalid_request = "InvalidRequest" + rate_limit_exceeded = "RateLimitExceeded" + invalid_authorization = "InvalidAuthorization" + insufficient_authorization = "InsufficientAuthorization" + + +class ErrorSubCode(str, Enum): + + unexpected_error = "UnexpectedError" + resource_error = "ResourceError" + not_implemented = "NotImplemented" + parameter_missing = "ParameterMissing" + parameter_invalid_value = "ParameterInvalidValue" + http_not_allowed = "HttpNotAllowed" + blocked = "Blocked" + authorization_missing = "AuthorizationMissing" + authorization_redundancy = "AuthorizationRedundancy" + authorization_disabled = "AuthorizationDisabled" + authorization_expired = "AuthorizationExpired" + + +class ImageAspect(str, Enum): + + all = "All" + square = "Square" + wide = "Wide" + tall = "Tall" + + +class ImageColor(str, Enum): + + color_only = "ColorOnly" + monochrome = "Monochrome" + black = "Black" + blue = "Blue" + brown = "Brown" + gray = "Gray" + green = "Green" + orange = "Orange" + pink = "Pink" + purple = "Purple" + red = "Red" + teal = "Teal" + white = "White" + yellow = "Yellow" + + +class Freshness(str, Enum): + + day = "Day" + week = "Week" + month = "Month" + + +class ImageContent(str, Enum): + + face = "Face" + portrait = "Portrait" + + +class ImageType(str, Enum): + + animated_gif = "AnimatedGif" + clipart = "Clipart" + line = "Line" + photo = "Photo" + shopping = "Shopping" + transparent = "Transparent" + + +class ImageLicense(str, Enum): + + all = "All" + any = "Any" + public = "Public" + share = "Share" + share_commercially = "ShareCommercially" + modify = "Modify" + modify_commercially = "ModifyCommercially" + + +class SafeSearch(str, Enum): + + off = "Off" + moderate = "Moderate" + strict = "Strict" + + +class ImageSize(str, Enum): + + all = "All" + small = "Small" + medium = "Medium" + large = "Large" + wallpaper = "Wallpaper" diff --git a/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/error.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/error.py new file mode 100644 index 000000000000..135fea28aa51 --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/error.py @@ -0,0 +1,72 @@ +# 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.search.customimagesearch.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.search.customimagesearch.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/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/error_py3.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/error_py3.py new file mode 100644 index 000000000000..0bcd0299e8e4 --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/error_py3.py @@ -0,0 +1,72 @@ +# 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.search.customimagesearch.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.search.customimagesearch.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/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/error_response.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/error_response.py new file mode 100644 index 000000000000..fd2dab8b29b7 --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/error_response.py @@ -0,0 +1,69 @@ +# 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 + :ivar read_link: The URL that returns this resource. + :vartype read_link: str + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + :param errors: Required. A list of errors that describe the reasons why + the request failed. + :type errors: + list[~azure.cognitiveservices.search.customimagesearch.models.Error] + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'read_link': {'readonly': True}, + 'web_search_url': {'readonly': True}, + 'errors': {'required': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'read_link': {'key': 'readLink', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', '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/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/error_response_py3.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/error_response_py3.py new file mode 100644 index 000000000000..7cacd226b933 --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/error_response_py3.py @@ -0,0 +1,69 @@ +# 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_py3 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 + :ivar read_link: The URL that returns this resource. + :vartype read_link: str + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + :param errors: Required. A list of errors that describe the reasons why + the request failed. + :type errors: + list[~azure.cognitiveservices.search.customimagesearch.models.Error] + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'read_link': {'readonly': True}, + 'web_search_url': {'readonly': True}, + 'errors': {'required': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'read_link': {'key': 'readLink', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', '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/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/identifiable.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/identifiable.py new file mode 100644 index 000000000000..513e53d238bb --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/identifiable.py @@ -0,0 +1,49 @@ +# 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/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/identifiable_py3.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/identifiable_py3.py new file mode 100644 index 000000000000..2d24a2c45775 --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/identifiable_py3.py @@ -0,0 +1,49 @@ +# 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_py3 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/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/image_object.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/image_object.py new file mode 100644 index 000000000000..08eb83f3532e --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/image_object.py @@ -0,0 +1,150 @@ +# 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 .media_object import MediaObject + + +class ImageObject(MediaObject): + """Defines an image. + + 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 + :ivar read_link: The URL that returns this resource. + :vartype read_link: str + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + :ivar name: The name of the thing represented by this object. + :vartype name: str + :ivar url: The URL to get more information about the thing represented by + this object. + :vartype url: str + :ivar image: An image of the item. + :vartype image: + ~azure.cognitiveservices.search.customimagesearch.models.ImageObject + :ivar description: A short description of the item. + :vartype description: str + :ivar alternate_name: An alias for the item + :vartype alternate_name: str + :ivar bing_id: An ID that uniquely identifies this item. + :vartype bing_id: str + :ivar thumbnail_url: The URL to a thumbnail of the item. + :vartype thumbnail_url: str + :ivar provider: The source of the creative work. + :vartype provider: + list[~azure.cognitiveservices.search.customimagesearch.models.Thing] + :ivar text: Text content of this creative work + :vartype text: str + :ivar content_url: Original URL to retrieve the source (file) for the + media object (e.g the source URL for the image). + :vartype content_url: str + :ivar host_page_url: URL of the page that hosts the media object. + :vartype host_page_url: str + :ivar content_size: Size of the media object content (use format "value + unit" e.g "1024 B"). + :vartype content_size: str + :ivar encoding_format: Encoding format (e.g mp3, mp4, jpeg, etc). + :vartype encoding_format: str + :ivar host_page_display_url: Display URL of the page that hosts the media + object. + :vartype host_page_display_url: str + :ivar width: The width of the media object, in pixels. + :vartype width: int + :ivar height: The height of the media object, in pixels. + :vartype height: int + :ivar thumbnail: The URL to a thumbnail of the image + :vartype thumbnail: + ~azure.cognitiveservices.search.customimagesearch.models.ImageObject + :ivar image_insights_token: The token that you use in a subsequent call to + the Image Search API to get additional information about the image. For + information about using this token, see the insightsToken query parameter. + :vartype image_insights_token: str + :ivar image_id: Unique Id for the image + :vartype image_id: str + :ivar accent_color: A three-byte hexadecimal number that represents the + color that dominates the image. Use the color as the temporary background + in your client until the image is loaded. + :vartype accent_color: str + :ivar visual_words: Visual representation of the image. Used for getting + more sizes + :vartype visual_words: str + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'read_link': {'readonly': True}, + 'web_search_url': {'readonly': True}, + 'name': {'readonly': True}, + 'url': {'readonly': True}, + 'image': {'readonly': True}, + 'description': {'readonly': True}, + 'alternate_name': {'readonly': True}, + 'bing_id': {'readonly': True}, + 'thumbnail_url': {'readonly': True}, + 'provider': {'readonly': True}, + 'text': {'readonly': True}, + 'content_url': {'readonly': True}, + 'host_page_url': {'readonly': True}, + 'content_size': {'readonly': True}, + 'encoding_format': {'readonly': True}, + 'host_page_display_url': {'readonly': True}, + 'width': {'readonly': True}, + 'height': {'readonly': True}, + 'thumbnail': {'readonly': True}, + 'image_insights_token': {'readonly': True}, + 'image_id': {'readonly': True}, + 'accent_color': {'readonly': True}, + 'visual_words': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'read_link': {'key': 'readLink', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'image': {'key': 'image', 'type': 'ImageObject'}, + 'description': {'key': 'description', 'type': 'str'}, + 'alternate_name': {'key': 'alternateName', 'type': 'str'}, + 'bing_id': {'key': 'bingId', 'type': 'str'}, + 'thumbnail_url': {'key': 'thumbnailUrl', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': '[Thing]'}, + 'text': {'key': 'text', 'type': 'str'}, + 'content_url': {'key': 'contentUrl', 'type': 'str'}, + 'host_page_url': {'key': 'hostPageUrl', 'type': 'str'}, + 'content_size': {'key': 'contentSize', 'type': 'str'}, + 'encoding_format': {'key': 'encodingFormat', 'type': 'str'}, + 'host_page_display_url': {'key': 'hostPageDisplayUrl', 'type': 'str'}, + 'width': {'key': 'width', 'type': 'int'}, + 'height': {'key': 'height', 'type': 'int'}, + 'thumbnail': {'key': 'thumbnail', 'type': 'ImageObject'}, + 'image_insights_token': {'key': 'imageInsightsToken', 'type': 'str'}, + 'image_id': {'key': 'imageId', 'type': 'str'}, + 'accent_color': {'key': 'accentColor', 'type': 'str'}, + 'visual_words': {'key': 'visualWords', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ImageObject, self).__init__(**kwargs) + self.thumbnail = None + self.image_insights_token = None + self.image_id = None + self.accent_color = None + self.visual_words = None + self._type = 'ImageObject' diff --git a/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/image_object_py3.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/image_object_py3.py new file mode 100644 index 000000000000..533afc3ed4b8 --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/image_object_py3.py @@ -0,0 +1,150 @@ +# 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 .media_object_py3 import MediaObject + + +class ImageObject(MediaObject): + """Defines an image. + + 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 + :ivar read_link: The URL that returns this resource. + :vartype read_link: str + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + :ivar name: The name of the thing represented by this object. + :vartype name: str + :ivar url: The URL to get more information about the thing represented by + this object. + :vartype url: str + :ivar image: An image of the item. + :vartype image: + ~azure.cognitiveservices.search.customimagesearch.models.ImageObject + :ivar description: A short description of the item. + :vartype description: str + :ivar alternate_name: An alias for the item + :vartype alternate_name: str + :ivar bing_id: An ID that uniquely identifies this item. + :vartype bing_id: str + :ivar thumbnail_url: The URL to a thumbnail of the item. + :vartype thumbnail_url: str + :ivar provider: The source of the creative work. + :vartype provider: + list[~azure.cognitiveservices.search.customimagesearch.models.Thing] + :ivar text: Text content of this creative work + :vartype text: str + :ivar content_url: Original URL to retrieve the source (file) for the + media object (e.g the source URL for the image). + :vartype content_url: str + :ivar host_page_url: URL of the page that hosts the media object. + :vartype host_page_url: str + :ivar content_size: Size of the media object content (use format "value + unit" e.g "1024 B"). + :vartype content_size: str + :ivar encoding_format: Encoding format (e.g mp3, mp4, jpeg, etc). + :vartype encoding_format: str + :ivar host_page_display_url: Display URL of the page that hosts the media + object. + :vartype host_page_display_url: str + :ivar width: The width of the media object, in pixels. + :vartype width: int + :ivar height: The height of the media object, in pixels. + :vartype height: int + :ivar thumbnail: The URL to a thumbnail of the image + :vartype thumbnail: + ~azure.cognitiveservices.search.customimagesearch.models.ImageObject + :ivar image_insights_token: The token that you use in a subsequent call to + the Image Search API to get additional information about the image. For + information about using this token, see the insightsToken query parameter. + :vartype image_insights_token: str + :ivar image_id: Unique Id for the image + :vartype image_id: str + :ivar accent_color: A three-byte hexadecimal number that represents the + color that dominates the image. Use the color as the temporary background + in your client until the image is loaded. + :vartype accent_color: str + :ivar visual_words: Visual representation of the image. Used for getting + more sizes + :vartype visual_words: str + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'read_link': {'readonly': True}, + 'web_search_url': {'readonly': True}, + 'name': {'readonly': True}, + 'url': {'readonly': True}, + 'image': {'readonly': True}, + 'description': {'readonly': True}, + 'alternate_name': {'readonly': True}, + 'bing_id': {'readonly': True}, + 'thumbnail_url': {'readonly': True}, + 'provider': {'readonly': True}, + 'text': {'readonly': True}, + 'content_url': {'readonly': True}, + 'host_page_url': {'readonly': True}, + 'content_size': {'readonly': True}, + 'encoding_format': {'readonly': True}, + 'host_page_display_url': {'readonly': True}, + 'width': {'readonly': True}, + 'height': {'readonly': True}, + 'thumbnail': {'readonly': True}, + 'image_insights_token': {'readonly': True}, + 'image_id': {'readonly': True}, + 'accent_color': {'readonly': True}, + 'visual_words': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'read_link': {'key': 'readLink', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'image': {'key': 'image', 'type': 'ImageObject'}, + 'description': {'key': 'description', 'type': 'str'}, + 'alternate_name': {'key': 'alternateName', 'type': 'str'}, + 'bing_id': {'key': 'bingId', 'type': 'str'}, + 'thumbnail_url': {'key': 'thumbnailUrl', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': '[Thing]'}, + 'text': {'key': 'text', 'type': 'str'}, + 'content_url': {'key': 'contentUrl', 'type': 'str'}, + 'host_page_url': {'key': 'hostPageUrl', 'type': 'str'}, + 'content_size': {'key': 'contentSize', 'type': 'str'}, + 'encoding_format': {'key': 'encodingFormat', 'type': 'str'}, + 'host_page_display_url': {'key': 'hostPageDisplayUrl', 'type': 'str'}, + 'width': {'key': 'width', 'type': 'int'}, + 'height': {'key': 'height', 'type': 'int'}, + 'thumbnail': {'key': 'thumbnail', 'type': 'ImageObject'}, + 'image_insights_token': {'key': 'imageInsightsToken', 'type': 'str'}, + 'image_id': {'key': 'imageId', 'type': 'str'}, + 'accent_color': {'key': 'accentColor', 'type': 'str'}, + 'visual_words': {'key': 'visualWords', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(ImageObject, self).__init__(**kwargs) + self.thumbnail = None + self.image_insights_token = None + self.image_id = None + self.accent_color = None + self.visual_words = None + self._type = 'ImageObject' diff --git a/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/images.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/images.py new file mode 100644 index 000000000000..b5a28a74f76d --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/images.py @@ -0,0 +1,68 @@ +# 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 .search_results_answer import SearchResultsAnswer + + +class Images(SearchResultsAnswer): + """Defines an image answer. + + 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 + :ivar read_link: The URL that returns this resource. + :vartype read_link: str + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + :ivar total_estimated_matches: The estimated number of webpages that are + relevant to the query. Use this number along with the count and offset + query parameters to page the results. + :vartype total_estimated_matches: long + :ivar next_offset: Used as part of deduping. Tells client the next offset + that client should use in the next pagination request + :vartype next_offset: int + :param value: Required. A list of image objects that are relevant to the + query. If there are no results, the List is empty. + :type value: + list[~azure.cognitiveservices.search.customimagesearch.models.ImageObject] + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'read_link': {'readonly': True}, + 'web_search_url': {'readonly': True}, + 'total_estimated_matches': {'readonly': True}, + 'next_offset': {'readonly': True}, + 'value': {'required': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'read_link': {'key': 'readLink', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + 'total_estimated_matches': {'key': 'totalEstimatedMatches', 'type': 'long'}, + 'next_offset': {'key': 'nextOffset', 'type': 'int'}, + 'value': {'key': 'value', 'type': '[ImageObject]'}, + } + + def __init__(self, **kwargs): + super(Images, self).__init__(**kwargs) + self.next_offset = None + self.value = kwargs.get('value', None) + self._type = 'Images' diff --git a/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/images_py3.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/images_py3.py new file mode 100644 index 000000000000..ad54a0f388e4 --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/images_py3.py @@ -0,0 +1,68 @@ +# 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 .search_results_answer_py3 import SearchResultsAnswer + + +class Images(SearchResultsAnswer): + """Defines an image answer. + + 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 + :ivar read_link: The URL that returns this resource. + :vartype read_link: str + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + :ivar total_estimated_matches: The estimated number of webpages that are + relevant to the query. Use this number along with the count and offset + query parameters to page the results. + :vartype total_estimated_matches: long + :ivar next_offset: Used as part of deduping. Tells client the next offset + that client should use in the next pagination request + :vartype next_offset: int + :param value: Required. A list of image objects that are relevant to the + query. If there are no results, the List is empty. + :type value: + list[~azure.cognitiveservices.search.customimagesearch.models.ImageObject] + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'read_link': {'readonly': True}, + 'web_search_url': {'readonly': True}, + 'total_estimated_matches': {'readonly': True}, + 'next_offset': {'readonly': True}, + 'value': {'required': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'read_link': {'key': 'readLink', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + 'total_estimated_matches': {'key': 'totalEstimatedMatches', 'type': 'long'}, + 'next_offset': {'key': 'nextOffset', 'type': 'int'}, + 'value': {'key': 'value', 'type': '[ImageObject]'}, + } + + def __init__(self, *, value, **kwargs) -> None: + super(Images, self).__init__(**kwargs) + self.next_offset = None + self.value = value + self._type = 'Images' diff --git a/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/media_object.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/media_object.py new file mode 100644 index 000000000000..9ab87d259487 --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/media_object.py @@ -0,0 +1,133 @@ +# 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 .creative_work import CreativeWork + + +class MediaObject(CreativeWork): + """Defines a media object. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ImageObject + + 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 + :ivar read_link: The URL that returns this resource. + :vartype read_link: str + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + :ivar name: The name of the thing represented by this object. + :vartype name: str + :ivar url: The URL to get more information about the thing represented by + this object. + :vartype url: str + :ivar image: An image of the item. + :vartype image: + ~azure.cognitiveservices.search.customimagesearch.models.ImageObject + :ivar description: A short description of the item. + :vartype description: str + :ivar alternate_name: An alias for the item + :vartype alternate_name: str + :ivar bing_id: An ID that uniquely identifies this item. + :vartype bing_id: str + :ivar thumbnail_url: The URL to a thumbnail of the item. + :vartype thumbnail_url: str + :ivar provider: The source of the creative work. + :vartype provider: + list[~azure.cognitiveservices.search.customimagesearch.models.Thing] + :ivar text: Text content of this creative work + :vartype text: str + :ivar content_url: Original URL to retrieve the source (file) for the + media object (e.g the source URL for the image). + :vartype content_url: str + :ivar host_page_url: URL of the page that hosts the media object. + :vartype host_page_url: str + :ivar content_size: Size of the media object content (use format "value + unit" e.g "1024 B"). + :vartype content_size: str + :ivar encoding_format: Encoding format (e.g mp3, mp4, jpeg, etc). + :vartype encoding_format: str + :ivar host_page_display_url: Display URL of the page that hosts the media + object. + :vartype host_page_display_url: str + :ivar width: The width of the media object, in pixels. + :vartype width: int + :ivar height: The height of the media object, in pixels. + :vartype height: int + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'read_link': {'readonly': True}, + 'web_search_url': {'readonly': True}, + 'name': {'readonly': True}, + 'url': {'readonly': True}, + 'image': {'readonly': True}, + 'description': {'readonly': True}, + 'alternate_name': {'readonly': True}, + 'bing_id': {'readonly': True}, + 'thumbnail_url': {'readonly': True}, + 'provider': {'readonly': True}, + 'text': {'readonly': True}, + 'content_url': {'readonly': True}, + 'host_page_url': {'readonly': True}, + 'content_size': {'readonly': True}, + 'encoding_format': {'readonly': True}, + 'host_page_display_url': {'readonly': True}, + 'width': {'readonly': True}, + 'height': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'read_link': {'key': 'readLink', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'image': {'key': 'image', 'type': 'ImageObject'}, + 'description': {'key': 'description', 'type': 'str'}, + 'alternate_name': {'key': 'alternateName', 'type': 'str'}, + 'bing_id': {'key': 'bingId', 'type': 'str'}, + 'thumbnail_url': {'key': 'thumbnailUrl', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': '[Thing]'}, + 'text': {'key': 'text', 'type': 'str'}, + 'content_url': {'key': 'contentUrl', 'type': 'str'}, + 'host_page_url': {'key': 'hostPageUrl', 'type': 'str'}, + 'content_size': {'key': 'contentSize', 'type': 'str'}, + 'encoding_format': {'key': 'encodingFormat', 'type': 'str'}, + 'host_page_display_url': {'key': 'hostPageDisplayUrl', 'type': 'str'}, + 'width': {'key': 'width', 'type': 'int'}, + 'height': {'key': 'height', 'type': 'int'}, + } + + _subtype_map = { + '_type': {'ImageObject': 'ImageObject'} + } + + def __init__(self, **kwargs): + super(MediaObject, self).__init__(**kwargs) + self.content_url = None + self.host_page_url = None + self.content_size = None + self.encoding_format = None + self.host_page_display_url = None + self.width = None + self.height = None + self._type = 'MediaObject' diff --git a/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/media_object_py3.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/media_object_py3.py new file mode 100644 index 000000000000..48ab05c81b39 --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/media_object_py3.py @@ -0,0 +1,133 @@ +# 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 .creative_work_py3 import CreativeWork + + +class MediaObject(CreativeWork): + """Defines a media object. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ImageObject + + 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 + :ivar read_link: The URL that returns this resource. + :vartype read_link: str + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + :ivar name: The name of the thing represented by this object. + :vartype name: str + :ivar url: The URL to get more information about the thing represented by + this object. + :vartype url: str + :ivar image: An image of the item. + :vartype image: + ~azure.cognitiveservices.search.customimagesearch.models.ImageObject + :ivar description: A short description of the item. + :vartype description: str + :ivar alternate_name: An alias for the item + :vartype alternate_name: str + :ivar bing_id: An ID that uniquely identifies this item. + :vartype bing_id: str + :ivar thumbnail_url: The URL to a thumbnail of the item. + :vartype thumbnail_url: str + :ivar provider: The source of the creative work. + :vartype provider: + list[~azure.cognitiveservices.search.customimagesearch.models.Thing] + :ivar text: Text content of this creative work + :vartype text: str + :ivar content_url: Original URL to retrieve the source (file) for the + media object (e.g the source URL for the image). + :vartype content_url: str + :ivar host_page_url: URL of the page that hosts the media object. + :vartype host_page_url: str + :ivar content_size: Size of the media object content (use format "value + unit" e.g "1024 B"). + :vartype content_size: str + :ivar encoding_format: Encoding format (e.g mp3, mp4, jpeg, etc). + :vartype encoding_format: str + :ivar host_page_display_url: Display URL of the page that hosts the media + object. + :vartype host_page_display_url: str + :ivar width: The width of the media object, in pixels. + :vartype width: int + :ivar height: The height of the media object, in pixels. + :vartype height: int + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'read_link': {'readonly': True}, + 'web_search_url': {'readonly': True}, + 'name': {'readonly': True}, + 'url': {'readonly': True}, + 'image': {'readonly': True}, + 'description': {'readonly': True}, + 'alternate_name': {'readonly': True}, + 'bing_id': {'readonly': True}, + 'thumbnail_url': {'readonly': True}, + 'provider': {'readonly': True}, + 'text': {'readonly': True}, + 'content_url': {'readonly': True}, + 'host_page_url': {'readonly': True}, + 'content_size': {'readonly': True}, + 'encoding_format': {'readonly': True}, + 'host_page_display_url': {'readonly': True}, + 'width': {'readonly': True}, + 'height': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'read_link': {'key': 'readLink', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'image': {'key': 'image', 'type': 'ImageObject'}, + 'description': {'key': 'description', 'type': 'str'}, + 'alternate_name': {'key': 'alternateName', 'type': 'str'}, + 'bing_id': {'key': 'bingId', 'type': 'str'}, + 'thumbnail_url': {'key': 'thumbnailUrl', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': '[Thing]'}, + 'text': {'key': 'text', 'type': 'str'}, + 'content_url': {'key': 'contentUrl', 'type': 'str'}, + 'host_page_url': {'key': 'hostPageUrl', 'type': 'str'}, + 'content_size': {'key': 'contentSize', 'type': 'str'}, + 'encoding_format': {'key': 'encodingFormat', 'type': 'str'}, + 'host_page_display_url': {'key': 'hostPageDisplayUrl', 'type': 'str'}, + 'width': {'key': 'width', 'type': 'int'}, + 'height': {'key': 'height', 'type': 'int'}, + } + + _subtype_map = { + '_type': {'ImageObject': 'ImageObject'} + } + + def __init__(self, **kwargs) -> None: + super(MediaObject, self).__init__(**kwargs) + self.content_url = None + self.host_page_url = None + self.content_size = None + self.encoding_format = None + self.host_page_display_url = None + self.width = None + self.height = None + self._type = 'MediaObject' diff --git a/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/query.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/query.py new file mode 100644 index 000000000000..fa369326e778 --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/query.py @@ -0,0 +1,67 @@ +# 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 Query(Model): + """Defines a search query. + + 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 text: Required. The query string. Use this string as the query term + in a new search request. + :type text: str + :ivar display_text: The display version of the query term. This version of + the query term may contain special characters that highlight the search + term found in the query string. The string contains the highlighting + characters only if the query enabled hit highlighting + :vartype display_text: str + :ivar web_search_url: The URL that takes the user to the Bing search + results page for the query.Only related search results include this field. + :vartype web_search_url: str + :ivar search_link: The URL that you use to get the results of the related + search. Before using the URL, you must append query parameters as + appropriate and include the Ocp-Apim-Subscription-Key header. Use this URL + if you're displaying the results in your own user interface. Otherwise, + use the webSearchUrl URL. + :vartype search_link: str + :ivar thumbnail: The URL to a thumbnail of a related image. + :vartype thumbnail: + ~azure.cognitiveservices.search.customimagesearch.models.ImageObject + """ + + _validation = { + 'text': {'required': True}, + 'display_text': {'readonly': True}, + 'web_search_url': {'readonly': True}, + 'search_link': {'readonly': True}, + 'thumbnail': {'readonly': True}, + } + + _attribute_map = { + 'text': {'key': 'text', 'type': 'str'}, + 'display_text': {'key': 'displayText', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + 'search_link': {'key': 'searchLink', 'type': 'str'}, + 'thumbnail': {'key': 'thumbnail', 'type': 'ImageObject'}, + } + + def __init__(self, **kwargs): + super(Query, self).__init__(**kwargs) + self.text = kwargs.get('text', None) + self.display_text = None + self.web_search_url = None + self.search_link = None + self.thumbnail = None diff --git a/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/query_py3.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/query_py3.py new file mode 100644 index 000000000000..e49097c01c59 --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/query_py3.py @@ -0,0 +1,67 @@ +# 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 Query(Model): + """Defines a search query. + + 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 text: Required. The query string. Use this string as the query term + in a new search request. + :type text: str + :ivar display_text: The display version of the query term. This version of + the query term may contain special characters that highlight the search + term found in the query string. The string contains the highlighting + characters only if the query enabled hit highlighting + :vartype display_text: str + :ivar web_search_url: The URL that takes the user to the Bing search + results page for the query.Only related search results include this field. + :vartype web_search_url: str + :ivar search_link: The URL that you use to get the results of the related + search. Before using the URL, you must append query parameters as + appropriate and include the Ocp-Apim-Subscription-Key header. Use this URL + if you're displaying the results in your own user interface. Otherwise, + use the webSearchUrl URL. + :vartype search_link: str + :ivar thumbnail: The URL to a thumbnail of a related image. + :vartype thumbnail: + ~azure.cognitiveservices.search.customimagesearch.models.ImageObject + """ + + _validation = { + 'text': {'required': True}, + 'display_text': {'readonly': True}, + 'web_search_url': {'readonly': True}, + 'search_link': {'readonly': True}, + 'thumbnail': {'readonly': True}, + } + + _attribute_map = { + 'text': {'key': 'text', 'type': 'str'}, + 'display_text': {'key': 'displayText', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + 'search_link': {'key': 'searchLink', 'type': 'str'}, + 'thumbnail': {'key': 'thumbnail', 'type': 'ImageObject'}, + } + + def __init__(self, *, text: str, **kwargs) -> None: + super(Query, self).__init__(**kwargs) + self.text = text + self.display_text = None + self.web_search_url = None + self.search_link = None + self.thumbnail = None diff --git a/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/response.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/response.py new file mode 100644 index 000000000000..1abf5a458dcf --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/response.py @@ -0,0 +1,59 @@ +# 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, Thing, 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 + :ivar read_link: The URL that returns this resource. + :vartype read_link: str + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'read_link': {'readonly': True}, + 'web_search_url': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'read_link': {'key': 'readLink', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + } + + _subtype_map = { + '_type': {'Answer': 'Answer', 'Thing': 'Thing', 'ErrorResponse': 'ErrorResponse'} + } + + def __init__(self, **kwargs): + super(Response, self).__init__(**kwargs) + self.read_link = None + self.web_search_url = None + self._type = 'Response' diff --git a/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/response_base.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/response_base.py new file mode 100644 index 000000000000..fd44632cfc0a --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/response_base.py @@ -0,0 +1,41 @@ +# 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): + """Response base. + + 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/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/response_base_py3.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/response_base_py3.py new file mode 100644 index 000000000000..680e0fe98ab4 --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/response_base_py3.py @@ -0,0 +1,41 @@ +# 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): + """Response base. + + 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/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/response_py3.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/response_py3.py new file mode 100644 index 000000000000..8790e1c5ab4c --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/response_py3.py @@ -0,0 +1,59 @@ +# 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_py3 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, Thing, 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 + :ivar read_link: The URL that returns this resource. + :vartype read_link: str + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'read_link': {'readonly': True}, + 'web_search_url': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'read_link': {'key': 'readLink', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + } + + _subtype_map = { + '_type': {'Answer': 'Answer', 'Thing': 'Thing', 'ErrorResponse': 'ErrorResponse'} + } + + def __init__(self, **kwargs) -> None: + super(Response, self).__init__(**kwargs) + self.read_link = None + self.web_search_url = None + self._type = 'Response' diff --git a/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/search_results_answer.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/search_results_answer.py new file mode 100644 index 000000000000..3ce089b82a6c --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/search_results_answer.py @@ -0,0 +1,63 @@ +# 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 SearchResultsAnswer(Answer): + """Defines a search result answer. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: Images + + 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 + :ivar read_link: The URL that returns this resource. + :vartype read_link: str + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + :ivar total_estimated_matches: The estimated number of webpages that are + relevant to the query. Use this number along with the count and offset + query parameters to page the results. + :vartype total_estimated_matches: long + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'read_link': {'readonly': True}, + 'web_search_url': {'readonly': True}, + 'total_estimated_matches': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'read_link': {'key': 'readLink', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + 'total_estimated_matches': {'key': 'totalEstimatedMatches', 'type': 'long'}, + } + + _subtype_map = { + '_type': {'Images': 'Images'} + } + + def __init__(self, **kwargs): + super(SearchResultsAnswer, self).__init__(**kwargs) + self.total_estimated_matches = None + self._type = 'SearchResultsAnswer' diff --git a/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/search_results_answer_py3.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/search_results_answer_py3.py new file mode 100644 index 000000000000..e972b77c2ea7 --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/search_results_answer_py3.py @@ -0,0 +1,63 @@ +# 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_py3 import Answer + + +class SearchResultsAnswer(Answer): + """Defines a search result answer. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: Images + + 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 + :ivar read_link: The URL that returns this resource. + :vartype read_link: str + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + :ivar total_estimated_matches: The estimated number of webpages that are + relevant to the query. Use this number along with the count and offset + query parameters to page the results. + :vartype total_estimated_matches: long + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'read_link': {'readonly': True}, + 'web_search_url': {'readonly': True}, + 'total_estimated_matches': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'read_link': {'key': 'readLink', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + 'total_estimated_matches': {'key': 'totalEstimatedMatches', 'type': 'long'}, + } + + _subtype_map = { + '_type': {'Images': 'Images'} + } + + def __init__(self, **kwargs) -> None: + super(SearchResultsAnswer, self).__init__(**kwargs) + self.total_estimated_matches = None + self._type = 'SearchResultsAnswer' diff --git a/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/thing.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/thing.py new file mode 100644 index 000000000000..9d686d477dce --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/thing.py @@ -0,0 +1,88 @@ +# 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 Thing(Response): + """Defines a thing. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: CreativeWork + + 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 + :ivar read_link: The URL that returns this resource. + :vartype read_link: str + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + :ivar name: The name of the thing represented by this object. + :vartype name: str + :ivar url: The URL to get more information about the thing represented by + this object. + :vartype url: str + :ivar image: An image of the item. + :vartype image: + ~azure.cognitiveservices.search.customimagesearch.models.ImageObject + :ivar description: A short description of the item. + :vartype description: str + :ivar alternate_name: An alias for the item + :vartype alternate_name: str + :ivar bing_id: An ID that uniquely identifies this item. + :vartype bing_id: str + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'read_link': {'readonly': True}, + 'web_search_url': {'readonly': True}, + 'name': {'readonly': True}, + 'url': {'readonly': True}, + 'image': {'readonly': True}, + 'description': {'readonly': True}, + 'alternate_name': {'readonly': True}, + 'bing_id': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'read_link': {'key': 'readLink', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'image': {'key': 'image', 'type': 'ImageObject'}, + 'description': {'key': 'description', 'type': 'str'}, + 'alternate_name': {'key': 'alternateName', 'type': 'str'}, + 'bing_id': {'key': 'bingId', 'type': 'str'}, + } + + _subtype_map = { + '_type': {'CreativeWork': 'CreativeWork'} + } + + def __init__(self, **kwargs): + super(Thing, self).__init__(**kwargs) + self.name = None + self.url = None + self.image = None + self.description = None + self.alternate_name = None + self.bing_id = None + self._type = 'Thing' diff --git a/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/thing_py3.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/thing_py3.py new file mode 100644 index 000000000000..587ea0596f3b --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/thing_py3.py @@ -0,0 +1,88 @@ +# 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_py3 import Response + + +class Thing(Response): + """Defines a thing. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: CreativeWork + + 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 + :ivar read_link: The URL that returns this resource. + :vartype read_link: str + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + :ivar name: The name of the thing represented by this object. + :vartype name: str + :ivar url: The URL to get more information about the thing represented by + this object. + :vartype url: str + :ivar image: An image of the item. + :vartype image: + ~azure.cognitiveservices.search.customimagesearch.models.ImageObject + :ivar description: A short description of the item. + :vartype description: str + :ivar alternate_name: An alias for the item + :vartype alternate_name: str + :ivar bing_id: An ID that uniquely identifies this item. + :vartype bing_id: str + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'read_link': {'readonly': True}, + 'web_search_url': {'readonly': True}, + 'name': {'readonly': True}, + 'url': {'readonly': True}, + 'image': {'readonly': True}, + 'description': {'readonly': True}, + 'alternate_name': {'readonly': True}, + 'bing_id': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'read_link': {'key': 'readLink', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'image': {'key': 'image', 'type': 'ImageObject'}, + 'description': {'key': 'description', 'type': 'str'}, + 'alternate_name': {'key': 'alternateName', 'type': 'str'}, + 'bing_id': {'key': 'bingId', 'type': 'str'}, + } + + _subtype_map = { + '_type': {'CreativeWork': 'CreativeWork'} + } + + def __init__(self, **kwargs) -> None: + super(Thing, self).__init__(**kwargs) + self.name = None + self.url = None + self.image = None + self.description = None + self.alternate_name = None + self.bing_id = None + self._type = 'Thing' diff --git a/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/web_page.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/web_page.py new file mode 100644 index 000000000000..d2c1e4c4a8d6 --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/web_page.py @@ -0,0 +1,88 @@ +# 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 .creative_work import CreativeWork + + +class WebPage(CreativeWork): + """Defines a webpage that is relevant to the query. + + 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 + :ivar read_link: The URL that returns this resource. + :vartype read_link: str + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + :ivar name: The name of the thing represented by this object. + :vartype name: str + :ivar url: The URL to get more information about the thing represented by + this object. + :vartype url: str + :ivar image: An image of the item. + :vartype image: + ~azure.cognitiveservices.search.customimagesearch.models.ImageObject + :ivar description: A short description of the item. + :vartype description: str + :ivar alternate_name: An alias for the item + :vartype alternate_name: str + :ivar bing_id: An ID that uniquely identifies this item. + :vartype bing_id: str + :ivar thumbnail_url: The URL to a thumbnail of the item. + :vartype thumbnail_url: str + :ivar provider: The source of the creative work. + :vartype provider: + list[~azure.cognitiveservices.search.customimagesearch.models.Thing] + :ivar text: Text content of this creative work + :vartype text: str + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'read_link': {'readonly': True}, + 'web_search_url': {'readonly': True}, + 'name': {'readonly': True}, + 'url': {'readonly': True}, + 'image': {'readonly': True}, + 'description': {'readonly': True}, + 'alternate_name': {'readonly': True}, + 'bing_id': {'readonly': True}, + 'thumbnail_url': {'readonly': True}, + 'provider': {'readonly': True}, + 'text': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'read_link': {'key': 'readLink', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'image': {'key': 'image', 'type': 'ImageObject'}, + 'description': {'key': 'description', 'type': 'str'}, + 'alternate_name': {'key': 'alternateName', 'type': 'str'}, + 'bing_id': {'key': 'bingId', 'type': 'str'}, + 'thumbnail_url': {'key': 'thumbnailUrl', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': '[Thing]'}, + 'text': {'key': 'text', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(WebPage, self).__init__(**kwargs) + self._type = 'WebPage' diff --git a/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/web_page_py3.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/web_page_py3.py new file mode 100644 index 000000000000..4a1f42b7355c --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/models/web_page_py3.py @@ -0,0 +1,88 @@ +# 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 .creative_work_py3 import CreativeWork + + +class WebPage(CreativeWork): + """Defines a webpage that is relevant to the query. + + 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 + :ivar read_link: The URL that returns this resource. + :vartype read_link: str + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + :ivar name: The name of the thing represented by this object. + :vartype name: str + :ivar url: The URL to get more information about the thing represented by + this object. + :vartype url: str + :ivar image: An image of the item. + :vartype image: + ~azure.cognitiveservices.search.customimagesearch.models.ImageObject + :ivar description: A short description of the item. + :vartype description: str + :ivar alternate_name: An alias for the item + :vartype alternate_name: str + :ivar bing_id: An ID that uniquely identifies this item. + :vartype bing_id: str + :ivar thumbnail_url: The URL to a thumbnail of the item. + :vartype thumbnail_url: str + :ivar provider: The source of the creative work. + :vartype provider: + list[~azure.cognitiveservices.search.customimagesearch.models.Thing] + :ivar text: Text content of this creative work + :vartype text: str + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'read_link': {'readonly': True}, + 'web_search_url': {'readonly': True}, + 'name': {'readonly': True}, + 'url': {'readonly': True}, + 'image': {'readonly': True}, + 'description': {'readonly': True}, + 'alternate_name': {'readonly': True}, + 'bing_id': {'readonly': True}, + 'thumbnail_url': {'readonly': True}, + 'provider': {'readonly': True}, + 'text': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'read_link': {'key': 'readLink', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'image': {'key': 'image', 'type': 'ImageObject'}, + 'description': {'key': 'description', 'type': 'str'}, + 'alternate_name': {'key': 'alternateName', 'type': 'str'}, + 'bing_id': {'key': 'bingId', 'type': 'str'}, + 'thumbnail_url': {'key': 'thumbnailUrl', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': '[Thing]'}, + 'text': {'key': 'text', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(WebPage, self).__init__(**kwargs) + self._type = 'WebPage' diff --git a/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/operations/__init__.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/operations/__init__.py new file mode 100644 index 000000000000..ce2670033a78 --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/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 .custom_instance_operations import CustomInstanceOperations + +__all__ = [ + 'CustomInstanceOperations', +] diff --git a/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/operations/custom_instance_operations.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/operations/custom_instance_operations.py new file mode 100644 index 000000000000..33932205668c --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/operations/custom_instance_operations.py @@ -0,0 +1,498 @@ +# 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.pipeline import ClientRawResponse + +from .. import models + + +class CustomInstanceOperations(object): + """CustomInstanceOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar x_bing_apis_sdk: Activate swagger compliance. Constant value: "true". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + + self.config = config + self.x_bing_apis_sdk = "true" + + def image_search( + self, custom_config, query, accept_language=None, user_agent=None, client_id=None, client_ip=None, location=None, aspect=None, color=None, country_code=None, count=None, freshness=None, height=None, id=None, image_content=None, image_type=None, license=None, market=None, max_file_size=None, max_height=None, max_width=None, min_file_size=None, min_height=None, min_width=None, offset=None, safe_search=None, size=None, set_lang=None, width=None, custom_headers=None, raw=False, **operation_config): + """The Custom Image Search API lets you send an image search query to Bing + and get image results found in your custom view of the web. + + :param custom_config: The identifier for the custom search + configuration + :type custom_config: str + :param query: The user's search query term. The term cannot be empty. + The term may contain [Bing Advanced + Operators](http://msdn.microsoft.com/library/ff795620.aspx). For + example, to limit images to a specific domain, use the + [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. To + help improve relevance of an insights query (see + [insightsToken](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#insightstoken)), + you should always include the user's query term. Use this parameter + only with the Image Search API.Do not specify this parameter when + calling the Trending Images API. + :type query: str + :param accept_language: A comma-delimited list of one or more + languages to use for user interface strings. The list is in decreasing + order of preference. For additional information, including expected + format, see + [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). + This header and the + [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#setlang) + query parameter are mutually exclusive; do not specify both. If you + set this header, you must also specify the + [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#cc) + query parameter. To determine the market to return results for, Bing + uses the first supported language it finds from the list and combines + it with the cc parameter value. If the list does not include a + supported language, Bing finds the closest language and market that + supports the request or it uses an aggregated or default market for + the results. To determine the market that Bing used, see the + BingAPIs-Market header. Use this header and the cc query parameter + only if you specify multiple languages. Otherwise, use the + [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#mkt) + and + [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#setlang) + query parameters. A user interface string is a string that's used as a + label in a user interface. There are few user interface strings in the + JSON response objects. Any links to Bing.com properties in the + response objects apply the specified language. + :type accept_language: str + :param user_agent: The user agent originating the request. Bing uses + the user agent to provide mobile users with an optimized experience. + Although optional, you are encouraged to always specify this header. + The user-agent should be the same string that any commonly used + browser sends. For information about user agents, see [RFC + 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The + following are examples of user-agent strings. Windows Phone: + Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; + IEMobile/10.0; ARM; Touch; NOKIA; Lumia 822). Android: Mozilla / 5.0 + (Linux; U; Android 2.3.5; en - us; SCH - I500 Build / GINGERBREAD) + AppleWebKit / 533.1 (KHTML; like Gecko) Version / 4.0 Mobile Safari / + 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) + AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142 iPhone4; 1 + BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3; + WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 + (iPad; CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like + Gecko) Version / 7.0 Mobile / 11A465 Safari / 9537.53 + :type user_agent: str + :param client_id: Bing uses this header to provide users with + consistent behavior across Bing API calls. Bing often flights new + features and improvements, and it uses the client ID as a key for + assigning traffic on different flights. If you do not use the same + client ID for a user across multiple requests, then Bing may assign + the user to multiple conflicting flights. Being assigned to multiple + conflicting flights can lead to an inconsistent user experience. For + example, if the second request has a different flight assignment than + the first, the experience may be unexpected. Also, Bing can use the + client ID to tailor web results to that client ID’s search history, + providing a richer experience for the user. Bing also uses this header + to help improve result rankings by analyzing the activity generated by + a client ID. The relevance improvements help with better quality of + results delivered by Bing APIs and in turn enables higher + click-through rates for the API consumer. IMPORTANT: Although + optional, you should consider this header required. Persisting the + client ID across multiple requests for the same end user and device + combination enables 1) the API consumer to receive a consistent user + experience, and 2) higher click-through rates via better quality of + results from the Bing APIs. Each user that uses your application on + the device must have a unique, Bing generated client ID. If you do not + include this header in the request, Bing generates an ID and returns + it in the X-MSEdge-ClientID response header. The only time that you + should NOT include this header in a request is the first time the user + uses your app on that device. Use the client ID for each Bing API + request that your app makes for this user on the device. Persist the + client ID. To persist the ID in a browser app, use a persistent HTTP + cookie to ensure the ID is used across all sessions. Do not use a + session cookie. For other apps such as mobile apps, use the device's + persistent storage to persist the ID. The next time the user uses your + app on that device, get the client ID that you persisted. Bing + responses may or may not include this header. If the response includes + this header, capture the client ID and use it for all subsequent Bing + requests for the user on that device. If you include the + X-MSEdge-ClientID, you must not include cookies in the request. + :type client_id: str + :param client_ip: The IPv4 or IPv6 address of the client device. The + IP address is used to discover the user's location. Bing uses the + location information to determine safe search behavior. Although + optional, you are encouraged to always specify this header and the + X-Search-Location header. Do not obfuscate the address (for example, + by changing the last octet to 0). Obfuscating the address results in + the location not being anywhere near the device's actual location, + which may result in Bing serving erroneous results. + :type client_ip: str + :param location: A semicolon-delimited list of key/value pairs that + describe the client's geographical location. Bing uses the location + information to determine safe search behavior and to return relevant + local content. Specify the key/value pair as :. The + following are the keys that you use to specify the user's location. + lat (required): The latitude of the client's location, in degrees. The + latitude must be greater than or equal to -90.0 and less than or equal + to +90.0. Negative values indicate southern latitudes and positive + values indicate northern latitudes. long (required): The longitude of + the client's location, in degrees. The longitude must be greater than + or equal to -180.0 and less than or equal to +180.0. Negative values + indicate western longitudes and positive values indicate eastern + longitudes. re (required): The radius, in meters, which specifies the + horizontal accuracy of the coordinates. Pass the value returned by the + device's location service. Typical values might be 22m for GPS/Wi-Fi, + 380m for cell tower triangulation, and 18,000m for reverse IP lookup. + ts (optional): The UTC UNIX timestamp of when the client was at the + location. (The UNIX timestamp is the number of seconds since January + 1, 1970.) head (optional): The client's relative heading or direction + of travel. Specify the direction of travel as degrees from 0 through + 360, counting clockwise relative to true north. Specify this key only + if the sp key is nonzero. sp (optional): The horizontal velocity + (speed), in meters per second, that the client device is traveling. + alt (optional): The altitude of the client device, in meters. are + (optional): The radius, in meters, that specifies the vertical + accuracy of the coordinates. Specify this key only if you specify the + alt key. Although many of the keys are optional, the more information + that you provide, the more accurate the location results are. Although + optional, you are encouraged to always specify the user's geographical + location. Providing the location is especially important if the + client's IP address does not accurately reflect the user's physical + location (for example, if the client uses VPN). For optimal results, + you should include this header and the X-MSEdge-ClientIP header, but + at a minimum, you should include this header. + :type location: str + :param aspect: Filter images by the following aspect ratios. All: Do + not filter by aspect.Specifying this value is the same as not + specifying the aspect parameter. Square: Return images with standard + aspect ratio. Wide: Return images with wide screen aspect ratio. Tall: + Return images with tall aspect ratio. Possible values include: 'All', + 'Square', 'Wide', 'Tall' + :type aspect: str or + ~azure.cognitiveservices.search.customimagesearch.models.ImageAspect + :param color: Filter images by the following color options. ColorOnly: + Return color images. Monochrome: Return black and white images. Return + images with one of the following dominant colors: Black, Blue, Brown, + Gray, Green, Orange, Pink, Purple, Red, Teal, White, Yellow. Possible + values include: 'ColorOnly', 'Monochrome', 'Black', 'Blue', 'Brown', + 'Gray', 'Green', 'Orange', 'Pink', 'Purple', 'Red', 'Teal', 'White', + 'Yellow' + :type color: str or + ~azure.cognitiveservices.search.customimagesearch.models.ImageColor + :param country_code: A 2-character country code of the country where + the results come from. For a list of possible values, see [Market + Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes). + If you set this parameter, you must also specify the + [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#acceptlanguage) + header. Bing uses the first supported language it finds from the + languages list, and combine that language with the country code that + you specify to determine the market to return results for. If the + languages list does not include a supported language, Bing finds the + closest language and market that supports the request, or it may use + an aggregated or default market for the results instead of a specified + one. You should use this query parameter and the Accept-Language query + parameter only if you specify multiple languages; otherwise, you + should use the mkt and setLang query parameters. This parameter and + the + [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#mkt) + query parameter are mutually exclusive—do not specify both. + :type country_code: str + :param count: The number of images to return in the response. The + actual number delivered may be less than requested. The default is 35. + The maximum value is 150. You use this parameter along with the offset + parameter to page results.For example, if your user interface displays + 20 images per page, set count to 20 and offset to 0 to get the first + page of results.For each subsequent page, increment offset by 20 (for + example, 0, 20, 40). Use this parameter only with the Image Search + API.Do not specify this parameter when calling the Insights, Trending + Images, or Web Search APIs. + :type count: int + :param freshness: Filter images by the following discovery options. + Day: Return images discovered by Bing within the last 24 hours. Week: + Return images discovered by Bing within the last 7 days. Month: Return + images discovered by Bing within the last 30 days. Possible values + include: 'Day', 'Week', 'Month' + :type freshness: str or + ~azure.cognitiveservices.search.customimagesearch.models.Freshness + :param height: Filter images that have the specified height, in + pixels. You may use this filter with the size filter to return small + images that have a height of 150 pixels. + :type height: int + :param id: An ID that uniquely identifies an image. Use this parameter + to ensure that the specified image is the first image in the list of + images that Bing returns. The + [Image](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#image) + object's imageId field contains the ID that you set this parameter to. + :type id: str + :param image_content: Filter images by the following content types. + Face: Return images that show only a person's face. Portrait: Return + images that show only a person's head and shoulders. Possible values + include: 'Face', 'Portrait' + :type image_content: str or + ~azure.cognitiveservices.search.customimagesearch.models.ImageContent + :param image_type: Filter images by the following image types. + AnimatedGif: Return only animated GIFs. Clipart: Return only clip art + images. Line: Return only line drawings. Photo: Return only + photographs(excluding line drawings, animated Gifs, and clip art). + Shopping: Return only images that contain items where Bing knows of a + merchant that is selling the items. This option is valid in the en - + US market only.Transparent: Return only images with a transparent + background. Possible values include: 'AnimatedGif', 'Clipart', 'Line', + 'Photo', 'Shopping', 'Transparent' + :type image_type: str or + ~azure.cognitiveservices.search.customimagesearch.models.ImageType + :param license: Filter images by the following license types. All: Do + not filter by license type.Specifying this value is the same as not + specifying the license parameter. Any: Return images that are under + any license type. The response doesn't include images that do not + specify a license or the license is unknown. Public: Return images + where the creator has waived their exclusive rights, to the fullest + extent allowed by law. Share: Return images that may be shared with + others. Changing or editing the image might not be allowed. Also, + modifying, sharing, and using the image for commercial purposes might + not be allowed. Typically, this option returns the most images. + ShareCommercially: Return images that may be shared with others for + personal or commercial purposes. Changing or editing the image might + not be allowed. Modify: Return images that may be modified, shared, + and used. Changing or editing the image might not be allowed. + Modifying, sharing, and using the image for commercial purposes might + not be allowed. ModifyCommercially: Return images that may be + modified, shared, and used for personal or commercial purposes. + Typically, this option returns the fewest images. For more information + about these license types, see [Filter Images By License + Type](http://go.microsoft.com/fwlink/?LinkId=309768). Possible values + include: 'All', 'Any', 'Public', 'Share', 'ShareCommercially', + 'Modify', 'ModifyCommercially' + :type license: str or + ~azure.cognitiveservices.search.customimagesearch.models.ImageLicense + :param market: The market where the results come from. Typically, mkt + is the country where the user is making the request from. However, it + could be a different country if the user is not located in a country + where Bing delivers results. The market must be in the form -. For example, en-US. The string is case + insensitive. For a list of possible market values, see [Market + Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes). + NOTE: If known, you are encouraged to always specify the market. + Specifying the market helps Bing route the request and return an + appropriate and optimal response. If you specify a market that is not + listed in [Market + Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes), + Bing uses a best fit market code based on an internal mapping that is + subject to change. This parameter and the + [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#cc) + query parameter are mutually exclusive—do not specify both. + :type market: str + :param max_file_size: Filter images that are less than or equal to the + specified file size. The maximum file size that you may specify is + 520,192 bytes. If you specify a larger value, the API uses 520,192. It + is possible that the response may include images that are slightly + larger than the specified maximum. You may specify this filter and + minFileSize to filter images within a range of file sizes. + :type max_file_size: long + :param max_height: Filter images that have a height that is less than + or equal to the specified height. Specify the height in pixels. You + may specify this filter and minHeight to filter images within a range + of heights. This filter and the height filter are mutually exclusive. + :type max_height: long + :param max_width: Filter images that have a width that is less than or + equal to the specified width. Specify the width in pixels. You may + specify this filter and maxWidth to filter images within a range of + widths. This filter and the width filter are mutually exclusive. + :type max_width: long + :param min_file_size: Filter images that are greater than or equal to + the specified file size. The maximum file size that you may specify is + 520,192 bytes. If you specify a larger value, the API uses 520,192. It + is possible that the response may include images that are slightly + smaller than the specified minimum. You may specify this filter and + maxFileSize to filter images within a range of file sizes. + :type min_file_size: long + :param min_height: Filter images that have a height that is greater + than or equal to the specified height. Specify the height in pixels. + You may specify this filter and maxHeight to filter images within a + range of heights. This filter and the height filter are mutually + exclusive. + :type min_height: long + :param min_width: Filter images that have a width that is greater than + or equal to the specified width. Specify the width in pixels. You may + specify this filter and maxWidth to filter images within a range of + widths. This filter and the width filter are mutually exclusive. + :type min_width: long + :param offset: The zero-based offset that indicates the number of + images to skip before returning images. The default is 0. The offset + should be less than + ([totalEstimatedMatches](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#totalestimatedmatches) + - count). Use this parameter along with the count parameter to page + results. For example, if your user interface displays 20 images per + page, set count to 20 and offset to 0 to get the first page of + results. For each subsequent page, increment offset by 20 (for + example, 0, 20, 40). It is possible for multiple pages to include some + overlap in results. To prevent duplicates, see + [nextOffset](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#nextoffset). + Use this parameter only with the Image API. Do not specify this + parameter when calling the Trending Images API or the Web Search API. + :type offset: long + :param safe_search: Filter images for adult content. The following are + the possible filter values. Off: May return images with adult content. + If the request is through the Image Search API, the response includes + thumbnail images that are clear (non-fuzzy). However, if the request + is through the Web Search API, the response includes thumbnail images + that are pixelated (fuzzy). Moderate: If the request is through the + Image Search API, the response doesn't include images with adult + content. If the request is through the Web Search API, the response + may include images with adult content (the thumbnail images are + pixelated (fuzzy)). Strict: Do not return images with adult content. + The default is Moderate. If the request comes from a market that + Bing's adult policy requires that safeSearch is set to Strict, Bing + ignores the safeSearch value and uses Strict. If you use the site: + query operator, there is the chance that the response may contain + adult content regardless of what the safeSearch query parameter is set + to. Use site: only if you are aware of the content on the site and + your scenario supports the possibility of adult content. Possible + values include: 'Off', 'Moderate', 'Strict' + :type safe_search: str or + ~azure.cognitiveservices.search.customimagesearch.models.SafeSearch + :param size: Filter images by the following sizes. All: Do not filter + by size. Specifying this value is the same as not specifying the size + parameter. Small: Return images that are less than 200x200 pixels. + Medium: Return images that are greater than or equal to 200x200 pixels + but less than 500x500 pixels. Large: Return images that are 500x500 + pixels or larger. Wallpaper: Return wallpaper images. You may use this + parameter along with the height or width parameters. For example, you + may use height and size to request small images that are 150 pixels + tall. Possible values include: 'All', 'Small', 'Medium', 'Large', + 'Wallpaper' + :type size: str or + ~azure.cognitiveservices.search.customimagesearch.models.ImageSize + :param set_lang: The language to use for user interface strings. + Specify the language using the ISO 639-1 2-letter language code. For + example, the language code for English is EN. The default is EN + (English). Although optional, you should always specify the language. + Typically, you set setLang to the same language specified by mkt + unless the user wants the user interface strings displayed in a + different language. This parameter and the + [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#acceptlanguage) + header are mutually exclusive; do not specify both. A user interface + string is a string that's used as a label in a user interface. There + are few user interface strings in the JSON response objects. Also, any + links to Bing.com properties in the response objects apply the + specified language. + :type set_lang: str + :param width: Filter images that have the specified width, in pixels. + You may use this filter with the size filter to return small images + that have a width of 150 pixels. + :type width: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Images or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.search.customimagesearch.models.Images or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.image_search.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['customConfig'] = self._serialize.query("custom_config", custom_config, 'str') + if aspect is not None: + query_parameters['aspect'] = self._serialize.query("aspect", aspect, 'str') + if color is not None: + query_parameters['color'] = self._serialize.query("color", color, 'str') + if country_code is not None: + query_parameters['cc'] = self._serialize.query("country_code", country_code, 'str') + if count is not None: + query_parameters['count'] = self._serialize.query("count", count, 'int') + if freshness is not None: + query_parameters['freshness'] = self._serialize.query("freshness", freshness, 'str') + if height is not None: + query_parameters['height'] = self._serialize.query("height", height, 'int') + if id is not None: + query_parameters['id'] = self._serialize.query("id", id, 'str') + if image_content is not None: + query_parameters['imageContent'] = self._serialize.query("image_content", image_content, 'str') + if image_type is not None: + query_parameters['imageType'] = self._serialize.query("image_type", image_type, 'str') + if license is not None: + query_parameters['license'] = self._serialize.query("license", license, 'str') + if market is not None: + query_parameters['mkt'] = self._serialize.query("market", market, 'str') + if max_file_size is not None: + query_parameters['maxFileSize'] = self._serialize.query("max_file_size", max_file_size, 'long') + if max_height is not None: + query_parameters['maxHeight'] = self._serialize.query("max_height", max_height, 'long') + if max_width is not None: + query_parameters['maxWidth'] = self._serialize.query("max_width", max_width, 'long') + if min_file_size is not None: + query_parameters['minFileSize'] = self._serialize.query("min_file_size", min_file_size, 'long') + if min_height is not None: + query_parameters['minHeight'] = self._serialize.query("min_height", min_height, 'long') + if min_width is not None: + query_parameters['minWidth'] = self._serialize.query("min_width", min_width, 'long') + if offset is not None: + query_parameters['offset'] = self._serialize.query("offset", offset, 'long') + query_parameters['q'] = self._serialize.query("query", query, 'str') + if safe_search is not None: + query_parameters['safeSearch'] = self._serialize.query("safe_search", safe_search, 'str') + if size is not None: + query_parameters['size'] = self._serialize.query("size", size, 'str') + if set_lang is not None: + query_parameters['setLang'] = self._serialize.query("set_lang", set_lang, 'str') + if width is not None: + query_parameters['width'] = self._serialize.query("width", width, 'int') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + header_parameters['X-BingApis-SDK'] = self._serialize.header("self.x_bing_apis_sdk", self.x_bing_apis_sdk, 'str') + if accept_language is not None: + header_parameters['Accept-Language'] = self._serialize.header("accept_language", accept_language, 'str') + if user_agent is not None: + header_parameters['User-Agent'] = self._serialize.header("user_agent", user_agent, 'str') + if client_id is not None: + header_parameters['X-MSEdge-ClientID'] = self._serialize.header("client_id", client_id, 'str') + if client_ip is not None: + header_parameters['X-MSEdge-ClientIP'] = self._serialize.header("client_ip", client_ip, 'str') + if location is not None: + header_parameters['X-Search-Location'] = self._serialize.header("location", location, 'str') + + # Construct and send request + request = self._client.get(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('Images', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + image_search.metadata = {'url': '/images/search'} diff --git a/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/version.py b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/version.py new file mode 100644 index 000000000000..63d89bfb54fa --- /dev/null +++ b/azure-cognitiveservices-search-customimagesearch/azure/cognitiveservices/search/customimagesearch/version.py @@ -0,0 +1,13 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "1.0" + diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/__init__.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/__init__.py index fd6c0d40bb86..5e34711b52be 100644 --- a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/__init__.py +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/__init__.py @@ -9,10 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .custom_search_api import CustomSearchAPI +from .custom_search_client import CustomSearchClient from .version import VERSION -__all__ = ['CustomSearchAPI'] +__all__ = ['CustomSearchClient'] __version__ = VERSION diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/custom_search_api.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/custom_search_client.py similarity index 83% rename from azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/custom_search_api.py rename to azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/custom_search_client.py index 4804fae6a637..ce11760e895c 100644 --- a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/custom_search_api.py +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/custom_search_client.py @@ -9,15 +9,15 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import ServiceClient +from msrest.service_client import SDKClient from msrest import Configuration, Serializer, Deserializer from .version import VERSION from .operations.custom_instance_operations import CustomInstanceOperations from . import models -class CustomSearchAPIConfiguration(Configuration): - """Configuration for CustomSearchAPI +class CustomSearchClientConfiguration(Configuration): + """Configuration for CustomSearchClient Note that all parameters used to create this instance are saved as instance attributes. @@ -35,18 +35,18 @@ def __init__( if not base_url: base_url = 'https://api.cognitive.microsoft.com/bingcustomsearch/v7.0' - super(CustomSearchAPIConfiguration, self).__init__(base_url) + super(CustomSearchClientConfiguration, self).__init__(base_url) self.add_user_agent('azure-cognitiveservices-search-customsearch/{}'.format(VERSION)) self.credentials = credentials -class CustomSearchAPI(object): +class CustomSearchClient(SDKClient): """The Bing Custom Search API lets you send a search query to Bing and get back search results customized to meet your custom search definition. :ivar config: Configuration for client. - :vartype config: CustomSearchAPIConfiguration + :vartype config: CustomSearchClientConfiguration :ivar custom_instance: CustomInstance operations :vartype custom_instance: azure.cognitiveservices.search.customsearch.operations.CustomInstanceOperations @@ -60,8 +60,8 @@ class CustomSearchAPI(object): def __init__( self, credentials, base_url=None): - self.config = CustomSearchAPIConfiguration(credentials, base_url) - self._client = ServiceClient(self.config.credentials, self.config) + self.config = CustomSearchClientConfiguration(credentials, base_url) + super(CustomSearchClient, 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' diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/__init__.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/__init__.py index c8ae3f2bd636..291919880acb 100644 --- a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/__init__.py +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/__init__.py @@ -9,22 +9,39 @@ # regenerated. # -------------------------------------------------------------------------- -from .query_context import QueryContext -from .web_meta_tag import WebMetaTag -from .web_page import WebPage -from .web_web_answer import WebWebAnswer -from .search_response import SearchResponse -from .response import Response -from .search_results_answer import SearchResultsAnswer -from .identifiable import Identifiable -from .error import Error -from .error_response import ErrorResponse, ErrorResponseException -from .query import Query -from .answer import Answer -from .thing import Thing -from .creative_work import CreativeWork -from .response_base import ResponseBase -from .custom_search_api_enums import ( +try: + from .query_context_py3 import QueryContext + from .web_meta_tag_py3 import WebMetaTag + from .web_page_py3 import WebPage + from .web_web_answer_py3 import WebWebAnswer + from .search_response_py3 import SearchResponse + from .response_py3 import Response + from .search_results_answer_py3 import SearchResultsAnswer + from .identifiable_py3 import Identifiable + from .error_py3 import Error + from .error_response_py3 import ErrorResponse, ErrorResponseException + from .query_py3 import Query + from .answer_py3 import Answer + from .thing_py3 import Thing + from .creative_work_py3 import CreativeWork + from .response_base_py3 import ResponseBase +except (SyntaxError, ImportError): + from .query_context import QueryContext + from .web_meta_tag import WebMetaTag + from .web_page import WebPage + from .web_web_answer import WebWebAnswer + from .search_response import SearchResponse + from .response import Response + from .search_results_answer import SearchResultsAnswer + from .identifiable import Identifiable + from .error import Error + from .error_response import ErrorResponse, ErrorResponseException + from .query import Query + from .answer import Answer + from .thing import Thing + from .creative_work import CreativeWork + from .response_base import ResponseBase +from .custom_search_client_enums import ( ErrorCode, ErrorSubCode, SafeSearch, diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/answer.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/answer.py index 50dd4581e363..643c7621a034 100644 --- a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/answer.py +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/answer.py @@ -21,7 +21,9 @@ class Answer(Response): Variables are only populated by the server, and will be ignored when sending a request. - :param _type: Constant filled by server. + 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 @@ -50,7 +52,7 @@ class Answer(Response): '_type': {'SearchResultsAnswer': 'SearchResultsAnswer'} } - def __init__(self): - super(Answer, self).__init__() + def __init__(self, **kwargs): + super(Answer, self).__init__(**kwargs) self.follow_up_queries = None self._type = 'Answer' diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/answer_py3.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/answer_py3.py new file mode 100644 index 000000000000..db1b9e6ef1d5 --- /dev/null +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/answer_py3.py @@ -0,0 +1,58 @@ +# 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_py3 import Response + + +class Answer(Response): + """Answer. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: SearchResultsAnswer + + 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 + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + :ivar follow_up_queries: + :vartype follow_up_queries: + list[~azure.cognitiveservices.search.customsearch.models.Query] + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'web_search_url': {'readonly': True}, + 'follow_up_queries': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + 'follow_up_queries': {'key': 'followUpQueries', 'type': '[Query]'}, + } + + _subtype_map = { + '_type': {'SearchResultsAnswer': 'SearchResultsAnswer'} + } + + def __init__(self, **kwargs) -> None: + super(Answer, self).__init__(**kwargs) + self.follow_up_queries = None + self._type = 'Answer' diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/creative_work.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/creative_work.py index 4c3f34256369..117fb6eb062e 100644 --- a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/creative_work.py +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/creative_work.py @@ -21,7 +21,9 @@ class CreativeWork(Thing): Variables are only populated by the server, and will be ignored when sending a request. - :param _type: Constant filled by server. + 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 @@ -75,8 +77,8 @@ class CreativeWork(Thing): '_type': {'WebPage': 'WebPage'} } - def __init__(self): - super(CreativeWork, self).__init__() + def __init__(self, **kwargs): + super(CreativeWork, self).__init__(**kwargs) self.thumbnail_url = None self.provider = None self.text = None diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/creative_work_py3.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/creative_work_py3.py new file mode 100644 index 000000000000..ae7d34b9ac3b --- /dev/null +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/creative_work_py3.py @@ -0,0 +1,85 @@ +# 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 .thing_py3 import Thing + + +class CreativeWork(Thing): + """CreativeWork. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: WebPage + + 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 + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + :ivar name: The name of the thing represented by this object. + :vartype name: str + :ivar url: The URL to get more information about the thing represented by + this object. + :vartype url: str + :ivar description: A short description of the item. + :vartype description: str + :ivar bing_id: An ID that uniquely identifies this item. + :vartype bing_id: str + :ivar thumbnail_url: The URL to a thumbnail of the item. + :vartype thumbnail_url: str + :ivar provider: The source of the creative work. + :vartype provider: + list[~azure.cognitiveservices.search.customsearch.models.Thing] + :ivar text: + :vartype text: str + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'web_search_url': {'readonly': True}, + 'name': {'readonly': True}, + 'url': {'readonly': True}, + 'description': {'readonly': True}, + 'bing_id': {'readonly': True}, + 'thumbnail_url': {'readonly': True}, + 'provider': {'readonly': True}, + 'text': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'bing_id': {'key': 'bingId', 'type': 'str'}, + 'thumbnail_url': {'key': 'thumbnailUrl', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': '[Thing]'}, + 'text': {'key': 'text', 'type': 'str'}, + } + + _subtype_map = { + '_type': {'WebPage': 'WebPage'} + } + + def __init__(self, **kwargs) -> None: + super(CreativeWork, self).__init__(**kwargs) + self.thumbnail_url = None + self.provider = None + self.text = None + self._type = 'CreativeWork' diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/custom_search_api_enums.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/custom_search_client_enums.py similarity index 91% rename from azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/custom_search_api_enums.py rename to azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/custom_search_client_enums.py index 5d369cb9be38..7cac41b1f38c 100644 --- a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/custom_search_api_enums.py +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/custom_search_client_enums.py @@ -12,7 +12,7 @@ from enum import Enum -class ErrorCode(Enum): +class ErrorCode(str, Enum): none = "None" server_error = "ServerError" @@ -22,7 +22,7 @@ class ErrorCode(Enum): insufficient_authorization = "InsufficientAuthorization" -class ErrorSubCode(Enum): +class ErrorSubCode(str, Enum): unexpected_error = "UnexpectedError" resource_error = "ResourceError" @@ -37,14 +37,14 @@ class ErrorSubCode(Enum): authorization_expired = "AuthorizationExpired" -class SafeSearch(Enum): +class SafeSearch(str, Enum): off = "Off" moderate = "Moderate" strict = "Strict" -class TextFormat(Enum): +class TextFormat(str, Enum): raw = "Raw" html = "Html" diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/error.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/error.py index 5e0da1332380..ca15821bf050 100644 --- a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/error.py +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/error.py @@ -18,8 +18,10 @@ class Error(Model): Variables are only populated by the server, and will be ignored when sending a request. - :param code: The error code that identifies the category of error. - Possible values include: 'None', 'ServerError', 'InvalidRequest', + 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 @@ -31,7 +33,7 @@ class Error(Model): 'AuthorizationRedundancy', 'AuthorizationDisabled', 'AuthorizationExpired' :vartype sub_code: str or ~azure.cognitiveservices.search.customsearch.models.ErrorSubCode - :param message: A description of the error. + :param message: Required. A description of the error. :type message: str :ivar more_details: A description that provides additional information about the error. @@ -60,11 +62,11 @@ class Error(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, message, code="None"): - super(Error, self).__init__() - self.code = code + def __init__(self, **kwargs): + super(Error, self).__init__(**kwargs) + self.code = kwargs.get('code', "None") self.sub_code = None - self.message = message + self.message = kwargs.get('message', None) self.more_details = None self.parameter = None self.value = None diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/error_py3.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/error_py3.py new file mode 100644 index 000000000000..e23c4cbb6054 --- /dev/null +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/error_py3.py @@ -0,0 +1,72 @@ +# 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.search.customsearch.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.search.customsearch.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/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/error_response.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/error_response.py index 5300a6937eb2..8c6c08da049d 100644 --- a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/error_response.py +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/error_response.py @@ -19,14 +19,16 @@ class ErrorResponse(Response): Variables are only populated by the server, and will be ignored when sending a request. - :param _type: Constant filled by server. + 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 :ivar web_search_url: The URL To Bing's search result for this item. :vartype web_search_url: str - :param errors: A list of errors that describe the reasons why the request - failed. + :param errors: Required. A list of errors that describe the reasons why + the request failed. :type errors: list[~azure.cognitiveservices.search.customsearch.models.Error] """ @@ -45,9 +47,9 @@ class ErrorResponse(Response): 'errors': {'key': 'errors', 'type': '[Error]'}, } - def __init__(self, errors): - super(ErrorResponse, self).__init__() - self.errors = errors + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.errors = kwargs.get('errors', None) self._type = 'ErrorResponse' diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/error_response_py3.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/error_response_py3.py new file mode 100644 index 000000000000..405e466ad93d --- /dev/null +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/error_response_py3.py @@ -0,0 +1,65 @@ +# 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_py3 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 + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + :param errors: Required. A list of errors that describe the reasons why + the request failed. + :type errors: + list[~azure.cognitiveservices.search.customsearch.models.Error] + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'web_search_url': {'readonly': True}, + 'errors': {'required': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', '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/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/identifiable.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/identifiable.py index 133e93fa8f94..513e53d238bb 100644 --- a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/identifiable.py +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/identifiable.py @@ -21,7 +21,9 @@ class Identifiable(ResponseBase): Variables are only populated by the server, and will be ignored when sending a request. - :param _type: Constant filled by server. + 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 @@ -41,7 +43,7 @@ class Identifiable(ResponseBase): '_type': {'Response': 'Response'} } - def __init__(self): - super(Identifiable, self).__init__() + def __init__(self, **kwargs): + super(Identifiable, self).__init__(**kwargs) self.id = None self._type = 'Identifiable' diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/identifiable_py3.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/identifiable_py3.py new file mode 100644 index 000000000000..2d24a2c45775 --- /dev/null +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/identifiable_py3.py @@ -0,0 +1,49 @@ +# 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_py3 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/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/query.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/query.py index adf7f2bbcef7..2cc49f11f355 100644 --- a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/query.py +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/query.py @@ -18,8 +18,10 @@ class Query(Model): Variables are only populated by the server, and will be ignored when sending a request. - :param text: The query string. Use this string as the query term in a new - search request. + All required parameters must be populated in order to send to Azure. + + :param text: Required. The query string. Use this string as the query term + in a new search request. :type text: str :ivar display_text: The display version of the query term. This version of the query term may contain special characters that highlight the search @@ -47,9 +49,9 @@ class Query(Model): 'search_link': {'key': 'searchLink', 'type': 'str'}, } - def __init__(self, text): - super(Query, self).__init__() - self.text = text + def __init__(self, **kwargs): + super(Query, self).__init__(**kwargs) + self.text = kwargs.get('text', None) self.display_text = None self.web_search_url = None self.search_link = None diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/query_context.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/query_context.py index 0a1be85aaef0..410f31e10e27 100644 --- a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/query_context.py +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/query_context.py @@ -18,7 +18,10 @@ class QueryContext(Model): Variables are only populated by the server, and will be ignored when sending a request. - :param original_query: The query string as specified in the request. + All required parameters must be populated in order to send to Azure. + + :param original_query: Required. The query string as specified in the + request. :type original_query: str :ivar altered_query: The query string used by Bing to perform the query. Bing uses the altered query string if the original query string contained @@ -53,9 +56,9 @@ class QueryContext(Model): 'adult_intent': {'key': 'adultIntent', 'type': 'bool'}, } - def __init__(self, original_query): - super(QueryContext, self).__init__() - self.original_query = original_query + def __init__(self, **kwargs): + super(QueryContext, self).__init__(**kwargs) + self.original_query = kwargs.get('original_query', None) self.altered_query = None self.alteration_override_query = None self.adult_intent = None diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/query_context_py3.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/query_context_py3.py new file mode 100644 index 000000000000..01c7f429d01e --- /dev/null +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/query_context_py3.py @@ -0,0 +1,64 @@ +# 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 QueryContext(Model): + """Defines the query context that Bing used for the 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 original_query: Required. The query string as specified in the + request. + :type original_query: str + :ivar altered_query: The query string used by Bing to perform the query. + Bing uses the altered query string if the original query string contained + spelling mistakes. For example, if the query string is "saling downwind", + the altered query string will be "sailing downwind". This field is + included only if the original query string contains a spelling mistake. + :vartype altered_query: str + :ivar alteration_override_query: The query string to use to force Bing to + use the original string. For example, if the query string is "saling + downwind", the override query string will be "+saling downwind". Remember + to encode the query string which results in "%2Bsaling+downwind". This + field is included only if the original query string contains a spelling + mistake. + :vartype alteration_override_query: str + :ivar adult_intent: A Boolean value that indicates whether the specified + query has adult intent. The value is true if the query has adult intent; + otherwise, false. + :vartype adult_intent: bool + """ + + _validation = { + 'original_query': {'required': True}, + 'altered_query': {'readonly': True}, + 'alteration_override_query': {'readonly': True}, + 'adult_intent': {'readonly': True}, + } + + _attribute_map = { + 'original_query': {'key': 'originalQuery', 'type': 'str'}, + 'altered_query': {'key': 'alteredQuery', 'type': 'str'}, + 'alteration_override_query': {'key': 'alterationOverrideQuery', 'type': 'str'}, + 'adult_intent': {'key': 'adultIntent', 'type': 'bool'}, + } + + def __init__(self, *, original_query: str, **kwargs) -> None: + super(QueryContext, self).__init__(**kwargs) + self.original_query = original_query + self.altered_query = None + self.alteration_override_query = None + self.adult_intent = None diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/query_py3.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/query_py3.py new file mode 100644 index 000000000000..059f963bc37f --- /dev/null +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/query_py3.py @@ -0,0 +1,57 @@ +# 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 Query(Model): + """Defines a search query. + + 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 text: Required. The query string. Use this string as the query term + in a new search request. + :type text: str + :ivar display_text: The display version of the query term. This version of + the query term may contain special characters that highlight the search + term found in the query string. The string contains the highlighting + characters only if the query enabled hit highlighting + :vartype display_text: str + :ivar web_search_url: The URL that takes the user to the Bing search + results page for the query.Only related search results include this field. + :vartype web_search_url: str + :ivar search_link: + :vartype search_link: str + """ + + _validation = { + 'text': {'required': True}, + 'display_text': {'readonly': True}, + 'web_search_url': {'readonly': True}, + 'search_link': {'readonly': True}, + } + + _attribute_map = { + 'text': {'key': 'text', 'type': 'str'}, + 'display_text': {'key': 'displayText', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + 'search_link': {'key': 'searchLink', 'type': 'str'}, + } + + def __init__(self, *, text: str, **kwargs) -> None: + super(Query, self).__init__(**kwargs) + self.text = text + self.display_text = None + self.web_search_url = None + self.search_link = None diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/response.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/response.py index 8f6f7ef2ed37..370004ddb0d7 100644 --- a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/response.py +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/response.py @@ -22,7 +22,9 @@ class Response(Identifiable): Variables are only populated by the server, and will be ignored when sending a request. - :param _type: Constant filled by server. + 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 @@ -46,7 +48,7 @@ class Response(Identifiable): '_type': {'SearchResponse': 'SearchResponse', 'ErrorResponse': 'ErrorResponse', 'Answer': 'Answer', 'Thing': 'Thing'} } - def __init__(self): - super(Response, self).__init__() + def __init__(self, **kwargs): + super(Response, self).__init__(**kwargs) self.web_search_url = None self._type = 'Response' diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/response_base.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/response_base.py index 0b5b11b43039..5a09ce0f95d6 100644 --- a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/response_base.py +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/response_base.py @@ -18,7 +18,9 @@ class ResponseBase(Model): You probably want to use the sub-classes and not this class directly. Known sub-classes are: Identifiable - :param _type: Constant filled by server. + All required parameters must be populated in order to send to Azure. + + :param _type: Required. Constant filled by server. :type _type: str """ @@ -34,6 +36,6 @@ class ResponseBase(Model): '_type': {'Identifiable': 'Identifiable'} } - def __init__(self): - super(ResponseBase, self).__init__() + def __init__(self, **kwargs): + super(ResponseBase, self).__init__(**kwargs) self._type = None diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/response_base_py3.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/response_base_py3.py new file mode 100644 index 000000000000..0ac9762f5cd7 --- /dev/null +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/response_base_py3.py @@ -0,0 +1,41 @@ +# 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/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/response_py3.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/response_py3.py new file mode 100644 index 000000000000..76fcfc583c01 --- /dev/null +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/response_py3.py @@ -0,0 +1,54 @@ +# 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_py3 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: SearchResponse, ErrorResponse, Answer, Thing + + 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 + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'web_search_url': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + } + + _subtype_map = { + '_type': {'SearchResponse': 'SearchResponse', 'ErrorResponse': 'ErrorResponse', 'Answer': 'Answer', 'Thing': 'Thing'} + } + + def __init__(self, **kwargs) -> None: + super(Response, self).__init__(**kwargs) + self.web_search_url = None + self._type = 'Response' diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/search_response.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/search_response.py index 6fe6dddaa472..3d3c95ef5424 100644 --- a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/search_response.py +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/search_response.py @@ -19,7 +19,9 @@ class SearchResponse(Response): Variables are only populated by the server, and will be ignored when sending a request. - :param _type: Constant filled by server. + 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 @@ -52,8 +54,8 @@ class SearchResponse(Response): 'web_pages': {'key': 'webPages', 'type': 'WebWebAnswer'}, } - def __init__(self): - super(SearchResponse, self).__init__() + def __init__(self, **kwargs): + super(SearchResponse, self).__init__(**kwargs) self.query_context = None self.web_pages = None self._type = 'SearchResponse' diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/search_response_py3.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/search_response_py3.py new file mode 100644 index 000000000000..ac1a9455a539 --- /dev/null +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/search_response_py3.py @@ -0,0 +1,61 @@ +# 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_py3 import Response + + +class SearchResponse(Response): + """Defines the top-level object that the response includes when the request + succeeds. + + 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 + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + :ivar query_context: An object that contains the query string that Bing + used for the request. This object contains the query string as entered by + the user. It may also contain an altered query string that Bing used for + the query if the query string contained a spelling mistake. + :vartype query_context: + ~azure.cognitiveservices.search.customsearch.models.QueryContext + :ivar web_pages: A list of webpages that are relevant to the search query. + :vartype web_pages: + ~azure.cognitiveservices.search.customsearch.models.WebWebAnswer + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'web_search_url': {'readonly': True}, + 'query_context': {'readonly': True}, + 'web_pages': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + 'query_context': {'key': 'queryContext', 'type': 'QueryContext'}, + 'web_pages': {'key': 'webPages', 'type': 'WebWebAnswer'}, + } + + def __init__(self, **kwargs) -> None: + super(SearchResponse, self).__init__(**kwargs) + self.query_context = None + self.web_pages = None + self._type = 'SearchResponse' diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/search_results_answer.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/search_results_answer.py index 3255878ef159..c0e0620953dd 100644 --- a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/search_results_answer.py +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/search_results_answer.py @@ -21,7 +21,9 @@ class SearchResultsAnswer(Answer): Variables are only populated by the server, and will be ignored when sending a request. - :param _type: Constant filled by server. + 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 @@ -65,8 +67,8 @@ class SearchResultsAnswer(Answer): '_type': {'Web/WebAnswer': 'WebWebAnswer'} } - def __init__(self): - super(SearchResultsAnswer, self).__init__() + def __init__(self, **kwargs): + super(SearchResultsAnswer, self).__init__(**kwargs) self.query_context = None self.total_estimated_matches = None self.is_family_friendly = None diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/search_results_answer_py3.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/search_results_answer_py3.py new file mode 100644 index 000000000000..678c7ab989cb --- /dev/null +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/search_results_answer_py3.py @@ -0,0 +1,75 @@ +# 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_py3 import Answer + + +class SearchResultsAnswer(Answer): + """SearchResultsAnswer. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: WebWebAnswer + + 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 + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + :ivar follow_up_queries: + :vartype follow_up_queries: + list[~azure.cognitiveservices.search.customsearch.models.Query] + :ivar query_context: + :vartype query_context: + ~azure.cognitiveservices.search.customsearch.models.QueryContext + :ivar total_estimated_matches: The estimated number of webpages that are + relevant to the query. Use this number along with the count and offset + query parameters to page the results. + :vartype total_estimated_matches: long + :ivar is_family_friendly: + :vartype is_family_friendly: bool + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'web_search_url': {'readonly': True}, + 'follow_up_queries': {'readonly': True}, + 'query_context': {'readonly': True}, + 'total_estimated_matches': {'readonly': True}, + 'is_family_friendly': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + 'follow_up_queries': {'key': 'followUpQueries', 'type': '[Query]'}, + 'query_context': {'key': 'queryContext', 'type': 'QueryContext'}, + 'total_estimated_matches': {'key': 'totalEstimatedMatches', 'type': 'long'}, + 'is_family_friendly': {'key': 'isFamilyFriendly', 'type': 'bool'}, + } + + _subtype_map = { + '_type': {'Web/WebAnswer': 'WebWebAnswer'} + } + + def __init__(self, **kwargs) -> None: + super(SearchResultsAnswer, self).__init__(**kwargs) + self.query_context = None + self.total_estimated_matches = None + self.is_family_friendly = None + self._type = 'SearchResultsAnswer' diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/thing.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/thing.py index d387cad847fd..9430456b9ff6 100644 --- a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/thing.py +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/thing.py @@ -21,7 +21,9 @@ class Thing(Response): Variables are only populated by the server, and will be ignored when sending a request. - :param _type: Constant filled by server. + 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 @@ -62,8 +64,8 @@ class Thing(Response): '_type': {'CreativeWork': 'CreativeWork'} } - def __init__(self): - super(Thing, self).__init__() + def __init__(self, **kwargs): + super(Thing, self).__init__(**kwargs) self.name = None self.url = None self.description = None diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/thing_py3.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/thing_py3.py new file mode 100644 index 000000000000..57b9aa17688c --- /dev/null +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/thing_py3.py @@ -0,0 +1,73 @@ +# 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_py3 import Response + + +class Thing(Response): + """Thing. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: CreativeWork + + 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 + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + :ivar name: The name of the thing represented by this object. + :vartype name: str + :ivar url: The URL to get more information about the thing represented by + this object. + :vartype url: str + :ivar description: A short description of the item. + :vartype description: str + :ivar bing_id: An ID that uniquely identifies this item. + :vartype bing_id: str + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'web_search_url': {'readonly': True}, + 'name': {'readonly': True}, + 'url': {'readonly': True}, + 'description': {'readonly': True}, + 'bing_id': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'bing_id': {'key': 'bingId', 'type': 'str'}, + } + + _subtype_map = { + '_type': {'CreativeWork': 'CreativeWork'} + } + + def __init__(self, **kwargs) -> None: + super(Thing, self).__init__(**kwargs) + self.name = None + self.url = None + self.description = None + self.bing_id = None + self._type = 'Thing' diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/web_meta_tag.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/web_meta_tag.py index 157658cda668..372f99be707a 100644 --- a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/web_meta_tag.py +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/web_meta_tag.py @@ -34,7 +34,7 @@ class WebMetaTag(Model): 'content': {'key': 'content', 'type': 'str'}, } - def __init__(self): - super(WebMetaTag, self).__init__() + def __init__(self, **kwargs): + super(WebMetaTag, self).__init__(**kwargs) self.name = None self.content = None diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/web_meta_tag_py3.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/web_meta_tag_py3.py new file mode 100644 index 000000000000..042a76bfb86d --- /dev/null +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/web_meta_tag_py3.py @@ -0,0 +1,40 @@ +# 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 WebMetaTag(Model): + """Defines a webpage's metadata. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: The metadata. + :vartype name: str + :ivar content: The name of the metadata. + :vartype content: str + """ + + _validation = { + 'name': {'readonly': True}, + 'content': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'content': {'key': 'content', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(WebMetaTag, self).__init__(**kwargs) + self.name = None + self.content = None diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/web_page.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/web_page.py index bc27ab16bd86..6fd7b5b9a7dd 100644 --- a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/web_page.py +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/web_page.py @@ -18,7 +18,9 @@ class WebPage(CreativeWork): Variables are only populated by the server, and will be ignored when sending a request. - :param _type: Constant filled by server. + 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 @@ -100,8 +102,8 @@ class WebPage(CreativeWork): 'search_tags': {'key': 'searchTags', 'type': '[WebMetaTag]'}, } - def __init__(self): - super(WebPage, self).__init__() + def __init__(self, **kwargs): + super(WebPage, self).__init__(**kwargs) self.display_url = None self.snippet = None self.deep_links = None diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/web_page_py3.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/web_page_py3.py new file mode 100644 index 000000000000..03765d9eef0f --- /dev/null +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/web_page_py3.py @@ -0,0 +1,112 @@ +# 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 .creative_work_py3 import CreativeWork + + +class WebPage(CreativeWork): + """Defines a webpage that is relevant to the query. + + 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 + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + :ivar name: The name of the thing represented by this object. + :vartype name: str + :ivar url: The URL to get more information about the thing represented by + this object. + :vartype url: str + :ivar description: A short description of the item. + :vartype description: str + :ivar bing_id: An ID that uniquely identifies this item. + :vartype bing_id: str + :ivar thumbnail_url: The URL to a thumbnail of the item. + :vartype thumbnail_url: str + :ivar provider: The source of the creative work. + :vartype provider: + list[~azure.cognitiveservices.search.customsearch.models.Thing] + :ivar text: + :vartype text: str + :ivar display_url: The display URL of the webpage. The URL is meant for + display purposes only and is not well formed. + :vartype display_url: str + :ivar snippet: A snippet of text from the webpage that describes its + contents. + :vartype snippet: str + :ivar deep_links: A list of links to related content that Bing found in + the website that contains this webpage. The Webpage object in this context + includes only the name, url, urlPingSuffix, and snippet fields. + :vartype deep_links: + list[~azure.cognitiveservices.search.customsearch.models.WebPage] + :ivar date_last_crawled: The last time that Bing crawled the webpage. The + date is in the form, YYYY-MM-DDTHH:MM:SS. For example, + 2015-04-13T05:23:39. + :vartype date_last_crawled: str + :ivar search_tags: A list of search tags that the webpage owner specified + on the webpage. The API returns only indexed search tags. The name field + of the MetaTag object contains the indexed search tag. Search tags begin + with search.* (for example, search.assetId). The content field contains + the tag's value. + :vartype search_tags: + list[~azure.cognitiveservices.search.customsearch.models.WebMetaTag] + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'web_search_url': {'readonly': True}, + 'name': {'readonly': True}, + 'url': {'readonly': True}, + 'description': {'readonly': True}, + 'bing_id': {'readonly': True}, + 'thumbnail_url': {'readonly': True}, + 'provider': {'readonly': True}, + 'text': {'readonly': True}, + 'display_url': {'readonly': True}, + 'snippet': {'readonly': True}, + 'deep_links': {'readonly': True}, + 'date_last_crawled': {'readonly': True}, + 'search_tags': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'bing_id': {'key': 'bingId', 'type': 'str'}, + 'thumbnail_url': {'key': 'thumbnailUrl', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': '[Thing]'}, + 'text': {'key': 'text', 'type': 'str'}, + 'display_url': {'key': 'displayUrl', 'type': 'str'}, + 'snippet': {'key': 'snippet', 'type': 'str'}, + 'deep_links': {'key': 'deepLinks', 'type': '[WebPage]'}, + 'date_last_crawled': {'key': 'dateLastCrawled', 'type': 'str'}, + 'search_tags': {'key': 'searchTags', 'type': '[WebMetaTag]'}, + } + + def __init__(self, **kwargs) -> None: + super(WebPage, self).__init__(**kwargs) + self.display_url = None + self.snippet = None + self.deep_links = None + self.date_last_crawled = None + self.search_tags = None + self._type = 'WebPage' diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/web_web_answer.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/web_web_answer.py index f2cf3706b1f3..8a28c6c9273f 100644 --- a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/web_web_answer.py +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/web_web_answer.py @@ -18,7 +18,9 @@ class WebWebAnswer(SearchResultsAnswer): Variables are only populated by the server, and will be ignored when sending a request. - :param _type: Constant filled by server. + 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 @@ -36,7 +38,7 @@ class WebWebAnswer(SearchResultsAnswer): :vartype total_estimated_matches: long :ivar is_family_friendly: :vartype is_family_friendly: bool - :param value: A list of webpages that are relevant to the query. + :param value: Required. A list of webpages that are relevant to the query. :type value: list[~azure.cognitiveservices.search.customsearch.models.WebPage] :ivar some_results_removed: A Boolean value that indicates whether the @@ -69,8 +71,8 @@ class WebWebAnswer(SearchResultsAnswer): 'some_results_removed': {'key': 'someResultsRemoved', 'type': 'bool'}, } - def __init__(self, value): - super(WebWebAnswer, self).__init__() - self.value = value + def __init__(self, **kwargs): + super(WebWebAnswer, self).__init__(**kwargs) + self.value = kwargs.get('value', None) self.some_results_removed = None self._type = 'Web/WebAnswer' diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/web_web_answer_py3.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/web_web_answer_py3.py new file mode 100644 index 000000000000..62bedaaa5da3 --- /dev/null +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/web_web_answer_py3.py @@ -0,0 +1,78 @@ +# 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 .search_results_answer_py3 import SearchResultsAnswer + + +class WebWebAnswer(SearchResultsAnswer): + """Defines a list of relevant webpage links. + + 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 + :ivar web_search_url: The URL To Bing's search result for this item. + :vartype web_search_url: str + :ivar follow_up_queries: + :vartype follow_up_queries: + list[~azure.cognitiveservices.search.customsearch.models.Query] + :ivar query_context: + :vartype query_context: + ~azure.cognitiveservices.search.customsearch.models.QueryContext + :ivar total_estimated_matches: The estimated number of webpages that are + relevant to the query. Use this number along with the count and offset + query parameters to page the results. + :vartype total_estimated_matches: long + :ivar is_family_friendly: + :vartype is_family_friendly: bool + :param value: Required. A list of webpages that are relevant to the query. + :type value: + list[~azure.cognitiveservices.search.customsearch.models.WebPage] + :ivar some_results_removed: A Boolean value that indicates whether the + response excluded some results from the answer. If Bing excluded some + results, the value is true. + :vartype some_results_removed: bool + """ + + _validation = { + '_type': {'required': True}, + 'id': {'readonly': True}, + 'web_search_url': {'readonly': True}, + 'follow_up_queries': {'readonly': True}, + 'query_context': {'readonly': True}, + 'total_estimated_matches': {'readonly': True}, + 'is_family_friendly': {'readonly': True}, + 'value': {'required': True}, + 'some_results_removed': {'readonly': True}, + } + + _attribute_map = { + '_type': {'key': '_type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'web_search_url': {'key': 'webSearchUrl', 'type': 'str'}, + 'follow_up_queries': {'key': 'followUpQueries', 'type': '[Query]'}, + 'query_context': {'key': 'queryContext', 'type': 'QueryContext'}, + 'total_estimated_matches': {'key': 'totalEstimatedMatches', 'type': 'long'}, + 'is_family_friendly': {'key': 'isFamilyFriendly', 'type': 'bool'}, + 'value': {'key': 'value', 'type': '[WebPage]'}, + 'some_results_removed': {'key': 'someResultsRemoved', 'type': 'bool'}, + } + + def __init__(self, *, value, **kwargs) -> None: + super(WebWebAnswer, self).__init__(**kwargs) + self.value = value + self.some_results_removed = None + self._type = 'Web/WebAnswer' diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/operations/custom_instance_operations.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/operations/custom_instance_operations.py index cf2e0a63be67..a90c6bfb63b3 100644 --- a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/operations/custom_instance_operations.py +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/operations/custom_instance_operations.py @@ -36,10 +36,13 @@ def __init__(self, client, config, serializer, deserializer): self.x_bing_apis_sdk = "true" def search( - self, query, accept_language=None, user_agent=None, client_id=None, client_ip=None, location=None, custom_config=None, country_code=None, count=None, market="en-us", offset=None, safe_search=None, set_lang=None, text_decorations=None, text_format=None, custom_headers=None, raw=False, **operation_config): + self, custom_config, query, accept_language=None, user_agent=None, client_id=None, client_ip=None, location=None, country_code=None, count=None, market="en-us", offset=None, safe_search=None, set_lang=None, text_decorations=None, text_format=None, custom_headers=None, raw=False, **operation_config): """The Custom Search API lets you send a search query to Bing and get back web pages found in your custom view of the web. + :param custom_config: The identifier for the custom search + configuration + :type custom_config: str :param query: The user's search query term. The term may not be empty. The term may contain Bing Advanced Operators. For example, to limit results to a specific domain, use the site: operator. @@ -151,9 +154,6 @@ def search( you should include this header and the X-MSEdge-ClientIP header, but at a minimum, you should include this header. :type location: str - :param custom_config: The identifier for the custom search - configuration - :type custom_config: int :param country_code: A 2-character country code of the country where the results come from. This API supports only the United States market. If you specify this query parameter, it must be set to us. If @@ -258,12 +258,11 @@ def search( :class:`ErrorResponseException` """ # Construct URL - url = '/search' + url = self.search.metadata['url'] # Construct parameters query_parameters = {} - if custom_config is not None: - query_parameters['customConfig'] = self._serialize.query("custom_config", custom_config, 'int') + query_parameters['customConfig'] = self._serialize.query("custom_config", custom_config, 'str') if country_code is not None: query_parameters['cc'] = self._serialize.query("country_code", country_code, 'str') if count is not None: @@ -284,7 +283,7 @@ def search( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) header_parameters['X-BingApis-SDK'] = self._serialize.header("self.x_bing_apis_sdk", self.x_bing_apis_sdk, 'str') @@ -300,8 +299,8 @@ def search( header_parameters['X-Search-Location'] = self._serialize.header("location", location, 'str') # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(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) @@ -316,3 +315,4 @@ def search( return client_raw_response return deserialized + search.metadata = {'url': '/search'} diff --git a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/version.py b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/version.py index e0ec669828cb..63d89bfb54fa 100644 --- a/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/version.py +++ b/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.1.0" +VERSION = "1.0"