Documentation ¶
Overview ¶
Package sib is a library for constructing a SendInBlue API2.0 client.
Index ¶
- type AggregateData
- type AggregateReport
- type AggregateResponse
- type CampaignData
- type CampaignResponse
- type Client
- func (c *Client) AggregateReport(a *AggregateReport) (AggregateResponse, error)
- func (c *Client) CreateSMSCampaign(s *SMSCampaign) (SMSCampaignResponse, error)
- func (c *Client) CreateTemplate(t *Template) (TemplateResponse, error)
- func (c *Client) DeleteBouncedEmails(start, end, email string) error
- func (c *Client) GetTemplate(template_id int) (CampaignResponse, error)
- func (c *Client) ListTemplates(t *TemplateList) (TemplateListResponse, error)
- func (c *Client) SMSCampaignTest(id int, to string) (SMSResponse, error)
- func (c *Client) SendEmail(e *Email) (EmailResponse, error)
- func (c *Client) SendSMS(s *SMSRequest) (SMSResponse, error)
- func (c *Client) SendTemplateEmail(id int, to []string, e *EmailOptions) (EmailResponse, error)
- func (c *Client) UpdateSMSCampaign(id int, s *SMSCampaign) error
- func (c *Client) UpdateTemplate(id int, t *Template) error
- type DeleteBouncesRequest
- type Email
- type EmailData
- type EmailOptions
- type EmailResponse
- type SMSCampaign
- type SMSCampaignData
- type SMSCampaignResponse
- type SMSData
- type SMSReference
- type SMSRequest
- type SMSResponse
- type SMSTest
- type Template
- type TemplateData
- type TemplateEmail
- type TemplateList
- type TemplateListData
- type TemplateListResponse
- type TemplateResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregateData ¶
type AggregateData struct { Date string `json:"date"` Tag string `json:"tag"` Requests int `json:"requests"` Delivered int `json:"delivered"` Bounces int `json:"bounces"` Clicks int `json:"clicks"` Unique_clicks int `json:"unique_clicks"` Opens int `json:"opens"` Unique_opens int `json:"unique_opens"` SpamReports int `json:"spamreports"` Blocked int `json:"blocked"` Invalid int `json:"invalid"` }
type AggregateReport ¶
type AggregateResponse ¶
type AggregateResponse struct { Code string `json:"code"` Message string `json:"message"` Data []AggregateData `json:"data"` }
type CampaignData ¶
type CampaignData struct { ID int `json:"id"` Campaign_name string `json:"campaign_name"` Subject string `json:"subject"` Bat_sent string `json:"bat_sent"` Type string `json:"type"` Html_content string `json:"html_content"` Entered string `json:"entered"` Modified string `json:"modified"` Templ_status string `json:"templ_status"` From_name string `json:"from_name"` From_email string `json:"from_email"` Reply_to string `json:"reply_to"` To_field string `json:"to_field"` }
type CampaignResponse ¶
type CampaignResponse struct { Code string `json:"code"` Message string `json:"message"` Data []CampaignData `json:"data"` }
type Client ¶
The Client type is the primary type in the package.
func NewClient ¶
NewClient takes a private SendInBlue API key and constructs a Client Object that can be used to talk to the SendInBlue API via the Client methods.
func (*Client) AggregateReport ¶
func (c *Client) AggregateReport(a *AggregateReport) (AggregateResponse, error)
AggregateReport is a Client Method for the SMTP API. Developers can access information about aggregate / date-wise report of the SendinBlue SMTP account using this API. https://apidocs.sendinblue.com/statistics/
func (*Client) CreateSMSCampaign ¶
func (c *Client) CreateSMSCampaign(s *SMSCampaign) (SMSCampaignResponse, error)
CreateSMSCampaign ...
func (*Client) CreateTemplate ¶
func (c *Client) CreateTemplate(t *Template) (TemplateResponse, error)
CreateTemplate ...
func (*Client) DeleteBouncedEmails ¶
DeleteBouncedEmails ... Start and End dates must be in YYYY-MM-DD format Start date must be before end date, and end date must be after start date
func (*Client) GetTemplate ¶
func (c *Client) GetTemplate(template_id int) (CampaignResponse, error)
GetTemplate ...
func (*Client) ListTemplates ¶
func (c *Client) ListTemplates(t *TemplateList) (TemplateListResponse, error)
ListTemplates ...
func (*Client) SMSCampaignTest ¶
func (c *Client) SMSCampaignTest(id int, to string) (SMSResponse, error)
SMSCampaignTest ...
func (*Client) SendEmail ¶
func (c *Client) SendEmail(e *Email) (EmailResponse, error)
SendEmail ...
func (*Client) SendTemplateEmail ¶
func (c *Client) SendTemplateEmail(id int, to []string, e *EmailOptions) (EmailResponse, error)
SendTemplateEmail ...
func (*Client) UpdateSMSCampaign ¶
func (c *Client) UpdateSMSCampaign(id int, s *SMSCampaign) error
UpdateSMSCampaign ...
type DeleteBouncesRequest ¶
type Email ¶
type Email struct { To map[string]string `json:"to"` Subject string `json:"subject"` From [2]string `json:"from"` HTML string `json:"html"` Text string `json:"text"` CC map[string]string `json:"cc"` Bcc map[string]string `json:"bcc"` ReplyTo map[string]string `json:"replyto"` Attachment map[string]string `json:"attachment"` // must be URL Headers map[string]string `json:"headers"` Inline_image map[string]string `json:"inline_image"` }
API Docs: https://apidocs.sendinblue.com/tutorial-sending-transactional-email/
type EmailOptions ¶
type EmailOptions struct { Cc string // multiple addresses, delimiter = pipe Bcc string // multiple addresses, delimiter = pipe ReplyTo string Attr map[string]string Attachment_url string Attachment map[string]string Headers map[string]string }
func NewEmailOptions ¶
func NewEmailOptions(replyto, attachment_url string, cc, bcc []string) *EmailOptions
func (*EmailOptions) AddAttachment ¶
func (e *EmailOptions) AddAttachment(f *os.File) error
type EmailResponse ¶
type SMSCampaign ¶
type SMSCampaign struct { Name string `json:"name"` // Mandatory Sender string `json:"sender"` Content string `json:"content"` Bat_sent string `json:"bat_sent"` List_ids []int `json:"listid"` // Mandatory if Scheduled_date Exclude_list []int `json:"exclude_list"` Scheduled_date string `json:"scheduled_date"` // Format: YYYY-MM-DD 00:00:00 Send_now int `json:"send_now"` // 0 = campaign not ready to send, 1 = ready to send now }
type SMSCampaignData ¶
type SMSCampaignData struct {
Id int `json:"id"`
}
type SMSCampaignResponse ¶
type SMSCampaignResponse struct { Code string `json:"code"` Message string `json:"message"` Data SMSCampaignData `json:"data"` }
type SMSData ¶
type SMSData struct { Status string `json:"status"` Number_sent int `json:"number_sent"` To string `json:"to"` Sms_count int `json:"sms_count"` Credits_used float64 `json:"credits_used"` Remaining_credit float64 `json:"remaining_credit"` Reference SMSReference `json:"reference"` Description string `json:"description"` Reply string `json:"reply"` Bounce_type string `json:"bounce_type"` Error_code int `json:"error_code"` }
type SMSReference ¶
type SMSReference struct {
One string `json:"1"`
}
type SMSRequest ¶
type SMSRequest struct { To string `json:"to"` // Mobile Number (Mandatory) From string `json:"from"` // No more than 11 alphanumeric characters (Mandatory) Text string `json:"text"` // No more than 160 characters (Mandatory) Web_url string `json:"web_url"` Tag string `json:"tag"` Type string `json:"type"` // "marketing" (default) or "transactional" }
type SMSResponse ¶
type Template ¶
type Template struct { From_name string `json:"from_name"` Template_name string `json:"template_name"` // Mandatory Bat string `json:"bat"` Html_content string `json:"html_content"` // Mandatory (if no html_url) Html_url string `json:"html_url"` // Mandatory (if no html_content) Subject string `json:"subject"` // Mandatory From_email string `json:"from_email"` // Mandatory Reply_to string `json:"reply_to"` To_field string `json:"to_field"` Status int `json:"status"` // 0 (inactive -- default) or 1 (active) Attachment_url string `json:"attachment_url"` }
API Docs: https://apidocs.sendinblue.com/template/
type TemplateData ¶
type TemplateData struct {
ID int `json:"id"`
}
type TemplateEmail ¶
type TemplateEmail struct { To string `json:"to"` // multiple addresses, delimiter = pipe Cc string `json:"cc"` // multiple addresses, delimiter = pipe Bcc string `json:"bcc"` // multiple addresses, delimiter = pipe ReplyTo string `json:"replyto"` Attr map[string]string `json:"attr"` Attachment_url string `json:"attachment_url"` Attachment map[string]string `json:"attachment"` Headers map[string]string `json:"headers"` }
type TemplateList ¶
type TemplateListData ¶
type TemplateListData struct { Campaign_records []CampaignData `json:"campaign_records"` Page int `json:"page"` Page_limit int `json:"page_limit"` Total_campaign_records int `json:"total_campaign_records"` }
type TemplateListResponse ¶
type TemplateListResponse struct { Code string `json:"code"` Message string `json:"message"` Data TemplateListData `json:"data"` }
type TemplateResponse ¶
type TemplateResponse struct { Code string `json:"code"` Message string `json:"message"` Data TemplateData `json:"data"` }