1/******************************************************************************
2 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
3 */
4
5#pragma once
6
7#include <Quotient/csapi/definitions/sync_filter.h>
8
9#include <Quotient/jobs/basejob.h>
10
11namespace Quotient {
12
13/*! \brief Upload a new filter.
14 *
15 * Uploads a new filter definition to the homeserver.
16 * Returns a filter ID that may be used in future requests to
17 * restrict which events are returned to the client.
18 */
19class QUOTIENT_API DefineFilterJob : public BaseJob {
20public:
21 /*! \brief Upload a new filter.
22 *
23 * \param userId
24 * The id of the user uploading the filter. The access token must be
25 * authorized to make requests for this user id.
26 *
27 * \param filter
28 * The filter to upload.
29 */
30 explicit DefineFilterJob(const QString& userId, const Filter& filter);
31
32 // Result properties
33
34 /// The ID of the filter that was created. Cannot start
35 /// with a `{` as this character is used to determine
36 /// if the filter provided is inline JSON or a previously
37 /// declared filter by homeservers on some APIs.
38 QString filterId() const { return loadFromJson<QString>(keyName: "filter_id"_ls); }
39};
40
41/*! \brief Download a filter
42 *
43 */
44class QUOTIENT_API GetFilterJob : public BaseJob {
45public:
46 /*! \brief Download a filter
47 *
48 * \param userId
49 * The user ID to download a filter for.
50 *
51 * \param filterId
52 * The filter ID to download.
53 */
54 explicit GetFilterJob(const QString& userId, const QString& filterId);
55
56 /*! \brief Construct a URL without creating a full-fledged job object
57 *
58 * This function can be used when a URL for GetFilterJob
59 * is necessary but the job itself isn't.
60 */
61 static QUrl makeRequestUrl(QUrl baseUrl, const QString& userId,
62 const QString& filterId);
63
64 // Result properties
65
66 /// The filter definition.
67 Filter filter() const { return fromJson<Filter>(json: jsonData()); }
68};
69
70} // namespace Quotient
71