client

package
v0.0.0-...-a8d0bc3 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2016 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*napping.Session
	*ClientOptions
}

func NewClient

func NewClient(opts ClientOptions) *Client

func (*Client) AuthFork

func (c *Client) AuthFork(username, password string) *Client

AuthFork is a shorthand of Fork, when you simply want to change the auth

func (*Client) Delete

func (c *Client) Delete(url string, result interface{}) (*napping.Response, error)

func (*Client) Fork

func (c *Client) Fork(opts ClientOptions) *Client

Fork creates a new client off of the base client however it shares the same http.Client for efficiency reasons this prevents socket leaks from happening etc ...

func (*Client) Get

func (c *Client) Get(url string, params *url.Values, result interface{}) (*napping.Response, error)

func (*Client) Head

func (c *Client) Head(url string, result interface{}) (*napping.Response, error)

func (*Client) Options

func (c *Client) Options(url string, result interface{}) (*napping.Response, error)

func (*Client) Patch

func (c *Client) Patch(url string, payload, result interface{}) (*napping.Response, error)

func (*Client) Post

func (c *Client) Post(url string, payload, result interface{}) (*napping.Response, error)

func (*Client) Put

func (c *Client) Put(url string, payload, result interface{}) (*napping.Response, error)

func (*Client) Url

func (c *Client) Url(urlpath string) string

Url returns the full http url including host

type ClientOptions

type ClientOptions struct {
	// Hostname of gitbookio endpoint
	Host string

	// Auth info
	Username string
	Password string
}

type Error

type Error struct {
	Msg  string `json:"error"`
	Code int    `json:"code"`
}

func DecodeError

func DecodeError(reader io.Reader) (*Error, error)

func (*Error) Error

func (e *Error) Error() string

Jump to

Keyboard shortcuts

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