File: login.cpp

package info (click to toggle)
libquotient 0.9.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,588 kB
  • sloc: xml: 39,103; cpp: 25,226; sh: 97; makefile: 10
file content (33 lines) | stat: -rw-r--r-- 1,407 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN

#include "login.h"

using namespace Quotient;

QUrl GetLoginFlowsJob::makeRequestUrl(const HomeserverData& hsData)
{
    return BaseJob::makeRequestUrl(hsData, makePath("/_matrix/client/v3", "/login"));
}

GetLoginFlowsJob::GetLoginFlowsJob()
    : BaseJob(HttpVerb::Get, u"GetLoginFlowsJob"_s, makePath("/_matrix/client/v3", "/login"), false)
{}

LoginJob::LoginJob(const QString& type, const std::optional<UserIdentifier>& identifier,
                   const QString& password, const QString& token, const QString& deviceId,
                   const QString& initialDeviceDisplayName, std::optional<bool> refreshToken)
    : BaseJob(HttpVerb::Post, u"LoginJob"_s, makePath("/_matrix/client/v3", "/login"), false)
{
    QJsonObject _dataJson;
    addParam(_dataJson, "type"_L1, type);
    addParam<IfNotEmpty>(_dataJson, "identifier"_L1, identifier);
    addParam<IfNotEmpty>(_dataJson, "password"_L1, password);
    addParam<IfNotEmpty>(_dataJson, "token"_L1, token);
    addParam<IfNotEmpty>(_dataJson, "device_id"_L1, deviceId);
    addParam<IfNotEmpty>(_dataJson, "initial_device_display_name"_L1, initialDeviceDisplayName);
    addParam<IfNotEmpty>(_dataJson, "refresh_token"_L1, refreshToken);
    setRequestData({ _dataJson });
    addExpectedKey(u"user_id"_s);
    addExpectedKey(u"access_token"_s);
    addExpectedKey(u"device_id"_s);
}