Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Add GetMessages and DeleteMessage to MessageHandler

Abierto
#11 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
go

Línea de trabajo

Comienza localizando la interfaz MessageHandler y la estructura Message; después, rastrea sus implementaciones y el uso de la API en todo el repositorio. Determina cómo deben representarse los ID de los mensajes y cómo deben comportarse las operaciones de listado, recuperación y eliminación para un plugin. Se considerará terminado cuando la interfaz y las implementaciones admitan las operaciones solicitadas con un comportamiento coherente.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
Go
Estrellas
16
Forks
4
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de gotify/plugin-api

Todos los issues de gotify/plugin-api

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.