-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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]>
- Loading branch information
1 parent
0787cfa
commit e561c4e
Showing
8 changed files
with
328 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# coding: utf-8 | ||
|
||
""" | ||
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. | ||
""" | ||
|
||
from __future__ import annotations | ||
|
||
from json import loads | ||
from sys import version_info | ||
from typing import Any, Dict, Optional | ||
|
||
from pydantic import BaseModel, ConfigDict | ||
|
||
if version_info >= (3, 11): | ||
from typing import Self | ||
else: | ||
from typing_extensions import Self | ||
|
||
|
||
_ALIASES = { | ||
"enabled": "enabled", | ||
} | ||
|
||
|
||
def _alias_generator(name: str) -> str: | ||
return _ALIASES.get(name, name) | ||
|
||
|
||
class EmailNotifications(BaseModel): | ||
""" | ||
EmailNotifications | ||
""" | ||
|
||
enabled: Optional[bool] = None | ||
""" Whether to send email notifications, note that this doesn't prevent the task from being blocked. """ | ||
|
||
model_config = ConfigDict( | ||
strict=False, | ||
use_enum_values=True, | ||
populate_by_name=True, | ||
validate_assignment=True, | ||
protected_namespaces=(), | ||
alias_generator=_alias_generator, | ||
extra="allow", | ||
) | ||
|
||
def to_json(self) -> str: | ||
return self.model_dump_json(by_alias=True, exclude_unset=True) | ||
|
||
@classmethod | ||
def from_json(cls, json_str: str) -> Optional[Self]: | ||
"""Create an instance of EmailNotifications from a JSON string""" | ||
return cls.from_dict(loads(json_str)) | ||
|
||
def to_dict(self) -> Dict[str, Any]: | ||
"""Return the dictionary representation of the model using alias.""" | ||
return self.model_dump( | ||
by_alias=True, | ||
exclude_none=True, | ||
exclude_unset=True, | ||
) | ||
|
||
@classmethod | ||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: | ||
"""Create an instance of EmailNotifications from a dict""" | ||
if obj is None: | ||
return None | ||
|
||
if not isinstance(obj, dict): | ||
return cls.model_validate(obj) | ||
|
||
return cls.model_validate(obj) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# coding: utf-8 | ||
|
||
""" | ||
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. | ||
""" | ||
|
||
from __future__ import annotations | ||
|
||
from json import loads | ||
from sys import version_info | ||
from typing import Any, Dict, Optional | ||
|
||
from pydantic import BaseModel, ConfigDict | ||
|
||
if version_info >= (3, 11): | ||
from typing import Self | ||
else: | ||
from typing_extensions import Self | ||
|
||
|
||
from algoliasearch.ingestion.models.email_notifications import EmailNotifications | ||
|
||
_ALIASES = { | ||
"email": "email", | ||
} | ||
|
||
|
||
def _alias_generator(name: str) -> str: | ||
return _ALIASES.get(name, name) | ||
|
||
|
||
class Notifications(BaseModel): | ||
""" | ||
Notifications settings for a task. | ||
""" | ||
|
||
email: EmailNotifications | ||
|
||
model_config = ConfigDict( | ||
strict=False, | ||
use_enum_values=True, | ||
populate_by_name=True, | ||
validate_assignment=True, | ||
protected_namespaces=(), | ||
alias_generator=_alias_generator, | ||
extra="allow", | ||
) | ||
|
||
def to_json(self) -> str: | ||
return self.model_dump_json(by_alias=True, exclude_unset=True) | ||
|
||
@classmethod | ||
def from_json(cls, json_str: str) -> Optional[Self]: | ||
"""Create an instance of Notifications from a JSON string""" | ||
return cls.from_dict(loads(json_str)) | ||
|
||
def to_dict(self) -> Dict[str, Any]: | ||
"""Return the dictionary representation of the model using alias.""" | ||
return self.model_dump( | ||
by_alias=True, | ||
exclude_none=True, | ||
exclude_unset=True, | ||
) | ||
|
||
@classmethod | ||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: | ||
"""Create an instance of Notifications from a dict""" | ||
if obj is None: | ||
return None | ||
|
||
if not isinstance(obj, dict): | ||
return cls.model_validate(obj) | ||
|
||
obj["email"] = ( | ||
EmailNotifications.from_dict(obj["email"]) | ||
if obj.get("email") is not None | ||
else None | ||
) | ||
|
||
return cls.model_validate(obj) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# coding: utf-8 | ||
|
||
""" | ||
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. | ||
""" | ||
|
||
from __future__ import annotations | ||
|
||
from json import loads | ||
from sys import version_info | ||
from typing import Any, Dict, Optional | ||
|
||
from pydantic import BaseModel, ConfigDict | ||
|
||
if version_info >= (3, 11): | ||
from typing import Self | ||
else: | ||
from typing_extensions import Self | ||
|
||
|
||
_ALIASES = { | ||
"critical_threshold": "criticalThreshold", | ||
} | ||
|
||
|
||
def _alias_generator(name: str) -> str: | ||
return _ALIASES.get(name, name) | ||
|
||
|
||
class Policies(BaseModel): | ||
""" | ||
Set of rules for a task. | ||
""" | ||
|
||
critical_threshold: Optional[int] = None | ||
""" The number of critical failures in a row before blocking the task and sending a notification. """ | ||
|
||
model_config = ConfigDict( | ||
strict=False, | ||
use_enum_values=True, | ||
populate_by_name=True, | ||
validate_assignment=True, | ||
protected_namespaces=(), | ||
alias_generator=_alias_generator, | ||
extra="allow", | ||
) | ||
|
||
def to_json(self) -> str: | ||
return self.model_dump_json(by_alias=True, exclude_unset=True) | ||
|
||
@classmethod | ||
def from_json(cls, json_str: str) -> Optional[Self]: | ||
"""Create an instance of Policies from a JSON string""" | ||
return cls.from_dict(loads(json_str)) | ||
|
||
def to_dict(self) -> Dict[str, Any]: | ||
"""Return the dictionary representation of the model using alias.""" | ||
return self.model_dump( | ||
by_alias=True, | ||
exclude_none=True, | ||
exclude_unset=True, | ||
) | ||
|
||
@classmethod | ||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: | ||
"""Create an instance of Policies from a dict""" | ||
if obj is None: | ||
return None | ||
|
||
if not isinstance(obj, dict): | ||
return cls.model_validate(obj) | ||
|
||
return cls.model_validate(obj) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.