api

package
v0.0.0-...-bc93523 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: MIT Imports: 10 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.4.1 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

Types

type ChiServerOptions

type ChiServerOptions struct {
	BaseURL          string
	BaseRouter       chi.Router
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type CreatePets201Response

type CreatePets201Response struct {
}

func (CreatePets201Response) VisitCreatePetsResponse

func (response CreatePets201Response) VisitCreatePetsResponse(w http.ResponseWriter) error

type CreatePetsJSONRequestBody

type CreatePetsJSONRequestBody = Pet

CreatePetsJSONRequestBody defines body for CreatePets for application/json ContentType.

type CreatePetsRequestObject

type CreatePetsRequestObject struct {
	Body *CreatePetsJSONRequestBody
}

type CreatePetsResponseObject

type CreatePetsResponseObject interface {
	VisitCreatePetsResponse(w http.ResponseWriter) error
}

type CreatePetsdefaultJSONResponse

type CreatePetsdefaultJSONResponse struct {
	Body       Error
	StatusCode int
}

func (CreatePetsdefaultJSONResponse) VisitCreatePetsResponse

func (response CreatePetsdefaultJSONResponse) VisitCreatePetsResponse(w http.ResponseWriter) error

type Error

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

Error defines model for Error.

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type ListPets200JSONResponse

type ListPets200JSONResponse struct {
	Body    Pets
	Headers ListPets200ResponseHeaders
}

func (ListPets200JSONResponse) VisitListPetsResponse

func (response ListPets200JSONResponse) VisitListPetsResponse(w http.ResponseWriter) error

type ListPets200ResponseHeaders

type ListPets200ResponseHeaders struct {
	XNext string
}

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 ListPetsRequestObject

type ListPetsRequestObject struct {
	Params ListPetsParams
}

type ListPetsResponseObject

type ListPetsResponseObject interface {
	VisitListPetsResponse(w http.ResponseWriter) error
}

type ListPetsdefaultJSONResponse

type ListPetsdefaultJSONResponse struct {
	Body       Error
	StatusCode int
}

func (ListPetsdefaultJSONResponse) VisitListPetsResponse

func (response ListPetsdefaultJSONResponse) VisitListPetsResponse(w http.ResponseWriter) error

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

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 RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(client *ent.Client) *Server

func (*Server) CreatePets

(POST /pets)

func (*Server) ListPets

(GET /pets)

func (*Server) ShowPetById

(GET /pets/{petId})

type ServerInterface

type ServerInterface interface {
	// List all pets
	// (GET /pets)
	ListPets(w http.ResponseWriter, r *http.Request, params ListPetsParams)
	// Create a pet
	// (POST /pets)
	CreatePets(w http.ResponseWriter, r *http.Request)
	// Info for a specific pet
	// (GET /pets/{petId})
	ShowPetById(w http.ResponseWriter, r *http.Request, petId string)
}

ServerInterface represents all server handlers.

func NewStrictHandler

func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface

func NewStrictHandlerWithOptions

func NewStrictHandlerWithOptions(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc, options StrictHTTPServerOptions) ServerInterface

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) CreatePets

func (siw *ServerInterfaceWrapper) CreatePets(w http.ResponseWriter, r *http.Request)

CreatePets operation middleware

func (*ServerInterfaceWrapper) ListPets

func (siw *ServerInterfaceWrapper) ListPets(w http.ResponseWriter, r *http.Request)

ListPets operation middleware

func (*ServerInterfaceWrapper) ShowPetById

func (siw *ServerInterfaceWrapper) ShowPetById(w http.ResponseWriter, r *http.Request)

ShowPetById operation middleware

type ShowPetById200JSONResponse

type ShowPetById200JSONResponse Pet

func (ShowPetById200JSONResponse) VisitShowPetByIdResponse

func (response ShowPetById200JSONResponse) VisitShowPetByIdResponse(w http.ResponseWriter) error

type ShowPetByIdRequestObject

type ShowPetByIdRequestObject struct {
	PetId string `json:"petId"`
}

type ShowPetByIdResponseObject

type ShowPetByIdResponseObject interface {
	VisitShowPetByIdResponse(w http.ResponseWriter) error
}

type ShowPetByIddefaultJSONResponse

type ShowPetByIddefaultJSONResponse struct {
	Body       Error
	StatusCode int
}

func (ShowPetByIddefaultJSONResponse) VisitShowPetByIdResponse

func (response ShowPetByIddefaultJSONResponse) VisitShowPetByIdResponse(w http.ResponseWriter) error

type StrictHTTPServerOptions

type StrictHTTPServerOptions struct {
	RequestErrorHandlerFunc  func(w http.ResponseWriter, r *http.Request, err error)
	ResponseErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type StrictServerInterface

type StrictServerInterface interface {
	// List all pets
	// (GET /pets)
	ListPets(ctx context.Context, request ListPetsRequestObject) (ListPetsResponseObject, error)
	// Create a pet
	// (POST /pets)
	CreatePets(ctx context.Context, request CreatePetsRequestObject) (CreatePetsResponseObject, error)
	// Info for a specific pet
	// (GET /pets/{petId})
	ShowPetById(ctx context.Context, request ShowPetByIdRequestObject) (ShowPetByIdResponseObject, error)
}

StrictServerInterface represents all server handlers.

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type Unimplemented

type Unimplemented struct{}

func (Unimplemented) CreatePets

func (_ Unimplemented) CreatePets(w http.ResponseWriter, r *http.Request)

Create a pet (POST /pets)

func (Unimplemented) ListPets

func (_ Unimplemented) ListPets(w http.ResponseWriter, r *http.Request, params ListPetsParams)

List all pets (GET /pets)

func (Unimplemented) ShowPetById

func (_ Unimplemented) ShowPetById(w http.ResponseWriter, r *http.Request, petId string)

Info for a specific pet (GET /pets/{petId})

type UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap

func (e *UnmarshalingParamError) Unwrap() error

Jump to

Keyboard shortcuts

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