genhttp

package
v0.0.0-...-64b14c1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package genhttp 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 RegisterHandlers

func RegisterHandlers(router gin.IRouter, si ServerInterface)

RegisterHandlers creates http.Handler with routing matching OpenAPI spec.

func RegisterHandlersWithOptions

func RegisterHandlersWithOptions(router gin.IRouter, si ServerInterface, options GinServerOptions)

RegisterHandlersWithOptions creates http.Handler with additional options

Types

type CreateDog201JSONResponse

type CreateDog201JSONResponse struct {
	Body    Dog
	Headers CreateDog201ResponseHeaders
}

func (CreateDog201JSONResponse) VisitCreateDogResponse

func (response CreateDog201JSONResponse) VisitCreateDogResponse(w http.ResponseWriter) error

type CreateDog201ResponseHeaders

type CreateDog201ResponseHeaders struct {
	XRequestId string
}

type CreateDog400JSONResponse

type CreateDog400JSONResponse struct {
	Body    ValidationError
	Headers CreateDog400ResponseHeaders
}

func (CreateDog400JSONResponse) VisitCreateDogResponse

func (response CreateDog400JSONResponse) VisitCreateDogResponse(w http.ResponseWriter) error

type CreateDog400ResponseHeaders

type CreateDog400ResponseHeaders struct {
	XRequestId string
}

type CreateDog500JSONResponse

type CreateDog500JSONResponse struct {
	Body    InternalServerError
	Headers CreateDog500ResponseHeaders
}

func (CreateDog500JSONResponse) VisitCreateDogResponse

func (response CreateDog500JSONResponse) VisitCreateDogResponse(w http.ResponseWriter) error

type CreateDog500ResponseHeaders

type CreateDog500ResponseHeaders struct {
	XRequestId string
}

type CreateDogJSONRequestBody

type CreateDogJSONRequestBody = DogCreate

CreateDogJSONRequestBody defines body for CreateDog for application/json ContentType.

type CreateDogParams

type CreateDogParams struct {
	// XRequestId Unique request identifier for tracking
	XRequestId *string `json:"x-request-id,omitempty"`
}

CreateDogParams defines parameters for CreateDog.

type CreateDogRequestObject

type CreateDogRequestObject struct {
	Params CreateDogParams
	Body   *CreateDogJSONRequestBody
}

type CreateDogResponseObject

type CreateDogResponseObject interface {
	VisitCreateDogResponse(w http.ResponseWriter) error
}

type DeleteDog204Response

type DeleteDog204Response struct {
	Headers DeleteDog204ResponseHeaders
}

func (DeleteDog204Response) VisitDeleteDogResponse

func (response DeleteDog204Response) VisitDeleteDogResponse(w http.ResponseWriter) error

type DeleteDog204ResponseHeaders

type DeleteDog204ResponseHeaders struct {
	XRequestId string
}

type DeleteDog400JSONResponse

type DeleteDog400JSONResponse struct {
	Body    ValidationError
	Headers DeleteDog400ResponseHeaders
}

func (DeleteDog400JSONResponse) VisitDeleteDogResponse

func (response DeleteDog400JSONResponse) VisitDeleteDogResponse(w http.ResponseWriter) error

type DeleteDog400ResponseHeaders

type DeleteDog400ResponseHeaders struct {
	XRequestId string
}

type DeleteDog404JSONResponse

type DeleteDog404JSONResponse struct {
	Body    NotFoundError
	Headers DeleteDog404ResponseHeaders
}

func (DeleteDog404JSONResponse) VisitDeleteDogResponse

func (response DeleteDog404JSONResponse) VisitDeleteDogResponse(w http.ResponseWriter) error

type DeleteDog404ResponseHeaders

type DeleteDog404ResponseHeaders struct {
	XRequestId string
}

type DeleteDog500JSONResponse

type DeleteDog500JSONResponse struct {
	Body    InternalServerError
	Headers DeleteDog500ResponseHeaders
}

func (DeleteDog500JSONResponse) VisitDeleteDogResponse

func (response DeleteDog500JSONResponse) VisitDeleteDogResponse(w http.ResponseWriter) error

type DeleteDog500ResponseHeaders

type DeleteDog500ResponseHeaders struct {
	XRequestId string
}

type DeleteDogParams

type DeleteDogParams struct {
	// XRequestId Unique request identifier for tracking
	XRequestId *string `json:"x-request-id,omitempty"`
}

DeleteDogParams defines parameters for DeleteDog.

type DeleteDogRequestObject

type DeleteDogRequestObject struct {
	DogId  openapi_types.UUID `json:"dogId"`
	Params DeleteDogParams
}

type DeleteDogResponseObject

type DeleteDogResponseObject interface {
	VisitDeleteDogResponse(w http.ResponseWriter) error
}

type Dog

type Dog struct {
	// Age Age of the dog in years
	Age int32 `json:"age" validate:"min=0,max=30"`

	// Breed Breed of the dog
	Breed string `json:"breed" validate:"required,min=1,max=100"`

	// CreatedAt When the dog was created
	CreatedAt *time.Time `json:"createdAt,omitempty" validate:"required"`

	// Id Unique identifier for the dog
	Id openapi_types.UUID `json:"id" validate:"required,uuid4_rfc4122"`

	// Name Name of the dog
	Name string `json:"name" validate:"required,min=1,max=50"`

	// UpdatedAt When the dog was last updated
	UpdatedAt *time.Time `json:"updatedAt,omitzero" validate:"omitempty"`
}

Dog defines model for Dog.

type DogCreate

type DogCreate struct {
	// Age Age of the dog in years
	Age int32 `json:"age" validate:"min=0,max=30"`

	// Breed Breed of the dog
	Breed string `json:"breed" validate:"required,min=1,max=100"`

	// Name Name of the dog
	Name string `json:"name" validate:"required,min=1,max=50"`
}

DogCreate defines model for DogCreate.

type DogUpdate

type DogUpdate struct {
	// Age Age of the dog in years
	Age int32 `json:"age" validate:"min=0,max=30"`

	// Breed Breed of the dog
	Breed string `json:"breed" validate:"required,min=1,max=100"`

	// Name Name of the dog
	Name string `json:"name" validate:"required,min=1,max=50"`
}

DogUpdate defines model for DogUpdate.

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 GetDogById200JSONResponse

type GetDogById200JSONResponse struct {
	Body    Dog
	Headers GetDogById200ResponseHeaders
}

func (GetDogById200JSONResponse) VisitGetDogByIdResponse

func (response GetDogById200JSONResponse) VisitGetDogByIdResponse(w http.ResponseWriter) error

type GetDogById200ResponseHeaders

type GetDogById200ResponseHeaders struct {
	XRequestId string
}

type GetDogById400JSONResponse

type GetDogById400JSONResponse struct {
	Body    ValidationError
	Headers GetDogById400ResponseHeaders
}

func (GetDogById400JSONResponse) VisitGetDogByIdResponse

func (response GetDogById400JSONResponse) VisitGetDogByIdResponse(w http.ResponseWriter) error

type GetDogById400ResponseHeaders

type GetDogById400ResponseHeaders struct {
	XRequestId string
}

type GetDogById404JSONResponse

type GetDogById404JSONResponse struct {
	Body    NotFoundError
	Headers GetDogById404ResponseHeaders
}

func (GetDogById404JSONResponse) VisitGetDogByIdResponse

func (response GetDogById404JSONResponse) VisitGetDogByIdResponse(w http.ResponseWriter) error

type GetDogById404ResponseHeaders

type GetDogById404ResponseHeaders struct {
	XRequestId string
}

type GetDogById500JSONResponse

type GetDogById500JSONResponse struct {
	Body    InternalServerError
	Headers GetDogById500ResponseHeaders
}

func (GetDogById500JSONResponse) VisitGetDogByIdResponse

func (response GetDogById500JSONResponse) VisitGetDogByIdResponse(w http.ResponseWriter) error

type GetDogById500ResponseHeaders

type GetDogById500ResponseHeaders struct {
	XRequestId string
}

type GetDogByIdParams

type GetDogByIdParams struct {
	// XRequestId Unique request identifier for tracking
	XRequestId *string `json:"x-request-id,omitempty"`
}

GetDogByIdParams defines parameters for GetDogById.

type GetDogByIdRequestObject

type GetDogByIdRequestObject struct {
	DogId  openapi_types.UUID `json:"dogId"`
	Params GetDogByIdParams
}

type GetDogByIdResponseObject

type GetDogByIdResponseObject interface {
	VisitGetDogByIdResponse(w http.ResponseWriter) error
}

type GinServerOptions

type GinServerOptions struct {
	BaseURL      string
	Middlewares  []MiddlewareFunc
	ErrorHandler func(*gin.Context, error, int)
}

GinServerOptions provides options for the Gin server.

type InternalServerError

type InternalServerError struct {
	Code    interface{} `json:"code"`
	Message interface{} `json:"message"`
}

InternalServerError defines model for InternalServerError.

type MiddlewareFunc

type MiddlewareFunc func(c *gin.Context)

type NotFoundError

type NotFoundError struct {
	Code    interface{} `json:"code"`
	Message interface{} `json:"message"`
}

NotFoundError defines model for NotFoundError.

type ServerInterface

type ServerInterface interface {
	// Create a new dog
	// (POST /dogs)
	CreateDog(c *gin.Context, params CreateDogParams)
	// Delete a dog
	// (DELETE /dogs/{dogId})
	DeleteDog(c *gin.Context, dogId openapi_types.UUID, params DeleteDogParams)
	// Get a dog by ID
	// (GET /dogs/{dogId})
	GetDogById(c *gin.Context, dogId openapi_types.UUID, params GetDogByIdParams)
	// Update a dog
	// (PUT /dogs/{dogId})
	UpdateDog(c *gin.Context, dogId openapi_types.UUID, params UpdateDogParams)
}

ServerInterface represents all server handlers.

func NewStrictHandler

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

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandler       func(*gin.Context, error, int)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) CreateDog

func (siw *ServerInterfaceWrapper) CreateDog(c *gin.Context)

CreateDog operation middleware

func (*ServerInterfaceWrapper) DeleteDog

func (siw *ServerInterfaceWrapper) DeleteDog(c *gin.Context)

DeleteDog operation middleware

func (*ServerInterfaceWrapper) GetDogById

func (siw *ServerInterfaceWrapper) GetDogById(c *gin.Context)

GetDogById operation middleware

func (*ServerInterfaceWrapper) UpdateDog

func (siw *ServerInterfaceWrapper) UpdateDog(c *gin.Context)

UpdateDog operation middleware

type StrictHandlerFunc

type StrictHandlerFunc = strictgin.StrictGinHandlerFunc

type StrictMiddlewareFunc

type StrictMiddlewareFunc = strictgin.StrictGinMiddlewareFunc

type StrictServerInterface

type StrictServerInterface interface {
	// Create a new dog
	// (POST /dogs)
	CreateDog(ctx context.Context, request CreateDogRequestObject) (CreateDogResponseObject, error)
	// Delete a dog
	// (DELETE /dogs/{dogId})
	DeleteDog(ctx context.Context, request DeleteDogRequestObject) (DeleteDogResponseObject, error)
	// Get a dog by ID
	// (GET /dogs/{dogId})
	GetDogById(ctx context.Context, request GetDogByIdRequestObject) (GetDogByIdResponseObject, error)
	// Update a dog
	// (PUT /dogs/{dogId})
	UpdateDog(ctx context.Context, request UpdateDogRequestObject) (UpdateDogResponseObject, error)
}

StrictServerInterface represents all server handlers.

type UpdateDog200JSONResponse

type UpdateDog200JSONResponse struct {
	Body    Dog
	Headers UpdateDog200ResponseHeaders
}

func (UpdateDog200JSONResponse) VisitUpdateDogResponse

func (response UpdateDog200JSONResponse) VisitUpdateDogResponse(w http.ResponseWriter) error

type UpdateDog200ResponseHeaders

type UpdateDog200ResponseHeaders struct {
	XRequestId string
}

type UpdateDog400JSONResponse

type UpdateDog400JSONResponse struct {
	Body    ValidationError
	Headers UpdateDog400ResponseHeaders
}

func (UpdateDog400JSONResponse) VisitUpdateDogResponse

func (response UpdateDog400JSONResponse) VisitUpdateDogResponse(w http.ResponseWriter) error

type UpdateDog400ResponseHeaders

type UpdateDog400ResponseHeaders struct {
	XRequestId string
}

type UpdateDog404JSONResponse

type UpdateDog404JSONResponse struct {
	Body    NotFoundError
	Headers UpdateDog404ResponseHeaders
}

func (UpdateDog404JSONResponse) VisitUpdateDogResponse

func (response UpdateDog404JSONResponse) VisitUpdateDogResponse(w http.ResponseWriter) error

type UpdateDog404ResponseHeaders

type UpdateDog404ResponseHeaders struct {
	XRequestId string
}

type UpdateDog500JSONResponse

type UpdateDog500JSONResponse struct {
	Body    InternalServerError
	Headers UpdateDog500ResponseHeaders
}

func (UpdateDog500JSONResponse) VisitUpdateDogResponse

func (response UpdateDog500JSONResponse) VisitUpdateDogResponse(w http.ResponseWriter) error

type UpdateDog500ResponseHeaders

type UpdateDog500ResponseHeaders struct {
	XRequestId string
}

type UpdateDogJSONRequestBody

type UpdateDogJSONRequestBody = DogUpdate

UpdateDogJSONRequestBody defines body for UpdateDog for application/json ContentType.

type UpdateDogParams

type UpdateDogParams struct {
	// XRequestId Unique request identifier for tracking
	XRequestId *string `json:"x-request-id,omitempty"`
}

UpdateDogParams defines parameters for UpdateDog.

type UpdateDogRequestObject

type UpdateDogRequestObject struct {
	DogId  openapi_types.UUID `json:"dogId"`
	Params UpdateDogParams
	Body   *UpdateDogJSONRequestBody
}

type UpdateDogResponseObject

type UpdateDogResponseObject interface {
	VisitUpdateDogResponse(w http.ResponseWriter) error
}

type ValidationError

type ValidationError struct {
	Code    interface{} `json:"code"`
	Details *[]struct {
		// Field Field with error
		Field *string `json:"field,omitempty"`

		// Message Error message for the field
		Message *string `json:"message,omitempty"`
	} `json:"details,omitempty"`
	Message interface{} `json:"message"`
}

ValidationError defines model for ValidationError.

Jump to

Keyboard shortcuts

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