Documentation
¶
Index ¶
- Constants
- type Error
- type Headers
- type Request
- type Response
- type RestClient
- func (r *RestClient) Delete(ctx context.Context, request Request, response Response) error
- func (r *RestClient) Endpoint() string
- 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) SetEndpoint(endpoint string)
- func (r *RestClient) SetHTTPClient(client *http.Client)
- func (r *RestClient) SetRequestModifier(requestModifier func(*http.Request) *http.Request)
- func (r *RestClient) WithDecodeOnError(decodeOnError bool) *RestClient
- func (r *RestClient) WithHTTPClient(client *http.Client) *RestClient
- func (r *RestClient) WithRequestModifier(requestModifier func(*http.Request) *http.Request) *RestClient
- type StreamCallback
- type Streamable
- 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 // SetHeaders sets the HTTP response headers. SetHeaders(headers Headers) error }
type RestClient ¶
type RestClient struct {
// contains filtered or unexported fields
}
func (*RestClient) Endpoint ¶ added in v1.0.3
func (r *RestClient) Endpoint() string
func (*RestClient) SetEndpoint ¶ added in v1.0.3
func (r *RestClient) SetEndpoint(endpoint string)
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
func (*RestClient) WithDecodeOnError ¶ added in v1.1.0
func (r *RestClient) WithDecodeOnError(decodeOnError bool) *RestClient
WithDecodeOnError forces the response to be decoded even if the status code is >= 400.
func (*RestClient) WithHTTPClient ¶ added in v1.1.0
func (r *RestClient) WithHTTPClient(client *http.Client) *RestClient
WithHTTPClient overrides the default http client.
func (*RestClient) WithRequestModifier ¶ added in v1.1.0
func (r *RestClient) WithRequestModifier(requestModifier func(*http.Request) *http.Request) *RestClient
WithRequestModifier adds a function that will modify each request
type StreamCallback ¶ added in v1.1.1
type Streamable ¶ added in v1.2.0
type Streamable interface { // StreamCallback get the stream callback if any. StreamCallback() StreamCallback }
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/stream
command
|
|
cmd/url_values
command
|
Click to show internal directories.
Click to hide internal directories.