server

package
v0.0.0-...-b934907 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

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

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.3.0 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 Error

type Error struct {
	// Details A human-readable explanation specific to this occurrence of the problem.
	Details *string `json:"details,omitempty"`

	// Properties Optional map of properties
	Properties *map[string]interface{} `json:"properties"`

	// Title A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
	Title string `json:"title"`
}

Error An API error

type GetGreetingOutputBody

type GetGreetingOutputBody struct {
	// Message Greeting message
	Message string `json:"message"`
}

GetGreetingOutputBody defines model for GetGreetingOutputBody.

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 MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type PostReviewInputBody

type PostReviewInputBody struct {
	// Author Author of the review
	Author string `json:"author"`

	// Message Review message
	Message *string `json:"message,omitempty"`

	// Rating Rating from 1 to 5
	Rating int64 `json:"rating"`
}

PostReviewInputBody defines model for PostReviewInputBody.

type PostReviewJSONRequestBody

type PostReviewJSONRequestBody = PostReviewInputBody

PostReviewJSONRequestBody defines body for PostReview for application/json ContentType.

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 ServerInterface

type ServerInterface interface {
	// Get an error
	// (GET /error)
	GetError(w http.ResponseWriter, r *http.Request)
	// Say hello to someone
	// (GET /greeting/{name})
	Greeting(w http.ResponseWriter, r *http.Request, name string)
	// Send a review
	// (POST /reviews)
	PostReview(w http.ResponseWriter, r *http.Request)
}

ServerInterface represents all server handlers.

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) GetError

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

GetError operation middleware

func (*ServerInterfaceWrapper) Greeting

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

Greeting operation middleware

func (*ServerInterfaceWrapper) PostReview

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

PostReview operation middleware

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) GetError

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

Get an error (GET /error)

func (Unimplemented) Greeting

func (_ Unimplemented) Greeting(w http.ResponseWriter, r *http.Request, name string)

Say hello to someone (GET /greeting/{name})

func (Unimplemented) PostReview

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

Send a review (POST /reviews)

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