Skip to content

Commit 3f6c475

Browse files
feat(specs): document runMetadata parameter (generated)
algolia/api-clients-automation#5087 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Devin Beeuwkes <[email protected]>
1 parent 4841f5e commit 3f6c475

File tree

4 files changed

+133
-4
lines changed

4 files changed

+133
-4
lines changed

algoliasearch/ingestion/client.py

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
RunSourcePayload,
7777
RunSourceResponse,
7878
RunStatus,
79+
RunTaskPayload,
7980
RunType,
8081
Source,
8182
SourceCreate,
@@ -3916,6 +3917,7 @@ async def run_task_with_http_info(
39163917
task_id: Annotated[
39173918
StrictStr, Field(description="Unique identifier of a task.")
39183919
],
3920+
run_task_payload: Union[Optional[RunTaskPayload], dict[str, Any]] = None,
39193921
request_options: Optional[Union[dict, RequestOptions]] = None,
39203922
) -> ApiResponse[str]:
39213923
"""
@@ -3928,19 +3930,26 @@ async def run_task_with_http_info(
39283930
39293931
:param task_id: Unique identifier of a task. (required)
39303932
:type task_id: str
3933+
:param run_task_payload:
3934+
:type run_task_payload: RunTaskPayload
39313935
: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)
39323936
:return: Returns the raw algoliasearch 'APIResponse' object.
39333937
"""
39343938

39353939
if task_id is None:
39363940
raise ValueError("Parameter `task_id` is required when calling `run_task`.")
39373941

3942+
_data = {}
3943+
if run_task_payload is not None:
3944+
_data = run_task_payload
3945+
39383946
return await self._transporter.request(
39393947
verb=Verb.POST,
39403948
path="/2/tasks/{taskID}/run".replace(
39413949
"{taskID}", quote(str(task_id), safe="")
39423950
),
39433951
request_options=self._request_options.merge(
3952+
data=dumps(body_serializer(_data)),
39443953
user_request_options=request_options,
39453954
),
39463955
use_read_transporter=False,
@@ -3951,6 +3960,7 @@ async def run_task(
39513960
task_id: Annotated[
39523961
StrictStr, Field(description="Unique identifier of a task.")
39533962
],
3963+
run_task_payload: Union[Optional[RunTaskPayload], dict[str, Any]] = None,
39543964
request_options: Optional[Union[dict, RequestOptions]] = None,
39553965
) -> RunResponse:
39563966
"""
@@ -3963,17 +3973,22 @@ async def run_task(
39633973
39643974
:param task_id: Unique identifier of a task. (required)
39653975
:type task_id: str
3976+
:param run_task_payload:
3977+
:type run_task_payload: RunTaskPayload
39663978
: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)
39673979
:return: Returns the deserialized response in a 'RunResponse' result object.
39683980
"""
3969-
resp = await self.run_task_with_http_info(task_id, request_options)
3981+
resp = await self.run_task_with_http_info(
3982+
task_id, run_task_payload, request_options
3983+
)
39703984
return resp.deserialize(RunResponse, resp.raw_data)
39713985

39723986
async def run_task_v1_with_http_info(
39733987
self,
39743988
task_id: Annotated[
39753989
StrictStr, Field(description="Unique identifier of a task.")
39763990
],
3991+
run_task_payload: Union[Optional[RunTaskPayload], dict[str, Any]] = None,
39773992
request_options: Optional[Union[dict, RequestOptions]] = None,
39783993
) -> ApiResponse[str]:
39793994
"""
@@ -3987,6 +4002,8 @@ async def run_task_v1_with_http_info(
39874002
39884003
:param task_id: Unique identifier of a task. (required)
39894004
:type task_id: str
4005+
:param run_task_payload:
4006+
:type run_task_payload: RunTaskPayload
39904007
: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)
39914008
:return: Returns the raw algoliasearch 'APIResponse' object.
39924009
"""
@@ -3998,12 +4015,17 @@ async def run_task_v1_with_http_info(
39984015
"Parameter `task_id` is required when calling `run_task_v1`."
39994016
)
40004017

4018+
_data = {}
4019+
if run_task_payload is not None:
4020+
_data = run_task_payload
4021+
40014022
return await self._transporter.request(
40024023
verb=Verb.POST,
40034024
path="/1/tasks/{taskID}/run".replace(
40044025
"{taskID}", quote(str(task_id), safe="")
40054026
),
40064027
request_options=self._request_options.merge(
4028+
data=dumps(body_serializer(_data)),
40074029
user_request_options=request_options,
40084030
),
40094031
use_read_transporter=False,
@@ -4014,6 +4036,7 @@ async def run_task_v1(
40144036
task_id: Annotated[
40154037
StrictStr, Field(description="Unique identifier of a task.")
40164038
],
4039+
run_task_payload: Union[Optional[RunTaskPayload], dict[str, Any]] = None,
40174040
request_options: Optional[Union[dict, RequestOptions]] = None,
40184041
) -> RunResponse:
40194042
"""
@@ -4027,10 +4050,14 @@ async def run_task_v1(
40274050
40284051
:param task_id: Unique identifier of a task. (required)
40294052
:type task_id: str
4053+
:param run_task_payload:
4054+
:type run_task_payload: RunTaskPayload
40304055
: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)
40314056
:return: Returns the deserialized response in a 'RunResponse' result object.
40324057
"""
4033-
resp = await self.run_task_v1_with_http_info(task_id, request_options)
4058+
resp = await self.run_task_v1_with_http_info(
4059+
task_id, run_task_payload, request_options
4060+
)
40344061
return resp.deserialize(RunResponse, resp.raw_data)
40354062

40364063
async def search_authentications_with_http_info(
@@ -8989,6 +9016,7 @@ def run_task_with_http_info(
89899016
task_id: Annotated[
89909017
StrictStr, Field(description="Unique identifier of a task.")
89919018
],
9019+
run_task_payload: Union[Optional[RunTaskPayload], dict[str, Any]] = None,
89929020
request_options: Optional[Union[dict, RequestOptions]] = None,
89939021
) -> ApiResponse[str]:
89949022
"""
@@ -9001,19 +9029,26 @@ def run_task_with_http_info(
90019029
90029030
:param task_id: Unique identifier of a task. (required)
90039031
:type task_id: str
9032+
:param run_task_payload:
9033+
:type run_task_payload: RunTaskPayload
90049034
: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)
90059035
:return: Returns the raw algoliasearch 'APIResponse' object.
90069036
"""
90079037

90089038
if task_id is None:
90099039
raise ValueError("Parameter `task_id` is required when calling `run_task`.")
90109040

9041+
_data = {}
9042+
if run_task_payload is not None:
9043+
_data = run_task_payload
9044+
90119045
return self._transporter.request(
90129046
verb=Verb.POST,
90139047
path="/2/tasks/{taskID}/run".replace(
90149048
"{taskID}", quote(str(task_id), safe="")
90159049
),
90169050
request_options=self._request_options.merge(
9051+
data=dumps(body_serializer(_data)),
90179052
user_request_options=request_options,
90189053
),
90199054
use_read_transporter=False,
@@ -9024,6 +9059,7 @@ def run_task(
90249059
task_id: Annotated[
90259060
StrictStr, Field(description="Unique identifier of a task.")
90269061
],
9062+
run_task_payload: Union[Optional[RunTaskPayload], dict[str, Any]] = None,
90279063
request_options: Optional[Union[dict, RequestOptions]] = None,
90289064
) -> RunResponse:
90299065
"""
@@ -9036,17 +9072,20 @@ def run_task(
90369072
90379073
:param task_id: Unique identifier of a task. (required)
90389074
:type task_id: str
9075+
:param run_task_payload:
9076+
:type run_task_payload: RunTaskPayload
90399077
: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)
90409078
:return: Returns the deserialized response in a 'RunResponse' result object.
90419079
"""
9042-
resp = self.run_task_with_http_info(task_id, request_options)
9080+
resp = self.run_task_with_http_info(task_id, run_task_payload, request_options)
90439081
return resp.deserialize(RunResponse, resp.raw_data)
90449082

90459083
def run_task_v1_with_http_info(
90469084
self,
90479085
task_id: Annotated[
90489086
StrictStr, Field(description="Unique identifier of a task.")
90499087
],
9088+
run_task_payload: Union[Optional[RunTaskPayload], dict[str, Any]] = None,
90509089
request_options: Optional[Union[dict, RequestOptions]] = None,
90519090
) -> ApiResponse[str]:
90529091
"""
@@ -9060,6 +9099,8 @@ def run_task_v1_with_http_info(
90609099
90619100
:param task_id: Unique identifier of a task. (required)
90629101
:type task_id: str
9102+
:param run_task_payload:
9103+
:type run_task_payload: RunTaskPayload
90639104
: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)
90649105
:return: Returns the raw algoliasearch 'APIResponse' object.
90659106
"""
@@ -9071,12 +9112,17 @@ def run_task_v1_with_http_info(
90719112
"Parameter `task_id` is required when calling `run_task_v1`."
90729113
)
90739114

9115+
_data = {}
9116+
if run_task_payload is not None:
9117+
_data = run_task_payload
9118+
90749119
return self._transporter.request(
90759120
verb=Verb.POST,
90769121
path="/1/tasks/{taskID}/run".replace(
90779122
"{taskID}", quote(str(task_id), safe="")
90789123
),
90799124
request_options=self._request_options.merge(
9125+
data=dumps(body_serializer(_data)),
90809126
user_request_options=request_options,
90819127
),
90829128
use_read_transporter=False,
@@ -9087,6 +9133,7 @@ def run_task_v1(
90879133
task_id: Annotated[
90889134
StrictStr, Field(description="Unique identifier of a task.")
90899135
],
9136+
run_task_payload: Union[Optional[RunTaskPayload], dict[str, Any]] = None,
90909137
request_options: Optional[Union[dict, RequestOptions]] = None,
90919138
) -> RunResponse:
90929139
"""
@@ -9100,10 +9147,14 @@ def run_task_v1(
91009147
91019148
:param task_id: Unique identifier of a task. (required)
91029149
:type task_id: str
9150+
:param run_task_payload:
9151+
:type run_task_payload: RunTaskPayload
91039152
: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)
91049153
:return: Returns the deserialized response in a 'RunResponse' result object.
91059154
"""
9106-
resp = self.run_task_v1_with_http_info(task_id, request_options)
9155+
resp = self.run_task_v1_with_http_info(
9156+
task_id, run_task_payload, request_options
9157+
)
91079158
return resp.deserialize(RunResponse, resp.raw_data)
91089159

91099160
def search_authentications_with_http_info(

algoliasearch/ingestion/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
from .run_source_payload import RunSourcePayload
9393
from .run_source_response import RunSourceResponse
9494
from .run_status import RunStatus
95+
from .run_task_payload import RunTaskPayload
9596
from .run_type import RunType
9697
from .schedule_trigger import ScheduleTrigger
9798
from .schedule_trigger_input import ScheduleTriggerInput
@@ -241,6 +242,7 @@
241242
"RunSourcePayload",
242243
"RunSourceResponse",
243244
"RunStatus",
245+
"RunTaskPayload",
244246
"RunType",
245247
"ScheduleTrigger",
246248
"ScheduleTriggerInput",

algoliasearch/ingestion/models/run_source_payload.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"index_to_exclude": "indexToExclude",
2626
"entity_ids": "entityIDs",
2727
"entity_type": "entityType",
28+
"run_metadata": "runMetadata",
2829
}
2930

3031

@@ -44,6 +45,8 @@ class RunSourcePayload(BaseModel):
4445
entity_ids: Optional[List[str]] = None
4546
""" List of entityIDs to update. """
4647
entity_type: Optional[EntityType] = None
48+
run_metadata: Optional[Dict[str, object]] = None
49+
""" Additional information that will be passed to the created runs. """
4750

4851
model_config = ConfigDict(
4952
strict=False,
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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+
"run_metadata": "runMetadata",
23+
}
24+
25+
26+
def _alias_generator(name: str) -> str:
27+
return _ALIASES.get(name, name)
28+
29+
30+
class RunTaskPayload(BaseModel):
31+
"""
32+
RunTaskPayload
33+
"""
34+
35+
run_metadata: Optional[Dict[str, object]] = None
36+
""" Additional information that will be passed to the created run. """
37+
38+
model_config = ConfigDict(
39+
strict=False,
40+
use_enum_values=True,
41+
populate_by_name=True,
42+
validate_assignment=True,
43+
protected_namespaces=(),
44+
alias_generator=_alias_generator,
45+
extra="allow",
46+
)
47+
48+
def to_json(self) -> str:
49+
return self.model_dump_json(by_alias=True, exclude_unset=True)
50+
51+
@classmethod
52+
def from_json(cls, json_str: str) -> Optional[Self]:
53+
"""Create an instance of RunTaskPayload from a JSON string"""
54+
return cls.from_dict(loads(json_str))
55+
56+
def to_dict(self) -> Dict[str, Any]:
57+
"""Return the dictionary representation of the model using alias."""
58+
return self.model_dump(
59+
by_alias=True,
60+
exclude_none=True,
61+
exclude_unset=True,
62+
)
63+
64+
@classmethod
65+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
66+
"""Create an instance of RunTaskPayload from a dict"""
67+
if obj is None:
68+
return None
69+
70+
if not isinstance(obj, dict):
71+
return cls.model_validate(obj)
72+
73+
return cls.model_validate(obj)

0 commit comments

Comments
 (0)