libQuotient
A Qt library for building matrix clients
Loading...
Searching...
No Matches
pusher.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
7namespace Quotient {
8
9//! \brief Gets the current pushers for the authenticated user
10//!
11//! Gets all currently active pushers for the authenticated user.
13public:
14 // Inner data structures
15
16 //! A dictionary of information for the pusher implementation
17 //! itself.
19 //! Required if `kind` is `http`. The URL to use to send
20 //! notifications to.
22
23 //! The format to use when sending notifications to the Push
24 //! Gateway.
26 };
27
29 //! This is a unique identifier for this pusher. See `/set` for
30 //! more detail.
31 //! Max length, 512 bytes.
33
34 //! The kind of pusher. `"http"` is a pusher that
35 //! sends HTTP pokes.
37
38 //! This is a reverse-DNS style identifier for the application.
39 //! Max length, 64 chars.
41
42 //! A string that will allow the user to identify what application
43 //! owns this pusher.
45
46 //! A string that will allow the user to identify what device owns
47 //! this pusher.
49
50 //! The preferred language for receiving notifications (e.g. 'en'
51 //! or 'en-US')
53
54 //! A dictionary of information for the pusher implementation
55 //! itself.
57
58 //! This string determines which set of device specific rules this
59 //! pusher executes.
61 };
62
63 // Construction/destruction
64
65 explicit GetPushersJob();
66
67 //! \brief Construct a URL without creating a full-fledged job object
68 //!
69 //! This function can be used when a URL for GetPushersJob
70 //! is necessary but the job itself isn't.
72
73 // Result properties
74
75 //! An array containing the current pushers for the user
76 QVector<Pusher> pushers() const { return loadFromJson<QVector<Pusher>>("pushers"_L1); }
77};
78
79inline auto collectResponse(const GetPushersJob* job) { return job->pushers(); }
80
81template <>
84 {
85 fillFromJson(jo.value("url"_L1), result.url);
86 fillFromJson(jo.value("format"_L1), result.format);
87 }
88};
89
90template <>
92 static void fillFrom(const QJsonObject& jo, GetPushersJob::Pusher& result)
93 {
94 fillFromJson(jo.value("pushkey"_L1), result.pushkey);
95 fillFromJson(jo.value("kind"_L1), result.kind);
96 fillFromJson(jo.value("app_id"_L1), result.appId);
97 fillFromJson(jo.value("app_display_name"_L1), result.appDisplayName);
98 fillFromJson(jo.value("device_display_name"_L1), result.deviceDisplayName);
99 fillFromJson(jo.value("lang"_L1), result.lang);
100 fillFromJson(jo.value("data"_L1), result.data);
101 fillFromJson(jo.value("profile_tag"_L1), result.profileTag);
102 }
103};
104
105//! \brief Modify a pusher for this user on the homeserver.
106//!
107//! This endpoint allows the creation, modification and deletion of
108//! [pushers](/client-server-api/#push-notifications) for this user ID. The behaviour of this
109//! endpoint varies depending on the values in the JSON body.
110//!
111//! If `kind` is not `null`, the pusher with this `app_id` and `pushkey`
112//! for this user is updated, or it is created if it doesn't exist. If
113//! `kind` is `null`, the pusher with this `app_id` and `pushkey` for this
114//! user is deleted.
116public:
117 // Inner data structures
118
119 //! Required if `kind` is not `null`. A dictionary of information
120 //! for the pusher implementation itself. If `kind` is `http`,
121 //! this should contain `url` which is the URL to use to send
122 //! notifications to.
124 //! Required if `kind` is `http`. The URL to use to send
125 //! notifications to. MUST be an HTTPS URL with a path of
126 //! `/_matrix/push/v1/notify`.
128
129 //! The format to send notifications in to Push Gateways if the
130 //! `kind` is `http`. The details about what fields the
131 //! homeserver should send to the push gateway are defined in the
132 //! [Push Gateway Specification](/push-gateway-api/). Currently the only format
133 //! available is 'event_id_only'.
135 };
136
137 // Construction/destruction
138
139 //! \param pushkey
140 //! This is a unique identifier for this pusher. The value you
141 //! should use for this is the routing or destination address
142 //! information for the notification, for example, the APNS token
143 //! for APNS or the Registration ID for GCM. If your notification
144 //! client has no such concept, use any unique identifier.
145 //! Max length, 512 bytes.
146 //!
147 //! If the `kind` is `"email"`, this is the email address to
148 //! send notifications to.
149 //!
150 //! \param kind
151 //! The kind of pusher to configure. `"http"` makes a pusher that
152 //! sends HTTP pokes. `"email"` makes a pusher that emails the
153 //! user with unread notifications. `null` deletes the pusher.
154 //!
155 //! \param appId
156 //! This is a reverse-DNS style identifier for the application.
157 //! It is recommended that this end with the platform, such that
158 //! different platform versions get different app identifiers.
159 //! Max length, 64 chars.
160 //!
161 //! If the `kind` is `"email"`, this is `"m.email"`.
162 //!
163 //! \param appDisplayName
164 //! Required if `kind` is not `null`. A string that will allow the
165 //! user to identify what application owns this pusher.
166 //!
167 //! \param deviceDisplayName
168 //! Required if `kind` is not `null`. A string that will allow the
169 //! user to identify what device owns this pusher.
170 //!
171 //! \param profileTag
172 //! This string determines which set of device specific rules this
173 //! pusher executes.
174 //!
175 //! \param lang
176 //! Required if `kind` is not `null`. The preferred language for
177 //! receiving notifications (e.g. 'en' or 'en-US').
178 //!
179 //! \param data
180 //! Required if `kind` is not `null`. A dictionary of information
181 //! for the pusher implementation itself. If `kind` is `http`,
182 //! this should contain `url` which is the URL to use to send
183 //! notifications to.
184 //!
185 //! \param append
186 //! If true, the homeserver should add another pusher with the
187 //! given pushkey and App ID in addition to any others with
188 //! different user IDs. Otherwise, the homeserver must remove any
189 //! other pushers with the same App ID and pushkey for different
190 //! users. The default is `false`.
191 explicit PostPusherJob(const QString& pushkey, const QString& kind, const QString& appId,
192 const QString& appDisplayName = {}, const QString& deviceDisplayName = {},
193 const QString& profileTag = {}, const QString& lang = {},
195 std::optional<bool> append = std::nullopt);
196};
197
198template <>
200 static void dumpTo(QJsonObject& jo, const PostPusherJob::PusherData& pod)
201 {
202 addParam<IfNotEmpty>(jo, "url"_L1, pod.url);
203 addParam<IfNotEmpty>(jo, "format"_L1, pod.format);
204 }
205};
206
207} // namespace Quotient
Gets the current pushers for the authenticated user.
Definition pusher.h:12
Modify a pusher for this user on the homeserver.
Definition pusher.h:115
auto collectResponse(const GetAccountDataJob *job)
#define QUOTIENT_API