aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/administrative_contact.cpp
blob: 589c9fc108f6d84130f558abd58707e9a4482bc4 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/******************************************************************************
 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
 */

#include "administrative_contact.h"

using namespace Quotient;

QUrl GetAccount3PIDsJob::makeRequestUrl(QUrl baseUrl)
{
    return BaseJob::makeRequestUrl(
        std::move(baseUrl), makePath("/_matrix/client/r0", "/account/3pid"));
}

GetAccount3PIDsJob::GetAccount3PIDsJob()
    : BaseJob(HttpVerb::Get, QStringLiteral("GetAccount3PIDsJob"),
              makePath("/_matrix/client/r0", "/account/3pid"))
{}

Post3PIDsJob::Post3PIDsJob(const ThreePidCredentials& threePidCreds)
    : BaseJob(HttpVerb::Post, QStringLiteral("Post3PIDsJob"),
              makePath("/_matrix/client/r0", "/account/3pid"))
{
    QJsonObject _data;
    addParam<>(_data, QStringLiteral("three_pid_creds"), threePidCreds);
    setRequestData(std::move(_data));
}

Add3PIDJob::Add3PIDJob(const QString& clientSecret, const QString& sid,
                       const Omittable<AuthenticationData>& auth)
    : BaseJob(HttpVerb::Post, QStringLiteral("Add3PIDJob"),
              makePath("/_matrix/client/r0", "/account/3pid/add"))
{
    QJsonObject _data;
    addParam<IfNotEmpty>(_data, QStringLiteral("auth"), auth);
    addParam<>(_data, QStringLiteral("client_secret"), clientSecret);
    addParam<>(_data, QStringLiteral("sid"), sid);
    setRequestData(std::move(_data));
}

Bind3PIDJob::Bind3PIDJob(const QString& clientSecret, const QString& idServer,
                         const QString& idAccessToken, const QString& sid)
    : BaseJob(HttpVerb::Post, QStringLiteral("Bind3PIDJob"),
              makePath("/_matrix/client/r0", "/account/3pid/bind"))
{
    QJsonObject _data;
    addParam<>(_data, QStringLiteral("client_secret"), clientSecret);
    addParam<>(_data, QStringLiteral("id_server"), idServer);
    addParam<>(_data, QStringLiteral("id_access_token"), idAccessToken);
    addParam<>(_data, QStringLiteral("sid"), sid);
    setRequestData(std::move(_data));
}

Delete3pidFromAccountJob::Delete3pidFromAccountJob(const QString& medium,
                                                   const QString& address,
                                                   const QString& idServer)
    : BaseJob(HttpVerb::Post, QStringLiteral("Delete3pidFromAccountJob"),
              makePath("/_matrix/client/r0", "/account/3pid/delete"))
{
    QJsonObject _data;
    addParam<IfNotEmpty>(_data, QStringLiteral("id_server"), idServer);
    addParam<>(_data, QStringLiteral("medium"), medium);
    addParam<>(_data, QStringLiteral("address"), address);
    setRequestData(std::move(_data));
    addExpectedKey("id_server_unbind_result");
}

Unbind3pidFromAccountJob::Unbind3pidFromAccountJob(const QString& medium,
                                                   const QString& address,
                                                   const QString& idServer)
    : BaseJob(HttpVerb::Post, QStringLiteral("Unbind3pidFromAccountJob"),
              makePath("/_matrix/client/r0", "/account/3pid/unbind"))
{
    QJsonObject _data;
    addParam<IfNotEmpty>(_data, QStringLiteral("id_server"), idServer);
    addParam<>(_data, QStringLiteral("medium"), medium);
    addParam<>(_data, QStringLiteral("address"), address);
    setRequestData(std::move(_data));
    addExpectedKey("id_server_unbind_result");
}

RequestTokenTo3PIDEmailJob::RequestTokenTo3PIDEmailJob(
    const EmailValidationData& body)
    : BaseJob(HttpVerb::Post, QStringLiteral("RequestTokenTo3PIDEmailJob"),
              makePath("/_matrix/client/r0",
                       "/account/3pid/email/requestToken"),
              false)
{
    setRequestData(RequestData(toJson(body)));
}

RequestTokenTo3PIDMSISDNJob::RequestTokenTo3PIDMSISDNJob(
    const MsisdnValidationData& body)
    : BaseJob(HttpVerb::Post, QStringLiteral("RequestTokenTo3PIDMSISDNJob"),
              makePath("/_matrix/client/r0",
                       "/account/3pid/msisdn/requestToken"),
              false)
{
    setRequestData(RequestData(toJson(body)));
}