ezapi
import "github.com/paijerry/ezapi"
Install
go get -u -v "github.com/paijerry/ezapi"
Overview
Package ezapi can help you call api easier
Index
- type EzAPI
- func New() *EzAPI
- func (ez *EzAPI) Do(method string) (rspn Rspn, err error)
- func (ez *EzAPI) Form(form url.Values) *EzAPI
- func (ez *EzAPI) FormData(form url.Values) *EzAPI
- func (ez *EzAPI) Header(header http.Header) *EzAPI
- func (ez *EzAPI) JSON(body []byte) *EzAPI
- func (ez *EzAPI) URL(url string) *EzAPI
- func (ez *EzAPI) URLQuery(urlquery url.Values) *EzAPI
- type Rspn
Package files
type EzAPI
type EzAPI struct {
// contains filtered or unexported fields
}
EzAPI is the main struct of this package
func New
func New() *EzAPI
New create an EzAPI object
func (*EzAPI) Do
func (ez *EzAPI) Do(method string) (rspn Rspn, err error)
Do the http request
func (*EzAPI) Form
func (ez *EzAPI) Form(form url.Values) *EzAPI
Form add form("application/x-www-form-urlencoded") by a url.Values object ("Content-Type", "application/x-www-form-urlencoded")
func (*EzAPI) FormData
func (ez *EzAPI) FormData(form url.Values) *EzAPI
FormData add formdata by a url.Values object (no Content-Type)
func (*EzAPI) Header
func (ez *EzAPI) Header(header http.Header) *EzAPI
Header add head by a http.Header object
func (*EzAPI) JSON
func (ez *EzAPI) JSON(body []byte) *EzAPI
JSON add json of []byte
func (*EzAPI) URL
func (ez *EzAPI) URL(url string) *EzAPI
URL set url
func (*EzAPI) URLQuery
func (ez *EzAPI) URLQuery(urlquery url.Values) *EzAPI
URLQuery add urlquery into url
type Rspn
type Rspn struct {
Header http.Header
Body []byte
StatusCode int
}
Rspn - contains response data
Generated by godoc2md