oapi

package
v0.0.0-...-81cff1a Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

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

Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 DO NOT EDIT.

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

Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 DO NOT EDIT.

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

Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 DO NOT EDIT.

Index

Constants

View Source
const (
	BearerAuthScopes = "bearerAuth.Scopes"
	CookieAuthScopes = "cookieAuth.Scopes"
)

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 EchoRouter, si ServerInterface)

RegisterHandlers adds each server route to the EchoRouter.

func RegisterHandlersWithBaseURL

func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)

Registers handlers, and prepends BaseURL to the paths, so that the paths can be served under a prefix.

Types

type CreatePetsJSONRequestBody

type CreatePetsJSONRequestBody = Pet

CreatePetsJSONRequestBody defines body for CreatePets for application/json ContentType.

type EchoRouter

type EchoRouter interface {
	CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}

This is a simple interface which specifies echo.Route addition functions which are present on both echo.Echo and echo.Group, since we want to allow using either of them for path registration

type Error

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

Error defines model for Error.

type ListPetsParams

type ListPetsParams struct {
	// Limit How many items to return at one time (max 100)
	Limit *int32 `form:"limit,omitempty" json:"limit,omitempty"`
}

ListPetsParams defines parameters for ListPets.

type Pet

type Pet struct {
	Id   int64   `json:"id"`
	Name string  `json:"name"`
	Tag  *string `json:"tag,omitempty"`
}

Pet defines model for Pet.

type Pets

type Pets = []Pet

Pets defines model for Pets.

type ServerInterface

type ServerInterface interface {
	// List all pets
	// (GET /pets)
	ListPets(ctx echo.Context, params ListPetsParams) error
	// Create a pet
	// (POST /pets)
	CreatePets(ctx echo.Context) error
	// Info for a specific pet
	// (GET /pets/{pet_id})
	ShowPetById(ctx echo.Context, petId string) error
	// Redirect
	// (GET /redirect)
	Redirect(ctx echo.Context) error
	// Delete session
	// (DELETE /session)
	DeleteSession(ctx echo.Context) error
	// Get session
	// (GET /session)
	GetSession(ctx echo.Context) error
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) CreatePets

func (w *ServerInterfaceWrapper) CreatePets(ctx echo.Context) error

CreatePets converts echo context to params.

func (*ServerInterfaceWrapper) DeleteSession

func (w *ServerInterfaceWrapper) DeleteSession(ctx echo.Context) error

DeleteSession converts echo context to params.

func (*ServerInterfaceWrapper) GetSession

func (w *ServerInterfaceWrapper) GetSession(ctx echo.Context) error

GetSession converts echo context to params.

func (*ServerInterfaceWrapper) ListPets

func (w *ServerInterfaceWrapper) ListPets(ctx echo.Context) error

ListPets converts echo context to params.

func (*ServerInterfaceWrapper) Redirect

func (w *ServerInterfaceWrapper) Redirect(ctx echo.Context) error

Redirect converts echo context to params.

func (*ServerInterfaceWrapper) ShowPetById

func (w *ServerInterfaceWrapper) ShowPetById(ctx echo.Context) error

ShowPetById converts echo context to params.

Jump to

Keyboard shortcuts

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