This repository has been archived by the owner on Jul 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
SendMessage.kt
50 lines (47 loc) · 1.6 KB
/
SendMessage.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package io.github.matrixkt.api
import io.github.matrixkt.utils.MatrixRpc
import io.github.matrixkt.utils.RpcMethod
import io.ktor.resources.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.JsonObject
/**
* This endpoint is used to send a message event to a room. Message events
* allow access to historical events and pagination, making them suited
* for "once-off" activity in a room.
*
* The body of the request should be the content object of the event; the
* fields in this object will vary depending on the type of event. See
* `Room Events`_ for the m. event specification.
*/
public class SendMessage(
public override val url: Url,
public override val body: JsonObject
) : MatrixRpc.WithAuth<RpcMethod.Put, SendMessage.Url, JsonObject, SendMessage.Response> {
@Resource("_matrix/client/r0/rooms/{roomId}/send/{eventType}/{txnId}")
@Serializable
public class Url(
/**
* The room to send the event to.
*/
public val roomId: String,
/**
* The type of event to send.
*/
public val eventType: String,
/**
* The transaction ID for this event. Clients should generate an
* ID unique across requests with the same access token; it will be
* used by the server to ensure idempotency of requests.
*/
public val txnId: String
)
@Serializable
public class Response(
/**
* A unique identifier for the event.
*/
@SerialName("event_id")
public val eventId: String
)
}