File size: 1,503 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
package notification
import (
"context"
"github.com/target/goalert/auth/authlink"
"github.com/target/goalert/gadb"
)
// A Receiver processes incoming messages and responses.
type Receiver interface {
// SetMessageStatus can be used to update the state of a message.
SetMessageStatus(ctx context.Context, externalID string, status *Status) error
// Receive records a response to a previously sent message.
Receive(ctx context.Context, callbackID string, result Result) error
// ReceiveSubject records a response to a previously sent message from a provider/subject (e.g. Slack user).
ReceiveSubject(ctx context.Context, providerID, subjectID, callbackID string, result Result) error
// AuthLinkURL will generate a URL to link a provider and subject to a GoAlert user.
AuthLinkURL(ctx context.Context, providerID, subjectID string, meta authlink.Metadata) (string, error)
// Start indicates a user has opted-in for notifications to this contact method.
Start(context.Context, gadb.DestV1) error
// Stop indicates a user has opted-out of notifications from a contact method.
Stop(context.Context, gadb.DestV1) error
// IsKnownDest checks if the given destination is known/not disabled.
IsKnownDest(ctx context.Context, dest gadb.DestV1) (bool, error)
}
// UnknownSubjectError is returned from ReceiveSubject when the subject is unknown.
type UnknownSubjectError struct {
AlertID int
}
func (e UnknownSubjectError) Error() string {
return "unknown subject for that provider"
}
|