Skip to content

petfinder-com/petfinder-go-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Petfinder.com API Client sdk for Golang

CircleCI Coverage Status Documentation

Uses Petfinder API v2.

Please see example usage in cmd/main.go

Example client usage:

//Pull Client ID key and Client Secret Key from environment variables
clientID := os.Getenv("PF_CLIENT_ID")
clientSecret := os.Getenv("PF_CLIENT_SECRET")

//Create pfclient Object
pfclient, err := pfapi.NewClient(clientID, clientSecret)
if err != nil {
    fmt.Println("Could not create client")
}

//Create variable based on AnimalType struct
var types []pfapi.AnimalType

//Retreive all animal types, put into struct
types, _ = pfclient.GetAllTypes()

//Iterate through animal types using struct data
for _, t := range types {
    fmt.Println("Name: ", t.Name)
    fmt.Println("Colors: ", t.Colors)
    fmt.Println("Self Link: ", t.Links.Self.Href)
}