Skip to content

Commit 456da6e

Browse files
algolia-botFluf22
andcommitted
chore(website): exclude schema from generated variables file (generated)
algolia/api-clients-automation#5306 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Thomas Raffray <[email protected]>
1 parent b207bd1 commit 456da6e

File tree

4 files changed

+172
-0
lines changed

4 files changed

+172
-0
lines changed

algoliasearch/composition/models/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
from .compositions_search_response import CompositionsSearchResponse
2222
from .error_base import ErrorBase
2323
from .exhaustive import Exhaustive
24+
from .external_injected_item import ExternalInjectedItem
25+
from .external_injection import ExternalInjection
2426
from .facet_filters import FacetFilters
2527
from .facet_hits import FacetHits
2628
from .facet_ordering import FacetOrdering
@@ -77,6 +79,8 @@
7779
"CompositionsSearchResponse",
7880
"ErrorBase",
7981
"Exhaustive",
82+
"ExternalInjectedItem",
83+
"ExternalInjection",
8084
"FacetFilters",
8185
"FacetHits",
8286
"FacetOrdering",
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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 sys import version_info
11+
from typing import Any, Dict, List, Optional
12+
13+
from pydantic import BaseModel, ConfigDict
14+
15+
if version_info >= (3, 11):
16+
from typing import Self
17+
else:
18+
from typing_extensions import Self
19+
20+
21+
from algoliasearch.composition.models.external_injection import ExternalInjection
22+
23+
_ALIASES = {
24+
"items": "items",
25+
}
26+
27+
28+
def _alias_generator(name: str) -> str:
29+
return _ALIASES.get(name, name)
30+
31+
32+
class ExternalInjectedItem(BaseModel):
33+
"""
34+
ExternalInjectedItem
35+
"""
36+
37+
items: List[ExternalInjection]
38+
39+
model_config = ConfigDict(
40+
strict=False,
41+
use_enum_values=True,
42+
populate_by_name=True,
43+
validate_assignment=True,
44+
protected_namespaces=(),
45+
alias_generator=_alias_generator,
46+
extra="allow",
47+
)
48+
49+
def to_json(self) -> str:
50+
return self.model_dump_json(by_alias=True, exclude_unset=True)
51+
52+
@classmethod
53+
def from_json(cls, json_str: str) -> Optional[Self]:
54+
"""Create an instance of ExternalInjectedItem from a JSON string"""
55+
return cls.from_dict(loads(json_str))
56+
57+
def to_dict(self) -> Dict[str, Any]:
58+
"""Return the dictionary representation of the model using alias."""
59+
return self.model_dump(
60+
by_alias=True,
61+
exclude_none=True,
62+
exclude_unset=True,
63+
)
64+
65+
@classmethod
66+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
67+
"""Create an instance of ExternalInjectedItem from a dict"""
68+
if obj is None:
69+
return None
70+
71+
if not isinstance(obj, dict):
72+
return cls.model_validate(obj)
73+
74+
obj["items"] = (
75+
[ExternalInjection.from_dict(_item) for _item in obj["items"]]
76+
if obj.get("items") is not None
77+
else None
78+
)
79+
80+
return cls.model_validate(obj)
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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 sys import version_info
11+
from typing import Any, Dict, Optional
12+
13+
from pydantic import BaseModel, ConfigDict
14+
15+
if version_info >= (3, 11):
16+
from typing import Self
17+
else:
18+
from typing_extensions import Self
19+
20+
21+
_ALIASES = {
22+
"object_id": "objectID",
23+
"metadata": "metadata",
24+
}
25+
26+
27+
def _alias_generator(name: str) -> str:
28+
return _ALIASES.get(name, name)
29+
30+
31+
class ExternalInjection(BaseModel):
32+
"""
33+
ExternalInjection
34+
"""
35+
36+
object_id: str
37+
""" An objectID injected into an external source. """
38+
metadata: Optional[Dict[str, object]] = None
39+
""" User-defined key-values that will be added to the injected item in the response. This is identical to Hits metadata defined in Composition or Composition Rule, with the benefit of being set at runtime. """
40+
41+
model_config = ConfigDict(
42+
strict=False,
43+
use_enum_values=True,
44+
populate_by_name=True,
45+
validate_assignment=True,
46+
protected_namespaces=(),
47+
alias_generator=_alias_generator,
48+
extra="allow",
49+
)
50+
51+
def to_json(self) -> str:
52+
return self.model_dump_json(by_alias=True, exclude_unset=True)
53+
54+
@classmethod
55+
def from_json(cls, json_str: str) -> Optional[Self]:
56+
"""Create an instance of ExternalInjection from a JSON string"""
57+
return cls.from_dict(loads(json_str))
58+
59+
def to_dict(self) -> Dict[str, Any]:
60+
"""Return the dictionary representation of the model using alias."""
61+
return self.model_dump(
62+
by_alias=True,
63+
exclude_none=True,
64+
exclude_unset=True,
65+
)
66+
67+
@classmethod
68+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
69+
"""Create an instance of ExternalInjection from a dict"""
70+
if obj is None:
71+
return None
72+
73+
if not isinstance(obj, dict):
74+
return cls.model_validate(obj)
75+
76+
return cls.model_validate(obj)

algoliasearch/composition/models/params.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
from algoliasearch.composition.models.around_precision import AroundPrecision
2222
from algoliasearch.composition.models.around_radius import AroundRadius
23+
from algoliasearch.composition.models.external_injected_item import ExternalInjectedItem
2324
from algoliasearch.composition.models.facet_filters import FacetFilters
2425
from algoliasearch.composition.models.inside_bounding_box import InsideBoundingBox
2526
from algoliasearch.composition.models.numeric_filters import NumericFilters
@@ -53,6 +54,7 @@
5354
"analytics_tags": "analyticsTags",
5455
"enable_ab_test": "enableABTest",
5556
"enable_re_ranking": "enableReRanking",
57+
"injected_items": "injectedItems",
5658
}
5759

5860

@@ -111,6 +113,8 @@ class Params(BaseModel):
111113
""" Whether to enable index level A/B testing for this run request. If the composition mixes multiple indices, the A/B test is ignored. """
112114
enable_re_ranking: Optional[bool] = None
113115
""" Whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/) This setting only has an effect if you activated Dynamic Re-Ranking for this index in the Algolia dashboard. """
116+
injected_items: Optional[Dict[str, ExternalInjectedItem]] = None
117+
""" A list of extenrally injected objectID groups into from an external source. """
114118

115119
model_config = ConfigDict(
116120
strict=False,
@@ -179,5 +183,13 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
179183
)
180184
obj["queryLanguages"] = obj.get("queryLanguages")
181185
obj["naturalLanguages"] = obj.get("naturalLanguages")
186+
obj["injectedItems"] = (
187+
dict(
188+
(_k, ExternalInjectedItem.from_dict(_v))
189+
for _k, _v in obj["injectedItems"].items()
190+
)
191+
if obj.get("injectedItems") is not None
192+
else None
193+
)
182194

183195
return cls.model_validate(obj)

0 commit comments

Comments
 (0)