test

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const SpecFile string = `` /* 305-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 {
	PostLoginHandler PostLoginHandlerFunc
	PostShopsHandler PostShopsHandlerFunc

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

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

	SecurityBearerAuth SecurityBearerAuthMiddleware
}

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

func (c *Client) PostLogin(ctx context.Context, request PostLoginParams) (PostLoginResponse, error)

PostLogin - POST /login

func (*Client) PostShops

func (c *Client) PostShops(ctx context.Context, request PostShopsParams) (PostShopsResponse, error)

PostShops - POST /shops

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

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

type HTTPClientFunc

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

func (HTTPClientFunc) Do

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 PostLoginHandlerFunc

type PostLoginHandlerFunc func(ctx context.Context, r PostLoginRequest) PostLoginResponse

func (PostLoginHandlerFunc) ServeHTTP

type PostLoginParams

type PostLoginParams struct {
}

func (PostLoginParams) HTTP

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

func (PostLoginParams) Parse

func (r PostLoginParams) Parse() PostLoginParams

type PostLoginRequest

type PostLoginRequest interface {
	HTTP() *http.Request
	Parse() PostLoginParams
}

func PostLoginHTTPRequest

func PostLoginHTTPRequest(r *http.Request) PostLoginRequest

type PostLoginResponse

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

func NewPostLoginResponse200

func NewPostLoginResponse200() PostLoginResponse

func NewPostLoginResponse401

func NewPostLoginResponse401() PostLoginResponse

type PostLoginResponse200

type PostLoginResponse200 struct{}

func (PostLoginResponse200) Write

type PostLoginResponse401

type PostLoginResponse401 struct{}

func (PostLoginResponse401) Write

type PostShopsHandlerFunc

type PostShopsHandlerFunc func(ctx context.Context, r PostShopsRequest) PostShopsResponse

func (PostShopsHandlerFunc) ServeHTTP

type PostShopsParams

type PostShopsParams struct {
	Headers struct {

		// Authorization - JWT
		Authorization string
	}
}

func (PostShopsParams) HTTP

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

func (PostShopsParams) Parse

func (r PostShopsParams) Parse() (PostShopsParams, error)

type PostShopsRequest

type PostShopsRequest interface {
	HTTP() *http.Request
	Parse() (PostShopsParams, error)
}

func PostShopsHTTPRequest

func PostShopsHTTPRequest(r *http.Request) PostShopsRequest

type PostShopsResponse

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

func NewPostShopsResponse200

func NewPostShopsResponse200() PostShopsResponse

func NewPostShopsResponse401

func NewPostShopsResponse401() PostShopsResponse

type PostShopsResponse200

type PostShopsResponse200 struct{}

func (PostShopsResponse200) Write

type PostShopsResponse401

type PostShopsResponse401 struct{}

func (PostShopsResponse401) Write

type SecurityBearerAuthMiddleware

type SecurityBearerAuthMiddleware func(w http.ResponseWriter, r *http.Request, token string, next http.Handler)

func (SecurityBearerAuthMiddleware) Middleware

Jump to

Keyboard shortcuts

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