Add GetMessages and DeleteMessage to MessageHandler
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- go
调研方向
首先定位 MessageHandler 接口和 Message 结构体,然后追踪它们在整个仓库中的实现和 API 使用情况。确定消息 ID 应如何表示,以及对于 plugin,列出、获取和删除应如何工作。接口和实现支持所请求的操作并具有一致的行为,即表示完成。
由索引模型根据 Issue 内容生成。
描述
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
- 主要语言
- Go
- 星标
- 16
- 派生
- 4
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
gotify/plugin-api 的其他 Issue
-
难度 5/5 一周以上 新手友好度 35/100
gotify/plugin-api#8 · 1 条评论 ·
-
难度 5/5 一周以上 新手友好度 30/100
gotify/plugin-api#7 · 1 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 35/100
gotify/plugin-api#6 · 2 条评论 ·
-
new-api
难度 5/5 一周以上 新手友好度 25/100
gotify/plugin-api#3 · 4 条评论 · 1 个 reaction ·
查看 gotify/plugin-api 的全部 Issue
相似的 Issue
-
textual definition
难度 1/5 1 小时以内 新手友好度 90/100
geneontology/go-ontology#32653 ·
-
难度 1/5 1 小时以内 新手友好度 75/100
-
needs design
难度 2/5 1-3 小时 新手友好度 75/100
-
Priority/High ready-for-agent Severity/Major Type/Bug
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 70/100