ruma_client_api/push/get_pushrule_actions.rs
1//! `GET /_matrix/client/*/pushrules/global/{kind}/{ruleId}/actions`
2//!
3//! This endpoint get the actions for the specified push rule.
4
5pub mod v3 {
6 //! `/v3/` ([spec])
7 //!
8 //! [spec]: https://spec.matrix.org/latest/client-server-api/#get_matrixclientv3pushrulesglobalkindruleidactions
9
10 use ruma_common::{
11 api::{request, response},
12 metadata,
13 push::Action,
14 };
15
16 use crate::push::RuleKind;
17
18 metadata! {
19 method: GET,
20 rate_limited: false,
21 authentication: AccessToken,
22 history: {
23 1.0 => "/_matrix/client/r0/pushrules/global/{kind}/{rule_id}/actions",
24 1.1 => "/_matrix/client/v3/pushrules/global/{kind}/{rule_id}/actions",
25 }
26 }
27
28 /// Request type for the `get_pushrule_actions` endpoint.
29 #[request(error = crate::Error)]
30 pub struct Request {
31 /// The kind of rule
32 #[ruma_api(path)]
33 pub kind: RuleKind,
34
35 /// The identifier for the rule.
36 #[ruma_api(path)]
37 pub rule_id: String,
38 }
39
40 /// Response type for the `get_pushrule_actions` endpoint.
41 #[response(error = crate::Error)]
42 pub struct Response {
43 /// The actions to perform for this rule.
44 pub actions: Vec<Action>,
45 }
46
47 impl Request {
48 /// Creates a new `Request` with the given kind and rule ID.
49 pub fn new(kind: RuleKind, rule_id: String) -> Self {
50 Self { kind, rule_id }
51 }
52 }
53
54 impl Response {
55 /// Creates a new `Response` with the given actions.
56 pub fn new(actions: Vec<Action>) -> Self {
57 Self { actions }
58 }
59 }
60}