petfinder

package module
v0.0.0-...-9e67375 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2013 License: ISC Imports: 7 Imported by: 0

README

go-petfinder provides a go interface to petfinder.com's REST API

http://godoc.org/github.com/tmc/go-petfinder

Status: Partially implemented (patches welcome!)

License: ISC

Example:

⚛ ~$ go get github.com/tmc/go-petfinder/examples/listbreeds
⚛ ~$ listbreeds -key="da544897134f1053173e6f906421ae9e" -animal="pig"
Breed: Pig (Farm)
Breed: Pot Bellied
Breed: Vietnamese Pot Bellied

Documentation

Overview

Package petfinder provides an interface to the petfinder.com REST API

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingAPIKey is returned if there is an attempt to create an api instance without a key
	ErrMissingAPIKey = errors.New("Missing API Key")
)

Functions

This section is empty.

Types

type API

type API struct {
	BaseURL string
	// contains filtered or unexported fields
}

func NewAPI

func NewAPI(key, secret string) (*API, error)

NewAPI creates a new API object from an API key and secret key

Note: secret is ignored for now

func (*API) Breeds

func (a *API) Breeds(animalName string) ([]Breed, error)

Breeds fetches the available breeds for an animal

func (*API) RandomPets

func (a *API) RandomPets() ([]Pet, error)

RandomPet fetches a list of random Pets

type Animal

type Animal string

type Breed

type Breed string

Breed is a petfinder Breed

type Pet

type Pet struct {
	ID      int
	Age     string
	Animal  Animal
	Breeds  []Breed
	Contact struct {
		Email                                string
		Address1, Address2, City, State, Zip string
		Fax, Phone                           string
	}
	Description string
	LastUpdate  string // TODO: make time.Time
	Media       struct {
		Photos []struct {
			ID   string
			T    string
			Size string
		}
	}
	Mix          string
	Name         string
	Options      string
	Sex          string
	ShelterId    int
	ShelterPetId int
	Size         string
	Status       string
}

func (Pet) String

func (p Pet) String() string

Directories

Path Synopsis
examples
listbreeds
program listbreeds lists animal breeds with the petfinder API
program listbreeds lists animal breeds with the petfinder API
randompets
program listpets lists random pets from the petfinder API
program listpets lists random pets from the petfinder API

Jump to

Keyboard shortcuts

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