yo

package module
v0.0.0-...-15ce827 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2014 License: MIT Imports: 6 Imported by: 0

README

go-yo

Go bindings for the Yo API. Code structure inspired by the wonderful go-github.

Documentation: http://godoc.org/github.com/zachlatta/go-yo

Build Status: Build Status

Getting Started

$ go get github.com/yo-bindings/go-yo

License

See LICENSE (tl;dr).

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckResponse

func CheckResponse(r *http.Response) error

CheckResponse checks the response for errors. A response is considered an error if it is outside the 200 range.

Types

type Client

type Client struct {
	BaseURL   *url.URL
	UserAgent string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(client *http.Client) *Client

NewClient returns a new Yo API client. If client is nil, then http.DefaultClient is used.

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*http.Response, error)

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string,
	body interface{}) (*http.Request, error)

NewRequest creates a new API request. urlStr can either be an relative or absolute url. If it's relative, the it's resolved to the BaseURL of the Client. If body is provided, then it is encoded as JSON and included in the request body.

func (*Client) NewRequestForm

func (c *Client) NewRequestForm(urlStr string,
	data url.Values) (*http.Request, error)

NewRequestForm creates a new API request that POSTs a form. urlStr can either be a relative or absolute url. If it's relative, then it's resolved to the BaseURL of the Client. data's keys and values are encoded to the request body.

func (*Client) YoAll

func (c *Client) YoAll(apiToken string) (*http.Response, error)

YoAll sends a Yo to all of your subscribers. The API token is issued by Yo for a specific account and is required.

type ErrorResponse

type ErrorResponse struct {
	Response *http.Response
}

ErrorResponse reports one or more errors returned from an API request.

TODO: Acutally report one or more errors instead of just have the response. Can't currently do this because I don't have an API token.

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

Jump to

Keyboard shortcuts

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