Documentation
¶
Index ¶
Constants ¶
const (
// DefaultBaseURL the default API base URL.
DefaultBaseURL = "https://api.createsend.com/api/v3.2/"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a client to access Campaign Monitor API.
type ClientErrorCode ¶
type ClientErrorCode int
ClientErrorCode client side error codes.
const ( // ErrCodeDataProcessing indicates that processing the input/output data has failed. ErrCodeDataProcessing ClientErrorCode = -1 // ErrCodeNilHTTPClient the provided internal HTTP client is nil. ErrCodeNilHTTPClient ClientErrorCode = -2 // ErrCodeAuthenticationNotSet neither API key nor Oauth token was provided. ErrCodeAuthenticationNotSet ClientErrorCode = -3 // ErrCodeEmptyOAuthToken the provided Oauth token was empty. ErrCodeEmptyOAuthToken ClientErrorCode = -4 // ErrCodeEmptyAPIKey the provided API key was empty. ErrCodeEmptyAPIKey ClientErrorCode = -5 // ErrCodeEmptyURL the requested URL was empty. ErrCodeEmptyURL ClientErrorCode = -6 // ErrCodeInvalidURL the requested UTL was invalid. ErrCodeInvalidURL ClientErrorCode = -7 // ErrCodeInvalidJSON the provided JSON payload was invalid. ErrCodeInvalidJSON ClientErrorCode = -8 // ErrCodeInvalidRequestBody the provided request was invalid. ErrCodeInvalidRequestBody ClientErrorCode = -9 )
func (ClientErrorCode) String ¶
func (c ClientErrorCode) String() string
String returns the string representation of the error code.
type Error ¶
type Error struct { // Code error code. Code int // Message error message. Message string // contains filtered or unexported fields }
Error wraps server side and client side errors.
func (*Error) IsFromServer ¶
IsFromServer returns true if the error reported by the server.
The method will return false if this is a client side error.
type HTTPClient ¶
HTTPClient is an interface for the internal HTTP client.
type Option ¶
type Option func(*Options)
Option represents an optional client configuration function.
func WithAccountsAPI ¶
WithAccountsAPI overrides the internal object for accessing Accounts API.
You can override the API to mock out Accounts API methods altogether.
func WithClientsAPI ¶ added in v0.0.2
WithClientsAPI overrides the internal object for accessing Clients API.
You can override the API to mock out Clients API methods altogether.
func WithContext ¶ added in v0.0.2
WithContext sets the context for all the HTTP requests.
func WithHTTPClient ¶
func WithHTTPClient(client HTTPClient) Option
WithHTTPClient sets the internal HTTP client.
func WithOAuthToken ¶
WithOAuthToken enables Oauth token authentication.