client_server: use and provide authenticated media API

This commit is contained in:
Lambda 2024-07-21 19:24:29 +00:00
parent 7f6ab63752
commit 79053ad052
4 changed files with 568 additions and 101 deletions

View file

@ -24,6 +24,31 @@ pub(crate) struct Ar<T> {
pub(crate) appservice_info: Option<RegistrationInfo>,
}
impl<T> Ar<T> {
pub(crate) fn map_body<F, U>(self, f: F) -> Ar<U>
where
F: FnOnce(T) -> U,
{
let Ar {
body,
sender_user,
sender_device,
sender_servername,
json_body,
appservice_info,
} = self;
Ar {
body: f(body),
sender_user,
sender_device,
sender_servername,
json_body,
appservice_info,
}
}
}
impl<T> Deref for Ar<T> {
type Target = T;