Add GetMessages and DeleteMessage to MessageHandler
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- go
- Domain
- api, backend-api-design
Research direction
Start by locating the MessageHandler interface and Message struct, then trace their implementations and API usage throughout the repository. Determine how message IDs should be represented and how listing, retrieval, and deletion should behave for a plugin. Done means the interface and implementations support the requested operations with consistent behavior.
Written by the indexing model from the issue text.
Description
Currently, the MessageHandler has an API gap in that it cannot list, get, or delete messages. This would be valuable for plugins who want to display a persistent notification while some event is ongoing.
I think the MessageHandler interface could just be extended with a few extra functions
// MessageHandler consists of message callbacks to be used by plugins.
type MessageHandler interface {
// SendMessage sends a message with the given information in the request.
SendMessage(msg Message) error
// GetMessages returns all active messages sent by this plugin.
GetMessages() ([]Message, error)
// GetMessage returns a specific message by ID.
GetMessage(id uint) (*Message, error)
// DeleteMessages deletes all messages created by this plugin.
DeleteMessages() error
// DeleteMessage deletes a specific message by ID.
DeleteMessage(id uint) error
}
I think the Message struct might also need to be extended or a new struct would need to be defined that includes an ID.
As background, I want to make a plugin for Alertmanager where alerts will be persistently created as notifications in Gotify so that I only get one notification for the alert and it gets deleted automatically when it resolves. Additionally, I want to add special handling for the watchdog alert so if Alertmanager stops sending it, I get a notification. With the current plugin API, I am only able to send messages when I get them from alertmanager.
If this is a desirable inclusion, I would love to implement it.
Relates to #7
- Dominant language
- Go
- Stars
- 16
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from gotify/plugin-api
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
gotify/plugin-api#8 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
gotify/plugin-api#7 · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
gotify/plugin-api#6 · 2 comments ·
-
new-api
Difficulty 5/5 Over a week Newbie friendliness 25/100
gotify/plugin-api#3 · 4 comments · 1 reaction ·
All issues in gotify/plugin-api
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
Bob Shell support Openenhancement
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
santhosh-tekuri/jsonschema#276 ·