Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add notification actions #461

Open
mStirner opened this issue May 22, 2024 · 0 comments
Open

Add notification actions #461

mStirner opened this issue May 22, 2024 · 0 comments
Labels

Comments

@mStirner
Copy link
Member

Add actions to notifications (responses), like buttons/inputs.

Draft:

const Joi = require("joi");

module.exports = class Action {

    constructor(options, cb) {

        this.options = Object.assign({

        }, options);

        Object.defineProperty(this, "callback", {
            value: cb,
            enumerable: false,
            configurable: false,
            writable: false
        });

    }

    static schema() {
        return Joi.object({
            title: Joi.string().required(),
            type: Joi.string().valid("boolean", "string", "number"),
            display: Joi.string().valid("input", "button")
        });
    }

    static validate(data) {
        return Action.schema().validate(data);
    }

    apply(value) {
        this.callback(value);
    }

};

Comparable to gotify actions: https://gotify.net/docs/msgextras#androidaction

@mStirner mStirner added this to the v4.0.0 release milestone May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant