Skip to content

Commit e561c4e

Browse files
algolia-botmillotp
andcommitted
feat(specs): add notification settings to tasks [skip-bc] (generated)
algolia/api-clients-automation#4297 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Pierre Millot <[email protected]>
1 parent 0787cfa commit e561c4e

File tree

8 files changed

+328
-0
lines changed

8 files changed

+328
-0
lines changed

algoliasearch/ingestion/client.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2933,6 +2933,12 @@ async def list_tasks_with_http_info(
29332933
Optional[List[TriggerType]],
29342934
Field(description="Type of task trigger for filtering the list of tasks."),
29352935
] = None,
2936+
with_email_notifications: Annotated[
2937+
Optional[StrictBool],
2938+
Field(
2939+
description="If specified, the response only includes tasks with notifications.email.enabled set to this value."
2940+
),
2941+
] = None,
29362942
sort: Union[
29372943
Annotated[
29382944
Optional[TaskSortKeys],
@@ -2975,6 +2981,8 @@ async def list_tasks_with_http_info(
29752981
:type destination_id: List[str]
29762982
:param trigger_type: Type of task trigger for filtering the list of tasks.
29772983
:type trigger_type: List[TriggerType]
2984+
:param with_email_notifications: If specified, the response only includes tasks with notifications.email.enabled set to this value.
2985+
:type with_email_notifications: bool
29782986
:param sort: Property by which to sort the list of tasks.
29792987
:type sort: TaskSortKeys
29802988
:param order: Sort order of the response, ascending or descending.
@@ -3001,6 +3009,8 @@ async def list_tasks_with_http_info(
30013009
_query_parameters["destinationID"] = destination_id
30023010
if trigger_type is not None:
30033011
_query_parameters["triggerType"] = trigger_type
3012+
if with_email_notifications is not None:
3013+
_query_parameters["withEmailNotifications"] = with_email_notifications
30043014
if sort is not None:
30053015
_query_parameters["sort"] = sort
30063016
if order is not None:
@@ -3052,6 +3062,12 @@ async def list_tasks(
30523062
Optional[List[TriggerType]],
30533063
Field(description="Type of task trigger for filtering the list of tasks."),
30543064
] = None,
3065+
with_email_notifications: Annotated[
3066+
Optional[StrictBool],
3067+
Field(
3068+
description="If specified, the response only includes tasks with notifications.email.enabled set to this value."
3069+
),
3070+
] = None,
30553071
sort: Union[
30563072
Annotated[
30573073
Optional[TaskSortKeys],
@@ -3094,6 +3110,8 @@ async def list_tasks(
30943110
:type destination_id: List[str]
30953111
:param trigger_type: Type of task trigger for filtering the list of tasks.
30963112
:type trigger_type: List[TriggerType]
3113+
:param with_email_notifications: If specified, the response only includes tasks with notifications.email.enabled set to this value.
3114+
:type with_email_notifications: bool
30973115
:param sort: Property by which to sort the list of tasks.
30983116
:type sort: TaskSortKeys
30993117
:param order: Sort order of the response, ascending or descending.
@@ -3110,6 +3128,7 @@ async def list_tasks(
31103128
source_type,
31113129
destination_id,
31123130
trigger_type,
3131+
with_email_notifications,
31133132
sort,
31143133
order,
31153134
request_options,
@@ -7708,6 +7727,12 @@ def list_tasks_with_http_info(
77087727
Optional[List[TriggerType]],
77097728
Field(description="Type of task trigger for filtering the list of tasks."),
77107729
] = None,
7730+
with_email_notifications: Annotated[
7731+
Optional[StrictBool],
7732+
Field(
7733+
description="If specified, the response only includes tasks with notifications.email.enabled set to this value."
7734+
),
7735+
] = None,
77117736
sort: Union[
77127737
Annotated[
77137738
Optional[TaskSortKeys],
@@ -7750,6 +7775,8 @@ def list_tasks_with_http_info(
77507775
:type destination_id: List[str]
77517776
:param trigger_type: Type of task trigger for filtering the list of tasks.
77527777
:type trigger_type: List[TriggerType]
7778+
:param with_email_notifications: If specified, the response only includes tasks with notifications.email.enabled set to this value.
7779+
:type with_email_notifications: bool
77537780
:param sort: Property by which to sort the list of tasks.
77547781
:type sort: TaskSortKeys
77557782
:param order: Sort order of the response, ascending or descending.
@@ -7776,6 +7803,8 @@ def list_tasks_with_http_info(
77767803
_query_parameters["destinationID"] = destination_id
77777804
if trigger_type is not None:
77787805
_query_parameters["triggerType"] = trigger_type
7806+
if with_email_notifications is not None:
7807+
_query_parameters["withEmailNotifications"] = with_email_notifications
77797808
if sort is not None:
77807809
_query_parameters["sort"] = sort
77817810
if order is not None:
@@ -7827,6 +7856,12 @@ def list_tasks(
78277856
Optional[List[TriggerType]],
78287857
Field(description="Type of task trigger for filtering the list of tasks."),
78297858
] = None,
7859+
with_email_notifications: Annotated[
7860+
Optional[StrictBool],
7861+
Field(
7862+
description="If specified, the response only includes tasks with notifications.email.enabled set to this value."
7863+
),
7864+
] = None,
78307865
sort: Union[
78317866
Annotated[
78327867
Optional[TaskSortKeys],
@@ -7869,6 +7904,8 @@ def list_tasks(
78697904
:type destination_id: List[str]
78707905
:param trigger_type: Type of task trigger for filtering the list of tasks.
78717906
:type trigger_type: List[TriggerType]
7907+
:param with_email_notifications: If specified, the response only includes tasks with notifications.email.enabled set to this value.
7908+
:type with_email_notifications: bool
78727909
:param sort: Property by which to sort the list of tasks.
78737910
:type sort: TaskSortKeys
78747911
:param order: Sort order of the response, ascending or descending.
@@ -7885,6 +7922,7 @@ def list_tasks(
78857922
source_type,
78867923
destination_id,
78877924
trigger_type,
7925+
with_email_notifications,
78887926
sort,
78897927
order,
78907928
request_options,
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+
"enabled": "enabled",
23+
}
24+
25+
26+
def _alias_generator(name: str) -> str:
27+
return _ALIASES.get(name, name)
28+
29+
30+
class EmailNotifications(BaseModel):
31+
"""
32+
EmailNotifications
33+
"""
34+
35+
enabled: Optional[bool] = None
36+
""" Whether to send email notifications, note that this doesn't prevent the task from being blocked. """
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 EmailNotifications 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 EmailNotifications 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)
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, 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.ingestion.models.email_notifications import EmailNotifications
22+
23+
_ALIASES = {
24+
"email": "email",
25+
}
26+
27+
28+
def _alias_generator(name: str) -> str:
29+
return _ALIASES.get(name, name)
30+
31+
32+
class Notifications(BaseModel):
33+
"""
34+
Notifications settings for a task.
35+
"""
36+
37+
email: EmailNotifications
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 Notifications 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 Notifications 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["email"] = (
75+
EmailNotifications.from_dict(obj["email"])
76+
if obj.get("email") is not None
77+
else None
78+
)
79+
80+
return cls.model_validate(obj)
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+
"critical_threshold": "criticalThreshold",
23+
}
24+
25+
26+
def _alias_generator(name: str) -> str:
27+
return _ALIASES.get(name, name)
28+
29+
30+
class Policies(BaseModel):
31+
"""
32+
Set of rules for a task.
33+
"""
34+
35+
critical_threshold: Optional[int] = None
36+
""" The number of critical failures in a row before blocking the task and sending a notification. """
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 Policies 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 Policies 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)

algoliasearch/ingestion/models/task.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020

2121
from algoliasearch.ingestion.models.action_type import ActionType
22+
from algoliasearch.ingestion.models.notifications import Notifications
23+
from algoliasearch.ingestion.models.policies import Policies
2224
from algoliasearch.ingestion.models.task_input import TaskInput
2325

2426
_ALIASES = {
@@ -33,6 +35,8 @@
3335
"failure_threshold": "failureThreshold",
3436
"action": "action",
3537
"cursor": "cursor",
38+
"notifications": "notifications",
39+
"policies": "policies",
3640
"created_at": "createdAt",
3741
"updated_at": "updatedAt",
3842
}
@@ -67,6 +71,8 @@ class Task(BaseModel):
6771
action: Optional[ActionType] = None
6872
cursor: Optional[str] = None
6973
""" Date of the last cursor in RFC 3339 format. """
74+
notifications: Optional[Notifications] = None
75+
policies: Optional[Policies] = None
7076
created_at: str
7177
""" Date of creation in RFC 3339 format. """
7278
updated_at: Optional[str] = None
@@ -111,5 +117,15 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
111117
TaskInput.from_dict(obj["input"]) if obj.get("input") is not None else None
112118
)
113119
obj["action"] = obj.get("action")
120+
obj["notifications"] = (
121+
Notifications.from_dict(obj["notifications"])
122+
if obj.get("notifications") is not None
123+
else None
124+
)
125+
obj["policies"] = (
126+
Policies.from_dict(obj["policies"])
127+
if obj.get("policies") is not None
128+
else None
129+
)
114130

115131
return cls.model_validate(obj)

0 commit comments

Comments
 (0)