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 HciRequest) (*HciResponse, error) GetApiURL() string GetApiKey() string }
func NewApiClient ¶
func NewInsecureApiClient ¶
type HciApiClient ¶
type HciApiClient struct {
// contains filtered or unexported fields
}
func (HciApiClient) Do ¶
func (hciClient HciApiClient) Do(request HciRequest) (*HciResponse, error)
Does the API call to server and returns a HCIResponse. hci errors will be returned in the HCIResponse body, not in the error return value. The error return value is reserved for unexpected errors.
func (HciApiClient) GetApiKey ¶
func (hciClient HciApiClient) GetApiKey() string
func (HciApiClient) GetApiURL ¶
func (hciClient HciApiClient) GetApiURL() string
type HciError ¶
type HciError struct { ErrorCode string `json:"errorCode"` Message string `json:"message"` Context map[string]interface{} `json:"context"` }
An API error
type HciErrorResponse ¶
type HciErrorResponse HciResponse
An Api Response with errors
func (HciErrorResponse) Error ¶
func (errorResponse HciErrorResponse) Error() string
type HciRequest ¶
A request object
type HciResponse ¶
type HciResponse struct { TaskId string TaskStatus string StatusCode int Data []byte Errors []HciError MetaData map[string]interface{} }
An Api Response
func NewHciResponse ¶
func NewHciResponse(response *http.Response) (*HciResponse, error)
func (HciResponse) IsError ¶
func (hciResponse HciResponse) IsError() bool
Returns true if API response has errors
Click to show internal directories.
Click to hide internal directories.