ruma_client_api/media/
get_media_config.rs

1//! `GET /_matrix/media/*/config`
2//!
3//! Gets the config for the media repository.
4
5pub mod v3 {
6    //! `/v3/` ([spec])
7    //!
8    //! [spec]: https://spec.matrix.org/latest/client-server-api/#get_matrixmediav3config
9
10    use js_int::UInt;
11    use ruma_common::{
12        api::{request, response, Metadata},
13        metadata,
14    };
15
16    const METADATA: Metadata = metadata! {
17        method: GET,
18        rate_limited: true,
19        authentication: AccessToken,
20        history: {
21            1.0 => "/_matrix/media/r0/config",
22            1.1 => "/_matrix/media/v3/config",
23            1.11 => deprecated,
24        }
25    };
26
27    /// Request type for the `get_media_config` endpoint.
28    #[request(error = crate::Error)]
29    #[derive(Default)]
30    #[deprecated = "\
31        Since Matrix 1.11, clients should use `authenticated_media::get_media_config::v1::Request` \
32        instead if the homeserver supports it.\
33    "]
34    pub struct Request {}
35
36    /// Response type for the `get_media_config` endpoint.
37    #[response(error = crate::Error)]
38    pub struct Response {
39        /// Maximum size of upload in bytes.
40        #[serde(rename = "m.upload.size")]
41        pub upload_size: UInt,
42    }
43
44    #[allow(deprecated)]
45    impl Request {
46        /// Creates an empty `Request`.
47        pub fn new() -> Self {
48            Self {}
49        }
50    }
51
52    impl Response {
53        /// Creates a new `Response` with the given maximum upload size.
54        pub fn new(upload_size: UInt) -> Self {
55            Self { upload_size }
56        }
57    }
58}