Documentation ¶
Index ¶
- Constants
- type Address
- type AdoptionPolicy
- type Animal
- type AnimalLinks
- type AnimalResponse
- type AnimalType
- type Attribute
- type Breeds
- type Client
- func (c Client) GetAllTypes() ([]AnimalType, error)
- func (c Client) GetAnimalById(animalID string) (Animal, error)
- func (c Client) GetAnimals(params SearchParams) (AnimalResponse, error)
- func (c Client) GetOrganizations() (OrganizationResponse, error)
- func (c Client) GetOrganizationsByID(organizationID string) (Organization, error)
- func (c Client) GetType(reqType string) (AnimalType, error)
- type Colors
- type Contact
- type Environment
- type Hours
- type Link
- type Organization
- type OrganizationLinks
- type OrganizationResponse
- type Pagination
- type PaginationLinks
- type Photo
- type SearchParams
- type SocialMedia
- type TypeLinks
Constants ¶
const DefaultBaseURL = "https://api.petfinder.com/v2"
DefaultBaseURL contains url for petfinder API
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdoptionPolicy ¶
type Animal ¶
type Animal struct { ID int OrganizationID string `mapstructure:"organization_id"` URL string Type string Species string Breeds Breeds Colors Colors Age string Gender string Size string Coat string Name string Description string Photos []Photo Status string Attributes Attribute Environment Environment Tags []string Contact Contact }
type AnimalLinks ¶
type AnimalResponse ¶
type AnimalResponse struct { Animals []Animal Pagination Pagination }
type AnimalType ¶
type Client ¶
Client struct is used to hold http.Client
func NewClient ¶
NewClient accepts client id and secret client id issued by Petfinder It returns a struct callled Client that contains a pointer to http.Client
func (Client) GetAllTypes ¶
func (c Client) GetAllTypes() ([]AnimalType, error)
GetAllTypes function is a method of Client It returns a struct of animals types and error
func (Client) GetAnimalById ¶
GetAnimal takes a string of the type id (1234134) and returns an Animal struct and error.
func (Client) GetAnimals ¶
func (c Client) GetAnimals(params SearchParams) (AnimalResponse, error)
GetAnimals takes a key,value pair for query string parameters It returns a hash of animals or error
func (Client) GetOrganizations ¶
func (c Client) GetOrganizations() (OrganizationResponse, error)
GetOrganizations takes a key,value pair for query string parameters It returns a hash of organizations or error
func (Client) GetOrganizationsByID ¶
func (c Client) GetOrganizationsByID(organizationID string) (Organization, error)
GetOrganizationsByID takes a string ID It returns a hash of organizations or error
type Environment ¶
type Organization ¶
type Organization struct { ID string Name string Email string Phone string Address Address Hours Hours URL string WebSite string MissionStatement string AdoptionPolicy AdoptionPolicy SocialMedia SocialMedia `mapstructure:"social_media"` Photos []Photo Links OrganizationLinks `mapstructure:"_links"` }
type OrganizationLinks ¶
type OrganizationResponse ¶
type OrganizationResponse struct { Organizations []Organization Pagination Pagination }
type Pagination ¶
type Pagination struct { CountPerPage int `mapstructure:"count_per_page"` TotalCount int `mapstructure:"total_count"` CurrentPage int `mapstructure:"current_page"` TotalPages int `mapstructure:"total_pages"` Links PaginationLinks `mapstructure:"_links"` }
type PaginationLinks ¶
type PaginationLinks struct {
Next Link
}
type SearchParams ¶
func NewPetSearchParams ¶
func NewPetSearchParams() SearchParams
func (SearchParams) AddParam ¶
func (p SearchParams) AddParam(key string, value string)
func (SearchParams) CreateQueryString ¶
func (p SearchParams) CreateQueryString() string