# Pets ## Create `client.Pets.New(ctx, body) (*Pet, error)` **post** `/pets` Add a new pet to the store. ### Parameters - `body PetNewParams` - `Pet param.Field[Pet]` ### Returns - `type Pet struct{…}` - `Name string` - `PhotoURLs []string` - `ID int64` - `Category Category` - `ID int64` - `Name string` - `Status PetStatus` pet status in the store - `const PetStatusAvailable PetStatus = "available"` - `const PetStatusPending PetStatus = "pending"` - `const PetStatusSold PetStatus = "sold"` - `Tags []Tag` - `ID int64` - `Name string` ### Example ```go package main import ( "context" "fmt" "github.com/pedro/barkend" "github.com/pedro/barkend/option" ) func main() { client := barkend.NewClient( option.WithBearerToken("My Bearer Token"), ) pet, err := client.Pets.New(context.TODO(), barkend.PetNewParams{ Pet: barkend.PetParam{ Name: "doggie", PhotoURLs: []string{"string"}, }, }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", pet.ID) } ``` ## List `client.Pets.List(ctx) (*[]Pet, error)` **get** `/pets` List all pets. ### Returns - `type PetListResponse []Pet` - `Name string` - `PhotoURLs []string` - `ID int64` - `Category Category` - `ID int64` - `Name string` - `Status PetStatus` pet status in the store - `const PetStatusAvailable PetStatus = "available"` - `const PetStatusPending PetStatus = "pending"` - `const PetStatusSold PetStatus = "sold"` - `Tags []Tag` - `ID int64` - `Name string` ### Example ```go package main import ( "context" "fmt" "github.com/pedro/barkend" "github.com/pedro/barkend/option" ) func main() { client := barkend.NewClient( option.WithBearerToken("My Bearer Token"), ) pets, err := client.Pets.List(context.TODO()) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", pets) } ``` ## Retrieve `client.Pets.Get(ctx, petID) (*Pet, error)` **get** `/pets/{petId}` Find pet by ID. ### Parameters - `petID int64` ### Returns - `type Pet struct{…}` - `Name string` - `PhotoURLs []string` - `ID int64` - `Category Category` - `ID int64` - `Name string` - `Status PetStatus` pet status in the store - `const PetStatusAvailable PetStatus = "available"` - `const PetStatusPending PetStatus = "pending"` - `const PetStatusSold PetStatus = "sold"` - `Tags []Tag` - `ID int64` - `Name string` ### Example ```go package main import ( "context" "fmt" "github.com/pedro/barkend" "github.com/pedro/barkend/option" ) func main() { client := barkend.NewClient( option.WithBearerToken("My Bearer Token"), ) pet, err := client.Pets.Get(context.TODO(), 0) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", pet.ID) } ``` ## Delete `client.Pets.Delete(ctx, petID) error` **delete** `/pets/{petId}` Deletes a pet. ### Parameters - `petID int64` ### Example ```go package main import ( "context" "github.com/pedro/barkend" "github.com/pedro/barkend/option" ) func main() { client := barkend.NewClient( option.WithBearerToken("My Bearer Token"), ) err := client.Pets.Delete(context.TODO(), 0) if err != nil { panic(err.Error()) } } ``` ## Domain Types ### Category - `type Category struct{…}` - `ID int64` - `Name string` ### Error - `type Error struct{…}` - `ID string` Machine-readable error code - `Message string` Human-readable error message ### Error Response - `type ErrorResponse struct{…}` - `Error Error` - `ID string` Machine-readable error code - `Message string` Human-readable error message ### Pet - `type Pet struct{…}` - `Name string` - `PhotoURLs []string` - `ID int64` - `Category Category` - `ID int64` - `Name string` - `Status PetStatus` pet status in the store - `const PetStatusAvailable PetStatus = "available"` - `const PetStatusPending PetStatus = "pending"` - `const PetStatusSold PetStatus = "sold"` - `Tags []Tag` - `ID int64` - `Name string` ### Tag - `type Tag struct{…}` - `ID int64` - `Name string`