Documentation ¶
Index ¶
- func CheckResponse(r *http.Response) error
- type AuthTransport
- type Bounce
- type BounceActivated
- type BounceDeliveryStats
- type BounceDump
- type BounceService
- func (s *BounceService) ActivateBounce(bounceID int64) (*BounceActivated, *Response, error)
- func (s *BounceService) GetBounceDump(bounceID int64) (*BounceDump, *Response, error)
- func (s *BounceService) GetBounceTags() ([]string, *Response, error)
- func (s *BounceService) GetBounces(bounceCount, bounceOffset int, parameters map[string]interface{}) (*Bounces, *Response, error)
- func (s *BounceService) GetDeliveryStats() (*BounceDeliveryStats, *Response, error)
- func (s *BounceService) GetSingleBounce(bounceID int64) (*Bounce, *Response, error)
- type BounceType
- type Bounces
- type Client
- type Email
- type EmailAttachment
- type EmailHeader
- type EmailResponse
- type EmailService
- type ErrorResponse
- type Option
- type Options
- type Response
- type Template
- type TemplateOverview
- type TemplateService
- type Templates
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors. A response is considered an error if it has a status code outside the 200 range. API error responses map to ErrorResponse.
Types ¶
type AuthTransport ¶
type AuthTransport struct { Transport http.RoundTripper Token string }
AuthTransport holds a authentication information for Postmark API.
type Bounce ¶ added in v0.1.3
type Bounce struct { ID int64 Type string TypeCode int64 Name string Tag string MessageID string Description string Details string Email string BouncedAt time.Time DumpAvailable bool Inactive bool CanActivate bool Subject string }
Bounce represents a BounceType in further detail.
type BounceActivated ¶ added in v0.1.4
BounceActivated represents a bounce that has been reactivated.
type BounceDeliveryStats ¶ added in v0.1.2
type BounceDeliveryStats struct { InactiveMails int64 Bounces []BounceType }
BounceDeliveryStats represents a collection of bounce stats.
type BounceDump ¶ added in v0.1.4
type BounceDump struct {
Body string
}
BounceDump represents a the raw source of bounce.
type BounceService ¶ added in v0.1.2
type BounceService service
BounceService handles communication with the bounce related methods of the Postmark API (http://developer.postmarkapp.com/developer-api-bounce.html)
func (*BounceService) ActivateBounce ¶ added in v0.1.4
func (s *BounceService) ActivateBounce(bounceID int64) (*BounceActivated, *Response, error)
ActivateBounce will attempt to reactivate this email via bounce ID.
func (*BounceService) GetBounceDump ¶ added in v0.1.4
func (s *BounceService) GetBounceDump(bounceID int64) (*BounceDump, *Response, error)
GetBounceDump will return a single bounce dump by ID.
func (*BounceService) GetBounceTags ¶ added in v0.1.4
func (s *BounceService) GetBounceTags() ([]string, *Response, error)
GetBounceTags will return a slice of tag values that have generated bounces.
func (*BounceService) GetBounces ¶ added in v0.1.3
func (s *BounceService) GetBounces(bounceCount, bounceOffset int, parameters map[string]interface{}) (*Bounces, *Response, error)
GetBounces will return all bounces.
func (*BounceService) GetDeliveryStats ¶ added in v0.1.2
func (s *BounceService) GetDeliveryStats() (*BounceDeliveryStats, *Response, error)
GetDeliveryStats will return all delivery stats aggregated by bounce type.
func (*BounceService) GetSingleBounce ¶ added in v0.1.4
func (s *BounceService) GetSingleBounce(bounceID int64) (*Bounce, *Response, error)
GetSingleBounce will return a single bounce by ID.
type BounceType ¶ added in v0.1.2
BounceType represents the type of bounce with a count.
type Client ¶
type Client struct { Token string UserAgent string BackendURL *url.URL // Services used for communicating with the API. Email *EmailService Bounce *BounceService Template *TemplateService // contains filtered or unexported fields }
Client holds a connection to the Postmark API.
func NewClient ¶
NewClient creates a new Client with the appropriate connection details and services used for communicating with the API.
type Email ¶
type Email struct { From string `json:",omitempty"` To string `json:",omitempty"` Cc string `json:",omitempty"` Bcc string `json:",omitempty"` Subject string `json:",omitempty"` Tag string `json:",omitempty"` TemplateID int `json:",omitempty"` TemplateModel map[string]interface{} `json:",omitempty"` HTMLBody string `json:",omitempty"` TextBody string `json:",omitempty"` ReplyTo string `json:",omitempty"` Headers []EmailHeader `json:",omitempty"` Attachments []EmailAttachment `json:",omitempty"` TrackOpens bool `json:",omitempty"` MessageStream string `json:",omitempty"` Metadata map[string]string `json:",omitempty"` }
Email is the set of parameters that can be used when sending an email.
type EmailAttachment ¶ added in v0.1.1
EmailAttachment represents the values for an email attachment.
type EmailHeader ¶
EmailHeader represents the values for an email header.
type EmailResponse ¶
EmailResponse is the set of parameters that is used in response to a send request
type EmailService ¶
type EmailService service
EmailService handles communication with the email related methods of the Postmark API (http://developer.postmarkapp.com/developer-api-email.html)
func (*EmailService) Send ¶
func (s *EmailService) Send(emailRequest *Email) (*EmailResponse, *Response, error)
Send will build and execute request to send an email via the API.
func (*EmailService) SendBatch ¶
func (s *EmailService) SendBatch(emailRequests []*Email) ([]*EmailResponse, *Response, error)
SendBatch will build and execute request to send batch emails via the API.
type ErrorResponse ¶
An ErrorResponse reports the error caused by an API request
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type Option ¶ added in v1.0.0
type Option func(o *Options)
Option to set an optional client value.
func WithBackendURL ¶ added in v1.0.0
WithBackendURL allows you to set a custom backend URL.
func WithClient ¶ added in v1.0.0
WithClient allows you to set a custom http client.
func WithUserAgent ¶ added in v1.0.0
WithUserAgent allows you to set a custom user agent.
type Options ¶ added in v1.0.0
Options for our client.
func NewOptions ¶ added in v1.0.0
NewOptions returns a new Options with defaults and supplied overrides.
type Response ¶
Response is a Postmark response. This wraps the standard http.Response returned from the Postmark API.
type Template ¶ added in v0.1.4
type Template struct { TemplateId int64 Name string Subject string HtmlBody string TextBody string AssociatedServerId int64 Active bool }
Template represents a templates in further detail.
type TemplateOverview ¶ added in v0.1.4
TemplateOverview represents overview/identifying information about a template.
type TemplateService ¶ added in v0.1.4
type TemplateService service
TemplateService handles communication with the template related methods of the Postmark API (https://postmarkapp.com/developer/api/templates-api)
func (*TemplateService) GetSingleTemplate ¶ added in v0.1.4
func (s *TemplateService) GetSingleTemplate(templateID int64) (*Template, *Response, error)
GetSingleTemplate will return a single template by ID.
func (*TemplateService) GetTemplates ¶ added in v0.1.4
func (s *TemplateService) GetTemplates(count, offset int) (*Templates, *Response, error)
GetTemplates will return all templates.
type Templates ¶ added in v0.1.4
type Templates struct { TotalCount int64 Templates []TemplateOverview }
Templates represents a slice of templates and a given count.