libQuotient
A Qt library for building matrix clients
joining.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/csapi/definitions/third_party_signed.h>
6 
7 #include <Quotient/jobs/basejob.h>
8 
9 namespace Quotient {
10 
11 //! \brief Start the requesting user participating in a particular room.
12 //!
13 //! *Note that this API requires a room ID, not alias.*
14 //! `/join/{roomIdOrAlias}` *exists if you have a room alias.*
15 //!
16 //! This API starts a user participating in a particular room, if that user
17 //! is allowed to participate in that room. After this call, the client is
18 //! allowed to see all current state events in the room, and all subsequent
19 //! events associated with the room until the user leaves the room.
20 //!
21 //! After a user has joined a room, the room will appear as an entry in the
22 //! response of the [`/initialSync`](/client-server-api/#get_matrixclientv3initialsync)
23 //! and [`/sync`](/client-server-api/#get_matrixclientv3sync) APIs.
24 class QUOTIENT_API JoinRoomByIdJob : public BaseJob {
25 public:
26  //! \param roomId
27  //! The room identifier (not alias) to join.
28  //!
29  //! \param thirdPartySigned
30  //! If supplied, the homeserver must verify that it matches a pending
31  //! `m.room.third_party_invite` event in the room, and perform
32  //! key validity checking if required by the event.
33  //!
34  //! \param reason
35  //! Optional reason to be included as the `reason` on the subsequent
36  //! membership event.
37  explicit JoinRoomByIdJob(const QString& roomId,
38  const std::optional<ThirdPartySigned>& thirdPartySigned = std::nullopt,
39  const QString& reason = {});
40 
41  // Result properties
42 
43  //! The joined room ID.
44  QString roomId() const { return loadFromJson<QString>("room_id"_L1); }
45 };
46 
47 inline auto collectResponse(const JoinRoomByIdJob* job) { return job->roomId(); }
48 
49 //! \brief Start the requesting user participating in a particular room.
50 //!
51 //! *Note that this API takes either a room ID or alias, unlike* `/rooms/{roomId}/join`.
52 //!
53 //! This API starts a user participating in a particular room, if that user
54 //! is allowed to participate in that room. After this call, the client is
55 //! allowed to see all current state events in the room, and all subsequent
56 //! events associated with the room until the user leaves the room.
57 //!
58 //! After a user has joined a room, the room will appear as an entry in the
59 //! response of the [`/initialSync`](/client-server-api/#get_matrixclientv3initialsync)
60 //! and [`/sync`](/client-server-api/#get_matrixclientv3sync) APIs.
61 class QUOTIENT_API JoinRoomJob : public BaseJob {
62 public:
63  //! \param roomIdOrAlias
64  //! The room identifier or alias to join.
65  //!
66  //! \param serverName
67  //! The servers to attempt to join the room through. One of the servers
68  //! must be participating in the room.
69  //!
70  //! \param via
71  //! The servers to attempt to join the room through. One of the servers
72  //! must be participating in the room.
73  //!
74  //! \param thirdPartySigned
75  //! If a `third_party_signed` was supplied, the homeserver must verify
76  //! that it matches a pending `m.room.third_party_invite` event in the
77  //! room, and perform key validity checking if required by the event.
78  //!
79  //! \param reason
80  //! Optional reason to be included as the `reason` on the subsequent
81  //! membership event.
82  explicit JoinRoomJob(const QString& roomIdOrAlias, const QStringList& serverName = {},
83  const QStringList& via = {},
84  const std::optional<ThirdPartySigned>& thirdPartySigned = std::nullopt,
85  const QString& reason = {});
86 
87  // Result properties
88 
89  //! The joined room ID.
90  QString roomId() const { return loadFromJson<QString>("room_id"_L1); }
91 };
92 
93 inline auto collectResponse(const JoinRoomJob* job) { return job->roomId(); }
94 
95 } // namespace Quotient