synapse-admin-api 0.10.0

Types for the endpoints in the synapse admin API.
Documentation
//! [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)

use ruma::{
    OwnedUserId,
    api::{auth_scheme::AccessToken, metadata, request, response},
};

metadata! {
    method: GET,
    rate_limited: false,
    authentication: AccessToken,
    path: "/_synapse/admin/v1/users/{user_id}/admin",
}

#[request]
pub struct Request {
    /// User to check.
    #[ruma_api(path)]
    pub user_id: OwnedUserId,
}

#[response]
pub struct Response {
    /// Whether the requested user ID is an admin.
    pub admin: bool,
}

impl Request {
    /// Creates an `Request` with the given user ID.
    pub fn new(user_id: OwnedUserId) -> Self {
        Self { user_id }
    }
}

impl Response {
    /// Creates a `Response` with the given admin flag.
    pub fn new(admin: bool) -> Self {
        Self { admin }
    }
}