Documentation
¶
Index ¶
- type HTTPClient
- type HTTPClientImpl
- func (c *HTTPClientImpl) BasicAuth(username, password string) HTTPClient
- func (c *HTTPClientImpl) Bearer(token string) HTTPClient
- func (c *HTTPClientImpl) ContentType(contentType string) HTTPClient
- func (c *HTTPClientImpl) Delete(path string) (*http.Response, error)
- func (c *HTTPClientImpl) Error(errVar any) HTTPClient
- func (c *HTTPClientImpl) Get(path string) (*http.Response, error)
- func (c *HTTPClientImpl) Post(path string, body any) (*http.Response, error)
- func (c *HTTPClientImpl) Put(path string, body any) (*http.Response, error)
- func (c *HTTPClientImpl) SetAuthToken(token string) HTTPClient
- func (c *HTTPClientImpl) SetBaseUrl(baseURL string) HTTPClient
- func (c *HTTPClientImpl) SetHeader(key, value string) HTTPClient
- func (c *HTTPClientImpl) ToBytesBuffer(byteArr *[]byte) HTTPClient
- func (c *HTTPClientImpl) ToJson(respBody any) HTTPClient
- func (c *HTTPClientImpl) ToPlainText(textResponse *string) HTTPClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPClient ¶
type HTTPClient interface {
SetBaseUrl(baseUrl string) HTTPClient
SetAuthToken(token string) HTTPClient
Bearer(token string) HTTPClient
BasicAuth(username, password string) HTTPClient
SetHeader(key, value string) HTTPClient
ToJson(any) HTTPClient
ToBytesBuffer(*[]byte) HTTPClient
ToPlainText(*string) HTTPClient
Error(any) HTTPClient
ContentType(string) HTTPClient
Get(path string) (*http.Response, error)
Post(path string, body any) (*http.Response, error)
Put(path string, body any) (*http.Response, error)
Delete(path string) (*http.Response, error)
}
func NewHTTPClient ¶
func NewHTTPClient(baseURL, authToken string) HTTPClient
type HTTPClientImpl ¶
type HTTPClientImpl struct {
BaseURL string
AuthToken string
HTTPClient *http.Client
// contains filtered or unexported fields
}
func (*HTTPClientImpl) BasicAuth ¶
func (c *HTTPClientImpl) BasicAuth(username, password string) HTTPClient
func (*HTTPClientImpl) Bearer ¶
func (c *HTTPClientImpl) Bearer(token string) HTTPClient
func (*HTTPClientImpl) ContentType ¶
func (c *HTTPClientImpl) ContentType(contentType string) HTTPClient
func (*HTTPClientImpl) Delete ¶
func (c *HTTPClientImpl) Delete(path string) (*http.Response, error)
func (*HTTPClientImpl) Error ¶
func (c *HTTPClientImpl) Error(errVar any) HTTPClient
func (*HTTPClientImpl) SetAuthToken ¶
func (c *HTTPClientImpl) SetAuthToken(token string) HTTPClient
func (*HTTPClientImpl) SetBaseUrl ¶
func (c *HTTPClientImpl) SetBaseUrl(baseURL string) HTTPClient
func (*HTTPClientImpl) SetHeader ¶
func (c *HTTPClientImpl) SetHeader(key, value string) HTTPClient
func (*HTTPClientImpl) ToBytesBuffer ¶
func (c *HTTPClientImpl) ToBytesBuffer(byteArr *[]byte) HTTPClient
func (*HTTPClientImpl) ToJson ¶
func (c *HTTPClientImpl) ToJson(respBody any) HTTPClient
func (*HTTPClientImpl) ToPlainText ¶
func (c *HTTPClientImpl) ToPlainText(textResponse *string) HTTPClient
Click to show internal directories.
Click to hide internal directories.