Skip to main content

arminius_server_client/handlers/
push.rs

1// SPDX-FileCopyrightText: 2025 BWI GmbH
2//
3// SPDX-License-Identifier: Apache-2.0
4
5//! Crate containing rules for push (See
6//! <https://spec.matrix.org/v1.14/client-server-api/#push-notifications>).
7
8use arminius_lib_component::{Component, ServerState, ruma_requests::ArminiusResponse};
9use axum::{Router, routing::get};
10use ruma::{api::client::push::get_pushrules_all, push::Ruleset};
11
12/// Handler for `GET /_matrix/client/v3/pushrules/` (See
13/// <https://spec.matrix.org/latest/client-server-api/#get_matrixclientv3pushrules>).
14///
15/// This endpoint all push rulesets of the user.
16///
17/// NOTE: This always return an empty set of push rules.
18pub async fn get_pushrules_all_handler() -> ArminiusResponse<get_pushrules_all::v3::Response> {
19	// TODO(#712): Implement this endpoint when adding support for push rules.
20	get_pushrules_all::v3::Response::new(Ruleset::new()).into()
21}
22
23/// Component for `pushrules` paths
24#[derive(Debug)]
25pub struct PushComponent;
26
27impl Component for PushComponent {
28	fn router() -> Router<ServerState> {
29		Router::new().route("/_matrix/client/v3/pushrules/", get(get_pushrules_all_handler))
30	}
31}