-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(specs): add estimate path and responses [skip-bc] (generated)
algolia/api-clients-automation#4057 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Christopher Hawke <[email protected]> Co-authored-by: Pierre Millot <[email protected]>
- Loading branch information
1 parent
d9c739a
commit 3aabb18
Showing
6 changed files
with
387 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
algoliasearch/abtesting/models/estimate_ab_test_request.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# coding: utf-8 | ||
|
||
""" | ||
Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. | ||
""" | ||
|
||
from __future__ import annotations | ||
|
||
from json import loads | ||
from sys import version_info | ||
from typing import Any, Dict, List, Optional | ||
|
||
from pydantic import BaseModel, ConfigDict | ||
|
||
if version_info >= (3, 11): | ||
from typing import Self | ||
else: | ||
from typing_extensions import Self | ||
|
||
|
||
from algoliasearch.abtesting.models.add_ab_tests_variant import AddABTestsVariant | ||
from algoliasearch.abtesting.models.estimate_configuration import EstimateConfiguration | ||
|
||
_ALIASES = { | ||
"configuration": "configuration", | ||
"variants": "variants", | ||
} | ||
|
||
|
||
def _alias_generator(name: str) -> str: | ||
return _ALIASES.get(name, name) | ||
|
||
|
||
class EstimateABTestRequest(BaseModel): | ||
""" | ||
EstimateABTestRequest | ||
""" | ||
|
||
configuration: EstimateConfiguration | ||
variants: List[AddABTestsVariant] | ||
""" A/B test variants. """ | ||
|
||
model_config = ConfigDict( | ||
use_enum_values=True, | ||
populate_by_name=True, | ||
validate_assignment=True, | ||
protected_namespaces=(), | ||
alias_generator=_alias_generator, | ||
) | ||
|
||
def to_json(self) -> str: | ||
return self.model_dump_json(by_alias=True, exclude_unset=True) | ||
|
||
@classmethod | ||
def from_json(cls, json_str: str) -> Optional[Self]: | ||
"""Create an instance of EstimateABTestRequest from a JSON string""" | ||
return cls.from_dict(loads(json_str)) | ||
|
||
def to_dict(self) -> Dict[str, Any]: | ||
"""Return the dictionary representation of the model using alias.""" | ||
return self.model_dump( | ||
by_alias=True, | ||
exclude_none=True, | ||
exclude_unset=True, | ||
) | ||
|
||
@classmethod | ||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: | ||
"""Create an instance of EstimateABTestRequest from a dict""" | ||
if obj is None: | ||
return None | ||
|
||
if not isinstance(obj, dict): | ||
return cls.model_validate(obj) | ||
|
||
obj["configuration"] = ( | ||
EstimateConfiguration.from_dict(obj["configuration"]) | ||
if obj.get("configuration") is not None | ||
else None | ||
) | ||
obj["variants"] = ( | ||
[AddABTestsVariant.from_dict(_item) for _item in obj["variants"]] | ||
if obj.get("variants") is not None | ||
else None | ||
) | ||
|
||
return cls.model_validate(obj) |
77 changes: 77 additions & 0 deletions
77
algoliasearch/abtesting/models/estimate_ab_test_response.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# coding: utf-8 | ||
|
||
""" | ||
Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. | ||
""" | ||
|
||
from __future__ import annotations | ||
|
||
from json import loads | ||
from sys import version_info | ||
from typing import Any, Dict, Optional | ||
|
||
from pydantic import BaseModel, ConfigDict | ||
|
||
if version_info >= (3, 11): | ||
from typing import Self | ||
else: | ||
from typing_extensions import Self | ||
|
||
|
||
_ALIASES = { | ||
"duration_days": "durationDays", | ||
"control_sample_size": "controlSampleSize", | ||
"experiment_sample_size": "experimentSampleSize", | ||
} | ||
|
||
|
||
def _alias_generator(name: str) -> str: | ||
return _ALIASES.get(name, name) | ||
|
||
|
||
class EstimateABTestResponse(BaseModel): | ||
""" | ||
EstimateABTestResponse | ||
""" | ||
|
||
duration_days: Optional[int] = None | ||
""" Estimated number of days needed to reach the sample sizes required for detecting the configured effect. This value is based on historical traffic. """ | ||
control_sample_size: Optional[int] = None | ||
""" Number of tracked searches needed to be able to detect the configured effect for the control variant. """ | ||
experiment_sample_size: Optional[int] = None | ||
""" Number of tracked searches needed to be able to detect the configured effect for the experiment variant. """ | ||
|
||
model_config = ConfigDict( | ||
use_enum_values=True, | ||
populate_by_name=True, | ||
validate_assignment=True, | ||
protected_namespaces=(), | ||
alias_generator=_alias_generator, | ||
) | ||
|
||
def to_json(self) -> str: | ||
return self.model_dump_json(by_alias=True, exclude_unset=True) | ||
|
||
@classmethod | ||
def from_json(cls, json_str: str) -> Optional[Self]: | ||
"""Create an instance of EstimateABTestResponse from a JSON string""" | ||
return cls.from_dict(loads(json_str)) | ||
|
||
def to_dict(self) -> Dict[str, Any]: | ||
"""Return the dictionary representation of the model using alias.""" | ||
return self.model_dump( | ||
by_alias=True, | ||
exclude_none=True, | ||
exclude_unset=True, | ||
) | ||
|
||
@classmethod | ||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: | ||
"""Create an instance of EstimateABTestResponse from a dict""" | ||
if obj is None: | ||
return None | ||
|
||
if not isinstance(obj, dict): | ||
return cls.model_validate(obj) | ||
|
||
return cls.model_validate(obj) |
Oops, something went wrong.