test

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const SpecFile string = `` /* 3645-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 {
	GetHandler                 GetHandlerFunc
	GetShopsHandler            GetShopsHandlerFunc
	GetShopsRTHandler          GetShopsRTHandlerFunc
	GetShopsActivateHandler    GetShopsActivateHandlerFunc
	GetShopsActivateRTHandler  GetShopsActivateRTHandlerFunc
	GetShopsActivateTagHandler GetShopsActivateTagHandlerFunc
	GetShopsShopHandler        GetShopsShopHandlerFunc
	GetShopsShopRTHandler      GetShopsShopRTHandlerFunc
	GetShopsShopPetsHandler    GetShopsShopPetsHandlerFunc
	ReviewShopHandler          ReviewShopHandlerFunc

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

func (c *Client) Get(ctx context.Context, request GetParams) (GetResponse, error)

Get - GET /

func (*Client) GetShops

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

GetShops - GET /shops

func (*Client) GetShopsActivate

func (c *Client) GetShopsActivate(ctx context.Context, request GetShopsActivateParams) (GetShopsActivateResponse, error)

GetShopsActivate - GET /shops/activate

func (*Client) GetShopsActivateRT

func (c *Client) GetShopsActivateRT(ctx context.Context, request GetShopsActivateRTParams) (GetShopsActivateRTResponse, error)

GetShopsActivateRT - GET /shops/activate/

func (*Client) GetShopsActivateTag

func (c *Client) GetShopsActivateTag(ctx context.Context, request GetShopsActivateTagParams) (GetShopsActivateTagResponse, error)

GetShopsActivateTag - GET /shops/activate/tag

func (*Client) GetShopsRT

func (c *Client) GetShopsRT(ctx context.Context, request GetShopsRTParams) (GetShopsRTResponse, error)

GetShopsRT - GET /shops/

func (*Client) GetShopsShop

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

GetShopsShop - GET /shops/{shop}

func (*Client) GetShopsShopPets

func (c *Client) GetShopsShopPets(ctx context.Context, request GetShopsShopPetsParams) (GetShopsShopPetsResponse, error)

GetShopsShopPets - GET /shops/{shop}/pets

func (*Client) GetShopsShopRT

func (c *Client) GetShopsShopRT(ctx context.Context, request GetShopsShopRTParams) (GetShopsShopRTResponse, error)

GetShopsShopRT - GET /shops/{shop}/

func (*Client) ReviewShop added in v0.0.5

func (c *Client) ReviewShop(ctx context.Context, request ReviewShopParams) (ReviewShopResponse, error)

ReviewShop - POST /shops/{shop}/review

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 Error

type Error struct {
	Message string `json:"message"`
}

type GetHandlerFunc

type GetHandlerFunc func(r GetRequest) GetResponse

func (GetHandlerFunc) ServeHTTP

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

type GetParams added in v0.0.3

type GetParams struct {
}

func (GetParams) HTTP added in v0.0.3

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

func (GetParams) Parse added in v0.0.3

func (r GetParams) Parse() GetParams

type GetRequest

type GetRequest interface {
	HTTP() *http.Request
	Parse() GetParams
}

func GetHTTPRequest

func GetHTTPRequest(r *http.Request) GetRequest

type GetResponse

type GetResponse interface {
	Write(w http.ResponseWriter)
	// contains filtered or unexported methods
}

func NewGetResponseDefault

func NewGetResponseDefault(code int) GetResponse

type GetResponseDefault

type GetResponseDefault struct {
	Code int
}

func (GetResponseDefault) Write

type GetShopsActivateHandlerFunc

type GetShopsActivateHandlerFunc func(r GetShopsActivateRequest) GetShopsActivateResponse

func (GetShopsActivateHandlerFunc) ServeHTTP

type GetShopsActivateParams added in v0.0.3

type GetShopsActivateParams struct {
}

func (GetShopsActivateParams) HTTP added in v0.0.3

func (GetShopsActivateParams) Parse added in v0.0.3

type GetShopsActivateRTHandlerFunc

type GetShopsActivateRTHandlerFunc func(r GetShopsActivateRTRequest) GetShopsActivateRTResponse

func (GetShopsActivateRTHandlerFunc) ServeHTTP

type GetShopsActivateRTParams added in v0.0.3

type GetShopsActivateRTParams struct {
}

func (GetShopsActivateRTParams) HTTP added in v0.0.3

func (GetShopsActivateRTParams) Parse added in v0.0.3

type GetShopsActivateRTRequest

type GetShopsActivateRTRequest interface {
	HTTP() *http.Request
	Parse() GetShopsActivateRTParams
}

func GetShopsActivateRTHTTPRequest

func GetShopsActivateRTHTTPRequest(r *http.Request) GetShopsActivateRTRequest

type GetShopsActivateRTResponse

type GetShopsActivateRTResponse interface {
	Write(w http.ResponseWriter)
	// contains filtered or unexported methods
}

func NewGetShopsActivateRTResponseDefault

func NewGetShopsActivateRTResponseDefault(code int) GetShopsActivateRTResponse

type GetShopsActivateRTResponseDefault

type GetShopsActivateRTResponseDefault struct {
	Code int
}

func (GetShopsActivateRTResponseDefault) Write

type GetShopsActivateRequest

type GetShopsActivateRequest interface {
	HTTP() *http.Request
	Parse() GetShopsActivateParams
}

func GetShopsActivateHTTPRequest

func GetShopsActivateHTTPRequest(r *http.Request) GetShopsActivateRequest

type GetShopsActivateResponse

type GetShopsActivateResponse interface {
	Write(w http.ResponseWriter)
	// contains filtered or unexported methods
}

func NewGetShopsActivateResponseDefault

func NewGetShopsActivateResponseDefault(code int) GetShopsActivateResponse

type GetShopsActivateResponseDefault

type GetShopsActivateResponseDefault struct {
	Code int
}

func (GetShopsActivateResponseDefault) Write

type GetShopsActivateTagHandlerFunc

type GetShopsActivateTagHandlerFunc func(r GetShopsActivateTagRequest) GetShopsActivateTagResponse

func (GetShopsActivateTagHandlerFunc) ServeHTTP

type GetShopsActivateTagParams added in v0.0.3

type GetShopsActivateTagParams struct {
}

func (GetShopsActivateTagParams) HTTP added in v0.0.3

func (GetShopsActivateTagParams) Parse added in v0.0.3

type GetShopsActivateTagRequest

type GetShopsActivateTagRequest interface {
	HTTP() *http.Request
	Parse() GetShopsActivateTagParams
}

func GetShopsActivateTagHTTPRequest

func GetShopsActivateTagHTTPRequest(r *http.Request) GetShopsActivateTagRequest

type GetShopsActivateTagResponse

type GetShopsActivateTagResponse interface {
	Write(w http.ResponseWriter)
	// contains filtered or unexported methods
}

func NewGetShopsActivateTagResponseDefault

func NewGetShopsActivateTagResponseDefault(code int) GetShopsActivateTagResponse

type GetShopsActivateTagResponseDefault

type GetShopsActivateTagResponseDefault struct {
	Code int
}

func (GetShopsActivateTagResponseDefault) Write

type GetShopsHandlerFunc

type GetShopsHandlerFunc func(r GetShopsRequest) GetShopsResponse

func (GetShopsHandlerFunc) ServeHTTP

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

type GetShopsParams added in v0.0.3

type GetShopsParams struct {
}

func (GetShopsParams) HTTP added in v0.0.3

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

func (GetShopsParams) Parse added in v0.0.3

func (r GetShopsParams) Parse() GetShopsParams

type GetShopsRTHandlerFunc

type GetShopsRTHandlerFunc func(r GetShopsRTRequest) GetShopsRTResponse

func (GetShopsRTHandlerFunc) ServeHTTP

type GetShopsRTParams added in v0.0.3

type GetShopsRTParams struct {
}

func (GetShopsRTParams) HTTP added in v0.0.3

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

func (GetShopsRTParams) Parse added in v0.0.3

type GetShopsRTRequest

type GetShopsRTRequest interface {
	HTTP() *http.Request
	Parse() GetShopsRTParams
}

func GetShopsRTHTTPRequest

func GetShopsRTHTTPRequest(r *http.Request) GetShopsRTRequest

type GetShopsRTResponse

type GetShopsRTResponse interface {
	Write(w http.ResponseWriter)
	// contains filtered or unexported methods
}

func NewGetShopsRTResponseDefault

func NewGetShopsRTResponseDefault(code int) GetShopsRTResponse

type GetShopsRTResponseDefault

type GetShopsRTResponseDefault struct {
	Code int
}

func (GetShopsRTResponseDefault) Write

type GetShopsRequest

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

func GetShopsHTTPRequest

func GetShopsHTTPRequest(r *http.Request) GetShopsRequest

type GetShopsResponse

type GetShopsResponse interface {
	Write(w http.ResponseWriter)
	// contains filtered or unexported methods
}

func NewGetShopsResponseDefault

func NewGetShopsResponseDefault(code int) GetShopsResponse

type GetShopsResponseDefault

type GetShopsResponseDefault struct {
	Code int
}

func (GetShopsResponseDefault) Write

type GetShopsShopHandlerFunc

type GetShopsShopHandlerFunc func(r GetShopsShopRequest) GetShopsShopResponse

func (GetShopsShopHandlerFunc) ServeHTTP

type GetShopsShopParams added in v0.0.3

type GetShopsShopParams struct {
	Path struct {
		Shop int32
	}
}

func (GetShopsShopParams) HTTP added in v0.0.3

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

func (GetShopsShopParams) Parse added in v0.0.3

type GetShopsShopPetsHandlerFunc

type GetShopsShopPetsHandlerFunc func(r GetShopsShopPetsRequest) GetShopsShopPetsResponse

func (GetShopsShopPetsHandlerFunc) ServeHTTP

type GetShopsShopPetsParams added in v0.0.3

type GetShopsShopPetsParams struct {
	Query struct {
		Page *int32

		PageSize int32
	}

	Path struct {
		Shop int32
	}
}

func (GetShopsShopPetsParams) HTTP added in v0.0.3

func (GetShopsShopPetsParams) Parse added in v0.0.3

type GetShopsShopPetsRequest

type GetShopsShopPetsRequest interface {
	HTTP() *http.Request
	Parse() (GetShopsShopPetsParams, error)
}

func GetShopsShopPetsHTTPRequest

func GetShopsShopPetsHTTPRequest(r *http.Request) GetShopsShopPetsRequest

type GetShopsShopPetsResponse

type GetShopsShopPetsResponse interface {
	Write(w http.ResponseWriter)
	// contains filtered or unexported methods
}

func NewGetShopsShopPetsResponseDefaultJSON

func NewGetShopsShopPetsResponseDefaultJSON(code int, body Error) GetShopsShopPetsResponse

type GetShopsShopPetsResponse200JSON

type GetShopsShopPetsResponse200JSON struct {
	Body    GetShopsShopPetsResponse200JSONBody
	Headers struct {
		Body  GetShopsShopPetsResponse200JSONBody
		XNext string
	}
}

func (GetShopsShopPetsResponse200JSON) Write

type GetShopsShopPetsResponse200JSONBody

type GetShopsShopPetsResponse200JSONBody struct {
	Groups map[string]Pets `json:"groups"`
}

type GetShopsShopPetsResponseDefaultJSON

type GetShopsShopPetsResponseDefaultJSON struct {
	Code int
	Body Error
}

func (GetShopsShopPetsResponseDefaultJSON) Write

type GetShopsShopRTHandlerFunc

type GetShopsShopRTHandlerFunc func(r GetShopsShopRTRequest) GetShopsShopRTResponse

func (GetShopsShopRTHandlerFunc) ServeHTTP

type GetShopsShopRTParams added in v0.0.3

type GetShopsShopRTParams struct {
	Path struct {
		Shop int32
	}
}

func (GetShopsShopRTParams) HTTP added in v0.0.3

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

func (GetShopsShopRTParams) Parse added in v0.0.3

type GetShopsShopRTRequest

type GetShopsShopRTRequest interface {
	HTTP() *http.Request
	Parse() (GetShopsShopRTParams, error)
}

func GetShopsShopRTHTTPRequest

func GetShopsShopRTHTTPRequest(r *http.Request) GetShopsShopRTRequest

type GetShopsShopRTResponse

type GetShopsShopRTResponse interface {
	Write(w http.ResponseWriter)
	// contains filtered or unexported methods
}

func NewGetShopsShopRTResponseDefault

func NewGetShopsShopRTResponseDefault(code int) GetShopsShopRTResponse

type GetShopsShopRTResponseDefault

type GetShopsShopRTResponseDefault struct {
	Code int
}

func (GetShopsShopRTResponseDefault) Write

type GetShopsShopRequest

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

func GetShopsShopHTTPRequest

func GetShopsShopHTTPRequest(r *http.Request) GetShopsShopRequest

type GetShopsShopResponse

type GetShopsShopResponse interface {
	Write(w http.ResponseWriter)
	// contains filtered or unexported methods
}

func NewGetShopsShopResponseDefault

func NewGetShopsShopResponseDefault(code int) GetShopsShopResponse

type GetShopsShopResponseDefault

type GetShopsShopResponseDefault struct {
	Code int
}

func (GetShopsShopResponseDefault) Write

type HTTPClient

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

type NewPet

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

type Pet

type Pet struct {
	NewPet
	ID int64 `json:"id"`
}

type Pets

type Pets []Pet

type ReviewShopHandlerFunc added in v0.0.5

type ReviewShopHandlerFunc func(r ReviewShopRequest) ReviewShopResponse

func (ReviewShopHandlerFunc) ServeHTTP added in v0.0.5

type ReviewShopParams added in v0.0.5

type ReviewShopParams struct {
	Query struct {
		Page *int32

		PageSize int32

		Tag []string

		Filter []int32
	}

	Path struct {
		Shop int32
	}

	Headers struct {
		RequestID *string

		UserID string
	}

	Body NewPet
}

func (ReviewShopParams) HTTP added in v0.0.5

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

func (ReviewShopParams) Parse added in v0.0.5

type ReviewShopRequest added in v0.0.5

type ReviewShopRequest interface {
	HTTP() *http.Request
	Parse() (ReviewShopParams, error)
}

func ReviewShopHTTPRequest added in v0.0.5

func ReviewShopHTTPRequest(r *http.Request) ReviewShopRequest

type ReviewShopResponse added in v0.0.5

type ReviewShopResponse interface {
	Write(w http.ResponseWriter)
	// contains filtered or unexported methods
}

func NewReviewShopResponse200JSON added in v0.0.5

func NewReviewShopResponse200JSON(body Pet, xNext string) ReviewShopResponse

func NewReviewShopResponseDefaultJSON added in v0.0.5

func NewReviewShopResponseDefaultJSON(code int, body Error) ReviewShopResponse

type ReviewShopResponse200JSON added in v0.0.5

type ReviewShopResponse200JSON struct {
	Body    Pet
	Headers struct {
		Body  Pet
		XNext string
	}
}

func (ReviewShopResponse200JSON) Write added in v0.0.5

type ReviewShopResponseDefaultJSON added in v0.0.5

type ReviewShopResponseDefaultJSON struct {
	Code int
	Body Error
}

func (ReviewShopResponseDefaultJSON) Write added in v0.0.5

Jump to

Keyboard shortcuts

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