Documentation
¶
Index ¶
Constants ¶
View Source
const ( GET = "GET" POST = "POST" DELETE = "DELETE" PUT = "PUT" )
HTTP Methods
View Source
const ( OK = 200 MUTIPLE_CHOICES = 300 BAD_REQUEST = 400 NOT_FOUND = 404 )
Status codes
View Source
const API_KEY_HEADER = "MC-Api-Key"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiClient ¶
type ApiClient interface { Do(request CcaRequest) (*CcaResponse, error) GetApiURL() string GetApiKey() string }
func NewApiClient ¶
func NewInsecureApiClient ¶
type CcaApiClient ¶
type CcaApiClient struct {
// contains filtered or unexported fields
}
func (CcaApiClient) Do ¶
func (ccaClient CcaApiClient) Do(request CcaRequest) (*CcaResponse, error)
Does the API call to server and returns a CCAResponse. Cloud.ca errors will be returned in the CCAResponse body, not in the error return value. The error return value is reserved for unexpected errors.
func (CcaApiClient) GetApiKey ¶
func (ccaClient CcaApiClient) GetApiKey() string
func (CcaApiClient) GetApiURL ¶
func (ccaClient CcaApiClient) GetApiURL() string
type CcaError ¶
type CcaError struct { ErrorCode string `json:"errorCode"` Message string `json:"message"` Context map[string]interface{} `json:"context"` }
An API error
type CcaErrorResponse ¶
type CcaErrorResponse CcaResponse
An Api Response with errors
func (CcaErrorResponse) Error ¶
func (errorResponse CcaErrorResponse) Error() string
type CcaRequest ¶
A request object
type CcaResponse ¶
type CcaResponse struct { TaskId string TaskStatus string StatusCode int Data []byte Errors []CcaError MetaData map[string]interface{} }
An Api Response
func NewCcaResponse ¶
func NewCcaResponse(response *http.Response) (*CcaResponse, error)
func (CcaResponse) IsError ¶
func (ccaResponse CcaResponse) IsError() bool
Returns true if API response has errors
Click to show internal directories.
Click to hide internal directories.