diff options
author | Andres Salomon <dilinger@queued.net> | 2021-01-18 04:00:14 -0500 |
---|---|---|
committer | Andres Salomon <dilinger@queued.net> | 2021-01-18 04:00:14 -0500 |
commit | 09eb39236666e81d5da014acea011dcd74d0999b (patch) | |
tree | 52876d96be71be1a39d5d935c1295a51995e8949 /lib/csapi/room_state.h | |
parent | f1788ee27f33e9339334e0d79bde9a27d9ce2e44 (diff) | |
parent | a4e78956f105875625b572d8b98459ffa86fafe5 (diff) | |
download | libquotient-09eb39236666e81d5da014acea011dcd74d0999b.tar.gz libquotient-09eb39236666e81d5da014acea011dcd74d0999b.zip |
Update upstream source from tag 'upstream/0.6.4'
Update to upstream version '0.6.4'
with Debian dir aa8705fd74743e79c043bc9e3e425d5064404cfe
Diffstat (limited to 'lib/csapi/room_state.h')
-rw-r--r-- | lib/csapi/room_state.h | 175 |
1 files changed, 69 insertions, 106 deletions
diff --git a/lib/csapi/room_state.h b/lib/csapi/room_state.h index 67420545..447605ff 100644 --- a/lib/csapi/room_state.h +++ b/lib/csapi/room_state.h @@ -6,113 +6,76 @@ #include "jobs/basejob.h" -#include <QtCore/QJsonObject> +namespace Quotient { -namespace QMatrixClient -{ - // Operations - - /// Send a state event to the given room. - /// - /// State events can be sent using this endpoint. These events will be - /// overwritten if ``<room id>``, ``<event type>`` and ``<state key>`` all - /// match. - /// - /// Requests to this endpoint **cannot use transaction IDs** - /// like other ``PUT`` paths because they cannot be differentiated from the - /// ``state_key``. Furthermore, ``POST`` is unsupported on state paths. - /// - /// 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. - class SetRoomStateWithKeyJob : public BaseJob - { - public: - /*! Send a state event to the given room. - * \param roomId - * The room to set the state in - * \param eventType - * The type of event to send. - * \param stateKey - * The state_key for the state to send. Defaults to the empty string. - * \param body - * State events can be sent using this endpoint. These events will be - * overwritten if ``<room id>``, ``<event type>`` and ``<state key>`` all - * match. - * - * Requests to this endpoint **cannot use transaction IDs** - * like other ``PUT`` paths because they cannot be differentiated from the - * ``state_key``. Furthermore, ``POST`` is unsupported on state paths. - * - * 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. - */ - explicit SetRoomStateWithKeyJob(const QString& roomId, const QString& eventType, const QString& stateKey, const QJsonObject& body = {}); - ~SetRoomStateWithKeyJob() override; - - // Result properties - - /// A unique identifier for the event. - const QString& eventId() const; - - protected: - Status parseJson(const QJsonDocument& data) override; - - private: - class Private; - QScopedPointer<Private> d; - }; - - /// Send a state event to the given room. - /// - /// State events can be sent using this endpoint. This endpoint is - /// equivalent to calling `/rooms/{roomId}/state/{eventType}/{stateKey}` - /// with an empty `stateKey`. Previous state events with matching - /// `<roomId>` and `<eventType>`, and empty `<stateKey>`, will be overwritten. - /// - /// Requests to this endpoint **cannot use transaction IDs** - /// like other ``PUT`` paths because they cannot be differentiated from the - /// ``state_key``. Furthermore, ``POST`` is unsupported on state paths. - /// - /// 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. - class SetRoomStateJob : public BaseJob - { - public: - /*! Send a state event to the given room. - * \param roomId - * The room to set the state in - * \param eventType - * The type of event to send. - * \param body - * State events can be sent using this endpoint. This endpoint is - * equivalent to calling `/rooms/{roomId}/state/{eventType}/{stateKey}` - * with an empty `stateKey`. Previous state events with matching - * `<roomId>` and `<eventType>`, and empty `<stateKey>`, will be overwritten. - * - * Requests to this endpoint **cannot use transaction IDs** - * like other ``PUT`` paths because they cannot be differentiated from the - * ``state_key``. Furthermore, ``POST`` is unsupported on state paths. - * - * 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. - */ - explicit SetRoomStateJob(const QString& roomId, const QString& eventType, const QJsonObject& body = {}); - ~SetRoomStateJob() override; - - // Result properties +/*! \brief Send a state event to the given room. + * + * .. For backwards compatibility with older links... + * .. _`put-matrix-client-r0-rooms-roomid-state-eventtype`: + * + * State events can be sent using this endpoint. These events will be + * overwritten if ``<room id>``, ``<event type>`` and ``<state key>`` all + * match. + * + * Requests to this endpoint **cannot use transaction IDs** + * like other ``PUT`` paths because they cannot be differentiated from the + * ``state_key``. Furthermore, ``POST`` is unsupported on state paths. + * + * 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. + * + * If the event type being sent is ``m.room.canonical_alias`` servers + * SHOULD ensure that any new aliases being listed in the event are valid + * per their grammar/syntax and that they point to the room ID where the + * state event is to be sent. Servers do not validate aliases which are + * being removed or are already present in the state event. + */ +class SetRoomStateWithKeyJob : public BaseJob { +public: + /*! \brief Send a state event to the given room. + * + * \param roomId + * The room to set the state in + * + * \param eventType + * The type of event to send. + * + * \param stateKey + * The state_key for the state to send. Defaults to the empty string. When + * an empty string, the trailing slash on this endpoint is optional. + * + * \param body + * .. For backwards compatibility with older links... + * .. _`put-matrix-client-r0-rooms-roomid-state-eventtype`: + * + * State events can be sent using this endpoint. These events will be + * overwritten if ``<room id>``, ``<event type>`` and ``<state key>`` all + * match. + * + * Requests to this endpoint **cannot use transaction IDs** + * like other ``PUT`` paths because they cannot be differentiated from the + * ``state_key``. Furthermore, ``POST`` is unsupported on state paths. + * + * 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. + * + * If the event type being sent is ``m.room.canonical_alias`` servers + * SHOULD ensure that any new aliases being listed in the event are valid + * per their grammar/syntax and that they point to the room ID where the + * state event is to be sent. Servers do not validate aliases which are + * being removed or are already present in the state event. + */ + explicit SetRoomStateWithKeyJob(const QString& roomId, + const QString& eventType, + const QString& stateKey, + const QJsonObject& body = {}); - /// A unique identifier for the event. - const QString& eventId() const; + // Result properties - protected: - Status parseJson(const QJsonDocument& data) override; + /// A unique identifier for the event. + QString eventId() const { return loadFromJson<QString>("event_id"_ls); } +}; - private: - class Private; - QScopedPointer<Private> d; - }; -} // namespace QMatrixClient +} // namespace Quotient |