Documentation
¶
Index ¶
- func DoResult[T any](r *Request, ctx context.Context) (T, error)
- type HttpClient
- func (c *HttpClient) Delete(endpoint string) *Request
- func (c *HttpClient) Get(endpoint string) *Request
- func (c *HttpClient) NewRequest(method, endpoint string) *Request
- func (c *HttpClient) Patch(endpoint string) *Request
- func (c *HttpClient) Post(endpoint string) *Request
- func (c *HttpClient) Put(endpoint string) *Request
- func (c *HttpClient) WithBaseURL(baseURL string) *HttpClient
- func (c *HttpClient) WithHTTPClient(hc *http.Client) *HttpClient
- func (c *HttpClient) WithQuery(query url.Values) *HttpClient
- func (c *HttpClient) WithRetry(retry int) *HttpClient
- func (c *HttpClient) WithTimeout(timeout time.Duration) *HttpClient
- type Request
- func (r *Request) Body(body io.Reader) *Request
- func (r *Request) Do(ctx context.Context) ([]byte, error)
- func (r *Request) JSONBody(v any) *Request
- func (r *Request) Query(key, value string) *Request
- func (r *Request) WithHeader(key, value string) *Request
- func (r *Request) WithQuery(query url.Values) *Request
- type StatusError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HttpClient ¶
type HttpClient struct {
// contains filtered or unexported fields
}
func New ¶
func New() *HttpClient
func (*HttpClient) Delete ¶
func (c *HttpClient) Delete(endpoint string) *Request
func (*HttpClient) Get ¶
func (c *HttpClient) Get(endpoint string) *Request
func (*HttpClient) NewRequest ¶
func (c *HttpClient) NewRequest(method, endpoint string) *Request
func (*HttpClient) Patch ¶
func (c *HttpClient) Patch(endpoint string) *Request
func (*HttpClient) Post ¶
func (c *HttpClient) Post(endpoint string) *Request
func (*HttpClient) Put ¶
func (c *HttpClient) Put(endpoint string) *Request
func (*HttpClient) WithBaseURL ¶
func (c *HttpClient) WithBaseURL(baseURL string) *HttpClient
func (*HttpClient) WithHTTPClient ¶
func (c *HttpClient) WithHTTPClient(hc *http.Client) *HttpClient
func (*HttpClient) WithQuery ¶
func (c *HttpClient) WithQuery(query url.Values) *HttpClient
func (*HttpClient) WithRetry ¶
func (c *HttpClient) WithRetry(retry int) *HttpClient
func (*HttpClient) WithTimeout ¶
func (c *HttpClient) WithTimeout(timeout time.Duration) *HttpClient
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func (*Request) WithHeader ¶
type StatusError ¶
StatusError represents a non-2xx HTTP response.
func (*StatusError) Error ¶
func (e *StatusError) Error() string
Click to show internal directories.
Click to hide internal directories.