api

package
v0.0.0-...-56e218b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2018 License: MIT Imports: 12 Imported by: 2

Documentation

Overview

api provides common functionality for all the iron.io APIs

Index

Constants

This section is empty.

Variables

View Source
var HTTPErrorDescriptions = map[int]string{
	http.StatusUnauthorized:     "The OAuth token is either not provided or invalid",
	http.StatusNotFound:         "The resource, project, or endpoint being requested doesn't exist.",
	http.StatusMethodNotAllowed: "This endpoint doesn't support that particular verb",
	http.StatusNotAcceptable:    "Required fields are missing",
}
View Source
var (

	// HttpClient is the client used by iron_go to make each http request. It is exported in case
	// the client would like to modify it from the default behavior from http.DefaultClient.
	HttpClient = &http.Client{}
)
View Source
var MaxRequestRetries = 5

Functions

func DumpRequest

func DumpRequest(req *http.Request)

func DumpResponse

func DumpResponse(response *http.Response)

Types

type HTTPResponseError

type HTTPResponseError interface {
	Error() string
	Response() *http.Response
}

func ResponseAsError

func ResponseAsError(response *http.Response) HTTPResponseError

type URL

type URL struct {
	URL      url.URL
	Settings config.Settings
}

func Action

func Action(cs config.Settings, prefix string, suffix ...string) *URL

func ActionEndpoint

func ActionEndpoint(cs config.Settings, endpoint string) *URL

func VersionAction

func VersionAction(cs config.Settings) *URL

func (*URL) QueryAdd

func (u *URL) QueryAdd(key string, format string, value interface{}) *URL

func (*URL) Req

func (u *URL) Req(method string, in, out interface{}) (err error)

func (*URL) Request

func (u *URL) Request(method string, body io.Reader) (response *http.Response, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL