Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[AutoPR cognitiveservices/data-plane/CustomImageSearch] Adding custom image search swagger spec #2514

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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_api import CustomImageSearchAPI
from .version import VERSION

__all__ = ['CustomImageSearchAPI']

__version__ = VERSION

Original file line number Diff line number Diff line change
@@ -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 CustomImageSearchAPIConfiguration(Configuration):
"""Configuration for CustomImageSearchAPI
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(CustomImageSearchAPIConfiguration, self).__init__(base_url)

self.add_user_agent('azure-cognitiveservices-search-customimagesearch/{}'.format(VERSION))

self.credentials = credentials


class CustomImageSearchAPI(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: CustomImageSearchAPIConfiguration

: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 = CustomImageSearchAPIConfiguration(credentials, base_url)
super(CustomImageSearchAPI, 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)
Original file line number Diff line number Diff line change
@@ -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_api_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',
]
Original file line number Diff line number Diff line change
@@ -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'
Original file line number Diff line number Diff line change
@@ -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) -> None:
super(Answer, self).__init__(**kwargs)
self._type = 'Answer'
Original file line number Diff line number Diff line change
@@ -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'
Loading