Documentation
¶
Index ¶
- func IsConnectionReset(err error) bool
- type HTTPClient
- type Interface
- type RESTClient
- func (c *RESTClient) APIVersion() string
- func (c *RESTClient) Delete() *Request
- func (c *RESTClient) Get() *Request
- func (c *RESTClient) Patch() *Request
- func (c *RESTClient) Post() *Request
- func (c *RESTClient) Put() *Request
- func (c *RESTClient) Verb(verb string) *Request
- func (c *RESTClient) VerbSp(verb string, subPath string) *Request
- type Request
- func (r *Request) Context(ctx context.Context) *Request
- func (r *Request) Do() Result
- func (r *Request) DoRaw() ([]byte, error)
- func (r *Request) Param(paramName, s string) *Request
- func (r *Request) PrintParams() error
- func (r *Request) ReadResponse() (io.ReadCloser, error)
- func (r *Request) SetBodyReader(t io.Reader) *Request
- func (r *Request) SetHeader(key string, values ...string) *Request
- func (r *Request) URL() *url.URL
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsConnectionReset ¶
Returns if the given err is "connection reset by peer" error.
Types ¶
type RESTClient ¶
type RESTClient struct {
//TODO: add content config for server communication
//TODO: add a backoff manager
//TODO: add throttle
Client *http.Client
// contains filtered or unexported fields
}
func NewRESTClient ¶
TODO: add max qps, max burst for throttle, rate limiter etc
func (*RESTClient) APIVersion ¶
func (c *RESTClient) APIVersion() string
func (*RESTClient) Delete ¶
func (c *RESTClient) Delete() *Request
func (*RESTClient) Get ¶
func (c *RESTClient) Get() *Request
func (*RESTClient) Patch ¶
func (c *RESTClient) Patch() *Request
func (*RESTClient) Post ¶
func (c *RESTClient) Post() *Request
func (*RESTClient) Put ¶
func (c *RESTClient) Put() *Request
func (*RESTClient) Verb ¶
func (c *RESTClient) Verb(verb string) *Request
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func NewRequest ¶
func NewRequest(client HTTPClient, verb string, baseURL *url.URL, apiPath string, subPath string, timeout time.Duration) *Request
ToDO: result into TODO: add config param
func (*Request) PrintParams ¶
func (*Request) ReadResponse ¶
func (r *Request) ReadResponse() (io.ReadCloser, error)
read raw output from server
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
func (Result) StatusCode ¶
Click to show internal directories.
Click to hide internal directories.