24 lines
543 B
Go
24 lines
543 B
Go
package push
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
)
|
|
|
|
var ErrProviderConfigInvalid = errors.New("push provider config invalid")
|
|
|
|
// Message 描述一条待发送的推送消息。
|
|
type Message struct {
|
|
Title string
|
|
Content string
|
|
}
|
|
|
|
// Provider 是站外推送渠道的统一接口。
|
|
// 实现方负责具体的 HTTP 调用(Bark、WPush 等)。
|
|
type Provider interface {
|
|
// Name 返回渠道标识,用于日志。
|
|
Name() string
|
|
// Send 发送一条推送消息。失败时返回 error。
|
|
Send(ctx context.Context, msg Message) error
|
|
}
|