Skip to content

Commit

Permalink
regen search documents
Browse files Browse the repository at this point in the history
  • Loading branch information
iscai-msft committed Oct 1, 2021
1 parent 0481e9d commit 6246067
Show file tree
Hide file tree
Showing 23 changed files with 9,206 additions and 3,881 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# --------------------------------------------------------------------------
# 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 azure.core.pipeline.transport import HttpRequest

def _convert_request(request, files=None):
data = request.content if not files else None
request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
if files:
request.set_formdata_body(files)
return request

def _format_url_section(template, **kwargs):
components = template.split("/")
while components:
try:
return template.format(**kwargs)
except KeyError as key:
formatted_components = template.split("/")
components = [
c for c in formatted_components if "{}".format(key.args[0]) not in c
]
template = "/".join(components)
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from azure.core.tracing.decorator_async import distributed_trace_async

from ... import models as _models
from ..._vendor import _convert_request
from ...operations._documents_operations import build_autocomplete_get_request, build_autocomplete_post_request, build_count_request, build_get_request, build_index_request, build_search_get_request, build_search_post_request, build_suggest_get_request, build_suggest_post_request

T = TypeVar('T')
Expand Down Expand Up @@ -71,19 +72,20 @@ async def count(
request = build_count_request(
x_ms_client_request_id=_x_ms_client_request_id,
template_url=self.count.metadata['url'],
)._to_pipeline_transport_request()
)
request = _convert_request(request)
path_format_arguments = {
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
"indexName": self._serialize.url("self._config.index_name", self._config.index_name, 'str'),
}
request.url = self._client.format_url(request.url, **path_format_arguments)

pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.SearchError, response)
error = self._deserialize.failsafe_deserialize(_models.SearchError, pipeline_response)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize('long', pipeline_response)
Expand Down Expand Up @@ -202,19 +204,20 @@ async def search_get(
semantic_fields=_semantic_fields,
x_ms_client_request_id=_x_ms_client_request_id,
template_url=self.search_get.metadata['url'],
)._to_pipeline_transport_request()
)
request = _convert_request(request)
path_format_arguments = {
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
"indexName": self._serialize.url("self._config.index_name", self._config.index_name, 'str'),
}
request.url = self._client.format_url(request.url, **path_format_arguments)

pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.SearchError, response)
error = self._deserialize.failsafe_deserialize(_models.SearchError, pipeline_response)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize('SearchDocumentsResult', pipeline_response)
Expand Down Expand Up @@ -263,19 +266,20 @@ async def search_post(
x_ms_client_request_id=_x_ms_client_request_id,
json=json,
template_url=self.search_post.metadata['url'],
)._to_pipeline_transport_request()
)
request = _convert_request(request)
path_format_arguments = {
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
"indexName": self._serialize.url("self._config.index_name", self._config.index_name, 'str'),
}
request.url = self._client.format_url(request.url, **path_format_arguments)

pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.SearchError, response)
error = self._deserialize.failsafe_deserialize(_models.SearchError, pipeline_response)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize('SearchDocumentsResult', pipeline_response)
Expand Down Expand Up @@ -325,19 +329,20 @@ async def get(
selected_fields=selected_fields,
x_ms_client_request_id=_x_ms_client_request_id,
template_url=self.get.metadata['url'],
)._to_pipeline_transport_request()
)
request = _convert_request(request)
path_format_arguments = {
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
"indexName": self._serialize.url("self._config.index_name", self._config.index_name, 'str'),
}
request.url = self._client.format_url(request.url, **path_format_arguments)

pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.SearchError, response)
error = self._deserialize.failsafe_deserialize(_models.SearchError, pipeline_response)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize('object', pipeline_response)
Expand Down Expand Up @@ -419,19 +424,20 @@ async def suggest_get(
top=_top,
x_ms_client_request_id=_x_ms_client_request_id,
template_url=self.suggest_get.metadata['url'],
)._to_pipeline_transport_request()
)
request = _convert_request(request)
path_format_arguments = {
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
"indexName": self._serialize.url("self._config.index_name", self._config.index_name, 'str'),
}
request.url = self._client.format_url(request.url, **path_format_arguments)

pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.SearchError, response)
error = self._deserialize.failsafe_deserialize(_models.SearchError, pipeline_response)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize('SuggestDocumentsResult', pipeline_response)
Expand Down Expand Up @@ -480,19 +486,20 @@ async def suggest_post(
x_ms_client_request_id=_x_ms_client_request_id,
json=json,
template_url=self.suggest_post.metadata['url'],
)._to_pipeline_transport_request()
)
request = _convert_request(request)
path_format_arguments = {
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
"indexName": self._serialize.url("self._config.index_name", self._config.index_name, 'str'),
}
request.url = self._client.format_url(request.url, **path_format_arguments)

pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.SearchError, response)
error = self._deserialize.failsafe_deserialize(_models.SearchError, pipeline_response)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize('SuggestDocumentsResult', pipeline_response)
Expand Down Expand Up @@ -542,19 +549,20 @@ async def index(
x_ms_client_request_id=_x_ms_client_request_id,
json=json,
template_url=self.index.metadata['url'],
)._to_pipeline_transport_request()
)
request = _convert_request(request)
path_format_arguments = {
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
"indexName": self._serialize.url("self._config.index_name", self._config.index_name, 'str'),
}
request.url = self._client.format_url(request.url, **path_format_arguments)

pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200, 207]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.SearchError, response)
error = self._deserialize.failsafe_deserialize(_models.SearchError, pipeline_response)
raise HttpResponseError(response=response, model=error)

if response.status_code == 200:
Expand Down Expand Up @@ -636,19 +644,20 @@ async def autocomplete_get(
search_fields=_search_fields,
top=_top,
template_url=self.autocomplete_get.metadata['url'],
)._to_pipeline_transport_request()
)
request = _convert_request(request)
path_format_arguments = {
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
"indexName": self._serialize.url("self._config.index_name", self._config.index_name, 'str'),
}
request.url = self._client.format_url(request.url, **path_format_arguments)

pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.SearchError, response)
error = self._deserialize.failsafe_deserialize(_models.SearchError, pipeline_response)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize('AutocompleteResult', pipeline_response)
Expand Down Expand Up @@ -697,19 +706,20 @@ async def autocomplete_post(
x_ms_client_request_id=_x_ms_client_request_id,
json=json,
template_url=self.autocomplete_post.metadata['url'],
)._to_pipeline_transport_request()
)
request = _convert_request(request)
path_format_arguments = {
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
"indexName": self._serialize.url("self._config.index_name", self._config.index_name, 'str'),
}
request.url = self._client.format_url(request.url, **path_format_arguments)

pipeline_response = await self._client.send_request(request, stream=False, _return_pipeline_response=True, **kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.SearchError, response)
error = self._deserialize.failsafe_deserialize(_models.SearchError, pipeline_response)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize('AutocompleteResult', pipeline_response)
Expand Down
Loading

0 comments on commit 6246067

Please sign in to comment.