diff --git a/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/__init__.py b/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/__init__.py index 5e80d0a867cd..0277a4eb3d1f 100644 --- a/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/__init__.py +++ b/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/__init__.py @@ -9,10 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .visual_search_api import VisualSearchAPI +from .visual_search_client import VisualSearchClient from .version import VERSION -__all__ = ['VisualSearchAPI'] +__all__ = ['VisualSearchClient'] __version__ = VERSION diff --git a/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/models/__init__.py b/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/models/__init__.py index c7c9a1729533..ff286cc5c9e5 100644 --- a/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/models/__init__.py +++ b/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/models/__init__.py @@ -93,7 +93,7 @@ from .filters import Filters from .knowledge_request import KnowledgeRequest from .visual_search_request import VisualSearchRequest -from .visual_search_api_enums import ( +from .visual_search_client_enums import ( Currency, ItemAvailability, ErrorCode, diff --git a/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/models/image_object.py b/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/models/image_object.py index af54a220f5bb..65d5847fa39e 100644 --- a/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/models/image_object.py +++ b/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/models/image_object.py @@ -83,7 +83,7 @@ class ImageObject(MediaObject): image is of an apple pie, this object includes a count of the number of websites where you can buy an apple pie. To indicate the number of offers in your UX, include badging such as a shopping cart icon that contains the - count. When the user clicks on the icon, use imageInisghtsToken in a + count. When the user clicks on the icon, use imageInsightsToken in a subsequent Visual Search API call to get the list of shopping websites. :vartype insights_metadata: ~azure.cognitiveservices.search.visualsearch.models.ImagesImageMetadata @@ -93,7 +93,7 @@ class ImageObject(MediaObject): 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: For interal use only. + :ivar visual_words: For internal use only. :vartype visual_words: str """ diff --git a/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/models/image_object_py3.py b/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/models/image_object_py3.py index 3e211afcb446..fc1ff56628b0 100644 --- a/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/models/image_object_py3.py +++ b/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/models/image_object_py3.py @@ -83,7 +83,7 @@ class ImageObject(MediaObject): image is of an apple pie, this object includes a count of the number of websites where you can buy an apple pie. To indicate the number of offers in your UX, include badging such as a shopping cart icon that contains the - count. When the user clicks on the icon, use imageInisghtsToken in a + count. When the user clicks on the icon, use imageInsightsToken in a subsequent Visual Search API call to get the list of shopping websites. :vartype insights_metadata: ~azure.cognitiveservices.search.visualsearch.models.ImagesImageMetadata @@ -93,7 +93,7 @@ class ImageObject(MediaObject): 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: For interal use only. + :ivar visual_words: For internal use only. :vartype visual_words: str """ diff --git a/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/models/visual_search_api_enums.py b/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/models/visual_search_client_enums.py similarity index 100% rename from azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/models/visual_search_api_enums.py rename to azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/models/visual_search_client_enums.py diff --git a/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/operations/images_operations.py b/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/operations/images_operations.py index 1ccc34842b68..8c92fe3a77ed 100644 --- a/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/operations/images_operations.py +++ b/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/operations/images_operations.py @@ -248,6 +248,10 @@ def visual_search( """ # Construct URL url = self.visual_search.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} diff --git a/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/version.py b/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/version.py index 9bd1dfac7ecb..63d89bfb54fa 100644 --- a/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/version.py +++ b/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.2.0" +VERSION = "1.0" diff --git a/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/visual_search_api.py b/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/visual_search_client.py similarity index 67% rename from azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/visual_search_api.py rename to azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/visual_search_client.py index fcdeafdf97fa..61bc4164f9a9 100644 --- a/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/visual_search_api.py +++ b/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/visual_search_client.py @@ -16,52 +16,60 @@ from . import models -class VisualSearchAPIConfiguration(Configuration): - """Configuration for VisualSearchAPI +class VisualSearchClientConfiguration(Configuration): + """Configuration for VisualSearchClient Note that all parameters used to create this instance are saved as instance attributes. + :param endpoint: Supported Cognitive Services endpoints (protocol and + hostname, for example: "https://westus.api.cognitive.microsoft.com", + "https://api.cognitive.microsoft.com"). + :type endpoint: str :param credentials: Subscription credentials which uniquely identify client subscription. :type credentials: None - :param str base_url: Service URL """ def __init__( - self, credentials, base_url=None): + self, endpoint, credentials): + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") if credentials is None: raise ValueError("Parameter 'credentials' must not be None.") - if not base_url: - base_url = 'https://api.cognitive.microsoft.com/bing/v7.0' + base_url = '{Endpoint}/bing/v7.0' - super(VisualSearchAPIConfiguration, self).__init__(base_url) + super(VisualSearchClientConfiguration, self).__init__(base_url) self.add_user_agent('azure-cognitiveservices-search-visualsearch/{}'.format(VERSION)) + self.endpoint = endpoint self.credentials = credentials -class VisualSearchAPI(SDKClient): +class VisualSearchClient(SDKClient): """Visual Search API lets you discover insights about an image such as visually similar images, shopping sources, and related searches. The API can also perform text recognition, identify entities (people, places, things), return other topical content for the user to explore, and more. For more information, see [Visual Search Overview](https://docs.microsoft.com/azure/cognitive-services/bing-visual-search/overview). :ivar config: Configuration for client. - :vartype config: VisualSearchAPIConfiguration + :vartype config: VisualSearchClientConfiguration :ivar images: Images operations :vartype images: azure.cognitiveservices.search.visualsearch.operations.ImagesOperations + :param endpoint: Supported Cognitive Services endpoints (protocol and + hostname, for example: "https://westus.api.cognitive.microsoft.com", + "https://api.cognitive.microsoft.com"). + :type endpoint: str :param credentials: Subscription credentials which uniquely identify client subscription. :type credentials: None - :param str base_url: Service URL """ def __init__( - self, credentials, base_url=None): + self, endpoint, credentials): - self.config = VisualSearchAPIConfiguration(credentials, base_url) - super(VisualSearchAPI, self).__init__(self.config.credentials, self.config) + self.config = VisualSearchClientConfiguration(endpoint, credentials) + super(VisualSearchClient, 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'