Documentation ¶
Index ¶
Constants ¶
View Source
const ( // HeaderKeyAccept is key for Accept HeaderKeyAccept = "Accept" // HeaderKeyContentType is key for Content-Type HeaderKeyContentType = "Content-Type" // HeaderValContentTypeJSON is key for application/json HeaderValContentTypeJSON = "application/json" )
Variables ¶
This section is empty.
Functions ¶
func WriteIndented ¶
WriteIndented indents all lines four spaces.
Types ¶
type Client ¶
type Client interface { // Do sends an HTTP request to the API. Do( ctx context.Context, method, path string, body, resp interface{}) error // DoWithHeaders sends an HTTP request to the API. DoWithHeaders( ctx context.Context, method, path string, headers map[string]string, body, resp interface{}) error // DoandGetREsponseBody sends an HTTP reqeust to the API and returns // the raw response body DoAndGetResponseBody( ctx context.Context, method, path string, headers map[string]string, body interface{}) (*http.Response, error) // DoandGetResponseBodyAuthorized sends an HTTP reqeust to the API and returns // the raw response body [Already available auth token is getting used] DoAndGetResponseBodyAuthorized( ctx context.Context, method, path string, headers map[string]string, body interface{}) (*http.Response, error) // Get sends an HTTP request using the GET method to the API. Get( ctx context.Context, path string, headers map[string]string, resp interface{}) error // Post sends an HTTP request using the POST method to the API. Post( ctx context.Context, path string, headers map[string]string, body, resp interface{}) error // Put sends an HTTP request using the PUT method to the API. Put( ctx context.Context, path string, headers map[string]string, body, resp interface{}) error // Delete sends an HTTP request using the DELETE method to the API. Delete( ctx context.Context, path string, headers map[string]string, resp interface{}) error // SetToken sets the Auth token for the HTTP client SetToken(token string) // GetToken gets the Auth token for the HTTP client GetToken() string // ParseJSONError parses the JSON in r into an error object ParseJSONError(r *http.Response) error }
Client is an API client.
type ClientOptions ¶
type ClientOptions struct { // Insecure is a flag that indicates whether or not to supress SSL errors. Insecure bool // UseCerts is a flag that indicates whether system certs should be loaded UseCerts bool // Timeout specifies a time limit for requests made by this client. Timeout time.Duration // ShowHTTP is a flag that indicates whether or not HTTP requests and // responses should be logged to stdout ShowHTTP bool }
ClientOptions are options for the API client.
Click to show internal directories.
Click to hide internal directories.