test

package
v0.1.29 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const SpecFile string = `` /* 828-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 {
	PostShopsNewHandler        PostShopsNewHandlerFunc
	GetShopsShopHandler        GetShopsShopHandlerFunc
	GetShopsShopReviewsHandler GetShopsShopReviewsHandlerFunc

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

func (API) TestClient added in v0.1.28

func (a API) TestClient() *Client

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

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

GetShopsShop GET /shops/{shop}

func (*Client) GetShopsShopReviews added in v0.0.2

func (c *Client) GetShopsShopReviews(ctx context.Context, request GetShopsShopReviewsParams) (GetShopsShopReviewsResponse, error)

GetShopsShopReviews GET /shops/{shop}/reviews

func (*Client) PostShopsNew added in v0.0.2

func (c *Client) PostShopsNew(ctx context.Context, request PostShopsNewParams) (PostShopsNewResponse, error)

PostShopsNew POST /shops/new

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 GetShopsShopHandlerFunc

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

func (GetShopsShopHandlerFunc) ServeHTTP

type GetShopsShopParams added in v0.0.3

type GetShopsShopParams struct {
	Query GetShopsShopParamsQuery

	Path GetShopsShopParamsPath
}

func (GetShopsShopParams) HTTP added in v0.0.3

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

func (GetShopsShopParams) Parse added in v0.0.3

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

func GetShopsShopHTTPRequest(r *http.Request) GetShopsShopRequest

type GetShopsShopResponse added in v0.0.2

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

func NewGetShopsShopResponse200 added in v0.0.2

func NewGetShopsShopResponse200() GetShopsShopResponse

func NewGetShopsShopResponseDefault added in v0.0.2

func NewGetShopsShopResponseDefault(code int) GetShopsShopResponse

type GetShopsShopResponse200

type GetShopsShopResponse200 struct{}

func (GetShopsShopResponse200) Write added in v0.0.2

type GetShopsShopResponseDefault

type GetShopsShopResponseDefault struct {
	Code int
}

func (GetShopsShopResponseDefault) Write added in v0.0.2

type GetShopsShopReviewsHandlerFunc

type GetShopsShopReviewsHandlerFunc func(ctx context.Context, r GetShopsShopReviewsRequest) GetShopsShopReviewsResponse

func (GetShopsShopReviewsHandlerFunc) ServeHTTP

type GetShopsShopReviewsParams added in v0.0.3

type GetShopsShopReviewsParams struct {
	Query GetShopsShopReviewsParamsQuery

	Path GetShopsShopReviewsParamsPath
}

func (GetShopsShopReviewsParams) HTTP added in v0.0.3

func (GetShopsShopReviewsParams) Parse added in v0.0.3

type GetShopsShopReviewsParamsPath added in v0.1.18

type GetShopsShopReviewsParamsPath struct {
	Shop string
}

type GetShopsShopReviewsParamsQuery added in v0.1.18

type GetShopsShopReviewsParamsQuery struct {
	Page Maybe[int32]
}

type GetShopsShopReviewsRequest

type GetShopsShopReviewsRequest interface {
	HTTP() *http.Request
	Parse() (GetShopsShopReviewsParams, error)
}

func GetShopsShopReviewsHTTPRequest added in v0.0.2

func GetShopsShopReviewsHTTPRequest(r *http.Request) GetShopsShopReviewsRequest

type GetShopsShopReviewsResponse added in v0.0.2

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

func NewGetShopsShopReviewsResponse200 added in v0.0.2

func NewGetShopsShopReviewsResponse200() GetShopsShopReviewsResponse

func NewGetShopsShopReviewsResponseDefault added in v0.0.2

func NewGetShopsShopReviewsResponseDefault(code int) GetShopsShopReviewsResponse

type GetShopsShopReviewsResponse200

type GetShopsShopReviewsResponse200 struct{}

func (GetShopsShopReviewsResponse200) Write added in v0.0.2

type GetShopsShopReviewsResponseDefault

type GetShopsShopReviewsResponseDefault struct {
	Code int
}

func (GetShopsShopReviewsResponseDefault) Write added in v0.0.2

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 Nothing added in v0.1.27

func Nothing[T any]() Maybe[T]

func (Maybe[T]) Get added in v0.1.27

func (m Maybe[T]) Get() (zero T, _ bool)

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

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

type Nullable added in v0.1.25

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

func Null added in v0.1.27

func Null[T any]() Nullable[T]

func Pointer added in v0.1.27

func Pointer[T any](v T) Nullable[T]

func (Nullable[T]) Get added in v0.1.27

func (m Nullable[T]) Get() (zero T, _ bool)

func (Nullable[T]) MarshalJSON added in v0.1.28

func (m Nullable[T]) MarshalJSON() ([]byte, error)

func (*Nullable[T]) Set added in v0.1.25

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

func (*Nullable[T]) UnmarshalJSON added in v0.1.28

func (m *Nullable[T]) UnmarshalJSON(bs []byte) error

type PostShopsNewHandlerFunc

type PostShopsNewHandlerFunc func(ctx context.Context, r PostShopsNewRequest) PostShopsNewResponse

func (PostShopsNewHandlerFunc) ServeHTTP

type PostShopsNewParams added in v0.0.3

type PostShopsNewParams struct {
	Query PostShopsNewParamsQuery
}

func (PostShopsNewParams) HTTP added in v0.0.3

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

func (PostShopsNewParams) Parse added in v0.0.3

type PostShopsNewParamsQuery added in v0.1.18

type PostShopsNewParamsQuery struct {
	Page Maybe[int32]
}

type PostShopsNewRequest

type PostShopsNewRequest interface {
	HTTP() *http.Request
	Parse() (PostShopsNewParams, error)
}

func PostShopsNewHTTPRequest added in v0.0.2

func PostShopsNewHTTPRequest(r *http.Request) PostShopsNewRequest

type PostShopsNewResponse added in v0.0.2

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

func NewPostShopsNewResponse200 added in v0.0.2

func NewPostShopsNewResponse200() PostShopsNewResponse

func NewPostShopsNewResponseDefault added in v0.0.2

func NewPostShopsNewResponseDefault(code int) PostShopsNewResponse

type PostShopsNewResponse200

type PostShopsNewResponse200 struct{}

func (PostShopsNewResponse200) Write added in v0.0.2

type PostShopsNewResponseDefault

type PostShopsNewResponseDefault struct {
	Code int
}

func (PostShopsNewResponseDefault) Write added in v0.0.2

Jump to

Keyboard shortcuts

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