Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bool ¶
Bool is a helper function that allocates a new bool value to store v and returns a pointer to it.
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range.
Types ¶
type Attachment ¶
type Attachment struct { Name *string `json:"Name,omitempty"` Content *string `json:"Content,omitempty"` ContentType *string `json:"ContentType,omitempty"` ContentID *string `json:"ContentID,omitempty"` }
func (*Attachment) MarshalJSON ¶
func (a *Attachment) MarshalJSON() ([]byte, error)
func (*Attachment) UnmarshalJSON ¶
func (a *Attachment) UnmarshalJSON(b []byte) error
type Client ¶
type Client struct { // BaseURL for the Postmark API. BaseURL *url.URL // Secret tokens used for authenticating with the Postmark API. ServerToken string AccountToken string // Services used for talking to different parts of the Postmark API. Email *EmailService // contains filtered or unexported fields }
A Client manages communication with the Postmark API.
func NewClient ¶
NewClient returns a new Postmark API client. If httpClient is nil, http.DefaultClient will be used.
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred.
func (*Client) NewRequest ¶
NewRequest creates an API request. A relative URL can be provided in path, in which case it is resolved relative to the BaseURL of the client. Relative URLs should always be specified without the preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body
type Email ¶
type Email struct { From *string `json:"From,omitempty"` To *string `json:"To,omitempty"` Cc *string `json:"Cc,omitempty"` Bcc *string `json:"Bcc,omitempty"` Subject *string `json:"Subject,omitempty"` Tag *string `json:"Tag,omitempty"` HTMLBody *string `json:"HtmlBody,omitempty"` TextBody *string `json:"TextBody,omitempty"` ReplyTo *string `json:"ReplyTo,omitempty"` Headers []Header `json:"Headers,omitempty"` TrackOpens *bool `json:"TrackOpens,omitempty"` Attachments []Attachment `json:"Attachments,omitempty"` }
type EmailService ¶
type EmailService struct {
// contains filtered or unexported fields
}
EmailService handles communication with the Email related methods of the Postmark API.
func (*EmailService) Send ¶
func (s *EmailService) Send(email *Email) (*EmailResult, *http.Response, error)
func (*EmailService) SendBatch ¶
func (s *EmailService) SendBatch(emails []Email) ([]EmailResult, *http.Response, error)
type ErrorResponse ¶
type ErrorResponse struct { Response *http.Response ErrorCode int `json:"ErrorCode"` Message string `json:"Message"` }
An ErrorResponse reports an error caused by an API request.
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string