Documentation ¶
Index ¶
- type APIConfig
- type Client
- func (c *Client) Delete(ctx context.Context, apiConfig *APIConfig) (*Response, error)
- func (c *Client) Get(ctx context.Context, apiConfig *APIConfig) (*Response, error)
- func (c *Client) GetClient() *http.Client
- func (c *Client) GetOrganizationID() string
- func (c *Client) GetValidator() *validator.Validate
- func (c *Client) Post(ctx context.Context, apiConfig *APIConfig, apiRequest any) (*Response, error)
- func (c *Client) PostFile(ctx context.Context, apiConfig *APIConfig, body *bytes.Buffer, ...) (*Response, error)
- func (c *Client) Stream(ctx context.Context, apiConfig *APIConfig, method Method, apiRequest any) (*Response, error)
- type Method
- type Option
- func Concurrency(n int) Option
- func SetEmptyMessageLimit(limit uint) Option
- func Timeout(d time.Duration) Option
- func WithCustomBaseURL(baseURL string) Option
- func WithCustomClient(client *http.Client) Option
- func WithOrganizationID(orgID string) Option
- func WithRateLimit(every time.Duration, requestPerTime int) Option
- type Response
- type Transporter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIConfig ¶
type APIConfig struct { Path string Query map[string]string // Query use for http get request for set query params example.com/x?q1=v1&q2=v2 Headers map[string]string // Headers set http header request }
APIConfig standard external api path address
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GetOrganizationID ¶
func (*Client) GetValidator ¶
func (c *Client) GetValidator() *validator.Validate
type Option ¶
type Option func(client *Client)
func SetEmptyMessageLimit ¶
func WithCustomBaseURL ¶
func WithCustomClient ¶
WithCustomClient use custom http httpClient instead default httpClient
func WithOrganizationID ¶
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
func (*Response) GetHttpResponse ¶
GetHttpResponse return http response
type Transporter ¶
type Transporter interface { GetClient() *http.Client GetValidator() *validator.Validate GetOrganizationID() string Get(ctx context.Context, apiConfig *APIConfig) (*Response, error) Post(ctx context.Context, apiConfig *APIConfig, apiRequest any) (*Response, error) PostFile(ctx context.Context, apiConfig *APIConfig, body *bytes.Buffer, contentType string) (*Response, error) Delete(ctx context.Context, apiConfig *APIConfig) (*Response, error) }
Click to show internal directories.
Click to hide internal directories.