Skip to content
Get started

Add a new pet to the store.

client.Pets.New(ctx, body) (*Pet, error)
post/pet

Add a new pet to the store.

ParametersExpand Collapse
body PetNewParams
Pet param.Field[Pet]
ReturnsExpand Collapse
type Pet struct{…}
Name string
PhotoURLs []string
ID int64optional
formatint64
Category PetCategoryoptional
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 []PetTagoptional
ID int64optional
formatint64
Name stringoptional
Add a new pet to the store.
package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/barkend-go"
  "github.com/stainless-sdks/barkend-go/option"
)

func main() {
  client := barkend.NewClient(
    option.WithAPIKey("My API Key"),
  )
  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)
}
{
  "id": 10,
  "name": "doggie",
  "photoUrls": [
    "https://example.com/dog.jpg"
  ],
  "category": {
    "id": 1,
    "name": "Dogs"
  },
  "tags": [
    {
      "id": 1,
      "name": "friendly"
    }
  ],
  "status": "available"
}
{
  "error": {
    "id": "invalid_input",
    "message": "Invalid input - name and photoUrls required"
  }
}
Returns Examples
{
  "id": 10,
  "name": "doggie",
  "photoUrls": [
    "https://example.com/dog.jpg"
  ],
  "category": {
    "id": 1,
    "name": "Dogs"
  },
  "tags": [
    {
      "id": 1,
      "name": "friendly"
    }
  ],
  "status": "available"
}
{
  "error": {
    "id": "invalid_input",
    "message": "Invalid input - name and photoUrls required"
  }
}