Skip to content

Commit 99b0d6c

Browse files
chore: generated code for commit 9776cb3b. [skip ci]
algolia/api-clients-automation@9776cb3 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent 039ed96 commit 99b0d6c

File tree

6 files changed

+144
-4
lines changed

6 files changed

+144
-4
lines changed

algoliasearch/recommend/models/redirect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
class Redirect(BaseModel):
2020
"""
21-
[Redirect results to a URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/).
21+
[Redirect results to a URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/), this this parameter is for internal use only.
2222
"""
2323

2424
index: Optional[List[RedirectRuleIndexMetadata]] = None
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# coding: utf-8
2+
3+
"""
4+
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.
5+
"""
6+
7+
from __future__ import annotations
8+
9+
from json import loads
10+
from typing import Any, Dict, Optional, Self
11+
12+
from pydantic import BaseModel, ConfigDict, StrictStr
13+
14+
15+
class RedirectURL(BaseModel):
16+
"""
17+
The redirect rule container.
18+
"""
19+
20+
url: Optional[StrictStr] = None
21+
22+
model_config = ConfigDict(
23+
use_enum_values=True, populate_by_name=True, validate_assignment=True
24+
)
25+
26+
def to_json(self) -> str:
27+
return self.model_dump_json(by_alias=True, exclude_unset=True)
28+
29+
@classmethod
30+
def from_json(cls, json_str: str) -> Self:
31+
"""Create an instance of RedirectURL from a JSON string"""
32+
return cls.from_dict(loads(json_str))
33+
34+
def to_dict(self) -> Dict[str, Any]:
35+
"""Return the dictionary representation of the model using alias.
36+
37+
This has the following differences from calling pydantic's
38+
`self.model_dump(by_alias=True)`:
39+
40+
* `None` is only added to the output dict for nullable fields that
41+
were set at model initialization. Other fields with value `None`
42+
are ignored.
43+
"""
44+
_dict = self.model_dump(
45+
by_alias=True,
46+
exclude={},
47+
exclude_none=True,
48+
)
49+
return _dict
50+
51+
@classmethod
52+
def from_dict(cls, obj: Dict) -> Self:
53+
"""Create an instance of RedirectURL from a dict"""
54+
if obj is None:
55+
return None
56+
57+
if not isinstance(obj, dict):
58+
return cls.model_validate(obj)
59+
60+
_obj = cls.model_validate({"url": obj.get("url")})
61+
return _obj

algoliasearch/recommend/models/rendering_content.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from pydantic import BaseModel, ConfigDict, Field
1313

1414
from algoliasearch.recommend.models.facet_ordering import FacetOrdering
15+
from algoliasearch.recommend.models.redirect_url import RedirectURL
1516

1617

1718
class RenderingContent(BaseModel):
@@ -20,6 +21,7 @@ class RenderingContent(BaseModel):
2021
"""
2122

2223
facet_ordering: Optional[FacetOrdering] = Field(default=None, alias="facetOrdering")
24+
redirect: Optional[RedirectURL] = None
2325

2426
model_config = ConfigDict(
2527
use_enum_values=True, populate_by_name=True, validate_assignment=True
@@ -50,6 +52,8 @@ def to_dict(self) -> Dict[str, Any]:
5052
)
5153
if self.facet_ordering:
5254
_dict["facetOrdering"] = self.facet_ordering.to_dict()
55+
if self.redirect:
56+
_dict["redirect"] = self.redirect.to_dict()
5357
return _dict
5458

5559
@classmethod
@@ -67,7 +71,12 @@ def from_dict(cls, obj: Dict) -> Self:
6771
FacetOrdering.from_dict(obj.get("facetOrdering"))
6872
if obj.get("facetOrdering") is not None
6973
else None
70-
)
74+
),
75+
"redirect": (
76+
RedirectURL.from_dict(obj.get("redirect"))
77+
if obj.get("redirect") is not None
78+
else None
79+
),
7180
}
7281
)
7382
return _obj

algoliasearch/search/models/redirect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
class Redirect(BaseModel):
2020
"""
21-
[Redirect results to a URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/).
21+
[Redirect results to a URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/), this this parameter is for internal use only.
2222
"""
2323

2424
index: Optional[List[RedirectRuleIndexMetadata]] = None
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# coding: utf-8
2+
3+
"""
4+
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.
5+
"""
6+
7+
from __future__ import annotations
8+
9+
from json import loads
10+
from typing import Any, Dict, Optional, Self
11+
12+
from pydantic import BaseModel, ConfigDict, StrictStr
13+
14+
15+
class RedirectURL(BaseModel):
16+
"""
17+
The redirect rule container.
18+
"""
19+
20+
url: Optional[StrictStr] = None
21+
22+
model_config = ConfigDict(
23+
use_enum_values=True, populate_by_name=True, validate_assignment=True
24+
)
25+
26+
def to_json(self) -> str:
27+
return self.model_dump_json(by_alias=True, exclude_unset=True)
28+
29+
@classmethod
30+
def from_json(cls, json_str: str) -> Self:
31+
"""Create an instance of RedirectURL from a JSON string"""
32+
return cls.from_dict(loads(json_str))
33+
34+
def to_dict(self) -> Dict[str, Any]:
35+
"""Return the dictionary representation of the model using alias.
36+
37+
This has the following differences from calling pydantic's
38+
`self.model_dump(by_alias=True)`:
39+
40+
* `None` is only added to the output dict for nullable fields that
41+
were set at model initialization. Other fields with value `None`
42+
are ignored.
43+
"""
44+
_dict = self.model_dump(
45+
by_alias=True,
46+
exclude={},
47+
exclude_none=True,
48+
)
49+
return _dict
50+
51+
@classmethod
52+
def from_dict(cls, obj: Dict) -> Self:
53+
"""Create an instance of RedirectURL from a dict"""
54+
if obj is None:
55+
return None
56+
57+
if not isinstance(obj, dict):
58+
return cls.model_validate(obj)
59+
60+
_obj = cls.model_validate({"url": obj.get("url")})
61+
return _obj

algoliasearch/search/models/rendering_content.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from pydantic import BaseModel, ConfigDict, Field
1313

1414
from algoliasearch.search.models.facet_ordering import FacetOrdering
15+
from algoliasearch.search.models.redirect_url import RedirectURL
1516

1617

1718
class RenderingContent(BaseModel):
@@ -20,6 +21,7 @@ class RenderingContent(BaseModel):
2021
"""
2122

2223
facet_ordering: Optional[FacetOrdering] = Field(default=None, alias="facetOrdering")
24+
redirect: Optional[RedirectURL] = None
2325

2426
model_config = ConfigDict(
2527
use_enum_values=True, populate_by_name=True, validate_assignment=True
@@ -50,6 +52,8 @@ def to_dict(self) -> Dict[str, Any]:
5052
)
5153
if self.facet_ordering:
5254
_dict["facetOrdering"] = self.facet_ordering.to_dict()
55+
if self.redirect:
56+
_dict["redirect"] = self.redirect.to_dict()
5357
return _dict
5458

5559
@classmethod
@@ -67,7 +71,12 @@ def from_dict(cls, obj: Dict) -> Self:
6771
FacetOrdering.from_dict(obj.get("facetOrdering"))
6872
if obj.get("facetOrdering") is not None
6973
else None
70-
)
74+
),
75+
"redirect": (
76+
RedirectURL.from_dict(obj.get("redirect"))
77+
if obj.get("redirect") is not None
78+
else None
79+
),
7180
}
7281
)
7382
return _obj

0 commit comments

Comments
 (0)