1//! `POST /_matrix/media/*/create`
2//!
3//! Create an MXC URI without content.
45pub mod v1 {
6//! `/v1/` ([spec])
7 //!
8 //! [spec]: https://spec.matrix.org/latest/client-server-api/#post_matrixmediav1create
910use ruma_common::{
11 api::{request, response, Metadata},
12 metadata, MilliSecondsSinceUnixEpoch, OwnedMxcUri,
13 };
1415const METADATA: Metadata = metadata! {
16 method: POST,
17 rate_limited: true,
18 authentication: AccessToken,
19 history: {
20 unstable => "/_matrix/media/unstable/fi.mau.msc2246/create",
211.7 => "/_matrix/media/v1/create",
22 }
23 };
2425/// Request type for the `create_mxc_uri` endpoint.
26#[request(error = crate::Error)]
27 #[derive(Default)]
28pub struct Request {}
2930/// Response type for the `create_mxc_uri` endpoint.
31#[response(error = crate::Error)]
32pub struct Response {
33/// The MXC URI for the about to be uploaded content.
34pub content_uri: OwnedMxcUri,
3536/// The time at which the URI will expire if an upload has not been started.
37#[serde(skip_serializing_if = "Option::is_none")]
38pub unused_expires_at: Option<MilliSecondsSinceUnixEpoch>,
39 }
4041impl Response {
42/// Creates a new `Response` with the given MXC URI.
43pub fn new(content_uri: OwnedMxcUri) -> Self {
44Self { content_uri, unused_expires_at: None }
45 }
46 }
47}