Skip to content

Commit 75b21d8

Browse files
authored
Generated from 8f44fce8ff071d239a14dbb1e074d39dccf38b3d (#2578)
renaming custom search to custom web search
1 parent 3411051 commit 75b21d8

35 files changed

+1116
-86
lines changed

azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/custom_search_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# regenerated.
1010
# --------------------------------------------------------------------------
1111

12-
from msrest.service_client import ServiceClient
12+
from msrest.service_client import SDKClient
1313
from msrest import Configuration, Serializer, Deserializer
1414
from .version import VERSION
1515
from .operations.custom_instance_operations import CustomInstanceOperations
@@ -42,7 +42,7 @@ def __init__(
4242
self.credentials = credentials
4343

4444

45-
class CustomSearchAPI(object):
45+
class CustomSearchAPI(SDKClient):
4646
"""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.
4747
4848
:ivar config: Configuration for client.
@@ -61,7 +61,7 @@ def __init__(
6161
self, credentials, base_url=None):
6262

6363
self.config = CustomSearchAPIConfiguration(credentials, base_url)
64-
self._client = ServiceClient(self.config.credentials, self.config)
64+
super(CustomSearchAPI, self).__init__(self.config.credentials, self.config)
6565

6666
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
6767
self.api_version = '1.0'

azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/__init__.py

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,38 @@
99
# regenerated.
1010
# --------------------------------------------------------------------------
1111

12-
from .query_context import QueryContext
13-
from .web_meta_tag import WebMetaTag
14-
from .web_page import WebPage
15-
from .web_web_answer import WebWebAnswer
16-
from .search_response import SearchResponse
17-
from .response import Response
18-
from .search_results_answer import SearchResultsAnswer
19-
from .identifiable import Identifiable
20-
from .error import Error
21-
from .error_response import ErrorResponse, ErrorResponseException
22-
from .query import Query
23-
from .answer import Answer
24-
from .thing import Thing
25-
from .creative_work import CreativeWork
26-
from .response_base import ResponseBase
12+
try:
13+
from .query_context_py3 import QueryContext
14+
from .web_meta_tag_py3 import WebMetaTag
15+
from .web_page_py3 import WebPage
16+
from .web_web_answer_py3 import WebWebAnswer
17+
from .search_response_py3 import SearchResponse
18+
from .response_py3 import Response
19+
from .search_results_answer_py3 import SearchResultsAnswer
20+
from .identifiable_py3 import Identifiable
21+
from .error_py3 import Error
22+
from .error_response_py3 import ErrorResponse, ErrorResponseException
23+
from .query_py3 import Query
24+
from .answer_py3 import Answer
25+
from .thing_py3 import Thing
26+
from .creative_work_py3 import CreativeWork
27+
from .response_base_py3 import ResponseBase
28+
except (SyntaxError, ImportError):
29+
from .query_context import QueryContext
30+
from .web_meta_tag import WebMetaTag
31+
from .web_page import WebPage
32+
from .web_web_answer import WebWebAnswer
33+
from .search_response import SearchResponse
34+
from .response import Response
35+
from .search_results_answer import SearchResultsAnswer
36+
from .identifiable import Identifiable
37+
from .error import Error
38+
from .error_response import ErrorResponse, ErrorResponseException
39+
from .query import Query
40+
from .answer import Answer
41+
from .thing import Thing
42+
from .creative_work import CreativeWork
43+
from .response_base import ResponseBase
2744
from .custom_search_api_enums import (
2845
ErrorCode,
2946
ErrorSubCode,

azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/answer.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ class Answer(Response):
2121
Variables are only populated by the server, and will be ignored when
2222
sending a request.
2323
24-
:param _type: Constant filled by server.
24+
All required parameters must be populated in order to send to Azure.
25+
26+
:param _type: Required. Constant filled by server.
2527
:type _type: str
2628
:ivar id: A String identifier.
2729
:vartype id: str
@@ -50,7 +52,7 @@ class Answer(Response):
5052
'_type': {'SearchResultsAnswer': 'SearchResultsAnswer'}
5153
}
5254

53-
def __init__(self):
54-
super(Answer, self).__init__()
55+
def __init__(self, **kwargs):
56+
super(Answer, self).__init__(**kwargs)
5557
self.follow_up_queries = None
5658
self._type = 'Answer'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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_py3 import Response
13+
14+
15+
class Answer(Response):
16+
"""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 web_search_url: The URL To Bing's search result for this item.
31+
:vartype web_search_url: str
32+
:ivar follow_up_queries:
33+
:vartype follow_up_queries:
34+
list[~azure.cognitiveservices.search.customsearch.models.Query]
35+
"""
36+
37+
_validation = {
38+
'_type': {'required': True},
39+
'id': {'readonly': True},
40+
'web_search_url': {'readonly': True},
41+
'follow_up_queries': {'readonly': True},
42+
}
43+
44+
_attribute_map = {
45+
'_type': {'key': '_type', 'type': 'str'},
46+
'id': {'key': 'id', 'type': 'str'},
47+
'web_search_url': {'key': 'webSearchUrl', 'type': 'str'},
48+
'follow_up_queries': {'key': 'followUpQueries', 'type': '[Query]'},
49+
}
50+
51+
_subtype_map = {
52+
'_type': {'SearchResultsAnswer': 'SearchResultsAnswer'}
53+
}
54+
55+
def __init__(self, **kwargs) -> None:
56+
super(Answer, self).__init__(**kwargs)
57+
self.follow_up_queries = None
58+
self._type = 'Answer'

azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/creative_work.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ class CreativeWork(Thing):
2121
Variables are only populated by the server, and will be ignored when
2222
sending a request.
2323
24-
:param _type: Constant filled by server.
24+
All required parameters must be populated in order to send to Azure.
25+
26+
:param _type: Required. Constant filled by server.
2527
:type _type: str
2628
:ivar id: A String identifier.
2729
:vartype id: str
@@ -75,8 +77,8 @@ class CreativeWork(Thing):
7577
'_type': {'WebPage': 'WebPage'}
7678
}
7779

78-
def __init__(self):
79-
super(CreativeWork, self).__init__()
80+
def __init__(self, **kwargs):
81+
super(CreativeWork, self).__init__(**kwargs)
8082
self.thumbnail_url = None
8183
self.provider = None
8284
self.text = None
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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_py3 import Thing
13+
14+
15+
class CreativeWork(Thing):
16+
"""CreativeWork.
17+
18+
You probably want to use the sub-classes and not this class directly. Known
19+
sub-classes are: WebPage
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 web_search_url: The URL To Bing's search result for this item.
31+
:vartype web_search_url: str
32+
:ivar name: The name of the thing represented by this object.
33+
:vartype name: str
34+
:ivar url: The URL to get more information about the thing represented by
35+
this object.
36+
:vartype url: str
37+
:ivar description: A short description of the item.
38+
:vartype description: str
39+
:ivar bing_id: An ID that uniquely identifies this item.
40+
:vartype bing_id: str
41+
:ivar thumbnail_url: The URL to a thumbnail of the item.
42+
:vartype thumbnail_url: str
43+
:ivar provider: The source of the creative work.
44+
:vartype provider:
45+
list[~azure.cognitiveservices.search.customsearch.models.Thing]
46+
:ivar text:
47+
:vartype text: str
48+
"""
49+
50+
_validation = {
51+
'_type': {'required': True},
52+
'id': {'readonly': True},
53+
'web_search_url': {'readonly': True},
54+
'name': {'readonly': True},
55+
'url': {'readonly': True},
56+
'description': {'readonly': True},
57+
'bing_id': {'readonly': True},
58+
'thumbnail_url': {'readonly': True},
59+
'provider': {'readonly': True},
60+
'text': {'readonly': True},
61+
}
62+
63+
_attribute_map = {
64+
'_type': {'key': '_type', 'type': 'str'},
65+
'id': {'key': 'id', 'type': 'str'},
66+
'web_search_url': {'key': 'webSearchUrl', 'type': 'str'},
67+
'name': {'key': 'name', 'type': 'str'},
68+
'url': {'key': 'url', 'type': 'str'},
69+
'description': {'key': 'description', 'type': 'str'},
70+
'bing_id': {'key': 'bingId', 'type': 'str'},
71+
'thumbnail_url': {'key': 'thumbnailUrl', 'type': 'str'},
72+
'provider': {'key': 'provider', 'type': '[Thing]'},
73+
'text': {'key': 'text', 'type': 'str'},
74+
}
75+
76+
_subtype_map = {
77+
'_type': {'WebPage': 'WebPage'}
78+
}
79+
80+
def __init__(self, **kwargs) -> None:
81+
super(CreativeWork, self).__init__(**kwargs)
82+
self.thumbnail_url = None
83+
self.provider = None
84+
self.text = None
85+
self._type = 'CreativeWork'

azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/custom_search_api_enums.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from enum import Enum
1313

1414

15-
class ErrorCode(Enum):
15+
class ErrorCode(str, Enum):
1616

1717
none = "None"
1818
server_error = "ServerError"
@@ -22,7 +22,7 @@ class ErrorCode(Enum):
2222
insufficient_authorization = "InsufficientAuthorization"
2323

2424

25-
class ErrorSubCode(Enum):
25+
class ErrorSubCode(str, Enum):
2626

2727
unexpected_error = "UnexpectedError"
2828
resource_error = "ResourceError"
@@ -37,14 +37,14 @@ class ErrorSubCode(Enum):
3737
authorization_expired = "AuthorizationExpired"
3838

3939

40-
class SafeSearch(Enum):
40+
class SafeSearch(str, Enum):
4141

4242
off = "Off"
4343
moderate = "Moderate"
4444
strict = "Strict"
4545

4646

47-
class TextFormat(Enum):
47+
class TextFormat(str, Enum):
4848

4949
raw = "Raw"
5050
html = "Html"

azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/error.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ class Error(Model):
1818
Variables are only populated by the server, and will be ignored when
1919
sending a request.
2020
21-
:param code: The error code that identifies the category of error.
22-
Possible values include: 'None', 'ServerError', 'InvalidRequest',
21+
All required parameters must be populated in order to send to Azure.
22+
23+
:param code: Required. The error code that identifies the category of
24+
error. Possible values include: 'None', 'ServerError', 'InvalidRequest',
2325
'RateLimitExceeded', 'InvalidAuthorization', 'InsufficientAuthorization'.
2426
Default value: "None" .
2527
:type code: str or
@@ -31,7 +33,7 @@ class Error(Model):
3133
'AuthorizationRedundancy', 'AuthorizationDisabled', 'AuthorizationExpired'
3234
:vartype sub_code: str or
3335
~azure.cognitiveservices.search.customsearch.models.ErrorSubCode
34-
:param message: A description of the error.
36+
:param message: Required. A description of the error.
3537
:type message: str
3638
:ivar more_details: A description that provides additional information
3739
about the error.
@@ -60,11 +62,11 @@ class Error(Model):
6062
'value': {'key': 'value', 'type': 'str'},
6163
}
6264

63-
def __init__(self, message, code="None"):
64-
super(Error, self).__init__()
65-
self.code = code
65+
def __init__(self, **kwargs):
66+
super(Error, self).__init__(**kwargs)
67+
self.code = kwargs.get('code', "None")
6668
self.sub_code = None
67-
self.message = message
69+
self.message = kwargs.get('message', None)
6870
self.more_details = None
6971
self.parameter = None
7072
self.value = None

0 commit comments

Comments
 (0)