From b809db81f46c180449273b67604b304efb672bb8 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Mon, 4 May 2020 18:34:52 +0200 Subject: [PATCH] Update create_message_event, create_state_event_* --- src/r0/message/create_message_event.rs | 16 +++++++++++----- src/r0/state/create_state_event_for_empty_key.rs | 14 +++++++++----- src/r0/state/create_state_event_for_key.rs | 15 ++++++++++----- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/src/r0/message/create_message_event.rs b/src/r0/message/create_message_event.rs index 573dff04..850f5eaf 100644 --- a/src/r0/message/create_message_event.rs +++ b/src/r0/message/create_message_event.rs @@ -1,8 +1,9 @@ -//! [PUT /_matrix/client/r0/rooms/{roomId}/send/{eventType}/{txnId}](https://matrix.org/docs/spec/client_server/r0.4.0.html#put-matrix-client-r0-rooms-roomid-send-eventtype-txnid) +//! [PUT /_matrix/client/r0/rooms/{roomId}/send/{eventType}/{txnId}](https://matrix.org/docs/spec/client_server/r0.6.0#put-matrix-client-r0-rooms-roomid-send-eventtype-txnid) use ruma_api::ruma_api; -use ruma_events::{room::message::MessageEventContent, EventJson, EventType}; +use ruma_events::EventType; use ruma_identifiers::{EventId, RoomId}; +use serde_json::value::RawValue as RawJsonValue; ruma_api! { metadata { @@ -18,9 +19,11 @@ ruma_api! { /// The room to send the event to. #[ruma_api(path)] pub room_id: RoomId, + /// The type of event to send. #[ruma_api(path)] pub event_type: EventType, + /// The transaction ID for this event. /// /// Clients should generate an ID unique across requests with the @@ -28,14 +31,17 @@ ruma_api! { /// idempotency of requests. #[ruma_api(path)] pub txn_id: String, - /// The event's content. + + /// The event's content. The type for this field will be updated in a + /// future release, until then you can create a value using + /// `serde_json::value::to_raw_value`. #[ruma_api(body)] - pub data: EventJson, + pub data: Box, } response { /// A unique identifier for the event. - pub event_id: EventId, + pub event_id: Option, } error: crate::Error diff --git a/src/r0/state/create_state_event_for_empty_key.rs b/src/r0/state/create_state_event_for_empty_key.rs index edee60d5..c73543d8 100644 --- a/src/r0/state/create_state_event_for_empty_key.rs +++ b/src/r0/state/create_state_event_for_empty_key.rs @@ -1,9 +1,9 @@ -//! [PUT /_matrix/client/r0/rooms/{roomId}/state/{eventType}](https://matrix.org/docs/spec/client_server/r0.4.0.html#put-matrix-client-r0-rooms-roomid-state-eventtype) +//! [PUT /_matrix/client/r0/rooms/{roomId}/state/{eventType}](https://matrix.org/docs/spec/client_server/r0.6.0#put-matrix-client-r0-rooms-roomid-state-eventtype) use ruma_api::ruma_api; use ruma_events::EventType; use ruma_identifiers::{EventId, RoomId}; -use serde_json::Value as JsonValue; +use serde_json::value::RawValue as RawJsonValue; ruma_api! { metadata { @@ -19,17 +19,21 @@ ruma_api! { /// The room to set the state in. #[ruma_api(path)] pub room_id: RoomId, + /// The type of event to send. #[ruma_api(path)] pub event_type: EventType, - /// The event's content. + + /// The event's content. The type for this field will be updated in a + /// future release, until then you can create a value using + /// `serde_json::value::to_raw_value`. #[ruma_api(body)] - pub data: JsonValue, + pub data: Box, } response { /// A unique identifier for the event. - pub event_id: EventId, + pub event_id: Option, } error: crate::Error diff --git a/src/r0/state/create_state_event_for_key.rs b/src/r0/state/create_state_event_for_key.rs index c52d4915..0b3d1646 100644 --- a/src/r0/state/create_state_event_for_key.rs +++ b/src/r0/state/create_state_event_for_key.rs @@ -1,9 +1,9 @@ -//! [PUT /_matrix/client/r0/rooms/{roomId}/state/{eventType}/{stateKey}](https://matrix.org/docs/spec/client_server/r0.4.0.html#put-matrix-client-r0-rooms-roomid-state-eventtype-statekey) +//! [PUT /_matrix/client/r0/rooms/{roomId}/state/{eventType}/{stateKey}](https://matrix.org/docs/spec/client_server/r0.6.0#put-matrix-client-r0-rooms-roomid-state-eventtype-statekey) use ruma_api::ruma_api; use ruma_events::EventType; use ruma_identifiers::{EventId, RoomId}; -use serde_json::Value as JsonValue; +use serde_json::value::RawValue as RawJsonValue; ruma_api! { metadata { @@ -19,20 +19,25 @@ ruma_api! { /// The room to set the state in. #[ruma_api(path)] pub room_id: RoomId, + /// The type of event to send. #[ruma_api(path)] pub event_type: EventType, + /// The state_key for the state to send. Defaults to the empty string. #[ruma_api(path)] pub state_key: String, - /// The event's content. + + /// The event's content. The type for this field will be updated in a + /// future release, until then you can create a value using + /// `serde_json::value::to_raw_value`. #[ruma_api(body)] - pub data: JsonValue, + pub data: Box, } response { /// A unique identifier for the event. - pub event_id: EventId, + pub event_id: Option, } error: crate::Error