synapse_admin_api/users/is_user_admin/
v1.rs

1//! [GET /_synapse/admin/v1/users/:user_id/admin](https://github.com/matrix-org/synapse/blob/master/docs/admin_api/user_admin_api.rst#get-whether-a-user-is-a-server-administrator-or-not)
2
3use ruma::{
4    api::{metadata, request, response, Metadata},
5    OwnedUserId,
6};
7
8const METADATA: Metadata = metadata! {
9    method: GET,
10    rate_limited: false,
11    authentication: AccessToken,
12    history: {
13        unstable => "/_synapse/admin/v1/users/{user_id}/admin",
14    }
15};
16
17#[request]
18pub struct Request {
19    /// User to check.
20    #[ruma_api(path)]
21    pub user_id: OwnedUserId,
22}
23
24#[response]
25pub struct Response {
26    /// Whether the requested user ID is an admin.
27    pub admin: bool,
28}
29
30impl Request {
31    /// Creates an `Request` with the given user ID.
32    pub fn new(user_id: OwnedUserId) -> Self {
33        Self { user_id }
34    }
35}
36
37impl Response {
38    /// Creates a `Response` with the given admin flag.
39    pub fn new(admin: bool) -> Self {
40        Self { admin }
41    }
42}