Documentation
¶
Index ¶
- Constants
- type Error
- type Request
- type Response
- type RestClient
- func (r *RestClient) Delete(ctx context.Context, request Request, response Response) error
- func (r *RestClient) Get(ctx context.Context, request Request, response Response) error
- func (r *RestClient) Patch(ctx context.Context, request Request, response Response) error
- func (r *RestClient) Post(ctx context.Context, request Request, response Response) error
- func (r *RestClient) Put(ctx context.Context, request Request, response Response) error
- func (r *RestClient) SetHTTPClient(client *http.Client)
- func (r *RestClient) SetRequestModifier(requestModifier func(*http.Request) *http.Request)
- type URLValues
- func (p *URLValues) Add(key string, value *string)
- func (p *URLValues) AddBool(key string, value *bool)
- func (p *URLValues) AddBoolAsInt(key string, value *bool)
- func (p *URLValues) AddFloat(key string, value *float64)
- func (p *URLValues) AddInt(key string, value *int)
- func (p *URLValues) Del(key string)
- func (p *URLValues) Encode() string
Constants ¶
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Response ¶
type Response interface {
// Decode decodes the response body into the given interface if the
// response matches the AcceptContentType.
Decode(body io.Reader) error
// SetBody sets the response raw body if the response can't be decoded.
SetBody(body io.Reader) error
// AcceptContentType returns the content type that the response should be decoded to.
AcceptContentType() string
// SetStatusCode sets the HTTP response status code.
SetStatusCode(code int) error
}
type RestClient ¶
type RestClient struct {
// contains filtered or unexported fields
}
func (*RestClient) SetHTTPClient ¶
func (r *RestClient) SetHTTPClient(client *http.Client)
SetHTTPClient overrides the default http client.
func (*RestClient) SetRequestModifier ¶
func (r *RestClient) SetRequestModifier(requestModifier func(*http.Request) *http.Request)
SetRequestModifier adds a function that will modify each request
type URLValues ¶
func (*URLValues) AddBoolAsInt ¶
AddBoolAsInt adds a bool value to the URLValues as an int (0=false, 1=true).
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
cmd/context
command
|
|
|
cmd/delete
command
|
|
|
cmd/get
command
|
|
|
cmd/patch
command
|
|
|
cmd/post
command
|
|
|
cmd/put
command
|
|
|
cmd/url_values
command
|
Click to show internal directories.
Click to hide internal directories.