api

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package api provides primitives to interact the openapi HTTP API.

Code generated by github.com/StevenACoffman/oapi-codegen DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPetCtx

func AddPetCtx(next http.Handler) http.Handler

AddPet operation middleware

func DeletePetCtx

func DeletePetCtx(next http.Handler) http.Handler

DeletePet operation middleware

func FindPetByIdCtx

func FindPetByIdCtx(next http.Handler) http.Handler

FindPetById operation middleware

func FindPetsCtx

func FindPetsCtx(next http.Handler) http.Handler

FindPets operation middleware

func GetSwagger

func GetSwagger() (*openapi3.Swagger, error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file.

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

Types

type AddPetJSONBody

type AddPetJSONBody NewPet

AddPetJSONBody defines parameters for AddPet.

type AddPetJSONRequestBody

type AddPetJSONRequestBody AddPetJSONBody

AddPetRequestBody defines body for AddPet for application/json ContentType.

type Error

type Error struct {
	Code    int32  `json:"code"`
	Message string `json:"message"`
}

Error defines model for Error.

type FindPetsParams

type FindPetsParams struct {

	// tags to filter by
	Tags *[]string `json:"tags,omitempty"`

	// maximum number of results to return
	Limit *int32 `json:"limit,omitempty"`
}

FindPetsParams defines parameters for FindPets.

func ParamsForFindPets

func ParamsForFindPets(ctx context.Context) *FindPetsParams

ParamsForFindPets operation parameters from context

type NewPet

type NewPet struct {
	Name string  `json:"name"`
	Tag  *string `json:"tag,omitempty"`
}

NewPet defines model for NewPet.

type Pet

type Pet struct {
	// Embedded struct due to allOf(#/components/schemas/NewPet)
	NewPet
	// Embedded fields due to inline allOf schema
	Id int64 `json:"id"`
}

Pet defines model for Pet.

type PetStore

type PetStore struct {
	Pets   map[int64]Pet
	NextId int64
	Lock   sync.Mutex
}

func NewPetStore

func NewPetStore() *PetStore

func (*PetStore) AddPet

func (p *PetStore) AddPet(w http.ResponseWriter, r *http.Request)

func (*PetStore) DeletePet

func (p *PetStore) DeletePet(w http.ResponseWriter, r *http.Request)

func (*PetStore) FindPetById

func (p *PetStore) FindPetById(w http.ResponseWriter, r *http.Request)

func (*PetStore) FindPets

func (p *PetStore) FindPets(w http.ResponseWriter, r *http.Request)

Here, we implement all of the handlers in the ServerInterface

type ServerInterface

type ServerInterface interface {
	//  (GET /pets)
	FindPets(w http.ResponseWriter, r *http.Request)
	//  (POST /pets)
	AddPet(w http.ResponseWriter, r *http.Request)
	//  (DELETE /pets/{id})
	DeletePet(w http.ResponseWriter, r *http.Request)
	//  (GET /pets/{id})
	FindPetById(w http.ResponseWriter, r *http.Request)
}

Jump to

Keyboard shortcuts

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