libQuotient
A Qt library for building matrix clients
room_send.h
Go to the documentation of this file.
1 // THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
2 
3 #pragma once
4 
5 #include <Quotient/jobs/basejob.h>
6 
7 namespace Quotient {
8 
9 //! \brief Send a message event to the given room.
10 //!
11 //! This endpoint is used to send a message event to a room. Message events
12 //! allow access to historical events and pagination, making them suited
13 //! for "once-off" activity in a room.
14 //!
15 //! The body of the request should be the content object of the event; the
16 //! fields in this object will vary depending on the type of event. See
17 //! [Room Events](/client-server-api/#room-events) for the m. event specification.
18 class QUOTIENT_API SendMessageJob : public BaseJob {
19 public:
20  //! \param roomId
21  //! The room to send the event to.
22  //!
23  //! \param eventType
24  //! The type of event to send.
25  //!
26  //! \param txnId
27  //! The [transaction ID](/client-server-api/#transaction-identifiers) for this event. Clients
28  //! should generate an ID unique across requests with the same access token; it will be used
29  //! by the server to ensure idempotency of requests.
30  //!
31  explicit SendMessageJob(const QString& roomId, const QString& eventType, const QString& txnId,
32  const QJsonObject& content = {});
33 
34  // Result properties
35 
36  //! A unique identifier for the event.
37  QString eventId() const { return loadFromJson<QString>("event_id"_L1); }
38 };
39 
40 inline auto collectResponse(const SendMessageJob* job) { return job->eventId(); }
41 
42 } // namespace Quotient