client-api: Fix the type of unused_expires_at for create_mxc_uri

This commit is contained in:
Kévin Commaille 2023-05-04 11:30:29 +02:00 committed by Kévin Commaille
parent 0e5503ed88
commit 67019c7f48

View File

@ -7,10 +7,9 @@ pub mod unstable {
//!
//! [spec]: https://github.com/tulir/matrix-doc/blob/asynchronous_uploads/proposals/2246-asynchronous-uploads.md
use js_int::UInt;
use ruma_common::{
api::{request, response, Metadata},
metadata, OwnedMxcUri,
metadata, MilliSecondsSinceUnixEpoch, OwnedMxcUri,
};
const METADATA: Metadata = metadata! {
@ -34,13 +33,14 @@ pub mod unstable {
pub content_uri: OwnedMxcUri,
/// The time at which the URI will expire if an upload has not been started.
pub unused_expires_at: UInt,
#[serde(skip_serializing_if = "Option::is_none")]
pub unused_expires_at: Option<MilliSecondsSinceUnixEpoch>,
}
impl Response {
/// Creates a new `Response` with the given MXC URI which expires at a given point in time.
pub fn new(content_uri: OwnedMxcUri, unused_expires_at: UInt) -> Self {
Self { content_uri, unused_expires_at }
/// Creates a new `Response` with the given MXC URI.
pub fn new(content_uri: OwnedMxcUri) -> Self {
Self { content_uri, unused_expires_at: None }
}
}
}