apidemicclient

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Endpoint   string     `json:"endpoint"`
	HTTPMethod string     `json:"http_method"`
	Any        *Response  `json:"any,omitempty"`
	Exactly    []Response `json:"exactly,omitempty"`
}

type Client

type Client struct {
	HTTPHost string
	// contains filtered or unexported fields
}

func New

func New(host string, port int) *Client

func NewAndReset

func NewAndReset(host string, port int) *Client

func (*Client) History

func (c *Client) History() ([]HistoryEntry, error)

func (*Client) HistoryFor

func (c *Client) HistoryFor(endpoint string) ([]HistoryEntry, error)

func (*Client) MustHistory

func (c *Client) MustHistory() []HistoryEntry

func (*Client) MustHistoryFor

func (c *Client) MustHistoryFor(endpoint string) []HistoryEntry

func (*Client) MustRegister

func (c *Client) MustRegister(api API)

func (*Client) MustRegisterAny

func (c *Client) MustRegisterAny(endpoint, httpMethod string, response interface{}, responseStatus int)

func (*Client) MustReset

func (c *Client) MustReset()

func (*Client) Register

func (c *Client) Register(api API) error

func (*Client) RegisterAny

func (c *Client) RegisterAny(endpoint, httpMethod string, response interface{}, responseStatus int) error

func (*Client) Reset

func (c *Client) Reset() error

func (*Client) URL

func (c *Client) URL(endpoint string) string

type HistoryEntry

type HistoryEntry struct {
	Endpoint       string                 `json:"endpoint"`
	Body           string                 `json:"body"`
	Headers        map[string][]string    `json:"headers"`
	ResponseStatus int                    `json:"response_status"`
	ResponseBody   map[string]interface{} `json:"response_body"`
}

type Response

type Response struct {
	Code    int         `json:"code"`
	Payload interface{} `json:"payload"`
}

Jump to

Keyboard shortcuts

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