/****************************************************************************** * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN */ #pragma once #include "csapi/definitions/push_condition.h" #include "csapi/definitions/push_rule.h" #include "csapi/definitions/push_ruleset.h" #include "jobs/basejob.h" namespace Quotient { /*! \brief Retrieve all push rulesets. * * Retrieve all push rulesets for this user. Clients can "drill-down" on * the rulesets by suffixing a `scope` to this path e.g. * `/pushrules/global/`. This will return a subset of this data under the * specified key e.g. the `global` key. */ class QUOTIENT_API GetPushRulesJob : public BaseJob { public: /// Retrieve all push rulesets. explicit GetPushRulesJob(); /*! \brief Construct a URL without creating a full-fledged job object * * This function can be used when a URL for GetPushRulesJob * is necessary but the job itself isn't. */ static QUrl makeRequestUrl(QUrl baseUrl); // Result properties /// The global ruleset. PushRuleset global() const { return loadFromJson("global"_ls); } }; /*! \brief Retrieve a push rule. * * Retrieve a single specified push rule. */ class QUOTIENT_API GetPushRuleJob : public BaseJob { public: /*! \brief Retrieve a push rule. * * \param scope * `global` to specify global rules. * * \param kind * The kind of rule * * \param ruleId * The identifier for the rule. */ explicit GetPushRuleJob(const QString& scope, const QString& kind, const QString& ruleId); /*! \brief Construct a URL without creating a full-fledged job object * * This function can be used when a URL for GetPushRuleJob * is necessary but the job itself isn't. */ static QUrl makeRequestUrl(QUrl baseUrl, const QString& scope, const QString& kind, const QString& ruleId); // Result properties /// The specific push rule. This will also include keys specific to the /// rule itself such as the rule's `actions` and `conditions` if set. PushRule pushRule() const { return fromJson(jsonData()); } }; /*! \brief Delete a push rule. * * This endpoint removes the push rule defined in the path. */ class QUOTIENT_API DeletePushRuleJob : public BaseJob { public: /*! \brief Delete a push rule. * * \param scope * `global` to specify global rules. * * \param kind * The kind of rule * * \param ruleId * The identifier for the rule. */ explicit DeletePushRuleJob(const QString& scope, const QString& kind, const QString& ruleId); /*! \brief Construct a URL without creating a full-fledged job object * * This function can be used when a URL for DeletePushRuleJob * is necessary but the job itself isn't. */ static QUrl makeRequestUrl(QUrl baseUrl, const QString& scope, const QString& kind, const QString& ruleId); }; /*! \brief Add or change a push rule. * * This endpoint allows the creation, modification and deletion of pushers * for this user ID. The behaviour of this endpoint varies depending on the * values in the JSON body. * * When creating push rules, they MUST be enabled by default. */ class QUOTIENT_API SetPushRuleJob : public BaseJob { public: /*! \brief Add or change a push rule. * * \param scope * `global` to specify global rules. * * \param kind * The kind of rule * * \param ruleId * The identifier for the rule. * * \param actions * The action(s) to perform when the conditions for this rule are met. * * \param before * Use 'before' with a `rule_id` as its value to make the new rule the * next-most important rule with respect to the given user defined rule. * It is not possible to add a rule relative to a predefined server rule. * * \param after * This makes the new rule the next-less important rule relative to the * given user defined rule. It is not possible to add a rule relative * to a predefined server rule. * * \param conditions * The conditions that must hold true for an event in order for a * rule to be applied to an event. A rule with no conditions * always matches. Only applicable to `underride` and `override` rules. * * \param pattern * Only applicable to `content` rules. The glob-style pattern to match * against. */ explicit SetPushRuleJob(const QString& scope, const QString& kind, const QString& ruleId, const QVector& actions, const QString& before = {}, const QString& after = {}, const QVector& conditions = {}, const QString& pattern = {}); }; /*! \brief Get whether a push rule is enabled * * This endpoint gets whether the specified push rule is enabled. */ class QUOTIENT_API IsPushRuleEnabledJob : public BaseJob { public: /*! \brief Get whether a push rule is enabled * * \param scope * Either `global` or `device/` to specify global * rules or device rules for the given `profile_tag`. * * \param kind * The kind of rule * * \param ruleId * The identifier for the rule. */ explicit IsPushRuleEnabledJob(const QString& scope, const QString& kind, const QString& ruleId); /*! \brief Construct a URL without creating a full-fledged job object * * This function can be used when a URL for IsPushRuleEnabledJob * is necessary but the job itself isn't. */ static QUrl makeRequestUrl(QUrl baseUrl, const QString& scope, const QString& kind, const QString& ruleId); // Result properties /// Whether the push rule is enabled or not. bool enabled() const { return loadFromJson("enabled"_ls); } }; /*! \brief Enable or disable a push rule. * * This endpoint allows clients to enable or disable the specified push rule. */ class QUOTIENT_API SetPushRuleEnabledJob : public BaseJob { public: /*! \brief Enable or disable a push rule. * * \param scope * `global` to specify global rules. * * \param kind * The kind of rule * * \param ruleId * The identifier for the rule. * * \param enabled * Whether the push rule is enabled or not. */ explicit SetPushRuleEnabledJob(const QString& scope, const QString& kind, const QString& ruleId, bool enabled); }; /*! \brief The actions for a push rule * * This endpoint get the actions for the specified push rule. */ class QUOTIENT_API GetPushRuleActionsJob : public BaseJob { public: /*! \brief The actions for a push rule * * \param scope * Either `global` or `device/` to specify global * rules or device rules for the given `profile_tag`. * * \param kind * The kind of rule * * \param ruleId * The identifier for the rule. */ explicit GetPushRuleActionsJob(const QString& scope, const QString& kind, const QString& ruleId); /*! \brief Construct a URL without creating a full-fledged job object * * This function can be used when a URL for GetPushRuleActionsJob * is necessary but the job itself isn't. */ static QUrl makeRequestUrl(QUrl baseUrl, const QString& scope, const QString& kind, const QString& ruleId); // Result properties /// The action(s) to perform for this rule. QVector actions() const { return loadFromJson>("actions"_ls); } }; /*! \brief Set the actions for a push rule. * * This endpoint allows clients to change the actions of a push rule. * This can be used to change the actions of builtin rules. */ class QUOTIENT_API SetPushRuleActionsJob : public BaseJob { public: /*! \brief Set the actions for a push rule. * * \param scope * `global` to specify global rules. * * \param kind * The kind of rule * * \param ruleId * The identifier for the rule. * * \param actions * The action(s) to perform for this rule. */ explicit SetPushRuleActionsJob(const QString& scope, const QString& kind, const QString& ruleId, const QVector& actions); }; } // namespace Quotient dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/******************************************************************************
 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
 */

#pragma once

#include "csapi/definitions/sync_filter.h"

#include "jobs/basejob.h"

namespace Quotient {

/*! \brief Upload a new filter.
 *
 * Uploads a new filter definition to the homeserver.
 * Returns a filter ID that may be used in future requests to
 * restrict which events are returned to the client.
 */
class DefineFilterJob : public BaseJob {
public:
    /*! \brief Upload a new filter.
     *
     * \param userId
     *   The id of the user uploading the filter. The access token must be
     * authorized to make requests for this user id.
     *
     * \param filter
     *   The filter to upload.
     */
    explicit DefineFilterJob(const QString& userId, const Filter& filter);

    // Result properties

    /// The ID of the filter that was created. Cannot start
    /// with a `{` as this character is used to determine
    /// if the filter provided is inline JSON or a previously
    /// declared filter by homeservers on some APIs.
    QString filterId() const { return loadFromJson<QString>("filter_id"_ls); }
};

/*! \brief Download a filter
 *
 */
class GetFilterJob : public BaseJob {
public:
    /*! \brief Download a filter
     *
     * \param userId
     *   The user ID to download a filter for.
     *
     * \param filterId
     *   The filter ID to download.
     */
    explicit GetFilterJob(const QString& userId, const QString& filterId);

    /*! \brief Construct a URL without creating a full-fledged job object
     *
     * This function can be used when a URL for GetFilterJob
     * is necessary but the job itself isn't.
     */
    static QUrl makeRequestUrl(QUrl baseUrl, const QString& userId,
                               const QString& filterId);

    // Result properties

    /// The filter definition.
    Filter filter() const { return fromJson<Filter>(jsonData()); }
};

} // namespace Quotient