libQuotient
A Qt library for building matrix clients
room_state.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 state event to the given room.
10 //!
11 //! State events can be sent using this endpoint. These events will be
12 //! overwritten if `<room id>`, `<event type>` and `<state key>` all
13 //! match.
14 //!
15 //! Requests to this endpoint **cannot use transaction IDs**
16 //! like other `PUT` paths because they cannot be differentiated from the
17 //! `state_key`. Furthermore, `POST` is unsupported on state paths.
18 //!
19 //! The body of the request should be the content object of the event; the
20 //! fields in this object will vary depending on the type of event. See
21 //! [Room Events](/client-server-api/#room-events) for the `m.` event specification.
22 //!
23 //! If the event type being sent is `m.room.canonical_alias` servers
24 //! SHOULD ensure that any new aliases being listed in the event are valid
25 //! per their grammar/syntax and that they point to the room ID where the
26 //! state event is to be sent. Servers do not validate aliases which are
27 //! being removed or are already present in the state event.
28 class QUOTIENT_API SetRoomStateWithKeyJob : public BaseJob {
29 public:
30  //! \param roomId
31  //! The room to set the state in
32  //!
33  //! \param eventType
34  //! The type of event to send.
35  //!
36  //! \param stateKey
37  //! The state_key for the state to send. Defaults to the empty string. When
38  //! an empty string, the trailing slash on this endpoint is optional.
39  //!
40  explicit SetRoomStateWithKeyJob(const QString& roomId, const QString& eventType,
41  const QString& stateKey, const QJsonObject& content = {});
42 
43  // Result properties
44 
45  //! A unique identifier for the event.
46  QString eventId() const { return loadFromJson<QString>("event_id"_L1); }
47 };
48 
49 inline auto collectResponse(const SetRoomStateWithKeyJob* job) { return job->eventId(); }
50 
51 } // namespace Quotient