Skip to content

Commit 3ee7108

Browse files
feat(javascript): add replaceAllObjectsWithTransformation (generated)
algolia/api-clients-automation#5008 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent 684db75 commit 3ee7108

File tree

2 files changed

+98
-0
lines changed

2 files changed

+98
-0
lines changed

algoliasearch/search/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@
174174
from .user_hit import UserHit
175175
from .user_id import UserId
176176
from .value import Value
177+
from .watch_response import WatchResponse
177178
from .widgets import Widgets
178179

179180
__all__ = (
@@ -343,5 +344,6 @@
343344
"UserHit",
344345
"UserId",
345346
"Value",
347+
"WatchResponse",
346348
"Widgets",
347349
)
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
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.search.models.updated_at_response import UpdatedAtResponse
22+
from algoliasearch.search.models.watch_response import WatchResponse
23+
24+
_ALIASES = {
25+
"copy_operation_response": "copyOperationResponse",
26+
"watch_responses": "watchResponses",
27+
"move_operation_response": "moveOperationResponse",
28+
}
29+
30+
31+
def _alias_generator(name: str) -> str:
32+
return _ALIASES.get(name, name)
33+
34+
35+
class ReplaceAllObjectsWithTransformationResponse(BaseModel):
36+
"""
37+
ReplaceAllObjectsWithTransformationResponse
38+
"""
39+
40+
copy_operation_response: UpdatedAtResponse
41+
watch_responses: List[WatchResponse]
42+
""" The response of the `push` request(s). """
43+
move_operation_response: UpdatedAtResponse
44+
45+
model_config = ConfigDict(
46+
strict=False,
47+
use_enum_values=True,
48+
populate_by_name=True,
49+
validate_assignment=True,
50+
protected_namespaces=(),
51+
alias_generator=_alias_generator,
52+
extra="allow",
53+
)
54+
55+
def to_json(self) -> str:
56+
return self.model_dump_json(by_alias=True, exclude_unset=True)
57+
58+
@classmethod
59+
def from_json(cls, json_str: str) -> Optional[Self]:
60+
"""Create an instance of ReplaceAllObjectsWithTransformationResponse from a JSON string"""
61+
return cls.from_dict(loads(json_str))
62+
63+
def to_dict(self) -> Dict[str, Any]:
64+
"""Return the dictionary representation of the model using alias."""
65+
return self.model_dump(
66+
by_alias=True,
67+
exclude_none=True,
68+
exclude_unset=True,
69+
)
70+
71+
@classmethod
72+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
73+
"""Create an instance of ReplaceAllObjectsWithTransformationResponse from a dict"""
74+
if obj is None:
75+
return None
76+
77+
if not isinstance(obj, dict):
78+
return cls.model_validate(obj)
79+
80+
obj["copyOperationResponse"] = (
81+
UpdatedAtResponse.from_dict(obj["copyOperationResponse"])
82+
if obj.get("copyOperationResponse") is not None
83+
else None
84+
)
85+
obj["watchResponses"] = (
86+
[WatchResponse.from_dict(_item) for _item in obj["watchResponses"]]
87+
if obj.get("watchResponses") is not None
88+
else None
89+
)
90+
obj["moveOperationResponse"] = (
91+
UpdatedAtResponse.from_dict(obj["moveOperationResponse"])
92+
if obj.get("moveOperationResponse") is not None
93+
else None
94+
)
95+
96+
return cls.model_validate(obj)

0 commit comments

Comments
 (0)