libQuotient
A Qt library for building matrix clients
Loading...
Searching...
No Matches
notifications.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
/
events
/
event
.
h
>
6
#
include
<
Quotient
/
jobs
/
basejob
.
h
>
7
8
namespace
Quotient
{
9
10
//! \brief Gets a list of events that the user has been notified about
11
//!
12
//! This API is used to paginate through the list of events that the
13
//! user has been, or would have been notified about.
14
class
QUOTIENT_API
GetNotificationsJob
:
public
BaseJob
{
15
public
:
16
// Inner data structures
17
18
struct
QUOTIENT_API
Notification
{
19
//! The action(s) to perform when the conditions for this rule are met.
20
//! See [Push Rules: API](/client-server-api/#push-rules-api).
21
QVector
<
QVariant
>
actions
;
22
23
//! The Event object for the event that triggered the notification.
24
EventPtr
event
;
25
26
//! Indicates whether the user has sent a read receipt indicating
27
//! that they have read this message.
28
bool
read
;
29
30
//! The ID of the room in which the event was posted.
31
QString
roomId
;
32
33
//! The unix timestamp at which the event notification was sent,
34
//! in milliseconds.
35
qint64
ts
;
36
37
//! The profile tag of the rule that matched this event.
38
QString
profileTag
{};
39
};
40
41
// Construction/destruction
42
43
//! \param from
44
//! Pagination token to continue from. This should be the `next_token`
45
//! returned from an earlier call to this endpoint.
46
//!
47
//! \param limit
48
//! Limit on the number of events to return in this request.
49
//!
50
//! \param only
51
//! Allows basic filtering of events returned. Supply `highlight`
52
//! to return only events where the notification had the highlight
53
//! tweak set.
54
explicit
GetNotificationsJob
(
const
QString
&
from
= {},
std
::
optional
<
int
>
limit
=
std
::
nullopt
,
55
const
QString
&
only
= {});
56
57
//! \brief Construct a URL without creating a full-fledged job object
58
//!
59
//! This function can be used when a URL for GetNotificationsJob
60
//! is necessary but the job itself isn't.
61
static
QUrl
makeRequestUrl
(
const
HomeserverData
&
hsData
,
const
QString
&
from
= {},
62
std
::
optional
<
int
>
limit
=
std
::
nullopt
,
const
QString
&
only
= {});
63
64
// Result properties
65
66
//! The token to supply in the `from` param of the next
67
//! `/notifications` request in order to request more
68
//! events. If this is absent, there are no more results.
69
QString
nextToken
()
const
{
return
loadFromJson
<
QString
>(
"next_token"_L1
); }
70
71
//! The list of events that triggered notifications.
72
std
::
vector
<
Notification
>
notifications
()
73
{
74
return
takeFromJson
<
std
::
vector
<
Notification
>>(
"notifications"_L1
);
75
}
76
77
struct
Response
{
78
//! The token to supply in the `from` param of the next
79
//! `/notifications` request in order to request more
80
//! events. If this is absent, there are no more results.
81
QString
nextToken
{};
82
83
//! The list of events that triggered notifications.
84
std
::
vector
<
Notification
>
notifications
{};
85
};
86
};
87
88
template
<
std
::
derived_from
<
GetNotificationsJob
>
JobT
>
89
constexpr
inline
auto
doCollectResponse
<
JobT
> =
90
[](
JobT
*
j
) ->
GetNotificationsJob
::
Response
{
return
{
j
->
nextToken
(),
j
->
notifications
() }; };
91
92
template
<>
93
struct
QUOTIENT_API
JsonObjectConverter
<
GetNotificationsJob
::
Notification
> {
94
static
void
fillFrom
(
const
QJsonObject
&
jo
,
GetNotificationsJob
::
Notification
&
result
)
95
{
96
fillFromJson
(
jo
.
value
(
"actions"_L1
),
result
.
actions
);
97
fillFromJson
(
jo
.
value
(
"event"_L1
),
result
.
event
);
98
fillFromJson
(
jo
.
value
(
"read"_L1
),
result
.
read
);
99
fillFromJson
(
jo
.
value
(
"room_id"_L1
),
result
.
roomId
);
100
fillFromJson
(
jo
.
value
(
"ts"_L1
),
result
.
ts
);
101
fillFromJson
(
jo
.
value
(
"profile_tag"_L1
),
result
.
profileTag
);
102
}
103
};
104
105
}
// namespace Quotient
Quotient::GetNotificationsJob
Gets a list of events that the user has been notified about.
Definition
notifications.h:14
Quotient
Definition
accountregistry.h:13
QUOTIENT_API
#define QUOTIENT_API
Definition
quotient_export.h:22
Quotient
csapi
notifications.h
Generated by
1.9.8