Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

Add GetMessages and DeleteMessage to MessageHandler

Aberta
#11 1 comentário 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
5/5
Tempo estimado
Mais de uma semana
Facilidade para iniciantes
35/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Estagnada
Stack de tecnologia
go

Direção de pesquisa

Comece localizando a interface MessageHandler e a struct Message; em seguida, rastreie suas implementações e o uso da API em todo o repositório. Determine como os IDs das mensagens devem ser representados e como a listagem, a recuperação e a exclusão devem se comportar para um plugin. A tarefa estará concluída quando a interface e as implementações derem suporte às operações solicitadas com comportamento consistente.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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

Linguagem predominante
Go
Estrelas
16
Forks
4
Métricas de merge de PRs
Nenhum PR com merge em 30d

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de gotify/plugin-api

Todas as issues de gotify/plugin-api

Issues semelhantes

Mais issues de Go

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.