client-api: Borrow RawJsonValue in set_global_account_data

This commit is contained in:
Jonas Platte 2021-04-18 12:44:28 +02:00
parent f11ba9ee15
commit 624a48a724
No known key found for this signature in database
GPG Key ID: 7D261D771D915378

View File

@ -15,11 +15,11 @@ ruma_api! {
} }
request: { request: {
/// Arbitrary JSON to store as config data. /// The ID of the user to set account_data for.
/// ///
/// To create a `Box<RawJsonValue>`, use `serde_json::value::to_raw_value`. /// The access token must be authorized to make requests for this user ID.
#[ruma_api(body)] #[ruma_api(path)]
pub data: Box<RawJsonValue>, pub user_id: &'a UserId,
/// The event type of the account_data to set. /// The event type of the account_data to set.
/// ///
@ -27,11 +27,11 @@ ruma_api! {
#[ruma_api(path)] #[ruma_api(path)]
pub event_type: &'a str, pub event_type: &'a str,
/// The ID of the user to set account_data for. /// Arbitrary JSON to store as config data.
/// ///
/// The access token must be authorized to make requests for this user ID. /// To create a `RawJsonValue`, use `serde_json::value::to_raw_value`.
#[ruma_api(path)] #[ruma_api(body)]
pub user_id: &'a UserId, pub data: &'a RawJsonValue,
} }
#[derive(Default)] #[derive(Default)]
@ -42,7 +42,7 @@ ruma_api! {
impl<'a> Request<'a> { impl<'a> Request<'a> {
/// Creates a new `Request` with the given data, event type and user ID. /// Creates a new `Request` with the given data, event type and user ID.
pub fn new(data: Box<RawJsonValue>, event_type: &'a str, user_id: &'a UserId) -> Self { pub fn new(data: &'a RawJsonValue, event_type: &'a str, user_id: &'a UserId) -> Self {
Self { data, event_type, user_id } Self { data, event_type, user_id }
} }
} }