petstore

package
v0.8.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorPetNotFound = errors.New("Pet not found")
View Source
var PetStore = NewStore()

Functions

func GeneratePetStore

func GeneratePetStore() rest.API

Types

type APIResponse

type APIResponse struct {
	Code    int    `json:"code"`
	Type    string `json:"type"`
	Message string `json:"message"`
}

type Pet

type Pet struct {
	// id
	ID int64 `json:"id,omitempty"`
	// name
	// Required: true
	Name string `json:"name"`
	// photo urls
	// Required: true
	PhotoUrls []string `json:"photoUrls" xml:"photoUrl"`
	// pet status in the store
	// Enum: [available pending sold]
	Status string `json:"status,omitempty"`
	// tags
	Tags []Tag `json:"tags" xml:"tag"`
	// created_at
	CreatedAt time.Time `json:"created_at" xml:"created_at"`
}

type Store

type Store struct {
	InMemoryFs afero.Fs
	// contains filtered or unexported fields
}

Store provides a CRUD non-persistent store in memory for integration tests.

func NewStore

func NewStore() *Store

func (*Store) Create

func (s *Store) Create(pet Pet) (Pet, error)

func (*Store) Delete

func (s *Store) Delete(petID string) error

func (*Store) Get

func (s *Store) Get(petID string) (Pet, error)

func (*Store) List

func (s *Store) List() ([]Pet, error)

func (*Store) Update

func (s *Store) Update(petID string, pet Pet) (Pet, error)

func (*Store) UploadPhoto

func (s *Store) UploadPhoto(petID string, fileContent []byte) error

type Tag

type Tag struct {
	// id
	ID int64 `json:"id,omitempty"`
	// name
	Name string `json:"name,omitempty"`
}

Tag tag

swagger:model Tag

type XMLPetsWrapper

type XMLPetsWrapper struct {
	XMLName xml.Name `xml:"pets"`
	Pets    []Pet    `xml:"Pet"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL