libQuotient
A Qt library for building matrix clients
Loading...
Searching...
No Matches
rooms.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/events/roomevent.h>
6#include <Quotient/events/stateevent.h>
7#include <Quotient/jobs/basejob.h>
8
9namespace Quotient {
10
11//! \brief Get a single event by event ID.
12//!
13//! Get a single event based on `roomId/eventId`. You must have permission to
14//! retrieve this event e.g. by being a member in the room for this event.
16public:
17 //! \param roomId
18 //! The ID of the room the event is in.
19 //!
20 //! \param eventId
21 //! The event ID to get.
23
24 //! \brief Construct a URL without creating a full-fledged job object
25 //!
26 //! This function can be used when a URL for GetOneRoomEventJob
27 //! is necessary but the job itself isn't.
29 const QString& eventId);
30
31 // Result properties
32
33 //! The full event.
35};
36
37inline auto collectResponse(GetOneRoomEventJob* job) { return job->event(); }
38
39//! \brief Get the state identified by the type and key.
40//!
41//! Looks up the contents of a state event in a room. If the user is
42//! joined to the room then the state is taken from the current
43//! state of the room. If the user has left the room then the state is
44//! taken from the state of the room when they left.
46public:
47 //! \param roomId
48 //! The room to look up the state in.
49 //!
50 //! \param eventType
51 //! The type of state to look up.
52 //!
53 //! \param stateKey
54 //! The key of the state to look up. Defaults to an empty string. When
55 //! an empty string, the trailing slash on this endpoint is optional.
57 const QString& stateKey);
58
59 //! \brief Construct a URL without creating a full-fledged job object
60 //!
61 //! This function can be used when a URL for GetRoomStateWithKeyJob
62 //! is necessary but the job itself isn't.
64 const QString& eventType, const QString& stateKey);
65
66 // Result properties
67
68 //! The content of the state event.
70};
71
72inline auto collectResponse(const GetRoomStateWithKeyJob* job) { return job->content(); }
73
74//! \brief Get all state events in the current state of a room.
75//!
76//! Get the state events for the current state of a room.
78public:
79 //! \param roomId
80 //! The room to look up the state for.
81 explicit GetRoomStateJob(const QString& roomId);
82
83 //! \brief Construct a URL without creating a full-fledged job object
84 //!
85 //! This function can be used when a URL for GetRoomStateJob
86 //! is necessary but the job itself isn't.
88
89 // Result properties
90
91 //! The current state of the room
93};
94
95inline auto collectResponse(GetRoomStateJob* job) { return job->events(); }
96
97//! \brief Get the m.room.member events for the room.
98//!
99//! Get the list of members for this room.
101public:
102 //! \param roomId
103 //! The room to get the member events for.
104 //!
105 //! \param at
106 //! The point in time (pagination token) to return members for in the room.
107 //! This token can be obtained from a `prev_batch` token returned for
108 //! each room by the sync API. Defaults to the current state of the room,
109 //! as determined by the server.
110 //!
111 //! \param membership
112 //! The kind of membership to filter for. Defaults to no filtering if
113 //! unspecified. When specified alongside `not_membership`, the two
114 //! parameters create an 'or' condition: either the membership *is*
115 //! the same as `membership` **or** *is not* the same as `not_membership`.
116 //!
117 //! \param notMembership
118 //! The kind of membership to exclude from the results. Defaults to no
119 //! filtering if unspecified.
120 explicit GetMembersByRoomJob(const QString& roomId, const QString& at = {},
121 const QString& membership = {}, const QString& notMembership = {});
122
123 //! \brief Construct a URL without creating a full-fledged job object
124 //!
125 //! This function can be used when a URL for GetMembersByRoomJob
126 //! is necessary but the job itself isn't.
128 const QString& at = {}, const QString& membership = {},
129 const QString& notMembership = {});
130
131 // Result properties
132
133 StateEvents chunk() { return takeFromJson<StateEvents>("chunk"_L1); }
134};
135
136inline auto collectResponse(GetMembersByRoomJob* job) { return job->chunk(); }
137
138//! \brief Gets the list of currently joined users and their profile data.
139//!
140//! This API returns a map of MXIDs to member info objects for members of the room. The current user
141//! must be in the room for it to work, unless it is an Application Service in which case any of the
142//! AS's users must be in the room. This API is primarily for Application Services and should be
143//! faster to respond than `/members` as it can be implemented more efficiently on the server.
145public:
146 // Inner data structures
147
149 //! The display name of the user this object is representing.
151
152 //! The avatar of the user this object is representing, as an [`mxc://`
153 //! URI](/client-server-api/#matrix-content-mxc-uris).
155 };
156
157 // Construction/destruction
158
159 //! \param roomId
160 //! The room to get the members of.
162
163 //! \brief Construct a URL without creating a full-fledged job object
164 //!
165 //! This function can be used when a URL for GetJoinedMembersByRoomJob
166 //! is necessary but the job itself isn't.
168
169 // Result properties
170
171 //! A map from user ID to a RoomMember object.
173 {
174 return loadFromJson<QHash<UserId, RoomMember>>("joined"_L1);
175 }
176};
177
178inline auto collectResponse(const GetJoinedMembersByRoomJob* job) { return job->joined(); }
179
180template <>
183 {
184 fillFromJson(jo.value("display_name"_L1), result.displayName);
185 fillFromJson(jo.value("avatar_url"_L1), result.avatarUrl);
186 }
187};
188
189} // namespace Quotient
Gets the list of currently joined users and their profile data.
Definition rooms.h:144
Get the m.room.member events for the room.
Definition rooms.h:100
Get a single event by event ID.
Definition rooms.h:15
Get all state events in the current state of a room.
Definition rooms.h:77
Get the state identified by the type and key.
Definition rooms.h:45
auto collectResponse(const GetAccountDataJob *job)
auto collectResponse(GetOneRoomEventJob *job)
Definition rooms.h:37
#define QUOTIENT_API