Skip to content

Commit a293852

Browse files
authored
[AutoPR cognitiveservices/data-plane/CustomImageSearch] Adding custom image search swagger spec (#2514)
* Generated from c9d4d41fb69f65f205c2ecbcdde8d1d1262ecbb7 Adding custom image search * Generated from 9f5bcc92bfd5f05be333758d433ffa36c96e40a2 Adding custom image search * Generated from e8d819e50515f9b0ba463341a2a38b3a9ebc6210 Adding custom image search
1 parent 215a44f commit a293852

35 files changed

+3014
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
from .custom_image_search_api import CustomImageSearchAPI
13+
from .version import VERSION
14+
15+
__all__ = ['CustomImageSearchAPI']
16+
17+
__version__ = VERSION
18+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
from msrest.service_client import SDKClient
13+
from msrest import Configuration, Serializer, Deserializer
14+
from .version import VERSION
15+
from .operations.custom_instance_operations import CustomInstanceOperations
16+
from . import models
17+
18+
19+
class CustomImageSearchAPIConfiguration(Configuration):
20+
"""Configuration for CustomImageSearchAPI
21+
Note that all parameters used to create this instance are saved as instance
22+
attributes.
23+
24+
:param credentials: Subscription credentials which uniquely identify
25+
client subscription.
26+
:type credentials: None
27+
:param str base_url: Service URL
28+
"""
29+
30+
def __init__(
31+
self, credentials, base_url=None):
32+
33+
if credentials is None:
34+
raise ValueError("Parameter 'credentials' must not be None.")
35+
if not base_url:
36+
base_url = 'https://api.cognitive.microsoft.com/bingcustomsearch/v7.0'
37+
38+
super(CustomImageSearchAPIConfiguration, self).__init__(base_url)
39+
40+
self.add_user_agent('azure-cognitiveservices-search-customimagesearch/{}'.format(VERSION))
41+
42+
self.credentials = credentials
43+
44+
45+
class CustomImageSearchAPI(SDKClient):
46+
"""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.
47+
48+
:ivar config: Configuration for client.
49+
:vartype config: CustomImageSearchAPIConfiguration
50+
51+
:ivar custom_instance: CustomInstance operations
52+
:vartype custom_instance: azure.cognitiveservices.search.customimagesearch.operations.CustomInstanceOperations
53+
54+
:param credentials: Subscription credentials which uniquely identify
55+
client subscription.
56+
:type credentials: None
57+
:param str base_url: Service URL
58+
"""
59+
60+
def __init__(
61+
self, credentials, base_url=None):
62+
63+
self.config = CustomImageSearchAPIConfiguration(credentials, base_url)
64+
super(CustomImageSearchAPI, self).__init__(self.config.credentials, self.config)
65+
66+
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
67+
self.api_version = '1.0'
68+
self._serialize = Serializer(client_models)
69+
self._deserialize = Deserializer(client_models)
70+
71+
self.custom_instance = CustomInstanceOperations(
72+
self._client, self.config, self._serialize, self._deserialize)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
try:
13+
from .image_object_py3 import ImageObject
14+
from .images_py3 import Images
15+
from .search_results_answer_py3 import SearchResultsAnswer
16+
from .query_py3 import Query
17+
from .answer_py3 import Answer
18+
from .media_object_py3 import MediaObject
19+
from .response_py3 import Response
20+
from .thing_py3 import Thing
21+
from .creative_work_py3 import CreativeWork
22+
from .identifiable_py3 import Identifiable
23+
from .error_py3 import Error
24+
from .error_response_py3 import ErrorResponse, ErrorResponseException
25+
from .web_page_py3 import WebPage
26+
from .response_base_py3 import ResponseBase
27+
except (SyntaxError, ImportError):
28+
from .image_object import ImageObject
29+
from .images import Images
30+
from .search_results_answer import SearchResultsAnswer
31+
from .query import Query
32+
from .answer import Answer
33+
from .media_object import MediaObject
34+
from .response import Response
35+
from .thing import Thing
36+
from .creative_work import CreativeWork
37+
from .identifiable import Identifiable
38+
from .error import Error
39+
from .error_response import ErrorResponse, ErrorResponseException
40+
from .web_page import WebPage
41+
from .response_base import ResponseBase
42+
from .custom_image_search_api_enums import (
43+
ErrorCode,
44+
ErrorSubCode,
45+
ImageAspect,
46+
ImageColor,
47+
Freshness,
48+
ImageContent,
49+
ImageType,
50+
ImageLicense,
51+
SafeSearch,
52+
ImageSize,
53+
)
54+
55+
__all__ = [
56+
'ImageObject',
57+
'Images',
58+
'SearchResultsAnswer',
59+
'Query',
60+
'Answer',
61+
'MediaObject',
62+
'Response',
63+
'Thing',
64+
'CreativeWork',
65+
'Identifiable',
66+
'Error',
67+
'ErrorResponse', 'ErrorResponseException',
68+
'WebPage',
69+
'ResponseBase',
70+
'ErrorCode',
71+
'ErrorSubCode',
72+
'ImageAspect',
73+
'ImageColor',
74+
'Freshness',
75+
'ImageContent',
76+
'ImageType',
77+
'ImageLicense',
78+
'SafeSearch',
79+
'ImageSize',
80+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
from .response import Response
13+
14+
15+
class Answer(Response):
16+
"""Defines an answer.
17+
18+
You probably want to use the sub-classes and not this class directly. Known
19+
sub-classes are: SearchResultsAnswer
20+
21+
Variables are only populated by the server, and will be ignored when
22+
sending a request.
23+
24+
All required parameters must be populated in order to send to Azure.
25+
26+
:param _type: Required. Constant filled by server.
27+
:type _type: str
28+
:ivar id: A String identifier.
29+
:vartype id: str
30+
:ivar read_link: The URL that returns this resource.
31+
:vartype read_link: str
32+
:ivar web_search_url: The URL To Bing's search result for this item.
33+
:vartype web_search_url: str
34+
"""
35+
36+
_validation = {
37+
'_type': {'required': True},
38+
'id': {'readonly': True},
39+
'read_link': {'readonly': True},
40+
'web_search_url': {'readonly': True},
41+
}
42+
43+
_attribute_map = {
44+
'_type': {'key': '_type', 'type': 'str'},
45+
'id': {'key': 'id', 'type': 'str'},
46+
'read_link': {'key': 'readLink', 'type': 'str'},
47+
'web_search_url': {'key': 'webSearchUrl', 'type': 'str'},
48+
}
49+
50+
_subtype_map = {
51+
'_type': {'SearchResultsAnswer': 'SearchResultsAnswer'}
52+
}
53+
54+
def __init__(self, **kwargs):
55+
super(Answer, self).__init__(**kwargs)
56+
self._type = 'Answer'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
from .response import Response
13+
14+
15+
class Answer(Response):
16+
"""Defines an answer.
17+
18+
You probably want to use the sub-classes and not this class directly. Known
19+
sub-classes are: SearchResultsAnswer
20+
21+
Variables are only populated by the server, and will be ignored when
22+
sending a request.
23+
24+
All required parameters must be populated in order to send to Azure.
25+
26+
:param _type: Required. Constant filled by server.
27+
:type _type: str
28+
:ivar id: A String identifier.
29+
:vartype id: str
30+
:ivar read_link: The URL that returns this resource.
31+
:vartype read_link: str
32+
:ivar web_search_url: The URL To Bing's search result for this item.
33+
:vartype web_search_url: str
34+
"""
35+
36+
_validation = {
37+
'_type': {'required': True},
38+
'id': {'readonly': True},
39+
'read_link': {'readonly': True},
40+
'web_search_url': {'readonly': True},
41+
}
42+
43+
_attribute_map = {
44+
'_type': {'key': '_type', 'type': 'str'},
45+
'id': {'key': 'id', 'type': 'str'},
46+
'read_link': {'key': 'readLink', 'type': 'str'},
47+
'web_search_url': {'key': 'webSearchUrl', 'type': 'str'},
48+
}
49+
50+
_subtype_map = {
51+
'_type': {'SearchResultsAnswer': 'SearchResultsAnswer'}
52+
}
53+
54+
def __init__(self, **kwargs) -> None:
55+
super(Answer, self).__init__(**kwargs)
56+
self._type = 'Answer'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
from .thing import Thing
13+
14+
15+
class CreativeWork(Thing):
16+
"""The most generic kind of creative work, including books, movies,
17+
photographs, software programs, etc.
18+
19+
You probably want to use the sub-classes and not this class directly. Known
20+
sub-classes are: MediaObject, WebPage
21+
22+
Variables are only populated by the server, and will be ignored when
23+
sending a request.
24+
25+
All required parameters must be populated in order to send to Azure.
26+
27+
:param _type: Required. Constant filled by server.
28+
:type _type: str
29+
:ivar id: A String identifier.
30+
:vartype id: str
31+
:ivar read_link: The URL that returns this resource.
32+
:vartype read_link: str
33+
:ivar web_search_url: The URL To Bing's search result for this item.
34+
:vartype web_search_url: str
35+
:ivar name: The name of the thing represented by this object.
36+
:vartype name: str
37+
:ivar url: The URL to get more information about the thing represented by
38+
this object.
39+
:vartype url: str
40+
:ivar image: An image of the item.
41+
:vartype image:
42+
~azure.cognitiveservices.search.customimagesearch.models.ImageObject
43+
:ivar description: A short description of the item.
44+
:vartype description: str
45+
:ivar alternate_name: An alias for the item
46+
:vartype alternate_name: str
47+
:ivar bing_id: An ID that uniquely identifies this item.
48+
:vartype bing_id: str
49+
:ivar thumbnail_url: The URL to a thumbnail of the item.
50+
:vartype thumbnail_url: str
51+
:ivar provider: The source of the creative work.
52+
:vartype provider:
53+
list[~azure.cognitiveservices.search.customimagesearch.models.Thing]
54+
:ivar text: Text content of this creative work
55+
:vartype text: str
56+
"""
57+
58+
_validation = {
59+
'_type': {'required': True},
60+
'id': {'readonly': True},
61+
'read_link': {'readonly': True},
62+
'web_search_url': {'readonly': True},
63+
'name': {'readonly': True},
64+
'url': {'readonly': True},
65+
'image': {'readonly': True},
66+
'description': {'readonly': True},
67+
'alternate_name': {'readonly': True},
68+
'bing_id': {'readonly': True},
69+
'thumbnail_url': {'readonly': True},
70+
'provider': {'readonly': True},
71+
'text': {'readonly': True},
72+
}
73+
74+
_attribute_map = {
75+
'_type': {'key': '_type', 'type': 'str'},
76+
'id': {'key': 'id', 'type': 'str'},
77+
'read_link': {'key': 'readLink', 'type': 'str'},
78+
'web_search_url': {'key': 'webSearchUrl', 'type': 'str'},
79+
'name': {'key': 'name', 'type': 'str'},
80+
'url': {'key': 'url', 'type': 'str'},
81+
'image': {'key': 'image', 'type': 'ImageObject'},
82+
'description': {'key': 'description', 'type': 'str'},
83+
'alternate_name': {'key': 'alternateName', 'type': 'str'},
84+
'bing_id': {'key': 'bingId', 'type': 'str'},
85+
'thumbnail_url': {'key': 'thumbnailUrl', 'type': 'str'},
86+
'provider': {'key': 'provider', 'type': '[Thing]'},
87+
'text': {'key': 'text', 'type': 'str'},
88+
}
89+
90+
_subtype_map = {
91+
'_type': {'MediaObject': 'MediaObject', 'WebPage': 'WebPage'}
92+
}
93+
94+
def __init__(self, **kwargs):
95+
super(CreativeWork, self).__init__(**kwargs)
96+
self.thumbnail_url = None
97+
self.provider = None
98+
self.text = None
99+
self._type = 'CreativeWork'

0 commit comments

Comments
 (0)