Skip to content
Get started

Find pet by ID.

client.Pets.Get(ctx, petID) (*Pet, error)
GET/pets/{petId}

Find pet by ID.

ParametersExpand Collapse
petID int64
formatint64
ReturnsExpand Collapse
type Pet struct{…}
Name string
PhotoURLs []string
ID int64optional
formatint64
Category Categoryoptional
ID int64optional
formatint64
Name stringoptional
Status PetStatusoptional

pet status in the store

Accepts one of the following:
const PetStatusAvailable PetStatus = "available"
const PetStatusPending PetStatus = "pending"
const PetStatusSold PetStatus = "sold"
Tags []Tagoptional
ID int64optional
formatint64
Name stringoptional

Find pet by ID.

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)
}
{
  "name": "doggie",
  "photoUrls": [
    "string"
  ],
  "id": 10,
  "category": {
    "id": 1,
    "name": "Dogs"
  },
  "status": "available",
  "tags": [
    {
      "id": 0,
      "name": "name"
    }
  ]
}
{
  "error": {
    "id": "invalid_id",
    "message": "Invalid ID supplied"
  }
}
{
  "error": {
    "id": "not_found",
    "message": "Pet not found"
  }
}
Returns Examples
{
  "name": "doggie",
  "photoUrls": [
    "string"
  ],
  "id": 10,
  "category": {
    "id": 1,
    "name": "Dogs"
  },
  "status": "available",
  "tags": [
    {
      "id": 0,
      "name": "name"
    }
  ]
}
{
  "error": {
    "id": "invalid_id",
    "message": "Invalid ID supplied"
  }
}
{
  "error": {
    "id": "not_found",
    "message": "Pet not found"
  }
}