Documentation
¶
Index ¶
- func Log(log xop.Log) *rest.RequestOpts
- type RequestOpts
- func (o *RequestOpts) AlwaysReadResponse() *RequestOpts
- func (o *RequestOpts) BodyIO(reader io.Reader) *RequestOpts
- func (o *RequestOpts) Cookie(cookie *http.Cookie) *RequestOpts
- func (o RequestOpts) Copy() *RequestOpts
- func (o *RequestOpts) Decode(statusCode int, target interface{}) *RequestOpts
- func (o *RequestOpts) DecodeWith(f func([]byte, interface{}) error) *RequestOpts
- func (o *RequestOpts) DecodeWithReader(f func(io.Reader, interface{}) error) *RequestOpts
- func (o *RequestOpts) Delete(url string) error
- func (o *RequestOpts) Describe(description string) *RequestOpts
- func (o *RequestOpts) Do() (result Result)
- func (o *RequestOpts) DoAfter(f func(Result) Result) *RequestOpts
- func (o *RequestOpts) DoBefore(f func(*RequestOpts, *http.Request) error) *RequestOpts
- func (o *RequestOpts) EncodeWith(f func(interface{}) ([]byte, error)) *RequestOpts
- func (o *RequestOpts) Get(url string) error
- func (o *RequestOpts) Head(url string) error
- func (o *RequestOpts) JSON() *RequestOpts
- func (o *RequestOpts) PathParam(name string, value interface{}) *RequestOpts
- func (o *RequestOpts) Post(url string) error
- func (o *RequestOpts) Put(url string) error
- func (o *RequestOpts) StrictJSON() *RequestOpts
- func (o *RequestOpts) WithBaseURL(url string) *RequestOpts
- func (o *RequestOpts) WithClient(client *http.Client) *RequestOpts
- func (o *RequestOpts) WithContext(ctx context.Context) *RequestOpts
- func (o *RequestOpts) WithData(data interface{}) *RequestOpts
- func (o *RequestOpts) WithMethod(m string) *RequestOpts
- func (o *RequestOpts) WithRaw(raw []byte) *RequestOpts
- func (o *RequestOpts) WithURL(url string) *RequestOpts
- func (o *RequestOpts) XML() *RequestOpts
- type RequestorFuncArg
- type Result
- func (r Result) Decode(statusCode int, target interface{}) Result
- func (r Result) Done() Result
- func (r Result) GetError() error
- func (r Result) HandleAfter() Result
- func (r Result) Raw() (*http.Response, error)
- func (r Result) ReadBody() Result
- func (r Result) Status() (int, error)
- func (r Result) WillDecode() Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type RequestOpts ¶
type RequestOpts struct {
// Log xm.Logger
URL string
BaseURL string
HasData bool
Data interface{}
HasRaw bool
Raw []byte
PathParams map[string]string
QueryParams url.Values
Encoder func(interface{}) ([]byte, error)
Decoder func([]byte, interface{}) error
DecodeReader func(io.Reader, interface{}) error
Method string
HasReader bool
Reader io.Reader
Client *http.Client
Cookies []*http.Cookie
Context context.Context
DecodeStatus map[int]interface{}
Before func(*RequestOpts, *http.Request) error
After func(Result) Result
AlwaysRead bool
Description string
}
func Make ¶
func Make() *RequestOpts
func (*RequestOpts) AlwaysReadResponse ¶
func (o *RequestOpts) AlwaysReadResponse() *RequestOpts
func (*RequestOpts) BodyIO ¶
func (o *RequestOpts) BodyIO(reader io.Reader) *RequestOpts
func (*RequestOpts) Cookie ¶
func (o *RequestOpts) Cookie(cookie *http.Cookie) *RequestOpts
func (RequestOpts) Copy ¶
func (o RequestOpts) Copy() *RequestOpts
func (*RequestOpts) Decode ¶
func (o *RequestOpts) Decode(statusCode int, target interface{}) *RequestOpts
func (*RequestOpts) DecodeWith ¶
func (o *RequestOpts) DecodeWith(f func([]byte, interface{}) error) *RequestOpts
func (*RequestOpts) DecodeWithReader ¶
func (o *RequestOpts) DecodeWithReader(f func(io.Reader, interface{}) error) *RequestOpts
func (*RequestOpts) Delete ¶
func (o *RequestOpts) Delete(url string) error
func (*RequestOpts) Describe ¶
func (o *RequestOpts) Describe(description string) *RequestOpts
func (*RequestOpts) Do ¶
func (o *RequestOpts) Do() (result Result)
func (*RequestOpts) DoAfter ¶
func (o *RequestOpts) DoAfter(f func(Result) Result) *RequestOpts
func (*RequestOpts) DoBefore ¶
func (o *RequestOpts) DoBefore(f func(*RequestOpts, *http.Request) error) *RequestOpts
func (*RequestOpts) EncodeWith ¶
func (o *RequestOpts) EncodeWith(f func(interface{}) ([]byte, error)) *RequestOpts
func (*RequestOpts) Get ¶
func (o *RequestOpts) Get(url string) error
func (*RequestOpts) Head ¶
func (o *RequestOpts) Head(url string) error
func (*RequestOpts) JSON ¶
func (o *RequestOpts) JSON() *RequestOpts
func (*RequestOpts) PathParam ¶
func (o *RequestOpts) PathParam(name string, value interface{}) *RequestOpts
func (*RequestOpts) Post ¶
func (o *RequestOpts) Post(url string) error
func (*RequestOpts) Put ¶
func (o *RequestOpts) Put(url string) error
func (*RequestOpts) StrictJSON ¶
func (o *RequestOpts) StrictJSON() *RequestOpts
func (*RequestOpts) WithBaseURL ¶
func (o *RequestOpts) WithBaseURL(url string) *RequestOpts
func (*RequestOpts) WithClient ¶
func (o *RequestOpts) WithClient(client *http.Client) *RequestOpts
func (*RequestOpts) WithContext ¶
func (o *RequestOpts) WithContext(ctx context.Context) *RequestOpts
func (*RequestOpts) WithData ¶
func (o *RequestOpts) WithData(data interface{}) *RequestOpts
func (*RequestOpts) WithMethod ¶
func (o *RequestOpts) WithMethod(m string) *RequestOpts
func (*RequestOpts) WithRaw ¶
func (o *RequestOpts) WithRaw(raw []byte) *RequestOpts
func (*RequestOpts) WithURL ¶
func (o *RequestOpts) WithURL(url string) *RequestOpts
func (*RequestOpts) XML ¶
func (o *RequestOpts) XML() *RequestOpts
type RequestorFuncArg ¶
type RequestorFuncArg func(*RequestOpts)
type Result ¶
type Result struct {
Request *http.Request
Response *http.Response
Error error
Decoded bool
Read bool
Body []byte
Options *RequestOpts
DecodeTarget interface{}
// contains filtered or unexported fields
}
func (Result) HandleAfter ¶
func (Result) WillDecode ¶
Click to show internal directories.
Click to hide internal directories.