Pusher/pkg/pushkit/email.go

31 lines
713 B
Go
Raw Permalink Normal View History

2024-10-26 15:01:40 +00:00
package pushkit
import (
"git.solsynth.dev/hypernet/pusher/pkg/proto"
"github.com/samber/lo"
)
type EmailDeliverRequest struct {
To string `json:"to" validate:"required"`
Email EmailData `json:"email" validate:"required"`
}
type EmailDeliverBatchRequest struct {
To []string `json:"to" validate:"required"`
Email EmailData `json:"email" validate:"required"`
}
type EmailData struct {
Subject string `json:"subject" validate:"required"`
Text *string `json:"text"`
HTML *string `json:"html"`
}
func NewEmailDataFromProto(in *proto.EmailInfo) EmailData {
return EmailData{
Subject: in.GetSubject(),
Text: lo.ToPtr(in.GetTextBody()),
HTML: lo.ToPtr(in.GetHtmlBody()),
}
}