fix(gotify): error if token not present

This commit is contained in:
yusing
2025-10-16 10:25:38 +08:00
parent af9363209b
commit 3e73be60a1

View File

@@ -7,6 +7,7 @@ import (
"github.com/bytedance/sonic"
"github.com/gotify/server/v2/model"
"github.com/rs/zerolog"
gperr "github.com/yusing/goutils/errs"
)
type (
@@ -18,6 +19,16 @@ type (
const gotifyMsgEndpoint = "/message"
func (client *GotifyClient) Validate() gperr.Error {
if err := client.ProviderBase.Validate(); err != nil {
return err
}
if client.Token == "" {
return gperr.New("token is required")
}
return nil
}
func (client *GotifyClient) GetURL() string {
return client.URL + gotifyMsgEndpoint
}