request

package
v0.0.0-...-506c09b Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActiveDevEnvironment

func ActiveDevEnvironment()

func Delete

func Delete(ctx context.Context, endpoint string, funcs ...BuildParamFunc) ([]byte, error)

func Get

func Get(ctx context.Context, endpoint string, funcs ...BuildParamFunc) ([]byte, error)

func Post

func Post(ctx context.Context, endpoint string, funcs ...BuildParamFunc) ([]byte, error)

func Put

func Put(ctx context.Context, endpoint string, funcs ...BuildParamFunc) ([]byte, error)

Types

type BuildParamFunc

type BuildParamFunc func(p Param) error

func H

func H(key, value string) BuildParamFunc

H return a build param func that set header

func V

func V(key string, value interface{}) BuildParamFunc

V return a build param func that set values

type Pagination

type Pagination struct {
	NextCursor string `json:"nextCursor"`
	HasNext    bool   `json:"hasNext"`
}

type Param

type Param interface {
	// read url query
	Query() url.Values
	// read body
	Body() []byte
	// read header
	Header() http.Header
	// Set Value
	SetValue(key string, value interface{})
	// Set Header
	SetHeader(key, value string)
}

func NewJsonParam

func NewJsonParam() Param

func NewQueryParam

func NewQueryParam() Param

type Request

type Request struct {
	// contains filtered or unexported fields
}

func New

func New(method, endpoint string, param Param) (*Request, error)

func (*Request) Do

func (r *Request) Do(ctx context.Context) ([]byte, error)

Jump to

Keyboard shortcuts

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