test

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const SpecFile string = `` /* 2313-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 {
	GetShopsShopHandler GetShopsShopHandlerFunc

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

type Client struct {
	BaseURL    string
	HTTPClient HTTPClient
}

func NewClient

func NewClient(baseURL string, httpClient HTTPClient) *Client

func (*Client) GetShopsShop

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

GetShopsShop GET /shops/{shop}

type Environment added in v0.1.29

type Environment = pkg.Environment

type EnvironmentSchema added in v0.1.29

type EnvironmentSchema struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

func (EnvironmentSchema) MarshalJSON added in v0.1.29

func (c EnvironmentSchema) MarshalJSON() ([]byte, error)

func (*EnvironmentSchema) UnmarshalJSON added in v0.1.29

func (c *EnvironmentSchema) UnmarshalJSON(bs []byte) error

type Environments added in v0.1.29

type Environments = pkg.Nullable[[]Environment]

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

type GetShop struct {
	Environments pkg.Maybe[Environments] `json:"environments"`
	Metadata     Metadata                `json:"metadata"`
	Settings     pkg.Maybe[Settings]     `json:"settings"`
}

func (GetShop) MarshalJSON added in v0.1.29

func (c GetShop) MarshalJSON() ([]byte, error)

func (*GetShop) UnmarshalJSON added in v0.1.29

func (c *GetShop) UnmarshalJSON(bs []byte) error

type GetShopsShopHandlerFunc

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

func (GetShopsShopHandlerFunc) ServeHTTP

type GetShopsShopParams

type GetShopsShopParams struct {
	Query GetShopsShopParamsQuery

	Path GetShopsShopParamsPath

	Body GetShop
}

func (GetShopsShopParams) HTTP

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

func (GetShopsShopParams) Parse

type GetShopsShopParamsPath added in v0.1.18

type GetShopsShopParamsPath struct {
	Shop pkg.Shop
}

type GetShopsShopParamsQuery added in v0.1.18

type GetShopsShopParamsQuery struct {
	PageSchemaRefQuery pkg.Maybe[PageCustom]

	PageCustomTypeQuery pkg.Maybe[pkg.PageCustomTypeQuery]
}

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 NewGetShopsShopResponse200JSON

func NewGetShopsShopResponse200JSON(body Shop) GetShopsShopResponse

func NewGetShopsShopResponseDefault

func NewGetShopsShopResponseDefault(code int) GetShopsShopResponse

type GetShopsShopResponse200JSON

type GetShopsShopResponse200JSON struct {
	Body Shop
}

GetShopsShopResponse200JSON - Shop response

func (GetShopsShopResponse200JSON) Write

type GetShopsShopResponseDefault

type GetShopsShopResponseDefault struct {
	Code int
}

GetShopsShopResponseDefault - Error response

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

type Metadata = pkg.Metadata

type MetadataSchema added in v0.1.29

type MetadataSchema struct {
	InnerID pkg.Maybe[string] `json:"inner_id"`
}

func (MetadataSchema) MarshalJSON added in v0.1.29

func (c MetadataSchema) MarshalJSON() ([]byte, error)

func (*MetadataSchema) UnmarshalJSON added in v0.1.29

func (c *MetadataSchema) UnmarshalJSON(bs []byte) error

type PageCustom

type PageCustom = pkg.Page

type PageCustomSchema added in v0.1.29

type PageCustomSchema string

func NewPageCustomSchema added in v0.1.29

func NewPageCustomSchema(v string) PageCustomSchema

func (PageCustomSchema) String added in v0.1.29

func (c PageCustomSchema) String() string

type Settings added in v0.1.29

type Settings = pkg.Nullable[pkg.Settings]

type SettingsSchema added in v0.1.29

type SettingsSchema struct {
	Theme pkg.Maybe[string] `json:"theme"`
}

func (SettingsSchema) MarshalJSON added in v0.1.29

func (c SettingsSchema) MarshalJSON() ([]byte, error)

func (*SettingsSchema) UnmarshalJSON added in v0.1.29

func (c *SettingsSchema) UnmarshalJSON(bs []byte) error

type Shop

type Shop ShopName

func NewShop added in v0.1.23

func NewShop(v ShopName) Shop

func (Shop) ShopName added in v0.1.23

func (c Shop) ShopName() ShopName

type ShopName

type ShopName = pkg.Page

type ShopNameSchema added in v0.1.29

type ShopNameSchema int64

func NewShopNameSchema added in v0.1.29

func NewShopNameSchema(v int64) ShopNameSchema

func (ShopNameSchema) Int64 added in v0.1.29

func (c ShopNameSchema) Int64() int64

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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