api

package
v0.0.0-...-7b47575 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package api provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.0.0-00010101000000-000000000000 DO NOT EDIT.

Package api provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.0.0-00010101000000-000000000000 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

func RegisterHandlers

func RegisterHandlers(router *iris.Application, si ServerInterface)

RegisterHandlers creates http.Handler with routing matching OpenAPI spec.

func RegisterHandlersWithOptions

func RegisterHandlersWithOptions(router *iris.Application, si ServerInterface, options IrisServerOptions)

RegisterHandlersWithOptions creates http.Handler with additional options

Types

type AddPetJSONRequestBody

type AddPetJSONRequestBody = NewPet

AddPetJSONRequestBody defines body for AddPet for application/json ContentType.

type Error

type Error struct {
	// Code Error code
	Code int32 `json:"code"`

	// Message Error message
	Message string `json:"message"`
}

Error defines model for Error.

type FindPetsParams

type FindPetsParams struct {
	// Tags tags to filter by
	Tags *[]string `form:"tags,omitempty" json:"tags,omitempty"`

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

FindPetsParams defines parameters for FindPets.

type IrisServerOptions

type IrisServerOptions struct {
	BaseURL     string
	Middlewares []MiddlewareFunc
}

IrisServerOption is the option for iris server

type MiddlewareFunc

type MiddlewareFunc iris.Handler

type NewPet

type NewPet struct {
	// Name Name of the pet
	Name string `json:"name"`

	// Tag Type of the pet
	Tag *string `json:"tag,omitempty"`
}

NewPet defines model for NewPet.

type Pet

type Pet struct {
	// Id Unique id of the pet
	Id int64 `json:"id"`

	// Name Name of the pet
	Name string `json:"name"`

	// Tag Type of the pet
	Tag *string `json:"tag,omitempty"`
}

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(c iris.Context)

func (*PetStore) DeletePet

func (p *PetStore) DeletePet(c iris.Context, id int64)

func (*PetStore) FindPetByID

func (p *PetStore) FindPetByID(c iris.Context, petId int64)

func (*PetStore) FindPets

func (p *PetStore) FindPets(c iris.Context, params FindPetsParams)

FindPets implements all the handlers in the ServerInterface

type ServerInterface

type ServerInterface interface {
	// Returns all pets
	// (GET /pets)
	FindPets(ctx iris.Context, params FindPetsParams)
	// Creates a new pet
	// (POST /pets)
	AddPet(ctx iris.Context)
	// Deletes a pet by ID
	// (DELETE /pets/{id})
	DeletePet(ctx iris.Context, id int64)
	// Returns a pet by ID
	// (GET /pets/{id})
	FindPetByID(ctx iris.Context, id int64)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) AddPet

func (w *ServerInterfaceWrapper) AddPet(ctx iris.Context)

AddPet converts iris context to params.

func (*ServerInterfaceWrapper) DeletePet

func (w *ServerInterfaceWrapper) DeletePet(ctx iris.Context)

DeletePet converts iris context to params.

func (*ServerInterfaceWrapper) FindPetByID

func (w *ServerInterfaceWrapper) FindPetByID(ctx iris.Context)

FindPetByID converts iris context to params.

func (*ServerInterfaceWrapper) FindPets

func (w *ServerInterfaceWrapper) FindPets(ctx iris.Context)

FindPets converts iris context to params.

Jump to

Keyboard shortcuts

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