Tool Replacement Notification Rule
Model
- class pytm4srv.models.tool.replacement_notify_rule.ToolReplacementNotifyRule
A rule that determines when a notification will be sent based on the last few replacements of a given tool.
- enabled: Mapped[bool]
Disabled rules will not be checked and therefore will never send notifications.
- eval_qty: Mapped[int]
Number of replacements to check (starting from the most recent).
- id: MappedColumn object at 0x7907c2991c60>]]
Unique, numeric ID for this rule across all rule types.
- indexed: Mapped[bool | None]
When null (default), all replacements will be considered when evaluating this rule.
If true, only indexed replacements will be considered when evaluating this rule.
If false, indexed replacements will not be considered when evaluating this rule.
- name: Mapped[str]
User-specified name of this rule.
- notify_channel_id: Mapped[int | None]
If set, an external notification will be sent when this rule is triggered.
Regardless of this setting, an OnTakt alert will be created when this rule is triggered.
- rule_type: Mapped[str]
The type of rule represented by this row.
Endpoints
- GET /api/tools/replacements/rules/
Get all existing tool replacement notification rules.
- Return:
an object mapping rule ID to rule object
- PUT /api/tools/replacements/rules/
Create a new tool replacement notification rule.
- Resjson:
a (partial) rule object
- Return:
the new rule object
- Status Codes:
201 Created – on success
400 Bad Request – if the new rule is invalid
- PATCH /api/tools/replacements/rules/(int: rule_id)
Edit an existing tool replacement notification rule.
Note
The
rule_type
field cannot be changed and will be ignored if it is present.- Parameters:
rule_id – the ID of the rule to edit
- Reqjson:
a (partial) rule object
- Return:
the new state of the rule object
- Status Codes:
400 Bad Request – if the rule object is invalid
404 Not Found – if the rule ID does not exist
- DELETE /api/tools/replacements/rules/(int: rule_id)
Delete an existing tool replacement notification rule.
- Parameters:
rule_id – the ID of the rule to delete
- Status Codes:
404 Not Found – if the rule does not exist
204 No Content – on success