Documentation
¶
Index ¶
- func AddRequestInterceptor(interceptor func(ctx context.Context, req *http.Request) error) opt.Option[Config]
- func AddResponseInterceptor(interceptor func(ctx context.Context, resp *http.Response) error) opt.Option[Config]
- func ApiKeyAuth(headerName, headerValue string) opt.Option[Config]
- func BearerAuth(token string) opt.Option[Config]
- func Execute[Response any](ctx context.Context, endpoint Client, request *Request) (*Response, error)
- func SetErrorResponseType[T any](handler ...func(response T) string) opt.Option[Config]
- func WithFormBody[Body any](value Body) opt.Option[Request]
- func WithHeader(name string, value string) opt.Option[Request]
- func WithJsonBody[Body any](value Body) opt.Option[Request]
- func WithMultipartFormBody(formWriter multipart.Writer, value *bytes.Buffer) opt.Option[Request]
- func WithQueryFloat(name string, value any) opt.Option[Request]
- func WithQueryInt(name string, value any) opt.Option[Request]
- func WithQueryParam(name string, value string) opt.Option[Request]
- func WithQueryStrings(name string, values ...string) opt.Option[Request]
- func WithQueryStruct[T any](value T) opt.Option[Request]
- func WithTimeout(ttl time.Duration) opt.Option[Request]
- type Client
- type Config
- type Endpoint
- type ErrorResponse
- type Request
- type RequestInterceptor
- type ResponseInterceptor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddRequestInterceptor ¶ added in v0.4.9
func AddResponseInterceptor ¶ added in v0.4.9
func SetErrorResponseType ¶ added in v0.4.9
func WithMultipartFormBody ¶
Types ¶
type Config ¶
type Config struct { Timeout time.Duration RequestInterceptors []RequestInterceptor ResponseInterceptors []ResponseInterceptor }
func (*Config) InterceptRequest ¶
type ErrorResponse ¶ added in v0.4.9
type ErrorResponse[T any] struct { Response T }
func (ErrorResponse[T]) Error ¶ added in v0.4.9
func (e ErrorResponse[T]) Error() string
type RequestInterceptor ¶
Click to show internal directories.
Click to hide internal directories.