libQuotient
A Qt library for building matrix clients
tags.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/tag.h>
6 
7 #include <Quotient/jobs/basejob.h>
8 
9 namespace Quotient {
10 
11 //! \brief List the tags for a room.
12 //!
13 //! List the tags set by a user on a room.
14 class QUOTIENT_API GetRoomTagsJob : public BaseJob {
15 public:
16  //! \param userId
17  //! The id of the user to get tags for. The access token must be
18  //! authorized to make requests for this user ID.
19  //!
20  //! \param roomId
21  //! The ID of the room to get tags for.
22  explicit GetRoomTagsJob(const QString& userId, const QString& roomId);
23 
24  //! \brief Construct a URL without creating a full-fledged job object
25  //!
26  //! This function can be used when a URL for GetRoomTagsJob
27  //! is necessary but the job itself isn't.
28  static QUrl makeRequestUrl(const HomeserverData& hsData, const QString& userId,
29  const QString& roomId);
30 
31  // Result properties
32 
33  QHash<QString, Tag> tags() const { return loadFromJson<QHash<QString, Tag>>("tags"_L1); }
34 };
35 
36 inline auto collectResponse(const GetRoomTagsJob* job) { return job->tags(); }
37 
38 //! \brief Add a tag to a room.
39 //!
40 //! Add a tag to the room.
41 class QUOTIENT_API SetRoomTagJob : public BaseJob {
42 public:
43  //! \param userId
44  //! The id of the user to add a tag for. The access token must be
45  //! authorized to make requests for this user ID.
46  //!
47  //! \param roomId
48  //! The ID of the room to add a tag to.
49  //!
50  //! \param tag
51  //! The tag to add.
52  //!
53  //! \param data
54  //! Extra data for the tag, e.g. ordering.
55  explicit SetRoomTagJob(const QString& userId, const QString& roomId, const QString& tag,
56  const Tag& data);
57 };
58 
59 //! \brief Remove a tag from the room.
60 //!
61 //! Remove a tag from the room.
62 class QUOTIENT_API DeleteRoomTagJob : public BaseJob {
63 public:
64  //! \param userId
65  //! The id of the user to remove a tag for. The access token must be
66  //! authorized to make requests for this user ID.
67  //!
68  //! \param roomId
69  //! The ID of the room to remove a tag from.
70  //!
71  //! \param tag
72  //! The tag to remove.
73  explicit DeleteRoomTagJob(const QString& userId, const QString& roomId, const QString& tag);
74 
75  //! \brief Construct a URL without creating a full-fledged job object
76  //!
77  //! This function can be used when a URL for DeleteRoomTagJob
78  //! is necessary but the job itself isn't.
79  static QUrl makeRequestUrl(const HomeserverData& hsData, const QString& userId,
80  const QString& roomId, const QString& tag);
81 };
82 
83 } // namespace Quotient