Documentation
¶
Index ¶
- Variables
- type APIResponse
- type Context
- type Ctx
- func (ctx Ctx) GetAPIKey(fallbackAPIKey string) string
- func (ctx Ctx) GetContext() context.Context
- func (ctx Ctx) NewRequest(baseURL *url.URL, method, path string, ...) (req *http.Request, err error)
- func (ctx Ctx) PrepareBody(method string, query *url.Values) (body io.Reader, contentType string, err error)
- func (ctx Ctx) PrepareHeader(header *http.Header)
- func (ctx Ctx) PrepareQuery(query *url.Values)
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultHTTPClient = func() *http.Client { return &http.Client{ Transport: DefaultHTTPTransport, Timeout: 90 * time.Second, } }()
View Source
var DefaultHTTPTransport = func() *http.Transport { transport := http.DefaultTransport.(*http.Transport).Clone() transport.DisableKeepAlives = true return transport }()
Functions ¶
This section is empty.
Types ¶
type APIResponse ¶
func NewAPIResponse ¶
func NewAPIResponse[T interface{}](res *http.Response, data T) APIResponse[T]
type Context ¶
type Context interface { GetAPIKey(fallbackAPIKey string) string GetContext() context.Context PrepareHeader(header *http.Header) PrepareQuery(query *url.Values) PrepareBody(method string, query *url.Values) (body io.Reader, contentType string, err error) NewRequest(baseURL *url.URL, method, path string, header func(header *http.Header, params Context), query func(query *url.Values, params Context)) (req *http.Request, err error) }
type Ctx ¶
type Ctx struct { APIKey string `json:"-"` Context context.Context `json:"-"` Form *url.Values `json:"-"` JSON any `json:"-"` Headers *http.Header `json:"-"` Query *url.Values `json:"-"` }
func (Ctx) GetContext ¶
func (Ctx) NewRequest ¶
func (Ctx) PrepareBody ¶
func (Ctx) PrepareHeader ¶
func (Ctx) PrepareQuery ¶
Click to show internal directories.
Click to hide internal directories.