Skip to content

Commit

Permalink
fix(specs): proper title with linter (generated)
Browse files Browse the repository at this point in the history
algolia/api-clients-automation#3444

Co-authored-by: algolia-bot <[email protected]>
Co-authored-by: Pierre Millot <[email protected]>
  • Loading branch information
algolia-bot and millotp committed Jul 30, 2024
1 parent 4ffbdc3 commit 13dcd44
Show file tree
Hide file tree
Showing 44 changed files with 440 additions and 205 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from pydantic import BaseModel, ConfigDict, Field, StrictInt


class FilterEffectsEmptySearch(BaseModel):
class EmptySearchFilter(BaseModel):
"""
Empty searches removed from the A/B test as a result of configuration settings.
"""
Expand All @@ -37,7 +37,7 @@ def to_json(self) -> str:

@classmethod
def from_json(cls, json_str: str) -> Self:
"""Create an instance of FilterEffectsEmptySearch from a JSON string"""
"""Create an instance of EmptySearchFilter from a JSON string"""
return cls.from_dict(loads(json_str))

def to_dict(self) -> Dict[str, Any]:
Expand All @@ -59,7 +59,7 @@ def to_dict(self) -> Dict[str, Any]:

@classmethod
def from_dict(cls, obj: Dict) -> Self:
"""Create an instance of FilterEffectsEmptySearch from a dict"""
"""Create an instance of EmptySearchFilter from a dict"""
if obj is None:
return None

Expand Down
16 changes: 6 additions & 10 deletions algoliasearch/abtesting/models/filter_effects.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,17 @@

from pydantic import BaseModel, ConfigDict, Field

from algoliasearch.abtesting.models.filter_effects_empty_search import (
FilterEffectsEmptySearch,
)
from algoliasearch.abtesting.models.filter_effects_outliers import FilterEffectsOutliers
from algoliasearch.abtesting.models.empty_search_filter import EmptySearchFilter
from algoliasearch.abtesting.models.outliers_filter import OutliersFilter


class FilterEffects(BaseModel):
"""
A/B test filter effects resulting from configuration settings.
"""

outliers: Optional[FilterEffectsOutliers] = None
empty_search: Optional[FilterEffectsEmptySearch] = Field(
default=None, alias="emptySearch"
)
outliers: Optional[OutliersFilter] = None
empty_search: Optional[EmptySearchFilter] = Field(default=None, alias="emptySearch")

model_config = ConfigDict(
use_enum_values=True, populate_by_name=True, validate_assignment=True
Expand Down Expand Up @@ -72,12 +68,12 @@ def from_dict(cls, obj: Dict) -> Self:
_obj = cls.model_validate(
{
"outliers": (
FilterEffectsOutliers.from_dict(obj.get("outliers"))
OutliersFilter.from_dict(obj.get("outliers"))
if obj.get("outliers") is not None
else None
),
"emptySearch": (
FilterEffectsEmptySearch.from_dict(obj.get("emptySearch"))
EmptySearchFilter.from_dict(obj.get("emptySearch"))
if obj.get("emptySearch") is not None
else None
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from pydantic import BaseModel, ConfigDict, Field, StrictInt


class FilterEffectsOutliers(BaseModel):
class OutliersFilter(BaseModel):
"""
Outliers removed from the A/B test as a result of configuration settings.
"""
Expand All @@ -37,7 +37,7 @@ def to_json(self) -> str:

@classmethod
def from_json(cls, json_str: str) -> Self:
"""Create an instance of FilterEffectsOutliers from a JSON string"""
"""Create an instance of OutliersFilter from a JSON string"""
return cls.from_dict(loads(json_str))

def to_dict(self) -> Dict[str, Any]:
Expand All @@ -59,7 +59,7 @@ def to_dict(self) -> Dict[str, Any]:

@classmethod
def from_dict(cls, obj: Dict) -> Self:
"""Create an instance of FilterEffectsOutliers from a dict"""
"""Create an instance of OutliersFilter from a dict"""
if obj is None:
return None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from pydantic import BaseModel, ConfigDict, Field, StrictInt


class ClickPositionsInner(BaseModel):
class ClickPosition(BaseModel):
"""
Click position.
"""
Expand All @@ -38,7 +38,7 @@ def to_json(self) -> str:

@classmethod
def from_json(cls, json_str: str) -> Self:
"""Create an instance of ClickPositionsInner from a JSON string"""
"""Create an instance of ClickPosition from a JSON string"""
return cls.from_dict(loads(json_str))

def to_dict(self) -> Dict[str, Any]:
Expand All @@ -60,7 +60,7 @@ def to_dict(self) -> Dict[str, Any]:

@classmethod
def from_dict(cls, obj: Dict) -> Self:
"""Create an instance of ClickPositionsInner from a dict"""
"""Create an instance of ClickPosition from a dict"""
if obj is None:
return None

Expand Down
15 changes: 6 additions & 9 deletions algoliasearch/analytics/models/get_click_positions_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@

from pydantic import BaseModel, ConfigDict, Field

from algoliasearch.analytics.models.click_positions_inner import ClickPositionsInner
from algoliasearch.analytics.models.click_position import ClickPosition


class GetClickPositionsResponse(BaseModel):
"""
GetClickPositionsResponse
"""

positions: Annotated[
List[ClickPositionsInner], Field(min_length=12, max_length=12)
] = Field(
description="List of positions in the search results and clicks associated with this search."
positions: Annotated[List[ClickPosition], Field(min_length=12, max_length=12)] = (
Field(
description="List of positions in the search results and clicks associated with this search."
)
)

model_config = ConfigDict(
Expand Down Expand Up @@ -72,10 +72,7 @@ def from_dict(cls, obj: Dict) -> Self:
_obj = cls.model_validate(
{
"positions": (
[
ClickPositionsInner.from_dict(_item)
for _item in obj.get("positions")
]
[ClickPosition.from_dict(_item) for _item in obj.get("positions")]
if obj.get("positions") is not None
else None
)
Expand Down
6 changes: 3 additions & 3 deletions algoliasearch/analytics/models/top_search_with_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr

from algoliasearch.analytics.models.click_positions_inner import ClickPositionsInner
from algoliasearch.analytics.models.click_position import ClickPosition


class TopSearchWithAnalytics(BaseModel):
Expand Down Expand Up @@ -40,7 +40,7 @@ class TopSearchWithAnalytics(BaseModel):
alias="averageClickPosition",
)
click_positions: Annotated[
List[ClickPositionsInner], Field(min_length=12, max_length=12)
List[ClickPosition], Field(min_length=12, max_length=12)
] = Field(
description="List of positions in the search results and clicks associated with this search.",
alias="clickPositions",
Expand Down Expand Up @@ -118,7 +118,7 @@ def from_dict(cls, obj: Dict) -> Self:
"averageClickPosition": obj.get("averageClickPosition"),
"clickPositions": (
[
ClickPositionsInner.from_dict(_item)
ClickPosition.from_dict(_item)
for _item in obj.get("clickPositions")
]
if obj.get("clickPositions") is not None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr

from algoliasearch.analytics.models.click_positions_inner import ClickPositionsInner
from algoliasearch.analytics.models.click_position import ClickPosition
from algoliasearch.analytics.models.currencies_value import CurrenciesValue


Expand Down Expand Up @@ -41,7 +41,7 @@ class TopSearchWithRevenueAnalytics(BaseModel):
alias="averageClickPosition",
)
click_positions: Annotated[
List[ClickPositionsInner], Field(min_length=12, max_length=12)
List[ClickPosition], Field(min_length=12, max_length=12)
] = Field(
description="List of positions in the search results and clicks associated with this search.",
alias="clickPositions",
Expand Down Expand Up @@ -153,7 +153,7 @@ def from_dict(cls, obj: Dict) -> Self:
"averageClickPosition": obj.get("averageClickPosition"),
"clickPositions": (
[
ClickPositionsInner.from_dict(_item)
ClickPosition.from_dict(_item)
for _item in obj.get("clickPositions")
]
if obj.get("clickPositions") is not None
Expand Down
2 changes: 1 addition & 1 deletion algoliasearch/ingestion/models/docker_streams_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class DockerStreamsInput(BaseModel):
"""
DockerStreamsInput
The selected streams of a singer or airbyte connector.
"""

streams: Dict[str, Any]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr


class TransformationTryResponseError(BaseModel):
class TransformationError(BaseModel):
"""
The error if the transformation failed.
"""
Expand All @@ -33,7 +33,7 @@ def to_json(self) -> str:

@classmethod
def from_json(cls, json_str: str) -> Self:
"""Create an instance of TransformationTryResponseError from a JSON string"""
"""Create an instance of TransformationError from a JSON string"""
return cls.from_dict(loads(json_str))

def to_dict(self) -> Dict[str, Any]:
Expand All @@ -55,7 +55,7 @@ def to_dict(self) -> Dict[str, Any]:

@classmethod
def from_dict(cls, obj: Dict) -> Self:
"""Create an instance of TransformationTryResponseError from a dict"""
"""Create an instance of TransformationError from a dict"""
if obj is None:
return None

Expand Down
8 changes: 3 additions & 5 deletions algoliasearch/ingestion/models/transformation_try_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

from pydantic import BaseModel, ConfigDict, Field

from algoliasearch.ingestion.models.transformation_try_response_error import (
TransformationTryResponseError,
)
from algoliasearch.ingestion.models.transformation_error import TransformationError


class TransformationTryResponse(BaseModel):
Expand All @@ -24,7 +22,7 @@ class TransformationTryResponse(BaseModel):
payloads: List[Dict[str, Any]] = Field(
description="The array of records returned by the transformation service."
)
error: Optional[TransformationTryResponseError] = None
error: Optional[TransformationError] = None

model_config = ConfigDict(
use_enum_values=True, populate_by_name=True, validate_assignment=True
Expand Down Expand Up @@ -70,7 +68,7 @@ def from_dict(cls, obj: Dict) -> Self:
{
"payloads": obj.get("payloads"),
"error": (
TransformationTryResponseError.from_dict(obj.get("error"))
TransformationError.from_dict(obj.get("error"))
if obj.get("error") is not None
else None
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
from pydantic import BaseModel, ConfigDict, StrictStr


class GetServers403Response(BaseModel):
class BadRequest(BaseModel):
"""
GetServers403Response
BadRequest
"""

reason: Optional[StrictStr] = None
Expand All @@ -28,7 +28,7 @@ def to_json(self) -> str:

@classmethod
def from_json(cls, json_str: str) -> Self:
"""Create an instance of GetServers403Response from a JSON string"""
"""Create an instance of BadRequest from a JSON string"""
return cls.from_dict(loads(json_str))

def to_dict(self) -> Dict[str, Any]:
Expand All @@ -50,7 +50,7 @@ def to_dict(self) -> Dict[str, Any]:

@classmethod
def from_dict(cls, obj: Dict) -> Self:
"""Create an instance of GetServers403Response from a dict"""
"""Create an instance of BadRequest from a dict"""
if obj is None:
return None

Expand Down
61 changes: 61 additions & 0 deletions algoliasearch/monitoring/models/forbidden.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# 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 typing import Any, Dict, Optional, Self

from pydantic import BaseModel, ConfigDict, StrictStr


class Forbidden(BaseModel):
"""
Forbidden
"""

reason: Optional[StrictStr] = None

model_config = ConfigDict(
use_enum_values=True, populate_by_name=True, validate_assignment=True
)

def to_json(self) -> str:
return self.model_dump_json(by_alias=True, exclude_unset=True)

@classmethod
def from_json(cls, json_str: str) -> Self:
"""Create an instance of Forbidden 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.
This has the following differences from calling pydantic's
`self.model_dump(by_alias=True)`:
* `None` is only added to the output dict for nullable fields that
were set at model initialization. Other fields with value `None`
are ignored.
"""
_dict = self.model_dump(
by_alias=True,
exclude={},
exclude_none=True,
)
return _dict

@classmethod
def from_dict(cls, obj: Dict) -> Self:
"""Create an instance of Forbidden from a dict"""
if obj is None:
return None

if not isinstance(obj, dict):
return cls.model_validate(obj)

_obj = cls.model_validate({"reason": obj.get("reason")})
return _obj
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
from algoliasearch.monitoring.models.incident import Incident


class IncidentsInner(BaseModel):
class IncidentEntry(BaseModel):
"""
IncidentsInner
IncidentEntry
"""

t: Optional[StrictInt] = Field(
Expand All @@ -34,7 +34,7 @@ def to_json(self) -> str:

@classmethod
def from_json(cls, json_str: str) -> Self:
"""Create an instance of IncidentsInner from a JSON string"""
"""Create an instance of IncidentEntry from a JSON string"""
return cls.from_dict(loads(json_str))

def to_dict(self) -> Dict[str, Any]:
Expand All @@ -58,7 +58,7 @@ def to_dict(self) -> Dict[str, Any]:

@classmethod
def from_dict(cls, obj: Dict) -> Self:
"""Create an instance of IncidentsInner from a dict"""
"""Create an instance of IncidentEntry from a dict"""
if obj is None:
return None

Expand Down
Loading

0 comments on commit 13dcd44

Please sign in to comment.