libQuotient
A Qt library for building matrix clients
knocking.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 Knock on a room, requesting permission to join.
10 //!
11 //! *Note that this API takes either a room ID or alias, unlike other membership APIs.*
12 //!
13 //! This API "knocks" on the room to ask for permission to join, if the user
14 //! is allowed to knock on the room. Acceptance of the knock happens out of
15 //! band from this API, meaning that the client will have to watch for updates
16 //! regarding the acceptance/rejection of the knock.
17 //!
18 //! If the room history settings allow, the user will still be able to see
19 //! history of the room while being in the "knock" state. The user will have
20 //! to accept the invitation to join the room (acceptance of knock) to see
21 //! messages reliably. See the `/join` endpoints for more information about
22 //! history visibility to the user.
23 //!
24 //! The knock will appear as an entry in the response of the
25 //! [`/sync`](/client-server-api/#get_matrixclientv3sync) API.
26 class QUOTIENT_API KnockRoomJob : public BaseJob {
27 public:
28  //! \param roomIdOrAlias
29  //! The room identifier or alias to knock upon.
30  //!
31  //! \param serverName
32  //! The servers to attempt to knock on the room through. One of the servers
33  //! must be participating in the room.
34  //!
35  //! \param via
36  //! The servers to attempt to knock on the room through. One of the servers
37  //! must be participating in the room.
38  //!
39  //! \param reason
40  //! Optional reason to be included as the `reason` on the subsequent
41  //! membership event.
42  explicit KnockRoomJob(const QString& roomIdOrAlias, const QStringList& serverName = {},
43  const QStringList& via = {}, const QString& reason = {});
44 
45  // Result properties
46 
47  //! The knocked room ID.
48  QString roomId() const { return loadFromJson<QString>("room_id"_L1); }
49 };
50 
51 inline auto collectResponse(const KnockRoomJob* job) { return job->roomId(); }
52 
53 } // namespace Quotient