-
Notifications
You must be signed in to change notification settings - Fork 3
v1 API #1
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
v1 API #1
Conversation
4d11e79 to
1b941e4
Compare
|
@jmattheis Would you please leave your review on the plugin interfaces before we moving on to the plugin loader. Thanks. By the way I am not sure if travis can build PR even when there is no |
|
@eternal-flame-AD Thanks for this PR (:. I've enabled travis-ci on this repo so on your next push it should trigger. |
config.go
Outdated
| package plugin | ||
|
|
||
| // Configor is the interface plugins should implement in order to provide configuration interface to the user | ||
| type Configor interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Configurer needs a Schema() string method, to provide the schema of the configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to just use the default config as the schema?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can generate a schema from the struct see https://github.com/alecthomas/jsonschema but I would prefer to use EmptyConfig if #1 (comment) will be done.
|
If I wanted to send messages in webhook, would I create a plugin like this? If yes, I would rename RegisterMessageHandler to SetMessageHandler and RegisterStorageHandler to SetStorageHandler. import (
"github.com/gin-gonic/gin"
"github.com/gotify/plugin-api"
)
type NetlifyWebhooker struct {
msg plugin.MessageHandler
}
var _ plugin.Webhooker = new(NetlifyWebhooker)
var _ plugin.Messenger = new(NetlifyWebhooker)
func (n *NetlifyWebhooker) Enable() error {
return nil
}
func (n *NetlifyWebhooker) Disable() error {
return nil
}
func (n *NetlifyWebhooker) RegisterWebhook(r plugin.WebhookRegisterRequest) {
r.Mux.POST("/netlify", func(context *gin.Context) {
n.msg.SendMessage(plugin.MessageSendRequest{
Message: "hurray",
Title: "something",
})
})
}
func (n *NetlifyWebhooker) RegisterMessageHandler(msg plugin.MessageHandler) {
n.msg = msg
} |
193c6ee to
63394f8
Compare
f2c0995 to
7d76ed5
Compare
798304e to
a2ae569
Compare
|
Okay, after #1 (comment), #1 (comment) and #1 (comment) are done I'd see this PR as mergable. |
55b4dca to
a9368a6
Compare
a9368a6 to
a46fa32
Compare
|
Okay I think this is ready to merge and we can move on to the main PR then. |
TODO: