Documentation ¶
Overview ¶
Package client contains a generic JSON API client for cockpit, cloud and jarvis
Index ¶
- Variables
- type Client
- func (c *Client) Do(ctx context.Context, req *http.Request) (*http.Response, error)
- func (c *Client) DoJSON(ctx context.Context, req *http.Request, v interface{}) error
- func (c *Client) GetJSON(ctx context.Context, url fmt.Stringer, v interface{}) error
- func (c *Client) URL(path string, values url.Values) (*url.URL, error)
- type ErrRequest
- type UnixTime
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("resource not found (HTTP 404)")
ErrNotFound error for HTTP 404 responses
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Endpoint string // Endpoint URL Language string // You can specify a locale (en|de) Retries int // using exponential backoff *http.Client // http client used for doing the requests }
Client implements a generic client for cockpit, cloud and jarvis
func (*Client) DoJSON ¶
DoJSON executes a request and decodes its response it into the given value v
type ErrRequest ¶
type ErrRequest struct { ErrorDetail struct { Type string `json:"type"` Codes []struct { Param string `json:"param"` CodeID string `json:"code_id"` } `json:"codes"` } `json:"error"` }
ErrRequest contains error details
type UnixTime ¶
UnixTime for json int values that represent a unix timestamp
func (UnixTime) MarshalJSON ¶
MarshalJSON is generated so TripStatus satisfies json.Marshaler.
func (*UnixTime) UnmarshalJSON ¶
UnmarshalJSON is generated so TripStatus satisfies json.Unmarshaler.
Click to show internal directories.
Click to hide internal directories.