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: {
/// 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`.
#[ruma_api(body)]
pub data: Box<RawJsonValue>,
/// The access token must be authorized to make requests for this user ID.
#[ruma_api(path)]
pub user_id: &'a UserId,
/// The event type of the account_data to set.
///
@ -27,11 +27,11 @@ ruma_api! {
#[ruma_api(path)]
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.
#[ruma_api(path)]
pub user_id: &'a UserId,
/// To create a `RawJsonValue`, use `serde_json::value::to_raw_value`.
#[ruma_api(body)]
pub data: &'a RawJsonValue,
}
#[derive(Default)]
@ -42,7 +42,7 @@ ruma_api! {
impl<'a> Request<'a> {
/// 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 }
}
}