Skip to content

Commit 84aac6e

Browse files
fix(specs): ingestion docker task input (generated)
algolia/api-clients-automation#3488 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent aa8eb52 commit 84aac6e

File tree

4 files changed

+129
-7
lines changed

4 files changed

+129
-7
lines changed

algoliasearch/ingestion/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4008,7 +4008,7 @@ async def trigger_docker_source_discover(
40084008
)
40094009
).deserialize(SourceWatchResponse)
40104010

4011-
async def try_transformations_with_http_info(
4011+
async def try_transformation_with_http_info(
40124012
self,
40134013
transformation_try: TransformationTry,
40144014
request_options: Optional[Union[dict, RequestOptions]] = None,
@@ -4029,7 +4029,7 @@ async def try_transformations_with_http_info(
40294029

40304030
if transformation_try is None:
40314031
raise ValueError(
4032-
"Parameter `transformation_try` is required when calling `try_transformations`."
4032+
"Parameter `transformation_try` is required when calling `try_transformation`."
40334033
)
40344034

40354035
_data = {}
@@ -4046,7 +4046,7 @@ async def try_transformations_with_http_info(
40464046
use_read_transporter=False,
40474047
)
40484048

4049-
async def try_transformations(
4049+
async def try_transformation(
40504050
self,
40514051
transformation_try: TransformationTry,
40524052
request_options: Optional[Union[dict, RequestOptions]] = None,
@@ -4065,7 +4065,7 @@ async def try_transformations(
40654065
:return: Returns the deserialized response in a 'TransformationTryResponse' result object.
40664066
"""
40674067
return (
4068-
await self.try_transformations_with_http_info(
4068+
await self.try_transformation_with_http_info(
40694069
transformation_try, request_options
40704070
)
40714071
).deserialize(TransformationTryResponse)
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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, List, Optional, Self
11+
12+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
13+
14+
from algoliasearch.ingestion.models.docker_streams_sync_mode import (
15+
DockerStreamsSyncMode,
16+
)
17+
18+
19+
class DockerStreams(BaseModel):
20+
"""
21+
DockerStreams
22+
"""
23+
24+
name: StrictStr = Field(
25+
description="The name of the stream to fetch the data from (e.g. table name)."
26+
)
27+
properties: Optional[List[StrictStr]] = Field(
28+
default=None,
29+
description="The properties of the stream to select (e.g. column).",
30+
)
31+
sync_mode: DockerStreamsSyncMode = Field(alias="syncMode")
32+
33+
model_config = ConfigDict(
34+
use_enum_values=True, populate_by_name=True, validate_assignment=True
35+
)
36+
37+
def to_json(self) -> str:
38+
return self.model_dump_json(by_alias=True, exclude_unset=True)
39+
40+
@classmethod
41+
def from_json(cls, json_str: str) -> Self:
42+
"""Create an instance of DockerStreams from a JSON string"""
43+
return cls.from_dict(loads(json_str))
44+
45+
def to_dict(self) -> Dict[str, Any]:
46+
"""Return the dictionary representation of the model using alias.
47+
48+
This has the following differences from calling pydantic's
49+
`self.model_dump(by_alias=True)`:
50+
51+
* `None` is only added to the output dict for nullable fields that
52+
were set at model initialization. Other fields with value `None`
53+
are ignored.
54+
"""
55+
_dict = self.model_dump(
56+
by_alias=True,
57+
exclude={},
58+
exclude_none=True,
59+
)
60+
return _dict
61+
62+
@classmethod
63+
def from_dict(cls, obj: Dict) -> Self:
64+
"""Create an instance of DockerStreams from a dict"""
65+
if obj is None:
66+
return None
67+
68+
if not isinstance(obj, dict):
69+
return cls.model_validate(obj)
70+
71+
_obj = cls.model_validate(
72+
{
73+
"name": obj.get("name"),
74+
"properties": obj.get("properties"),
75+
"syncMode": obj.get("syncMode"),
76+
}
77+
)
78+
return _obj

algoliasearch/ingestion/models/docker_streams_input.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@
77
from __future__ import annotations
88

99
from json import loads
10-
from typing import Any, Dict, Self
10+
from typing import Any, Dict, List, Self
1111

1212
from pydantic import BaseModel, ConfigDict
1313

14+
from algoliasearch.ingestion.models.docker_streams import DockerStreams
15+
1416

1517
class DockerStreamsInput(BaseModel):
1618
"""
1719
The selected streams of a singer or airbyte connector.
1820
"""
1921

20-
streams: Dict[str, Any]
22+
streams: List[DockerStreams]
2123

2224
model_config = ConfigDict(
2325
use_enum_values=True, populate_by_name=True, validate_assignment=True
@@ -46,6 +48,12 @@ def to_dict(self) -> Dict[str, Any]:
4648
exclude={},
4749
exclude_none=True,
4850
)
51+
_items = []
52+
if self.streams:
53+
for _item in self.streams:
54+
if _item:
55+
_items.append(_item.to_dict())
56+
_dict["streams"] = _items
4957
return _dict
5058

5159
@classmethod
@@ -57,5 +65,13 @@ def from_dict(cls, obj: Dict) -> Self:
5765
if not isinstance(obj, dict):
5866
return cls.model_validate(obj)
5967

60-
_obj = cls.model_validate({"streams": obj.get("streams")})
68+
_obj = cls.model_validate(
69+
{
70+
"streams": (
71+
[DockerStreams.from_dict(_item) for _item in obj.get("streams")]
72+
if obj.get("streams") is not None
73+
else None
74+
)
75+
}
76+
)
6177
return _obj
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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 enum import Enum
10+
from json import loads
11+
from typing import Self
12+
13+
14+
class DockerStreamsSyncMode(str, Enum):
15+
"""
16+
The strategy to use to fetch the data.
17+
"""
18+
19+
"""
20+
allowed enum values
21+
"""
22+
INCREMENTAL = "incremental"
23+
FULLTABLE = "fullTable"
24+
25+
@classmethod
26+
def from_json(cls, json_str: str) -> Self:
27+
"""Create an instance of DockerStreamsSyncMode from a JSON string"""
28+
return cls(loads(json_str))

0 commit comments

Comments
 (0)