test

package
v0.1.15 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const SpecFile string = `` /* 2881-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 {
	GetReviewsHandler GetReviewsHandlerFunc

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

type Client struct {
	BaseURL    string
	HTTPClient HTTPClient
}

func NewClient

func NewClient(baseURL string, httpClient HTTPClient) *Client

func (*Client) GetReviews

func (c *Client) GetReviews(ctx context.Context, request GetReviewsParams) (GetReviewsResponse, error)

GetReviews - GET /shops/{shop}/reviews

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 GetReviewsHandlerFunc

type GetReviewsHandlerFunc func(ctx context.Context, r GetReviewsRequest) GetReviewsResponse

func (GetReviewsHandlerFunc) ServeHTTP

type GetReviewsParams

type GetReviewsParams struct {
	Query struct {
		IntReq int

		Int Maybe[int]

		Int32Req int32

		Int32 Maybe[int32]

		Int64Req int64

		Int64 Maybe[int64]

		Float32Req float32

		Float32 Maybe[float32]

		Float64Req float64

		Float64 Maybe[float64]

		StringReq string

		String Maybe[string]

		Tag Maybe[[]string]

		Filter Maybe[[]int32]
	}

	Path struct {
		Shop int32
	}

	Headers struct {
		RequestID Maybe[string]

		UserID string
	}
}

func (GetReviewsParams) HTTP

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

func (GetReviewsParams) Parse

type GetReviewsRequest

type GetReviewsRequest interface {
	HTTP() *http.Request
	Parse() (GetReviewsParams, error)
}

func GetReviewsHTTPRequest

func GetReviewsHTTPRequest(r *http.Request) GetReviewsRequest

type GetReviewsResponse

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

func NewGetReviewsResponseDefault

func NewGetReviewsResponseDefault(code int) GetReviewsResponse

type GetReviewsResponseDefault

type GetReviewsResponseDefault struct {
	Code int
}

func (GetReviewsResponseDefault) Write

type HTTPClient

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)

Jump to

Keyboard shortcuts

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