Documentation
¶
Index ¶
- func GenerateQueryParams(data interface{}) string
- func GenerateQueryParamsForAny(queryParams map[string]any) string
- func GenerateQueryParamsForStrings(queryParams map[string]string) string
- func GenerateUrl(reqURL string, securityFlag bool, queryParams map[string]string) string
- type BaseRequest
- func (req *BaseRequest) AddQueryString(queryParams map[string]any)
- func (req *BaseRequest) Send(ss, sh, sb, redirect bool) (*rs.Response, error)
- func (req *BaseRequest) WithBody(body string, form *bool, multipart bool) *BaseRequest
- func (req *BaseRequest) WithCookie(key string, value string) *BaseRequest
- func (req *BaseRequest) WithHeader(key string, value string) *BaseRequest
- func (req *BaseRequest) WithHeaders(jsonData js.Json) (*BaseRequest, error)
- func (req *BaseRequest) WithHeadersMap(headersMap *(map[string]string)) *BaseRequest
- type DeleteRequest
- type GetRequest
- type HeadRequest
- type OptionsRequest
- type PatchRequest
- type PostRequest
- type PutRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateQueryParams ¶
func GenerateQueryParams(data interface{}) string
GenerateQueryParams can be used as the container function for both GenerateQueryParamsForStrings and GenerateQueryParamsForAny.
func GenerateQueryParamsForAny ¶
GenerateQueryParamsForAny generates query params of map[string]any type.
func GenerateQueryParamsForStrings ¶
GenerateQueryParamsForStrings generates query params of map[string]string type.
Types ¶
type BaseRequest ¶
type BaseRequest struct {
Method string
URL string
Headers map[string]any
Cookies map[string]string
Body string
BasicAuth auth.BaseAuth
MultipartBody io.Reader
Writer *multipart.Writer
}
BaseRequest is the base request object
func NewRequest ¶
func NewRequest(method, url string) BaseRequest
NewBaseRequest creates a new BaseRequest object
func (*BaseRequest) AddQueryString ¶
func (req *BaseRequest) AddQueryString(queryParams map[string]any)
AddQueryParams adds a query string to the request url.
func (*BaseRequest) Send ¶
func (req *BaseRequest) Send(ss, sh, sb, redirect bool) (*rs.Response, error)
Send function sends the request to the server.
func (*BaseRequest) WithBody ¶
func (req *BaseRequest) WithBody(body string, form *bool, multipart bool) *BaseRequest
WithBody adds body to the request based on the request body data type and form flags.
func (*BaseRequest) WithCookie ¶
func (req *BaseRequest) WithCookie(key string, value string) *BaseRequest
WithCookies adds single cookie to the request
func (*BaseRequest) WithHeader ¶
func (req *BaseRequest) WithHeader(key string, value string) *BaseRequest
WithHeaders adds single header to the request
func (*BaseRequest) WithHeaders ¶
func (req *BaseRequest) WithHeaders(jsonData js.Json) (*BaseRequest, error)
WithHeaders converts json to map and adds it to the request headers.
func (*BaseRequest) WithHeadersMap ¶
func (req *BaseRequest) WithHeadersMap(headersMap *(map[string]string)) *BaseRequest
WithHeadersMap adds the key-value of a map to the request headers.
type DeleteRequest ¶
type DeleteRequest struct {
BaseRequest
}
type GetRequest ¶
type GetRequest struct {
BaseRequest
}
type HeadRequest ¶
type HeadRequest struct {
BaseRequest
}
type OptionsRequest ¶
type OptionsRequest struct {
BaseRequest
}
type PatchRequest ¶
type PatchRequest struct {
BaseRequest
}
type PostRequest ¶
type PostRequest struct {
BaseRequest
}
type PutRequest ¶
type PutRequest struct {
BaseRequest
}