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

#pragma once


#include <QtCore/QJsonObject>
#include <QtCore/QVector>
#include "converters.h"

#include "converters.h"

namespace QMatrixClient
{
    // Data structures

    /// Definition of valid values for a field.
    struct FieldType
    {
        /// A regular expression for validation of a field's value.
        QString regexp;
        /// An placeholder serving as a valid example of the field value.
        QString placeholder;
    };

    QJsonObject toJson(const FieldType& pod);

    template <> struct FromJson<FieldType>
    {
        FieldType operator()(const QJsonValue& jv);
    };

    /// All location or user fields should have an entry here.
    struct FieldTypes
    {
        /// Definition of valid values for a field.
        Omittable<FieldType> fieldname;
    };

    QJsonObject toJson(const FieldTypes& pod);

    template <> struct FromJson<FieldTypes>
    {
        FieldTypes operator()(const QJsonValue& jv);
    };

    struct Protocol
    {
        /// Fields used to identify a third party user.
        QStringList userFields;
        /// Fields used to identify a third party location.
        QStringList locationFields;
        /// An icon representing the third party protocol.
        QString icon;
        /// All location or user fields should have an entry here.
        Omittable<FieldTypes> fieldTypes;
        /// A list of objects representing independent instances of configuration.
        /// For instance multiple networks on IRC if multiple are bridged by the
        /// same bridge.
        QVector<QJsonObject> instances;
    };

    QJsonObject toJson(const Protocol& pod);

    template <> struct FromJson<Protocol>
    {
        Protocol operator()(const QJsonValue& jv);
    };

} // namespace QMatrixClient