aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/login.cpp
blob: b2175a0513e340cbd11aa4362f99008d5662d979 (plain)
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
34
35
36
37
/******************************************************************************
 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
 */

#include "login.h"

using namespace Quotient;

QUrl GetLoginFlowsJob::makeRequestUrl(QUrl baseUrl)
{
    return BaseJob::makeRequestUrl(std::move(baseUrl),
                                   makePath("/_matrix/client/v3", "/login"));
}

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

LoginJob::LoginJob(const QString& type,
                   const Omittable<UserIdentifier>& identifier,
                   const QString& password, const QString& token,
                   const QString& deviceId,
                   const QString& initialDeviceDisplayName)
    : BaseJob(HttpVerb::Post, QStringLiteral("LoginJob"),
              makePath("/_matrix/client/v3", "/login"), false)
{
    QJsonObject _data;
    addParam<>(_data, QStringLiteral("type"), type);
    addParam<IfNotEmpty>(_data, QStringLiteral("identifier"), identifier);
    addParam<IfNotEmpty>(_data, QStringLiteral("password"), password);
    addParam<IfNotEmpty>(_data, QStringLiteral("token"), token);
    addParam<IfNotEmpty>(_data, QStringLiteral("device_id"), deviceId);
    addParam<IfNotEmpty>(_data, QStringLiteral("initial_device_display_name"),
                         initialDeviceDisplayName);
    setRequestData(std::move(_data));
}