mirror of
https://github.com/grafana/grafana.git
synced 2024-11-30 20:54:22 -06:00
efa0d90093
Team's webhook API does not always use the status code to communicate errors. There are cases where it returns 200 and an error message in the body. For example, 429 - Too Many Requests or when the message is too large. Instead, what we should be looking for is a response body = "1". https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using?tabs=cURL#send-messages-using-curl-and-powershell
55 lines
1.2 KiB
Go
55 lines
1.2 KiB
Go
package models
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/grafana/grafana/pkg/services/user"
|
|
)
|
|
|
|
var ErrInvalidEmailCode = errors.New("invalid or expired email code")
|
|
var ErrSmtpNotEnabled = errors.New("SMTP not configured, check your grafana.ini config file's [smtp] section")
|
|
|
|
// SendEmailAttachFile is a definition of the attached files without path
|
|
type SendEmailAttachFile struct {
|
|
Name string
|
|
Content []byte
|
|
}
|
|
|
|
// SendEmailCommand is the command for sending emails
|
|
type SendEmailCommand struct {
|
|
To []string
|
|
SingleEmail bool
|
|
Template string
|
|
Subject string
|
|
Data map[string]interface{}
|
|
Info string
|
|
ReplyTo []string
|
|
EmbeddedFiles []string
|
|
AttachedFiles []*SendEmailAttachFile
|
|
}
|
|
|
|
// SendEmailCommandSync is the command for sending emails synchronously
|
|
type SendEmailCommandSync struct {
|
|
SendEmailCommand
|
|
}
|
|
|
|
type SendWebhookSync struct {
|
|
Url string
|
|
User string
|
|
Password string
|
|
Body string
|
|
HttpMethod string
|
|
HttpHeader map[string]string
|
|
ContentType string
|
|
Validation func(body []byte, statusCode int) error
|
|
}
|
|
|
|
type SendResetPasswordEmailCommand struct {
|
|
User *user.User
|
|
}
|
|
|
|
type ValidateResetPasswordCodeQuery struct {
|
|
Code string
|
|
Result *user.User
|
|
}
|