libQuotient
A Qt library for building matrix clients
Loading...
Searching...
No Matches
support.h
Go to the documentation of this file.
1
// THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
2
3
#
pragma
once
4
5
#
include
<
Quotient
/
jobs
/
basejob
.
h
>
6
7
namespace
Quotient
{
8
9
//! \brief Gets homeserver contacts and support details.
10
//!
11
//! Gets server admin contact and support page of the domain.
12
//!
13
//! Like the [well-known discovery URI](/client-server-api/#well-known-uri),
14
//! this should be accessed with the hostname of the homeserver by making a
15
//! GET request to `https://hostname/.well-known/matrix/support`.
16
//!
17
//! Note that this endpoint is not necessarily handled by the homeserver.
18
//! It may be served by another webserver, used for discovering support
19
//! information for the homeserver.
20
class
QUOTIENT_API
GetWellknownSupportJob
:
public
BaseJob
{
21
public
:
22
// Inner data structures
23
24
//! A way to contact the server administrator.
25
struct
QUOTIENT_API
Contact
{
26
//! An informal description of what the contact methods
27
//! are used for.
28
//!
29
//! `m.role.admin` is a catch-all role for any queries
30
//! and `m.role.security` is intended for sensitive
31
//! requests.
32
//!
33
//! Unspecified roles are permitted through the use of
34
//! [Namespaced Identifiers](/appendices/#common-namespaced-identifier-grammar).
35
QString
role
;
36
37
//! A [Matrix User ID](/appendices/#user-identifiers)
38
//! representing the administrator.
39
//!
40
//! It could be an account registered on a different
41
//! homeserver so the administrator can be contacted
42
//! when the homeserver is down.
43
//!
44
//! At least one of `matrix_id` or `email_address` is
45
//! required.
46
QString
matrixId
{};
47
48
//! An email address to reach the administrator.
49
//!
50
//! At least one of `matrix_id` or `email_address` is
51
//! required.
52
QString
emailAddress
{};
53
};
54
55
// Construction/destruction
56
57
explicit
GetWellknownSupportJob
();
58
59
//! \brief Construct a URL without creating a full-fledged job object
60
//!
61
//! This function can be used when a URL for GetWellknownSupportJob
62
//! is necessary but the job itself isn't.
63
static
QUrl
makeRequestUrl
(
const
HomeserverData
&
hsData
);
64
65
// Result properties
66
67
//! Ways to contact the server administrator.
68
//!
69
//! At least one of `contacts` or `support_page` is required.
70
//! If only `contacts` is set, it must contain at least one
71
//! item.
72
QVector
<
Contact
>
contacts
()
const
{
return
loadFromJson
<
QVector
<
Contact
>>(
"contacts"_L1
); }
73
74
//! The URL of a page to give users help specific to the
75
//! homeserver, like extra login/registration steps.
76
//!
77
//! At least one of `contacts` or `support_page` is required.
78
QString
supportPage
()
const
{
return
loadFromJson
<
QString
>(
"support_page"_L1
); }
79
80
struct
Response
{
81
//! Ways to contact the server administrator.
82
//!
83
//! At least one of `contacts` or `support_page` is required.
84
//! If only `contacts` is set, it must contain at least one
85
//! item.
86
QVector
<
Contact
>
contacts
{};
87
88
//! The URL of a page to give users help specific to the
89
//! homeserver, like extra login/registration steps.
90
//!
91
//! At least one of `contacts` or `support_page` is required.
92
QString
supportPage
{};
93
};
94
};
95
96
template
<
std
::
derived_from
<
GetWellknownSupportJob
>
JobT
>
97
constexpr
inline
auto
doCollectResponse
<
JobT
> =
98
[](
JobT
*
j
) ->
GetWellknownSupportJob
::
Response
{
return
{
j
->
contacts
(),
j
->
supportPage
() }; };
99
100
template
<>
101
struct
QUOTIENT_API
JsonObjectConverter
<
GetWellknownSupportJob
::
Contact
> {
102
static
void
fillFrom
(
const
QJsonObject
&
jo
,
GetWellknownSupportJob
::
Contact
&
result
)
103
{
104
fillFromJson
(
jo
.
value
(
"role"_L1
),
result
.
role
);
105
fillFromJson
(
jo
.
value
(
"matrix_id"_L1
),
result
.
matrixId
);
106
fillFromJson
(
jo
.
value
(
"email_address"_L1
),
result
.
emailAddress
);
107
}
108
};
109
110
}
// namespace Quotient
Quotient::GetWellknownSupportJob
Gets homeserver contacts and support details.
Definition
support.h:20
Quotient
Definition
accountregistry.h:13
QUOTIENT_API
#define QUOTIENT_API
Definition
quotient_export.h:22
Quotient
csapi
support.h
Generated by
1.9.8