Skip to content

Commit

Permalink
feat(specs): add support for widgets / banners in search for the csha…
Browse files Browse the repository at this point in the history
…rp client (generated)

algolia/api-clients-automation#3870

Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com>
Co-authored-by: Jonas <42573917+Kalmar99@users.noreply.github.com>
Co-authored-by: Jonas Kalmar Rønning <jonaskalmar.ronning@komplett.com>
Co-authored-by: Pierre Millot <pierre.millot@algolia.com>
  • Loading branch information
4 people committed Oct 6, 2024
1 parent eed4172 commit eaa5b2a
Show file tree
Hide file tree
Showing 452 changed files with 11,426 additions and 5,594 deletions.
105 changes: 55 additions & 50 deletions algoliasearch/abtesting/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from json import dumps
from sys import version_info
from typing import Any, Dict, List, Optional, Tuple, Union
from typing import Any, Dict, Optional, Union
from urllib.parse import quote

from pydantic import Field, StrictInt, StrictStr
Expand All @@ -31,8 +31,9 @@
ScheduleABTestsRequest,
)
from algoliasearch.http.api_response import ApiResponse
from algoliasearch.http.base_config import BaseConfig
from algoliasearch.http.request_options import RequestOptions
from algoliasearch.http.serializer import bodySerializer
from algoliasearch.http.serializer import body_serializer
from algoliasearch.http.transporter import Transporter
from algoliasearch.http.transporter_sync import TransporterSync
from algoliasearch.http.verb import Verb
Expand All @@ -57,7 +58,7 @@ class AbtestingClient:
"""

_transporter: Transporter
_config: AbtestingConfig
_config: BaseConfig
_request_options: RequestOptions

def __init__(
Expand All @@ -69,7 +70,9 @@ def __init__(
config: Optional[AbtestingConfig] = None,
) -> None:
if transporter is not None and config is None:
config = transporter._config
config = AbtestingConfig(
transporter.config.app_id, transporter.config.api_key, region
)

if config is None:
config = AbtestingConfig(app_id, api_key, region)
Expand Down Expand Up @@ -121,11 +124,11 @@ async def close(self) -> None:

async def set_client_api_key(self, api_key: str) -> None:
"""Sets a new API key to authenticate requests."""
self._transporter._config.set_client_api_key(api_key)
self._transporter.config.set_client_api_key(api_key)

async def add_ab_tests_with_http_info(
self,
add_ab_tests_request: AddABTestsRequest,
add_ab_tests_request: Union[AddABTestsRequest, dict[str, Any]],
request_options: Optional[Union[dict, RequestOptions]] = None,
) -> ApiResponse[str]:
"""
Expand Down Expand Up @@ -153,15 +156,15 @@ async def add_ab_tests_with_http_info(
verb=Verb.POST,
path="/2/abtests",
request_options=self._request_options.merge(
data=dumps(bodySerializer(_data)),
data=dumps(body_serializer(_data)),
user_request_options=request_options,
),
use_read_transporter=False,
)

async def add_ab_tests(
self,
add_ab_tests_request: AddABTestsRequest,
add_ab_tests_request: Union[AddABTestsRequest, dict[str, Any]],
request_options: Optional[Union[dict, RequestOptions]] = None,
) -> ABTestResponse:
"""
Expand Down Expand Up @@ -211,11 +214,11 @@ async def custom_delete_with_http_info(
"Parameter `path` is required when calling `custom_delete`."
)

_query_parameters: List[Tuple[str, str]] = []
_query_parameters: Dict[str, Any] = {}

if parameters is not None:
for _qpkey, _qpvalue in parameters.items():
_query_parameters.append((_qpkey, _qpvalue))
_query_parameters[_qpkey] = _qpvalue

return await self._transporter.request(
verb=Verb.DELETE,
Expand Down Expand Up @@ -286,11 +289,11 @@ async def custom_get_with_http_info(
if path is None:
raise ValueError("Parameter `path` is required when calling `custom_get`.")

_query_parameters: List[Tuple[str, str]] = []
_query_parameters: Dict[str, Any] = {}

if parameters is not None:
for _qpkey, _qpvalue in parameters.items():
_query_parameters.append((_qpkey, _qpvalue))
_query_parameters[_qpkey] = _qpvalue

return await self._transporter.request(
verb=Verb.GET,
Expand Down Expand Up @@ -365,11 +368,11 @@ async def custom_post_with_http_info(
if path is None:
raise ValueError("Parameter `path` is required when calling `custom_post`.")

_query_parameters: List[Tuple[str, str]] = []
_query_parameters: Dict[str, Any] = {}

if parameters is not None:
for _qpkey, _qpvalue in parameters.items():
_query_parameters.append((_qpkey, _qpvalue))
_query_parameters[_qpkey] = _qpvalue

_data = {}
if body is not None:
Expand All @@ -380,7 +383,7 @@ async def custom_post_with_http_info(
path="/{path}".replace("{path}", path),
request_options=self._request_options.merge(
query_parameters=_query_parameters,
data=dumps(bodySerializer(_data)),
data=dumps(body_serializer(_data)),
user_request_options=request_options,
),
use_read_transporter=False,
Expand Down Expand Up @@ -457,11 +460,11 @@ async def custom_put_with_http_info(
if path is None:
raise ValueError("Parameter `path` is required when calling `custom_put`.")

_query_parameters: List[Tuple[str, str]] = []
_query_parameters: Dict[str, Any] = {}

if parameters is not None:
for _qpkey, _qpvalue in parameters.items():
_query_parameters.append((_qpkey, _qpvalue))
_query_parameters[_qpkey] = _qpvalue

_data = {}
if body is not None:
Expand All @@ -472,7 +475,7 @@ async def custom_put_with_http_info(
path="/{path}".replace("{path}", path),
request_options=self._request_options.merge(
query_parameters=_query_parameters,
data=dumps(bodySerializer(_data)),
data=dumps(body_serializer(_data)),
user_request_options=request_options,
),
use_read_transporter=False,
Expand Down Expand Up @@ -653,16 +656,16 @@ async def list_ab_tests_with_http_info(
:return: Returns the raw algoliasearch 'APIResponse' object.
"""

_query_parameters: List[Tuple[str, str]] = []
_query_parameters: Dict[str, Any] = {}

if offset is not None:
_query_parameters.append(("offset", offset))
_query_parameters["offset"] = offset
if limit is not None:
_query_parameters.append(("limit", limit))
_query_parameters["limit"] = limit
if index_prefix is not None:
_query_parameters.append(("indexPrefix", index_prefix))
_query_parameters["indexPrefix"] = index_prefix
if index_suffix is not None:
_query_parameters.append(("indexSuffix", index_suffix))
_query_parameters["indexSuffix"] = index_suffix

return await self._transporter.request(
verb=Verb.GET,
Expand Down Expand Up @@ -721,7 +724,7 @@ async def list_ab_tests(

async def schedule_ab_test_with_http_info(
self,
schedule_ab_tests_request: ScheduleABTestsRequest,
schedule_ab_tests_request: Union[ScheduleABTestsRequest, dict[str, Any]],
request_options: Optional[Union[dict, RequestOptions]] = None,
) -> ApiResponse[str]:
"""
Expand Down Expand Up @@ -749,15 +752,15 @@ async def schedule_ab_test_with_http_info(
verb=Verb.POST,
path="/2/abtests/schedule",
request_options=self._request_options.merge(
data=dumps(bodySerializer(_data)),
data=dumps(body_serializer(_data)),
user_request_options=request_options,
),
use_read_transporter=False,
)

async def schedule_ab_test(
self,
schedule_ab_tests_request: ScheduleABTestsRequest,
schedule_ab_tests_request: Union[ScheduleABTestsRequest, dict[str, Any]],
request_options: Optional[Union[dict, RequestOptions]] = None,
) -> ScheduleABTestResponse:
"""
Expand Down Expand Up @@ -844,7 +847,7 @@ class AbtestingClientSync:
"""

_transporter: TransporterSync
_config: AbtestingConfig
_config: BaseConfig
_request_options: RequestOptions

def __init__(
Expand All @@ -856,7 +859,9 @@ def __init__(
config: Optional[AbtestingConfig] = None,
) -> None:
if transporter is not None and config is None:
config = transporter._config
config = AbtestingConfig(
transporter.config.app_id, transporter.config.api_key, region
)

if config is None:
config = AbtestingConfig(app_id, api_key, region)
Expand Down Expand Up @@ -907,11 +912,11 @@ def close(self) -> None:

def set_client_api_key(self, api_key: str) -> None:
"""Sets a new API key to authenticate requests."""
self._transporter._config.set_client_api_key(api_key)
self._transporter.config.set_client_api_key(api_key)

def add_ab_tests_with_http_info(
self,
add_ab_tests_request: AddABTestsRequest,
add_ab_tests_request: Union[AddABTestsRequest, dict[str, Any]],
request_options: Optional[Union[dict, RequestOptions]] = None,
) -> ApiResponse[str]:
"""
Expand Down Expand Up @@ -939,15 +944,15 @@ def add_ab_tests_with_http_info(
verb=Verb.POST,
path="/2/abtests",
request_options=self._request_options.merge(
data=dumps(bodySerializer(_data)),
data=dumps(body_serializer(_data)),
user_request_options=request_options,
),
use_read_transporter=False,
)

def add_ab_tests(
self,
add_ab_tests_request: AddABTestsRequest,
add_ab_tests_request: Union[AddABTestsRequest, dict[str, Any]],
request_options: Optional[Union[dict, RequestOptions]] = None,
) -> ABTestResponse:
"""
Expand Down Expand Up @@ -995,11 +1000,11 @@ def custom_delete_with_http_info(
"Parameter `path` is required when calling `custom_delete`."
)

_query_parameters: List[Tuple[str, str]] = []
_query_parameters: Dict[str, Any] = {}

if parameters is not None:
for _qpkey, _qpvalue in parameters.items():
_query_parameters.append((_qpkey, _qpvalue))
_query_parameters[_qpkey] = _qpvalue

return self._transporter.request(
verb=Verb.DELETE,
Expand Down Expand Up @@ -1068,11 +1073,11 @@ def custom_get_with_http_info(
if path is None:
raise ValueError("Parameter `path` is required when calling `custom_get`.")

_query_parameters: List[Tuple[str, str]] = []
_query_parameters: Dict[str, Any] = {}

if parameters is not None:
for _qpkey, _qpvalue in parameters.items():
_query_parameters.append((_qpkey, _qpvalue))
_query_parameters[_qpkey] = _qpvalue

return self._transporter.request(
verb=Verb.GET,
Expand Down Expand Up @@ -1147,11 +1152,11 @@ def custom_post_with_http_info(
if path is None:
raise ValueError("Parameter `path` is required when calling `custom_post`.")

_query_parameters: List[Tuple[str, str]] = []
_query_parameters: Dict[str, Any] = {}

if parameters is not None:
for _qpkey, _qpvalue in parameters.items():
_query_parameters.append((_qpkey, _qpvalue))
_query_parameters[_qpkey] = _qpvalue

_data = {}
if body is not None:
Expand All @@ -1162,7 +1167,7 @@ def custom_post_with_http_info(
path="/{path}".replace("{path}", path),
request_options=self._request_options.merge(
query_parameters=_query_parameters,
data=dumps(bodySerializer(_data)),
data=dumps(body_serializer(_data)),
user_request_options=request_options,
),
use_read_transporter=False,
Expand Down Expand Up @@ -1237,11 +1242,11 @@ def custom_put_with_http_info(
if path is None:
raise ValueError("Parameter `path` is required when calling `custom_put`.")

_query_parameters: List[Tuple[str, str]] = []
_query_parameters: Dict[str, Any] = {}

if parameters is not None:
for _qpkey, _qpvalue in parameters.items():
_query_parameters.append((_qpkey, _qpvalue))
_query_parameters[_qpkey] = _qpvalue

_data = {}
if body is not None:
Expand All @@ -1252,7 +1257,7 @@ def custom_put_with_http_info(
path="/{path}".replace("{path}", path),
request_options=self._request_options.merge(
query_parameters=_query_parameters,
data=dumps(bodySerializer(_data)),
data=dumps(body_serializer(_data)),
user_request_options=request_options,
),
use_read_transporter=False,
Expand Down Expand Up @@ -1431,16 +1436,16 @@ def list_ab_tests_with_http_info(
:return: Returns the raw algoliasearch 'APIResponse' object.
"""

_query_parameters: List[Tuple[str, str]] = []
_query_parameters: Dict[str, Any] = {}

if offset is not None:
_query_parameters.append(("offset", offset))
_query_parameters["offset"] = offset
if limit is not None:
_query_parameters.append(("limit", limit))
_query_parameters["limit"] = limit
if index_prefix is not None:
_query_parameters.append(("indexPrefix", index_prefix))
_query_parameters["indexPrefix"] = index_prefix
if index_suffix is not None:
_query_parameters.append(("indexSuffix", index_suffix))
_query_parameters["indexSuffix"] = index_suffix

return self._transporter.request(
verb=Verb.GET,
Expand Down Expand Up @@ -1499,7 +1504,7 @@ def list_ab_tests(

def schedule_ab_test_with_http_info(
self,
schedule_ab_tests_request: ScheduleABTestsRequest,
schedule_ab_tests_request: Union[ScheduleABTestsRequest, dict[str, Any]],
request_options: Optional[Union[dict, RequestOptions]] = None,
) -> ApiResponse[str]:
"""
Expand Down Expand Up @@ -1527,15 +1532,15 @@ def schedule_ab_test_with_http_info(
verb=Verb.POST,
path="/2/abtests/schedule",
request_options=self._request_options.merge(
data=dumps(bodySerializer(_data)),
data=dumps(body_serializer(_data)),
user_request_options=request_options,
),
use_read_transporter=False,
)

def schedule_ab_test(
self,
schedule_ab_tests_request: ScheduleABTestsRequest,
schedule_ab_tests_request: Union[ScheduleABTestsRequest, dict[str, Any]],
request_options: Optional[Union[dict, RequestOptions]] = None,
) -> ScheduleABTestResponse:
"""
Expand Down
Loading

0 comments on commit eaa5b2a

Please sign in to comment.