Documentation
¶
Index ¶
- type BodyBytes
- func (bb *BodyBytes) AsBytes() (result []byte, err error)
- func (bb *BodyBytes) AsBytesResponse() (result []byte, response *http.Response, err error)
- func (bb *BodyBytes) AsMap() (result map[string]interface{}, err error)
- func (bb *BodyBytes) AsString() (result string, err error)
- func (bb *BodyBytes) AsStringResponse() (result string, response *http.Response, err error)
- func (bb *BodyBytes) Response() (response *http.Response, err error)
- func (bb *BodyBytes) ToStruct(out interface{}) (err error)
- func (bb *BodyBytes) ToStructResponse(out interface{}) (response *http.Response, err error)
- type BodyForm
- func (bf *BodyForm) AsBytes() (result []byte, err error)
- func (bf *BodyForm) AsBytesResponse() (result []byte, response *http.Response, err error)
- func (bf *BodyForm) AsMap() (result map[string]interface{}, err error)
- func (bf *BodyForm) AsString() (result string, err error)
- func (bf *BodyForm) AsStringResponse() (result string, response *http.Response, err error)
- func (bf *BodyForm) Response() (response *http.Response, err error)
- func (bf *BodyForm) ToStruct(out interface{}) (err error)
- func (bf *BodyForm) ToStructResponse(out interface{}) (response *http.Response, err error)
- type BodyJson
- func (bj *BodyJson) AsBytes() (result []byte, err error)
- func (bj *BodyJson) AsBytesResponse() (result []byte, response *http.Response, err error)
- func (bj *BodyJson) AsMap() (result map[string]interface{}, err error)
- func (bj *BodyJson) AsString() (result string, err error)
- func (bj *BodyJson) AsStringResponse() (result string, response *http.Response, err error)
- func (bj *BodyJson) Response() (response *http.Response, err error)
- func (bj *BodyJson) ToStruct(out interface{}) (err error)
- func (bj *BodyJson) ToStructResponse(out interface{}) (response *http.Response, err error)
- type BodyXml
- func (bx *BodyXml) AsBytes() (result []byte, err error)
- func (bx *BodyXml) AsBytesResponse() (result []byte, response *http.Response, err error)
- func (bx *BodyXml) AsMap() (result map[string]interface{}, err error)
- func (bx *BodyXml) AsString() (result string, err error)
- func (bx *BodyXml) AsStringResponse() (result string, response *http.Response, err error)
- func (bx *BodyXml) MarshalSettings(prefix, indent string) *BodyXml
- func (bx *BodyXml) Response() (response *http.Response, err error)
- func (bx *BodyXml) ToStruct(out interface{}) (err error)
- func (bx *BodyXml) ToStructResponse(out interface{}) (response *http.Response, err error)
- type Error
- type HGet
- func (h *HGet) AsBytes() (result []byte, err error)
- func (h *HGet) AsBytesResponse() (result []byte, response *http.Response, err error)
- func (h *HGet) AsMap() (result map[string]interface{}, err error)
- func (h *HGet) AsMapResponse() (result map[string]interface{}, response *http.Response, err error)
- func (h *HGet) AsString() (result string, err error)
- func (h *HGet) AsStringResponse() (result string, response *http.Response, err error)
- func (h *HGet) Headers(headers http.Header) *HGet
- func (h *HGet) Query(query url.Values) *HGet
- func (h *HGet) Response() (response *http.Response, err error)
- func (h *HGet) SetHeader(key, value string) *HGet
- func (h *HGet) SetValue(key, value string) *HGet
- func (h *HGet) ToStruct(out interface{}) (err error)
- func (h *HGet) ToStructResponse(out interface{}) (response *http.Response, err error)
- type HMethod
- type HPost
- func (h *HPost) Bytes(body []byte) *BodyBytes
- func (h *HPost) Form(body url.Values) *BodyForm
- func (h *HPost) Headers(headers http.Header) *HPost
- func (h *HPost) Json(body interface{}) *BodyJson
- func (h *HPost) Query(query url.Values) *HPost
- func (h *HPost) SetHeader(key, value string) *HPost
- func (h *HPost) SetValue(key, value string) *HPost
- func (h *HPost) Xml(body interface{}) *BodyXml
- type HPut
- func (h *HPut) Bytes(body []byte) *BodyBytes
- func (h *HPut) Form(body url.Values) *BodyForm
- func (h *HPut) Headers(headers http.Header) *HPut
- func (h *HPut) Json(body interface{}) *BodyJson
- func (h *HPut) Query(query url.Values) *HPut
- func (h *HPut) SetHeader(key, value string) *HPut
- func (h *HPut) SetValue(key, value string) *HPut
- func (h *HPut) Xml(body interface{}) *BodyXml
- type Hog
- func (h *Hog) Context(context context.Context) *Hog
- func (h *Hog) Get(url string) *HGet
- func (h *Hog) GetF(format string, a ...any) *HGet
- func (h *Hog) Headers(headers http.Header) *Hog
- func (h *Hog) LogLevel(level LogLevel) *Hog
- func (h *Hog) Logger(logger Logger) *Hog
- func (h *Hog) Post(url string) *HPost
- func (h *Hog) PostF(format string, a ...any) *HPost
- func (h *Hog) Put(url string) *HPut
- func (h *Hog) PutF(format string, a ...any) *HPut
- func (h *Hog) RetryCount(count int) *Hog
- func (h *Hog) SetHeader(key, value string) *Hog
- type LogLevel
- type Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BodyBytes ¶
type BodyBytes struct {
// contains filtered or unexported fields
}
BodyBytes handles binary request bodies.
func (*BodyBytes) AsBytesResponse ¶
AsBytesResponse executes the request and returns the response body as bytes along with the response.
func (*BodyBytes) AsString ¶
AsString executes the request and returns the response body as a string.
func (*BodyBytes) AsStringResponse ¶
AsStringResponse executes the request and returns the response body as a string along with the response.
func (*BodyBytes) Response ¶
Response executes the request with binary body and returns the raw response.
type BodyForm ¶
type BodyForm struct {
// contains filtered or unexported fields
}
BodyForm handles form urlencoded request bodies.
func (*BodyForm) AsBytesResponse ¶
AsBytesResponse executes the request and returns the response body as bytes along with the response.
func (*BodyForm) AsString ¶
AsString executes the request and returns the response body as a string.
func (*BodyForm) AsStringResponse ¶
AsStringResponse executes the request and returns the response body as a string along with the response.
func (*BodyForm) Response ¶
Response executes the request with form body and returns the raw response.
type BodyJson ¶
type BodyJson struct {
// contains filtered or unexported fields
}
BodyJson handles JSON request bodies with appropriate Content-Type headers.
func (*BodyJson) AsBytesResponse ¶
AsBytesResponse executes the request and returns the response body as bytes along with the response.
func (*BodyJson) AsString ¶
AsString executes the request and returns the response body as a string.
func (*BodyJson) AsStringResponse ¶
AsStringResponse executes the request and returns the response body as a string along with the response.
func (*BodyJson) Response ¶
Response executes the request with JSON body and returns the raw response.
type BodyXml ¶
type BodyXml struct {
// contains filtered or unexported fields
}
BodyXml handles XML request bodies with appropriate Content-Type headers.
func (*BodyXml) AsBytesResponse ¶
AsBytesResponse executes the request and returns the response body as bytes along with the response.
func (*BodyXml) AsStringResponse ¶
AsStringResponse executes the request and returns the response body as a string along with the response.
func (*BodyXml) MarshalSettings ¶
MarshalSettings configures XML marshaling with the specified prefix and indent.
func (*BodyXml) Response ¶
Response executes the request with XML body and returns the raw response.
type Error ¶
type Error struct { Op string // Operation where the error occurred Message string // Human-readable error description Err error // Underlying error, if any }
Error represents an HTTP request processing error with context.
type HGet ¶
type HGet struct {
// contains filtered or unexported fields
}
func (*HGet) AsBytesResponse ¶
AsBytesResponse executes the GET request and returns the response body as bytes along with the response.
func (*HGet) AsMapResponse ¶
AsMapResponse unmarshals the GET response body into a map and returns it along with the response.
func (*HGet) AsString ¶
AsString executes the GET request and returns the response body as a string.
func (*HGet) AsStringResponse ¶
AsStringResponse executes the GET request and returns the response body as a string along with the response.
type HMethod ¶
type HMethod interface {
// contains filtered or unexported methods
}
HMethod defines the interface for HTTP methods with common functionality.
type HPost ¶
type HPost struct {
// contains filtered or unexported fields
}
HPost handles HTTP POST requests with chainable options.
type HPut ¶
type HPut struct {
HPost
}
HPut handles HTTP PUT requests with chainable options.
type Hog ¶
type Hog struct {
// contains filtered or unexported fields
}
Hog is a flexible HTTP client that provides a chainable API for HTTP requests.
func NewConfig ¶
NewConfig creates a new Hog instance with specified TLS security and timeout. The secure parameter determines if TLS verification is enabled, and timeout is in seconds.
func (*Hog) RetryCount ¶
RetryCount sets the number of retry attempts for failed requests.
type Logger ¶
type Logger interface { // Debug logs debug level information. Debug(args ...interface{}) // Info logs informational messages. Info(args ...interface{}) // Error logs error information. Error(args ...interface{}) // IsEnabled checks if a specific log level is active. IsEnabled(level LogLevel) bool }
Logger defines methods for request/response logging.