test

package
v0.1.23 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const SpecFile string = `` /* 1101-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 {
	GetShopsHandler      GetShopsHandlerFunc
	GetShopsShopHandler  GetShopsShopHandlerFunc
	PostShopsShopHandler PostShopsShopHandlerFunc

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

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

func (*API) ServeHTTP

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

type Client

type Client struct {
	BaseURL    string
	HTTPClient HTTPClient
}

func NewClient

func NewClient(baseURL string, httpClient HTTPClient) *Client

func (*Client) GetShops

func (c *Client) GetShops(ctx context.Context, request GetShopsParams) (GetShopsResponse, error)

GetShops GET /shops

func (*Client) GetShopsShop

func (c *Client) GetShopsShop(ctx context.Context, request GetShopsShopParams) (GetShopsShopResponse, error)

GetShopsShop GET /shops/{shop}

func (*Client) PostShopsShop

func (c *Client) PostShopsShop(ctx context.Context, request PostShopsShopParams) (PostShopsShopResponse, error)

PostShopsShop POST /shops/{shop}

type CorsHandlerFunc

type CorsHandlerFunc func(methods, headers []string) http.Handler

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 GetShopsHandlerFunc

type GetShopsHandlerFunc func(ctx context.Context, r GetShopsRequest) GetShopsResponse

func (GetShopsHandlerFunc) ServeHTTP

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

type GetShopsParams

type GetShopsParams struct {
	Query GetShopsParamsQuery

	Headers GetShopsParamsHeaders
}

func (GetShopsParams) HTTP

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

func (GetShopsParams) Parse

func (r GetShopsParams) Parse() (GetShopsParams, error)

type GetShopsParamsHeaders added in v0.1.18

type GetShopsParamsHeaders struct {
	AccessKey Maybe[string]
}

type GetShopsParamsQuery added in v0.1.18

type GetShopsParamsQuery struct {
	Page Maybe[int32]
}

type GetShopsRequest

type GetShopsRequest interface {
	HTTP() *http.Request
	Parse() (GetShopsParams, error)
}

func GetShopsHTTPRequest

func GetShopsHTTPRequest(r *http.Request) GetShopsRequest

type GetShopsResponse

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

func NewGetShopsResponse200

func NewGetShopsResponse200() GetShopsResponse

func NewGetShopsResponseDefault

func NewGetShopsResponseDefault(code int) GetShopsResponse

type GetShopsResponse200

type GetShopsResponse200 struct{}

func (GetShopsResponse200) Write

type GetShopsResponseDefault

type GetShopsResponseDefault struct {
	Code int
}

func (GetShopsResponseDefault) Write

type GetShopsShopHandlerFunc

type GetShopsShopHandlerFunc func(ctx context.Context, r GetShopsShopRequest) GetShopsShopResponse

func (GetShopsShopHandlerFunc) ServeHTTP

type GetShopsShopParams

type GetShopsShopParams struct {
	Query GetShopsShopParamsQuery

	Path GetShopsShopParamsPath

	Headers GetShopsShopParamsHeaders
}

func (GetShopsShopParams) HTTP

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

func (GetShopsShopParams) Parse

type GetShopsShopParamsHeaders added in v0.1.18

type GetShopsShopParamsHeaders struct {
	RequestID Maybe[string]
}

type GetShopsShopParamsPath added in v0.1.18

type GetShopsShopParamsPath struct {
	Shop string
}

type GetShopsShopParamsQuery added in v0.1.18

type GetShopsShopParamsQuery struct {
	Page Maybe[int32]
}

type GetShopsShopRequest

type GetShopsShopRequest interface {
	HTTP() *http.Request
	Parse() (GetShopsShopParams, error)
}

func GetShopsShopHTTPRequest

func GetShopsShopHTTPRequest(r *http.Request) GetShopsShopRequest

type GetShopsShopResponse

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

func NewGetShopsShopResponse200

func NewGetShopsShopResponse200() GetShopsShopResponse

func NewGetShopsShopResponseDefault

func NewGetShopsShopResponseDefault(code int) GetShopsShopResponse

type GetShopsShopResponse200

type GetShopsShopResponse200 struct{}

func (GetShopsShopResponse200) Write

type GetShopsShopResponseDefault

type GetShopsShopResponseDefault struct {
	Code int
}

func (GetShopsShopResponseDefault) Write

type HTTPClient

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

type HTTPClientFunc

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

func (HTTPClientFunc) Do

type Maybe

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

func Just

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

func (*Maybe[T]) Set

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

type PostShopsShopHandlerFunc

type PostShopsShopHandlerFunc func(ctx context.Context, r PostShopsShopRequest) PostShopsShopResponse

func (PostShopsShopHandlerFunc) ServeHTTP

type PostShopsShopParams

type PostShopsShopParams struct {
	Query PostShopsShopParamsQuery

	Path PostShopsShopParamsPath

	Headers PostShopsShopParamsHeaders
}

func (PostShopsShopParams) HTTP

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

func (PostShopsShopParams) Parse

type PostShopsShopParamsHeaders added in v0.1.18

type PostShopsShopParamsHeaders struct {
	QueryID Maybe[string]
}

type PostShopsShopParamsPath added in v0.1.18

type PostShopsShopParamsPath struct {
	Shop string
}

type PostShopsShopParamsQuery added in v0.1.18

type PostShopsShopParamsQuery struct {
	Page Maybe[int32]
}

type PostShopsShopRequest

type PostShopsShopRequest interface {
	HTTP() *http.Request
	Parse() (PostShopsShopParams, error)
}

func PostShopsShopHTTPRequest

func PostShopsShopHTTPRequest(r *http.Request) PostShopsShopRequest

type PostShopsShopResponse

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

func NewPostShopsShopResponse200

func NewPostShopsShopResponse200() PostShopsShopResponse

func NewPostShopsShopResponseDefault

func NewPostShopsShopResponseDefault(code int) PostShopsShopResponse

type PostShopsShopResponse200

type PostShopsShopResponse200 struct{}

func (PostShopsShopResponse200) Write

type PostShopsShopResponseDefault

type PostShopsShopResponseDefault struct {
	Code int
}

func (PostShopsShopResponseDefault) Write

Jump to

Keyboard shortcuts

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