Documentation ¶
Index ¶
- func DefaultUserAgent() string
- type Config
- type Interface
- type RESTClient
- func (c *RESTClient) Delete(path string, headers, queries map[string]string, reqBody, respBody any) (*resty.Response, error)
- func (c *RESTClient) Get(path string, headers, queries map[string]string, reqBody, respBody any) (*resty.Response, error)
- func (c *RESTClient) Patch(path string, headers, queries map[string]string, reqBody, respBody any) (*resty.Response, error)
- func (c *RESTClient) Post(path string, headers, queries map[string]string, reqBody, respBody any) (*resty.Response, error)
- func (c *RESTClient) Put(path string, headers, queries map[string]string, reqBody, respBody any) (*resty.Response, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultUserAgent ¶
func DefaultUserAgent() string
DefaultUserAgent returns a default user agent string.
Types ¶
type Config ¶
type Config struct { // UserAgent is an optional field that specifies the caller of this request. UserAgent string `json:"user_agent,omitempty"` // Set retry parameters for http client. RetryCount int `json:"retry_count,omitempty"` RetryWaitTime time.Duration `json:"retry_wait_time,omitempty"` RetryMaxWaitTime time.Duration `json:"retry_max_wait_time,omitempty"` BaseURLs map[string]string `json:"base_urls,omitempty"` }
type Interface ¶
type Interface interface { Post(path string, headers, queries map[string]string, reqBody, respBody any) (*resty.Response, error) Put(path string, headers, queries map[string]string, reqBody, respBody any) (*resty.Response, error) Patch(path string, headers, queries map[string]string, reqBody, respBody any) (*resty.Response, error) Get(path string, headers, queries map[string]string, reqBody, respBody any) (*resty.Response, error) Delete(path string, headers, queries map[string]string, reqBody, respBody any) (*resty.Response, error) }
type RESTClient ¶
type RESTClient struct {
*resty.Client
}
func HTTPClientFor ¶
func HTTPClientFor(c *Config) *RESTClient
HTTPClientFor returns an http.Client that use the default transport. Will return the default http.DefaultClient if no special case behavior is needed.
func (*RESTClient) Delete ¶
func (c *RESTClient) Delete( path string, headers, queries map[string]string, reqBody, respBody any) (*resty.Response, error)
Delete sends a DELETE request to the specified path with optional query parameters and request/response body, and returns the resty.Response and an error.
func (*RESTClient) Get ¶
func (c *RESTClient) Get( path string, headers, queries map[string]string, reqBody, respBody any) (*resty.Response, error)
Get sends a GET request to the specified path with optional query parameters and request/response body, and returns the resty.Response and an error.
func (*RESTClient) Patch ¶
func (c *RESTClient) Patch( path string, headers, queries map[string]string, reqBody, respBody any) (*resty.Response, error)
Patch sends a PATCH request to the specified path with optional query parameters and request/response body, and returns the resty.Response and an error.
func (*RESTClient) Post ¶
func (c *RESTClient) Post( path string, headers, queries map[string]string, reqBody, respBody any) (*resty.Response, error)
Post sends a POST request to the specified path with optional query parameters and request/response body, and returns the resty.Response and an error.