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/CustomWebSearch] renaming custom search to custom web search #2578

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
Expand Up @@ -9,7 +9,7 @@
# 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
Expand Down Expand Up @@ -42,7 +42,7 @@ def __init__(
self.credentials = credentials


class CustomSearchAPI(object):
class CustomSearchAPI(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.
Expand All @@ -61,7 +61,7 @@ def __init__(
self, credentials, base_url=None):

self.config = CustomSearchAPIConfiguration(credentials, base_url)
self._client = ServiceClient(self.config.credentials, self.config)
super(CustomSearchAPI, 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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,38 @@
# 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
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_api_enums import (
ErrorCode,
ErrorSubCode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
Original file line number Diff line number Diff line change
@@ -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'
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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'
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from enum import Enum


class ErrorCode(Enum):
class ErrorCode(str, Enum):

none = "None"
server_error = "ServerError"
Expand All @@ -22,7 +22,7 @@ class ErrorCode(Enum):
insufficient_authorization = "InsufficientAuthorization"


class ErrorSubCode(Enum):
class ErrorSubCode(str, Enum):

unexpected_error = "UnexpectedError"
resource_error = "ResourceError"
Expand All @@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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
Loading