aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/csapi/account-data.cpp28
-rw-r--r--lib/csapi/account-data.h66
-rw-r--r--lib/csapi/capabilities.h8
-rw-r--r--lib/csapi/room_upgrades.h4
4 files changed, 94 insertions, 12 deletions
diff --git a/lib/csapi/account-data.cpp b/lib/csapi/account-data.cpp
index 5021c73a..96b32a92 100644
--- a/lib/csapi/account-data.cpp
+++ b/lib/csapi/account-data.cpp
@@ -21,6 +21,20 @@ SetAccountDataJob::SetAccountDataJob(const QString& userId, const QString& type,
setRequestData(Data(toJson(content)));
}
+QUrl GetAccountDataJob::makeRequestUrl(QUrl baseUrl, const QString& userId, const QString& type)
+{
+ return BaseJob::makeRequestUrl(std::move(baseUrl),
+ basePath % "/user/" % userId % "/account_data/" % type);
+}
+
+static const auto GetAccountDataJobName = QStringLiteral("GetAccountDataJob");
+
+GetAccountDataJob::GetAccountDataJob(const QString& userId, const QString& type)
+ : BaseJob(HttpVerb::Get, GetAccountDataJobName,
+ basePath % "/user/" % userId % "/account_data/" % type)
+{
+}
+
static const auto SetAccountDataPerRoomJobName = QStringLiteral("SetAccountDataPerRoomJob");
SetAccountDataPerRoomJob::SetAccountDataPerRoomJob(const QString& userId, const QString& roomId, const QString& type, const QJsonObject& content)
@@ -30,3 +44,17 @@ SetAccountDataPerRoomJob::SetAccountDataPerRoomJob(const QString& userId, const
setRequestData(Data(toJson(content)));
}
+QUrl GetAccountDataPerRoomJob::makeRequestUrl(QUrl baseUrl, const QString& userId, const QString& roomId, const QString& type)
+{
+ return BaseJob::makeRequestUrl(std::move(baseUrl),
+ basePath % "/user/" % userId % "/rooms/" % roomId % "/account_data/" % type);
+}
+
+static const auto GetAccountDataPerRoomJobName = QStringLiteral("GetAccountDataPerRoomJob");
+
+GetAccountDataPerRoomJob::GetAccountDataPerRoomJob(const QString& userId, const QString& roomId, const QString& type)
+ : BaseJob(HttpVerb::Get, GetAccountDataPerRoomJobName,
+ basePath % "/user/" % userId % "/rooms/" % roomId % "/account_data/" % type)
+{
+}
+
diff --git a/lib/csapi/account-data.h b/lib/csapi/account-data.h
index f3656a14..b067618f 100644
--- a/lib/csapi/account-data.h
+++ b/lib/csapi/account-data.h
@@ -22,8 +22,8 @@ namespace QMatrixClient
public:
/*! Set some account_data for the user.
* \param userId
- * The id of the user to set account_data for. The access token must be
- * authorized to make requests for this user id.
+ * The ID of the user to set account_data for. The access token must be
+ * authorized to make requests for this user ID.
* \param type
* The event type of the account_data to set. Custom types should be
* namespaced to avoid clashes.
@@ -33,6 +33,33 @@ namespace QMatrixClient
explicit SetAccountDataJob(const QString& userId, const QString& type, const QJsonObject& content = {});
};
+ /// Get some account_data for the user.
+ ///
+ /// Get some account_data for the client. This config is only visible to the user
+ /// that set the account_data.
+ class GetAccountDataJob : public BaseJob
+ {
+ public:
+ /*! Get some account_data for the user.
+ * \param userId
+ * The ID of the user to get account_data for. The access token must be
+ * authorized to make requests for this user ID.
+ * \param type
+ * The event type of the account_data to get. Custom types should be
+ * namespaced to avoid clashes.
+ */
+ explicit GetAccountDataJob(const QString& userId, const QString& type);
+
+ /*! Construct a URL without creating a full-fledged job object
+ *
+ * This function can be used when a URL for
+ * GetAccountDataJob is necessary but the job
+ * itself isn't.
+ */
+ static QUrl makeRequestUrl(QUrl baseUrl, const QString& userId, const QString& type);
+
+ };
+
/// Set some account_data for the user.
///
/// Set some account_data for the client on a given room. This config is only
@@ -43,10 +70,10 @@ namespace QMatrixClient
public:
/*! Set some account_data for the user.
* \param userId
- * The id of the user to set account_data for. The access token must be
- * authorized to make requests for this user id.
+ * The ID of the user to set account_data for. The access token must be
+ * authorized to make requests for this user ID.
* \param roomId
- * The id of the room to set account_data on.
+ * The ID of the room to set account_data on.
* \param type
* The event type of the account_data to set. Custom types should be
* namespaced to avoid clashes.
@@ -55,4 +82,33 @@ namespace QMatrixClient
*/
explicit SetAccountDataPerRoomJob(const QString& userId, const QString& roomId, const QString& type, const QJsonObject& content = {});
};
+
+ /// Get some account_data for the user.
+ ///
+ /// Get some account_data for the client on a given room. This config is only
+ /// visible to the user that set the account_data.
+ class GetAccountDataPerRoomJob : public BaseJob
+ {
+ public:
+ /*! Get some account_data for the user.
+ * \param userId
+ * The ID of the user to set account_data for. The access token must be
+ * authorized to make requests for this user ID.
+ * \param roomId
+ * The ID of the room to get account_data for.
+ * \param type
+ * The event type of the account_data to get. Custom types should be
+ * namespaced to avoid clashes.
+ */
+ explicit GetAccountDataPerRoomJob(const QString& userId, const QString& roomId, const QString& type);
+
+ /*! Construct a URL without creating a full-fledged job object
+ *
+ * This function can be used when a URL for
+ * GetAccountDataPerRoomJob is necessary but the job
+ * itself isn't.
+ */
+ static QUrl makeRequestUrl(QUrl baseUrl, const QString& userId, const QString& roomId, const QString& type);
+
+ };
} // namespace QMatrixClient
diff --git a/lib/csapi/capabilities.h b/lib/csapi/capabilities.h
index 39e2f4d1..06a8bf0d 100644
--- a/lib/csapi/capabilities.h
+++ b/lib/csapi/capabilities.h
@@ -39,8 +39,8 @@ namespace QMatrixClient
QHash<QString, QString> available;
};
- /// Gets information about the server's supported feature set
- /// and other relevant capabilities.
+ /// The custom capabilities the server supports, using the
+ /// Java package naming convention.
struct Capabilities
{
/// Capability to indicate if the user can change their password.
@@ -68,8 +68,8 @@ namespace QMatrixClient
// Result properties
- /// Gets information about the server's supported feature set
- /// and other relevant capabilities.
+ /// The custom capabilities the server supports, using the
+ /// Java package naming convention.
const Capabilities& capabilities() const;
protected:
diff --git a/lib/csapi/room_upgrades.h b/lib/csapi/room_upgrades.h
index 6f712f10..4da5941a 100644
--- a/lib/csapi/room_upgrades.h
+++ b/lib/csapi/room_upgrades.h
@@ -13,9 +13,7 @@ namespace QMatrixClient
/// Upgrades a room to a new room version.
///
- /// Upgrades the given room to a particular room version, migrating as much
- /// data as possible over to the new room. See the `room_upgrades <#room-upgrades>`_
- /// module for more information on what this entails.
+ /// Upgrades the given room to a particular room version.
class UpgradeRoomJob : public BaseJob
{
public: