test

package
v0.1.22 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const SpecFile string = `` /* 404-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 {
	PostPetsHandler PostPetsHandlerFunc

	// 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) PostPets added in v0.0.2

func (c *Client) PostPets(ctx context.Context, request PostPetsParams) (PostPetsResponse, error)

PostPets POST /pets

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 HTTPClient added in v0.0.2

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

type HTTPClientFunc added in v0.0.11

type HTTPClientFunc func(*http.Request) (*http.Response, error)

func (HTTPClientFunc) Do added in v0.0.11

type Maybe added in v0.1.5

type Maybe[T any] struct {
	IsSet bool
	Value T
}

func Just added in v0.1.5

func Just[T any](v T) Maybe[T]

func (*Maybe[T]) Set added in v0.1.6

func (m *Maybe[T]) Set(v T)

type NewPet

type NewPet struct {
	Name string `json:"name"`
	Tag  string `json:"tag"`
}

type PostPetsHandlerFunc

type PostPetsHandlerFunc func(ctx context.Context, r PostPetsRequest) PostPetsResponse

func (PostPetsHandlerFunc) ServeHTTP

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

type PostPetsParams added in v0.0.3

type PostPetsParams struct {
	Body NewPet
}

func (PostPetsParams) HTTP added in v0.0.3

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

func (PostPetsParams) Parse added in v0.0.3

func (r PostPetsParams) Parse() (PostPetsParams, error)

type PostPetsRequest

type PostPetsRequest interface {
	HTTP() *http.Request
	Parse() (PostPetsParams, error)
}

func PostPetsHTTPRequest added in v0.0.2

func PostPetsHTTPRequest(r *http.Request) PostPetsRequest

type PostPetsResponse added in v0.0.2

type PostPetsResponse interface {
	// contains filtered or unexported methods
}

func NewPostPetsResponse201 added in v0.0.2

func NewPostPetsResponse201() PostPetsResponse

func NewPostPetsResponseDefault added in v0.0.2

func NewPostPetsResponseDefault(code int) PostPetsResponse

type PostPetsResponse201

type PostPetsResponse201 struct{}

func (PostPetsResponse201) Write added in v0.0.2

type PostPetsResponseDefault

type PostPetsResponseDefault struct {
	Code int
}

func (PostPetsResponseDefault) Write added in v0.0.2

Jump to

Keyboard shortcuts

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