synapse_admin_api/users/is_user_admin/
v1.rs

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