Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FloatToString ¶
FloatToString converts a float64 number to string
Types ¶
type Client ¶
type Client struct { // Base URL for requests BaseURL *url.URL // Services HealthCheck HealthCheckService StopsNearMe StopService // contains filtered or unexported fields }
Client manages the communication with the API Modeled after https://github.com/digitalocean/godo/blob/master/godo.go
func (*Client) Do ¶
Do actually sends the API request. It calculates the signature using the request url, appends it to the request and returns the API response. The API response is JSON decoded and stored as "v" or returns an error. If "v" implements the io.Writer interface, the raw response is written to it, instead of decoding
func (*Client) GenerateSignature ¶
GenerateSignature returns the HMAC-SHA1 of the complete request string
func (*Client) NewRequest ¶
NewRequest creates an API request. A relative URL can be provided in urlStr, which will be resolved to the BaseURL of the Client. Relative URLS should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included in as the request body.
type HealthCheck ¶
type HealthCheck struct { SecurityTokenOK bool `json:"securityTokenOK,omitempty"` ClientClockOK bool `json:"clientClockOK,omitempty"` MemcacheOK bool `json:"memcacheOK,omitempty"` DatabaseOK bool `json:"databaseOK,omitempty"` }
HealthCheck response
type HealthCheckService ¶
type HealthCheckService interface {
Get() (*HealthCheck, *http.Response, error)
}
HealthCheckService interfaces with the /healthcheck endpoint
type HealthCheckServiceOp ¶
type HealthCheckServiceOp struct {
// contains filtered or unexported fields
}
HealthCheckServiceOp handles communication
func (*HealthCheckServiceOp) Get ¶
func (s *HealthCheckServiceOp) Get() (*HealthCheck, *http.Response, error)
Get healthcheck info
type NearmeResponse ¶
NearmeResponse represents the result from the API
type RequestCompletedCallback ¶
RequestCompletedCallback defines the type of request callback function
type Stop ¶
type Stop struct { Distance float64 `json:"distance"` Suburb string `json:"suburb"` TransportType string `json:"transport_type"` RouteType RouteType `json:"route_type"` StopID int `json:"stop_id"` LocationName string `json:"location_name"` Latitude float64 `json:"lat"` Longitude float64 `json:"lon"` }
Stop represents a single transport stop
type StopService ¶
type StopService interface {
Get(lat, lon float64) (NearmeResponse, *http.Response, error)
}
StopService interfaces with the /nearme endpoint
type StopServiceOp ¶
type StopServiceOp struct {
// contains filtered or unexported fields
}
StopServiceOp handles communication
func (*StopServiceOp) Get ¶
func (s *StopServiceOp) Get(lat, lon float64) (NearmeResponse, *http.Response, error)
Get stops nearme