Skip to content

Commit d0a8175

Browse files
feat(specs): add authentications to ingestion transformations (generated)
algolia/api-clients-automation#3494 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent 51155fa commit d0a8175

File tree

4 files changed

+117
-6
lines changed

4 files changed

+117
-6
lines changed

algoliasearch/ingestion/client.py

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4082,7 +4082,7 @@ async def try_transformation_with_http_info(
40824082
request_options: Optional[Union[dict, RequestOptions]] = None,
40834083
) -> ApiResponse[str]:
40844084
"""
4085-
Try a transformation.
4085+
Try a transformation before creating it.
40864086
40874087
Required API Key ACLs:
40884088
- addObject
@@ -4120,7 +4120,7 @@ async def try_transformation(
41204120
request_options: Optional[Union[dict, RequestOptions]] = None,
41214121
) -> TransformationTryResponse:
41224122
"""
4123-
Try a transformation.
4123+
Try a transformation before creating it.
41244124
41254125
Required API Key ACLs:
41264126
- addObject
@@ -4138,6 +4138,85 @@ async def try_transformation(
41384138
)
41394139
).deserialize(TransformationTryResponse)
41404140

4141+
async def try_transformation_before_update_with_http_info(
4142+
self,
4143+
transformation_id: Annotated[
4144+
StrictStr, Field(description="Unique identifier of a transformation.")
4145+
],
4146+
transformation_try: TransformationTry,
4147+
request_options: Optional[Union[dict, RequestOptions]] = None,
4148+
) -> ApiResponse[str]:
4149+
"""
4150+
Try a transformation before updating it.
4151+
4152+
Required API Key ACLs:
4153+
- addObject
4154+
- deleteIndex
4155+
- editSettings
4156+
4157+
:param transformation_id: Unique identifier of a transformation. (required)
4158+
:type transformation_id: str
4159+
:param transformation_try: (required)
4160+
:type transformation_try: TransformationTry
4161+
:param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
4162+
:return: Returns the raw algoliasearch 'APIResponse' object.
4163+
"""
4164+
4165+
if transformation_id is None:
4166+
raise ValueError(
4167+
"Parameter `transformation_id` is required when calling `try_transformation_before_update`."
4168+
)
4169+
4170+
if transformation_try is None:
4171+
raise ValueError(
4172+
"Parameter `transformation_try` is required when calling `try_transformation_before_update`."
4173+
)
4174+
4175+
_data = {}
4176+
if transformation_try is not None:
4177+
_data = transformation_try
4178+
4179+
return await self._transporter.request(
4180+
verb=Verb.POST,
4181+
path="/1/transformations/{transformationID}/try".replace(
4182+
"{transformationID}", quote(str(transformation_id), safe="")
4183+
),
4184+
request_options=self._request_options.merge(
4185+
data=dumps(bodySerializer(_data)),
4186+
user_request_options=request_options,
4187+
),
4188+
use_read_transporter=False,
4189+
)
4190+
4191+
async def try_transformation_before_update(
4192+
self,
4193+
transformation_id: Annotated[
4194+
StrictStr, Field(description="Unique identifier of a transformation.")
4195+
],
4196+
transformation_try: TransformationTry,
4197+
request_options: Optional[Union[dict, RequestOptions]] = None,
4198+
) -> TransformationTryResponse:
4199+
"""
4200+
Try a transformation before updating it.
4201+
4202+
Required API Key ACLs:
4203+
- addObject
4204+
- deleteIndex
4205+
- editSettings
4206+
4207+
:param transformation_id: Unique identifier of a transformation. (required)
4208+
:type transformation_id: str
4209+
:param transformation_try: (required)
4210+
:type transformation_try: TransformationTry
4211+
:param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
4212+
:return: Returns the deserialized response in a 'TransformationTryResponse' result object.
4213+
"""
4214+
return (
4215+
await self.try_transformation_before_update_with_http_info(
4216+
transformation_id, transformation_try, request_options
4217+
)
4218+
).deserialize(TransformationTryResponse)
4219+
41414220
async def update_authentication_with_http_info(
41424221
self,
41434222
authentication_id: Annotated[

algoliasearch/ingestion/models/transformation.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from __future__ import annotations
88

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

1212
from pydantic import BaseModel, ConfigDict, Field, StrictStr
1313

@@ -21,6 +21,11 @@ class Transformation(BaseModel):
2121
description="Universally unique identifier (UUID) of a transformation.",
2222
alias="transformationID",
2323
)
24+
authentication_ids: Optional[List[StrictStr]] = Field(
25+
default=None,
26+
description="The authentications associated for the current transformation.",
27+
alias="authenticationIDs",
28+
)
2429
code: StrictStr = Field(description="The source code of the transformation.")
2530
name: StrictStr = Field(
2631
description="The uniquely identified name of your transformation."
@@ -79,6 +84,7 @@ def from_dict(cls, obj: Dict) -> Self:
7984
_obj = cls.model_validate(
8085
{
8186
"transformationID": obj.get("transformationID"),
87+
"authenticationIDs": obj.get("authenticationIDs"),
8288
"code": obj.get("code"),
8389
"name": obj.get("name"),
8490
"description": obj.get("description"),

algoliasearch/ingestion/models/transformation_create.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from __future__ import annotations
88

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

1212
from pydantic import BaseModel, ConfigDict, Field, StrictStr
1313

@@ -25,6 +25,11 @@ class TransformationCreate(BaseModel):
2525
default=None,
2626
description="A descriptive name for your transformation of what it does.",
2727
)
28+
authentication_ids: Optional[List[StrictStr]] = Field(
29+
default=None,
30+
description="The authentications associated for the current transformation.",
31+
alias="authenticationIDs",
32+
)
2833

2934
model_config = ConfigDict(
3035
use_enum_values=True, populate_by_name=True, validate_assignment=True
@@ -69,6 +74,7 @@ def from_dict(cls, obj: Dict) -> Self:
6974
"code": obj.get("code"),
7075
"name": obj.get("name"),
7176
"description": obj.get("description"),
77+
"authenticationIDs": obj.get("authenticationIDs"),
7278
}
7379
)
7480
return _obj

algoliasearch/ingestion/models/transformation_try.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
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, Optional, Self
1111

1212
from pydantic import BaseModel, ConfigDict, Field, StrictStr
1313

14+
from algoliasearch.ingestion.models.authentication_create import AuthenticationCreate
15+
1416

1517
class TransformationTry(BaseModel):
1618
"""
@@ -21,6 +23,7 @@ class TransformationTry(BaseModel):
2123
sample_record: Dict[str, Any] = Field(
2224
description="The record to apply the given code to.", alias="sampleRecord"
2325
)
26+
authentications: Optional[List[AuthenticationCreate]] = None
2427

2528
model_config = ConfigDict(
2629
use_enum_values=True, populate_by_name=True, validate_assignment=True
@@ -49,6 +52,12 @@ def to_dict(self) -> Dict[str, Any]:
4952
exclude={},
5053
exclude_none=True,
5154
)
55+
_items = []
56+
if self.authentications:
57+
for _item in self.authentications:
58+
if _item:
59+
_items.append(_item.to_dict())
60+
_dict["authentications"] = _items
5261
return _dict
5362

5463
@classmethod
@@ -61,6 +70,17 @@ def from_dict(cls, obj: Dict) -> Self:
6170
return cls.model_validate(obj)
6271

6372
_obj = cls.model_validate(
64-
{"code": obj.get("code"), "sampleRecord": obj.get("sampleRecord")}
73+
{
74+
"code": obj.get("code"),
75+
"sampleRecord": obj.get("sampleRecord"),
76+
"authentications": (
77+
[
78+
AuthenticationCreate.from_dict(_item)
79+
for _item in obj.get("authentications")
80+
]
81+
if obj.get("authentications") is not None
82+
else None
83+
),
84+
}
6585
)
6686
return _obj

0 commit comments

Comments
 (0)