aboutsummaryrefslogtreecommitdiff
path: root/lib/application-service/definitions/location.cpp
blob: 973bcd22554afe8aa3f26f47f0393aac3f9bd2db (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
/******************************************************************************
 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
 */

#include "location.h"

using namespace QMatrixClient;

QJsonObject QMatrixClient::toJson(const ThirdPartyLocation& pod)
{
    QJsonObject _json;
    addParam<IfNotEmpty>(_json, QStringLiteral("alias"), pod.alias);
    addParam<IfNotEmpty>(_json, QStringLiteral("protocol"), pod.protocol);
    addParam<IfNotEmpty>(_json, QStringLiteral("fields"), pod.fields);
    return _json;
}

ThirdPartyLocation FromJson<ThirdPartyLocation>::operator()(const QJsonValue& jv)
{
    const auto& _json = jv.toObject();
    ThirdPartyLocation result;
    result.alias =
        fromJson<QString>(_json.value("alias"_ls));
    result.protocol =
        fromJson<QString>(_json.value("protocol"_ls));
    result.fields =
        fromJson<QJsonObject>(_json.value("fields"_ls));
    
    return result;
}