aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/list_joined_rooms.cpp
diff options
context:
space:
mode:
authorAndres Salomon <dilinger@queued.net>2021-01-18 04:00:14 -0500
committerAndres Salomon <dilinger@queued.net>2021-01-18 04:00:14 -0500
commit09eb39236666e81d5da014acea011dcd74d0999b (patch)
tree52876d96be71be1a39d5d935c1295a51995e8949 /lib/csapi/list_joined_rooms.cpp
parentf1788ee27f33e9339334e0d79bde9a27d9ce2e44 (diff)
parenta4e78956f105875625b572d8b98459ffa86fafe5 (diff)
downloadlibquotient-09eb39236666e81d5da014acea011dcd74d0999b.tar.gz
libquotient-09eb39236666e81d5da014acea011dcd74d0999b.zip
Update upstream source from tag 'upstream/0.6.4'
Update to upstream version '0.6.4' with Debian dir aa8705fd74743e79c043bc9e3e425d5064404cfe
Diffstat (limited to 'lib/csapi/list_joined_rooms.cpp')
-rw-r--r--lib/csapi/list_joined_rooms.cpp41
1 files changed, 6 insertions, 35 deletions
diff --git a/lib/csapi/list_joined_rooms.cpp b/lib/csapi/list_joined_rooms.cpp
index 85a9cae4..8d7e267f 100644
--- a/lib/csapi/list_joined_rooms.cpp
+++ b/lib/csapi/list_joined_rooms.cpp
@@ -4,49 +4,20 @@
#include "list_joined_rooms.h"
-#include "converters.h"
-
#include <QtCore/QStringBuilder>
-using namespace QMatrixClient;
-
-static const auto basePath = QStringLiteral("/_matrix/client/r0");
-
-class GetJoinedRoomsJob::Private
-{
- public:
- QStringList joinedRooms;
-};
+using namespace Quotient;
QUrl GetJoinedRoomsJob::makeRequestUrl(QUrl baseUrl)
{
return BaseJob::makeRequestUrl(std::move(baseUrl),
- basePath % "/joined_rooms");
+ QStringLiteral("/_matrix/client/r0")
+ % "/joined_rooms");
}
-static const auto GetJoinedRoomsJobName = QStringLiteral("GetJoinedRoomsJob");
-
GetJoinedRoomsJob::GetJoinedRoomsJob()
- : BaseJob(HttpVerb::Get, GetJoinedRoomsJobName,
- basePath % "/joined_rooms")
- , d(new Private)
+ : BaseJob(HttpVerb::Get, QStringLiteral("GetJoinedRoomsJob"),
+ QStringLiteral("/_matrix/client/r0") % "/joined_rooms")
{
+ addExpectedKey("joined_rooms");
}
-
-GetJoinedRoomsJob::~GetJoinedRoomsJob() = default;
-
-const QStringList& GetJoinedRoomsJob::joinedRooms() const
-{
- return d->joinedRooms;
-}
-
-BaseJob::Status GetJoinedRoomsJob::parseJson(const QJsonDocument& data)
-{
- auto json = data.object();
- if (!json.contains("joined_rooms"_ls))
- return { JsonParseError,
- "The key 'joined_rooms' not found in the response" };
- fromJson(json.value("joined_rooms"_ls), d->joinedRooms);
- return Success;
-}
-