Documentation
¶
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) Authenticate() error
- func (c *Client) CreateProfile(profile *CreateSendingProfile) (SendingProfile, error)
- func (c *Client) GetAllProfiles() ([]SendingProfile, error)
- func (c *Client) GetProfileByID(id string) (SendingProfile, error)
- func (c *Client) GetProfileByName(name string) (SendingProfile, error)
- func (c *Client) SendBasic(message SendBasicMessage) (SendBasicDetailedResponse, error)
- type CreateSendingProfile
- type Credentials
- type DomainRecords
- type HTTP
- func (h *HTTP) BuildEndpointWithQueryParameters(endpoint string, parameters map[string]string) (string, error)
- func (h *HTTP) Delete(endpoint string, headers map[string]string) ([]byte, int, error)
- func (h *HTTP) Get(endpoint string, headers map[string]string) ([]byte, int, error)
- func (h *HTTP) Post(endpoint string, payload []byte, headers map[string]string) ([]byte, int, error)
- func (h *HTTP) PostWithBasicAuth(endpoint string, credentials Credentials, payload []byte, ...) ([]byte, int, error)
- func (h *HTTP) Put(endpoint string, payload []byte, headers map[string]string) ([]byte, int, error)
- type OauthTokenResponse
- type RefreshTokenRequest
- type SendBasicDetailedResponse
- type SendBasicMessage
- type SendingProfile
- type SendingProfileSetup
Constants ¶
const ( HeaderAuthorization = "Authorization" HeaderContentType = "Content-Type" HeaderUserAgent = "User-Agent" )
Headers
const (
ContentTypeJson string = "application/json"
)
ContentType
Variables ¶
var ( // ErrInvalidCredentials is return when the api key & secret are invalid ErrInvalidCredentials = errors.New("api key OR secret is invalid") // ErrResourceNotFound is return when the resource is not found ErrResourceNotFound = errors.New("resource not found") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client -
func (*Client) Authenticate ¶
func (*Client) CreateProfile ¶
func (c *Client) CreateProfile(profile *CreateSendingProfile) (SendingProfile, error)
CreateProfile creates a profile
func (*Client) GetAllProfiles ¶
func (c *Client) GetAllProfiles() ([]SendingProfile, error)
GetAllProfiles retrieves all email sending profiles
func (*Client) GetProfileByID ¶
func (c *Client) GetProfileByID(id string) (SendingProfile, error)
GetProfileByID retrieves an email sending profile by ID
func (*Client) GetProfileByName ¶
func (c *Client) GetProfileByName(name string) (SendingProfile, error)
GetProfileByName retrieves an email sending profile by name
func (*Client) SendBasic ¶
func (c *Client) SendBasic(message SendBasicMessage) (SendBasicDetailedResponse, error)
SendBasic sends a transactional email
type CreateSendingProfile ¶
type CreateSendingProfile struct {
ProfileName string `json:"profile_name"`
SendingDomain string `json:"sending_domain"`
LinkDomain string `json:"link_domain"`
LinkDomainDefaultRedirect string `json:"link_domain_default_redirect"`
BounceDomain string `json:"bounce_domain"`
}
CreateSendingProfile represents the request payload to create a sending profile.
type Credentials ¶
type DomainRecords ¶
type DomainRecords struct {
Name string `json:"name"`
Type string `json:"type"`
Value string `json:"value"`
ValidationState string `json:"validation_state"`
}
DomainRecords is the DKIM records for a domain
type HTTP ¶
type HTTP struct {
// contains filtered or unexported fields
}
HTTP struct
func (*HTTP) BuildEndpointWithQueryParameters ¶
func (h *HTTP) BuildEndpointWithQueryParameters(endpoint string, parameters map[string]string) (string, error)
BuildEndpointWithQueryParameters add parameters to endpoint URL
func (*HTTP) Post ¶
func (h *HTTP) Post(endpoint string, payload []byte, headers map[string]string) ([]byte, int, error)
Post http call
type OauthTokenResponse ¶
type OauthTokenResponse struct {
TokenType string `json:"token_type"`
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
ExpiresIn int `json:"expires_in"`
Scope []string `json:"scope"`
}
OauthTokenResponse -
type RefreshTokenRequest ¶
type RefreshTokenRequest struct {
RefreshToken string `json:"refresh_token"`
}
RefreshTokenRequest is contains a RefreshToken used to revoke a RefreshToken OR refresh an AccessToken
type SendBasicDetailedResponse ¶
type SendBasicDetailedResponse struct {
SendID string `json:"send_id"`
SendKey string `json:"send_key"`
SendingProfileID string `json:"sending_profile_id"`
FromEmailAddress string `json:"from_email_address"`
FromName string `json:"from_name"`
RecipientEmailAddress string `json:"recipient_email_address"`
RecipientName string `json:"recipient_name"`
Subject string `json:"subject"`
OpenTracking bool `json:"open_tracking"`
ClickTracking bool `json:"click_tracking"`
Tags []string `json:"tags"`
State string `json:"state"`
StateCategory string `json:"state_category"`
Error string `json:"error,omitempty"`
CreatedAtUtc int64 `json:"created_at_utc"`
ModifiedAtUtc int64 `json:"modified_at_utc"`
}
SendBasicDetailedResponse after a message has been accepted
type SendBasicMessage ¶
type SendBasicMessage struct {
RecipientEmailAddress string `json:"recipient_email_address"`
RecipientName string `json:"recipient_name"`
FromEmailAddress string `json:"from_email_address"`
FromName string `json:"from_name"`
ReplyTo string `json:"reply_to"`
Subject string `json:"subject"`
ContentHTML string `json:"content_html"`
ContentText string `json:"content_text"`
OpenTracking bool `json:"open_tracking"`
ClickTracking bool `json:"click_tracking"`
Tags []string `json:"tags"`
}
SendBasicMessage is used to send an email
type SendingProfile ¶
type SendingProfile struct {
SendingProfileID string `json:"profile_id"`
ProfileName string `json:"profile_name"`
SendingDomain string `json:"sending_domain"`
LinkDomain string `json:"link_domain"`
LinkDomainDefaultRedirect string `json:"link_domain_default_redirect"`
BounceDomain string `json:"bounce_domain"`
State string `json:"state"`
CreatedAtUtc int64 `json:"created_at_utc"`
ModifiedAtUtc int64 `json:"modified_at_utc"`
}
SendingProfile is return when doing a lookup
type SendingProfileSetup ¶
type SendingProfileSetup struct {
SendingProfileID string `json:"profile_id"`
ProfileName string `json:"profile_name"`
Records []DomainRecords `json:"dns_records"`
State string `json:"state"`
CreatedAtUtc int64 `json:"created_at_utc"`
ModifiedAtUtc int64 `json:"modified_at_utc"`
}
SendingProfileSetup is return when doing a lookup