test

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const SpecFile string = `` /* 523-byte string literal not displayed */

Variables

View Source
var LogError = func(err error) {
	log.Println(fmt.Sprintf("Error: %v", err))
}

Functions

func SchemaPath

func SchemaPath(r *http.Request) (string, bool)

func SpecFileHandler

func SpecFileHandler() http.Handler

Types

type API

type API struct {
	GetPetHandler GetPetHandlerFunc

	// not found
	NotFoundHandler http.Handler
	// spec file
	SpecFileHandler http.Handler

	Middlewares []func(h http.Handler) http.Handler
}

func (*API) ServeHTTP

func (rt *API) ServeHTTP(rw http.ResponseWriter, r *http.Request)

type Client added in v0.0.2

type Client struct {
	BaseURL    string
	HTTPClient HTTPClient
}

func NewClient added in v0.0.2

func NewClient(baseURL string, httpClient HTTPClient) *Client

func (*Client) GetPet added in v0.0.2

func (c *Client) GetPet(ctx context.Context, request GetPetParams) (GetPetResponse, error)

GetPet - GET /pet

type ErrParseParam

type ErrParseParam struct {
	In        string
	Parameter string
	Reason    string
	Err       error
}

func (ErrParseParam) Error

func (e ErrParseParam) Error() string

func (ErrParseParam) Unwrap

func (e ErrParseParam) Unwrap() error

type GetPetHandlerFunc

type GetPetHandlerFunc func(r GetPetRequest) GetPetResponse

func (GetPetHandlerFunc) ServeHTTP

func (f GetPetHandlerFunc) ServeHTTP(w http.ResponseWriter, r *http.Request)

type GetPetParams added in v0.0.3

type GetPetParams struct {
}

func (GetPetParams) HTTP added in v0.0.3

func (r GetPetParams) HTTP() *http.Request

func (GetPetParams) Parse added in v0.0.3

func (r GetPetParams) Parse() GetPetParams

type GetPetRequest

type GetPetRequest interface {
	HTTP() *http.Request
	Parse() GetPetParams
}

func GetPetHTTPRequest added in v0.0.2

func GetPetHTTPRequest(r *http.Request) GetPetRequest

type GetPetResponse added in v0.0.2

type GetPetResponse interface {
	Write(w http.ResponseWriter)
	// contains filtered or unexported methods
}

func NewGetPetResponse200JSON added in v0.0.2

func NewGetPetResponse200JSON(body GetPetResponse200JSONBody) GetPetResponse

type GetPetResponse200JSON

type GetPetResponse200JSON struct {
	Body GetPetResponse200JSONBody
}

func (GetPetResponse200JSON) Write added in v0.0.2

type GetPetResponse200JSONBody

type GetPetResponse200JSONBody struct {
	Length               int             `json:"length"`
	AdditionalProperties map[string]Pets `json:"-"`
}

func (GetPetResponse200JSONBody) MarshalJSON

func (b GetPetResponse200JSONBody) MarshalJSON() ([]byte, error)

type HTTPClient added in v0.0.2

type HTTPClient interface {
	Do(*http.Request) (*http.Response, error)
}

type Pet

type Pet struct {
	Name string `json:"name"`
}

type Pets

type Pets []Pet

Jump to

Keyboard shortcuts

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