client-api: Stabilize authenticated media endpoints

According to Matrix 1.11
This commit is contained in:
Kévin Commaille 2024-06-21 15:21:32 +02:00 committed by Kévin Commaille
parent 644883eaf5
commit 44b474a6f1
10 changed files with 26 additions and 24 deletions

View File

@ -14,7 +14,8 @@ Improvements:
- Heroes in `sync::sync_events::v4`: `SyncRequestList` and `RoomSubscription` - Heroes in `sync::sync_events::v4`: `SyncRequestList` and `RoomSubscription`
both have a new `include_heroes` field. `SlidingSyncRoom` has a new `heroes` both have a new `include_heroes` field. `SlidingSyncRoom` has a new `heroes`
field, with a new type `SlidingSyncRoomHero`. field, with a new type `SlidingSyncRoomHero`.
- Add unstable support for authenticated media endpoints, according to MSC3916. - Add support for authenticated media endpoints, according to MSC3916 / Matrix
1.11.
Bug fixes: Bug fixes:

View File

@ -48,7 +48,6 @@ unstable-msc3488 = []
unstable-msc3575 = [] unstable-msc3575 = []
unstable-msc3814 = [] unstable-msc3814 = []
unstable-msc3843 = [] unstable-msc3843 = []
unstable-msc3916 = []
unstable-msc3983 = [] unstable-msc3983 = []
unstable-msc4108 = [] unstable-msc4108 = []
unstable-msc4121 = [] unstable-msc4121 = []

View File

@ -1,6 +1,6 @@
//! Authenticated endpoints for the media repository, according to [MSC3916]. //! Authenticated endpoints for the [content repository].
//! //!
//! [MSC3916]: https://github.com/matrix-org/matrix-spec-proposals/pull/3916 //! [content repository]: https://spec.matrix.org/latest/client-server-api/#content-repository
pub mod get_content; pub mod get_content;
pub mod get_content_as_filename; pub mod get_content_as_filename;

View File

@ -2,10 +2,10 @@
//! //!
//! Retrieve content from the media store. //! Retrieve content from the media store.
pub mod unstable { pub mod v1 {
//! `/unstable/org.matrix.msc3916/` ([MSC]) //! `/v1/` ([spec])
//! //!
//! [MSC]: https://github.com/matrix-org/matrix-spec-proposals/pull/3916 //! [spec]: https://spec.matrix.org/latest/client-server-api/#get_matrixclientv1mediadownloadservernamemediaid
use std::time::Duration; use std::time::Duration;
@ -17,10 +17,11 @@ pub mod unstable {
const METADATA: Metadata = metadata! { const METADATA: Metadata = metadata! {
method: GET, method: GET,
rate_limited: false, rate_limited: true,
authentication: AccessToken, authentication: AccessToken,
history: { history: {
unstable => "/_matrix/client/unstable/org.matrix.msc3916/media/download/:server_name/:media_id", unstable => "/_matrix/client/unstable/org.matrix.msc3916/media/download/:server_name/:media_id",
1.11 => "/_matrix/client/v1/media/download/:server_name/:media_id",
} }
}; };

View File

@ -2,10 +2,10 @@
//! //!
//! Retrieve content from the media store, specifying a filename to return. //! Retrieve content from the media store, specifying a filename to return.
pub mod unstable { pub mod v1 {
//! `/unstable/org.matrix.msc3916/` ([MSC]) //! `/v1/` ([spec])
//! //!
//! [MSC]: https://github.com/matrix-org/matrix-spec-proposals/pull/3916 //! [spec]: https://spec.matrix.org/latest/client-server-api/#get_matrixclientv1mediadownloadservernamemediaidfilename
use std::time::Duration; use std::time::Duration;
@ -17,10 +17,11 @@ pub mod unstable {
const METADATA: Metadata = metadata! { const METADATA: Metadata = metadata! {
method: GET, method: GET,
rate_limited: false, rate_limited: true,
authentication: AccessToken, authentication: AccessToken,
history: { history: {
unstable => "/_matrix/client/unstable/org.matrix.msc3916/media/download/:server_name/:media_id/:filename", unstable => "/_matrix/client/unstable/org.matrix.msc3916/media/download/:server_name/:media_id/:filename",
1.11 => "/_matrix/client/v1/media/download/:server_name/:media_id/:filename",
} }
}; };

View File

@ -2,10 +2,10 @@
//! //!
//! Get a thumbnail of content from the media store. //! Get a thumbnail of content from the media store.
pub mod unstable { pub mod v1 {
//! `/unstable/org.matrix.msc3916/` ([MSC]) //! `/v1/` ([spec])
//! //!
//! [MSC]: https://github.com/matrix-org/matrix-spec-proposals/pull/3916 //! [spec]: https://spec.matrix.org/latest/client-server-api/#get_matrixclientv1mediathumbnailservernamemediaid
use std::time::Duration; use std::time::Duration;
@ -24,6 +24,7 @@ pub mod unstable {
authentication: AccessToken, authentication: AccessToken,
history: { history: {
unstable => "/_matrix/client/unstable/org.matrix.msc3916/media/thumbnail/:server_name/:media_id", unstable => "/_matrix/client/unstable/org.matrix.msc3916/media/thumbnail/:server_name/:media_id",
1.11 => "/_matrix/client/v1/media/thumbnail/:server_name/:media_id",
} }
}; };

View File

@ -2,10 +2,10 @@
//! //!
//! Gets the config for the media repository. //! Gets the config for the media repository.
pub mod unstable { pub mod v1 {
//! `/unstable/org.matrix.msc3916/` ([MSC]) //! `/v1/` ([spec])
//! //!
//! [MSC]: https://github.com/matrix-org/matrix-spec-proposals/pull/3916 //! [spec]: https://spec.matrix.org/latest/client-server-api/#get_matrixclientv1mediaconfig
use js_int::UInt; use js_int::UInt;
use ruma_common::{ use ruma_common::{
@ -19,6 +19,7 @@ pub mod unstable {
authentication: AccessToken, authentication: AccessToken,
history: { history: {
unstable => "/_matrix/client/unstable/org.matrix.msc3916/media/config", unstable => "/_matrix/client/unstable/org.matrix.msc3916/media/config",
1.11 => "/_matrix/client/v1/media/config",
} }
}; };

View File

@ -2,10 +2,10 @@
//! //!
//! Get a preview for a URL. //! Get a preview for a URL.
pub mod unstable { pub mod v1 {
//! `/unstable/org.matrix.msc3916/` ([MSC]) //! `/v1/` ([spec])
//! //!
//! [MSC]: https://github.com/matrix-org/matrix-spec-proposals/pull/3916 //! [spec]: https://spec.matrix.org/latest/client-server-api/#get_matrixclientv1mediapreview_url
use ruma_common::{ use ruma_common::{
api::{request, response, Metadata}, api::{request, response, Metadata},
@ -20,6 +20,7 @@ pub mod unstable {
authentication: AccessToken, authentication: AccessToken,
history: { history: {
unstable => "/_matrix/client/unstable/org.matrix.msc3916/media/preview_url", unstable => "/_matrix/client/unstable/org.matrix.msc3916/media/preview_url",
1.11 => "/_matrix/client/v1/media/preview_url",
} }
}; };

View File

@ -12,7 +12,6 @@
pub mod account; pub mod account;
pub mod alias; pub mod alias;
pub mod appservice; pub mod appservice;
#[cfg(feature = "unstable-msc3916")]
pub mod authenticated_media; pub mod authenticated_media;
pub mod backup; pub mod backup;
pub mod config; pub mod config;

View File

@ -217,7 +217,6 @@ unstable-msc3618 = ["ruma-federation-api?/unstable-msc3618"]
unstable-msc3723 = ["ruma-federation-api?/unstable-msc3723"] unstable-msc3723 = ["ruma-federation-api?/unstable-msc3723"]
unstable-msc3814 = ["ruma-client-api?/unstable-msc3814"] unstable-msc3814 = ["ruma-client-api?/unstable-msc3814"]
unstable-msc3843 = ["ruma-client-api?/unstable-msc3843", "ruma-federation-api?/unstable-msc3843"] unstable-msc3843 = ["ruma-client-api?/unstable-msc3843", "ruma-federation-api?/unstable-msc3843"]
unstable-msc3916 = ["ruma-client-api?/unstable-msc3916"]
unstable-msc3927 = ["ruma-events?/unstable-msc3927"] unstable-msc3927 = ["ruma-events?/unstable-msc3927"]
unstable-msc3930 = ["ruma-common/unstable-msc3930"] unstable-msc3930 = ["ruma-common/unstable-msc3930"]
unstable-msc3931 = ["ruma-common/unstable-msc3931"] unstable-msc3931 = ["ruma-common/unstable-msc3931"]
@ -273,7 +272,6 @@ __ci = [
"unstable-msc3723", "unstable-msc3723",
"unstable-msc3814", "unstable-msc3814",
"unstable-msc3843", "unstable-msc3843",
"unstable-msc3916",
"unstable-msc3927", "unstable-msc3927",
"unstable-msc3930", "unstable-msc3930",
"unstable-msc3931", "unstable-msc3931",