test

package
v0.1.34 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const SpecFile string = `` /* 616-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 {
	GetPetsHandler GetPetsHandlerFunc

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

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

func (c *Client) GetPets(ctx context.Context, request GetPetsParams) (GetPetsResponse, error)

GetPets GET /pets

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 GetPetsHandlerFunc

type GetPetsHandlerFunc func(ctx context.Context, r GetPetsRequest) GetPetsResponse

func (GetPetsHandlerFunc) ServeHTTP

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

type GetPetsParams

type GetPetsParams struct {
}

func (GetPetsParams) HTTP

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

func (GetPetsParams) Parse

func (r GetPetsParams) Parse() GetPetsParams

type GetPetsRequest

type GetPetsRequest interface {
	HTTP() *http.Request
	Parse() GetPetsParams
}

func GetPetsHTTPRequest

func GetPetsHTTPRequest(r *http.Request) GetPetsRequest

type GetPetsResponse

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

func NewGetPetsResponse200JSON

func NewGetPetsResponse200JSON(body GetPetsResponse200JSONBody) GetPetsResponse

type GetPetsResponse200JSON

type GetPetsResponse200JSON struct {
	Body GetPetsResponse200JSONBody
}

GetPetsResponse200JSON - OK

func (GetPetsResponse200JSON) Write

type GetPetsResponse200JSONBody

type GetPetsResponse200JSONBody struct {
	Array    []string
	Nullable Nullable[[]string]
}

func (GetPetsResponse200JSONBody) MarshalJSON

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

func (*GetPetsResponse200JSONBody) UnmarshalJSON

func (c *GetPetsResponse200JSONBody) UnmarshalJSON(bs []byte) 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

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

func Just

func Just[T any](v T) Maybe[T]

func Nothing

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

func (Maybe[T]) Get

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

func (*Maybe[T]) Set

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

type Nullable

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

func Null

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

func Pointer

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

func (Nullable[T]) Get

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

func (Nullable[T]) MarshalJSON

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

func (*Nullable[T]) Set

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

func (*Nullable[T]) UnmarshalJSON

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

Jump to

Keyboard shortcuts

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