Documentation
¶
Index ¶
Constants ¶
View Source
const ( BASE_URL = "https://api.sendinblue.com/v2.0" CONTENT_TYPE = "application/json" EMAIL_URL = "/email" EMAIL_TEMPLATE_URL = "/template" SMS_URL = "/sms" POST = "POST" CONTENT_TYPE_HEADER = "Content-Type" API_KEY_HEADER = "api-key" )
View Source
const (
TIME_FORMAT = "2013-06-20 20:09:22"
)
Variables ¶
View Source
var (
DEFAULT_SEND_TIMEOUT time.Duration = time.Second * 30
)
Functions ¶
This section is empty.
Types ¶
type Email ¶
type Email struct {
To map[string]string `json:"to"`
Subject string `json:"subject"`
From []string `json:"from"`
Html string `json:"html"`
Text string `json:"text"`
Cc map[string]string `json:"cc"`
Bcc map[string]string `json:"bcc"`
ReplyTo []string `json:"replyto"`
Attachment interface{} `json:"attachment"`
Headers map[string]string `json:"headers"`
InlineImage map[string]string `json:"inline_image"`
}
Email request to be send
type EmailTemplate ¶
type EmailTemplate struct {
Id int `json:"id"`
To map[string]string `json:"to"`
Cc map[string]string `json:"cc"`
Bcc map[string]string `json:"bcc"`
Attr map[string]string `json:"attr"`
AttachmentUrl []string `json:"attachment_url"`
Attachment map[string]string `json:"attachment"`
Headers map[string]string `json:"headers"`
}
Email template request to be send
type Goinblue ¶
type Goinblue struct {
ApiKey string
Timeout time.Duration
BaseUrl string
ContentType string
Method string
ContentTypeHeader string
ApiKeyHeader string
EmailUrl string
EmailTemplateUrl string
SMSUrl string
}
The main struct of this package
func (*Goinblue) SendEmailTemplate ¶
func (g *Goinblue) SendEmailTemplate(emailTemplate *EmailTemplate) (*Response, error)
Send email using template
type Response ¶
type Response struct {
Code string `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data"`
}
The response from server
func (*Response) GetMessageId ¶
To get message-id of a sent message
func (*Response) GetSMSResponseData ¶
func (r *Response) GetSMSResponseData() (*SMSResponseData, error)
type SMSResponseData ¶
type SMSResponseData struct {
Status string `json:"status"`
Message string `json:"message"`
NumberSent int `json:"number_sent"`
To string `json:"to"`
SMSCount int `json:"sms_count"`
CreditsUsed float64 `json:"credits_used"`
RemainingCredit float64 `json:"remaining_credit"`
Reference map[string]string `json:"reference"`
Description string `json:"description"`
Reply string `json:"reply"`
BounceType string `json:"bounce_type"`
ErrorCode int `json:"error_code"`
}
type WebhookResponse ¶
type WebhookResponse struct {
Event string `json:"event"`
Email string `json:"email"`
Id int64 `json:"id"`
Date time.Time `json:"date_time"`
Ts int64 `json:"ts"` // timestamp (same as Date but GMT)
Subject string `json:"subject"`
SendingIP net.IP `json:"sending-ip"`
MessageId string `json:"message-id"`
Tag string `json:"tag"`
XMailinCustom string `json:"X-Mailin-custom"`
Reason string `json:"reason,omitempty"` // for "bounce" and "deferred" events only
Link string `json:"link,omitempty"` // for "click" events only
}
func (*WebhookResponse) UnmarshalJSON ¶
func (e *WebhookResponse) UnmarshalJSON(b []byte) error
Click to show internal directories.
Click to hide internal directories.