Update create_message_event, create_state_event_*

This commit is contained in:
Jonas Platte 2020-05-04 18:34:52 +02:00
parent bc9b43e03f
commit b809db81f4
No known key found for this signature in database
GPG Key ID: 7D261D771D915378
3 changed files with 30 additions and 15 deletions

View File

@ -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<MessageEventContent>,
pub data: Box<RawJsonValue>,
}
response {
/// A unique identifier for the event.
pub event_id: EventId,
pub event_id: Option<EventId>,
}
error: crate::Error

View File

@ -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<RawJsonValue>,
}
response {
/// A unique identifier for the event.
pub event_id: EventId,
pub event_id: Option<EventId>,
}
error: crate::Error

View File

@ -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<RawJsonValue>,
}
response {
/// A unique identifier for the event.
pub event_id: EventId,
pub event_id: Option<EventId>,
}
error: crate::Error