Documentation
¶
Index ¶
- func GetRequestID(ctx context.Context) string
- func WithRequestID(ctx context.Context, id string) context.Context
- type CircuitBreaker
- type Client
- func (c *Client) Breaker() *CircuitBreaker
- func (c *Client) Close() error
- func (c *Client) DownloadFile(ctx context.Context, filePath string) (io.ReadCloser, error)
- func (c *Client) Request(ctx context.Context, method string) (*Response, error)
- func (c *Client) RequestWithForm(ctx context.Context, method string, form map[string]string, ...) (*Response, error)
- func (c *Client) RequestWithMultipart(ctx context.Context, method string, fields map[string]string, ...) (*Response, error)
- func (c *Client) RequestWithParams(ctx context.Context, method string, params interface{}) (*Response, error)
- func (c *Client) SetHTTPClient(hc *http.Client)
- func (c *Client) SetTimeout(d time.Duration)
- func (c *Client) Stats() *Stats
- func (c *Client) StatsSnapshot() StatsSnapshot
- func (c *Client) UserAgent() string
- type Response
- type Stats
- type StatsSnapshot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRequestID ¶
Types ¶
type CircuitBreaker ¶
type CircuitBreaker struct {
// contains filtered or unexported fields
}
CircuitBreaker پیادهسازی بهینه با Single Probe در Half-Open
func NewCircuitBreaker ¶
func NewCircuitBreaker(threshold int, reset time.Duration) *CircuitBreaker
func (*CircuitBreaker) Allow ¶
func (c *CircuitBreaker) Allow() bool
func (*CircuitBreaker) RecordFailure ¶
func (c *CircuitBreaker) RecordFailure()
func (*CircuitBreaker) RecordSuccess ¶
func (c *CircuitBreaker) RecordSuccess()
func (*CircuitBreaker) State ¶
func (c *CircuitBreaker) State() int
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Breaker ¶
func (c *Client) Breaker() *CircuitBreaker
func (*Client) DownloadFile ¶
func (*Client) RequestWithForm ¶
func (*Client) RequestWithMultipart ¶
func (c *Client) RequestWithMultipart(ctx context.Context, method string, fields map[string]string, files map[string]string) (*Response, error)
RequestWithMultipart بهینهشده با io.Pipe و Streaming Decode
func (*Client) RequestWithParams ¶
func (c *Client) RequestWithParams(ctx context.Context, method string, params interface{}) (*Response, error)
RequestWithParams بهینهشده با Streaming Decode
func (*Client) SetHTTPClient ¶
func (*Client) SetTimeout ¶
func (*Client) StatsSnapshot ¶
func (c *Client) StatsSnapshot() StatsSnapshot
type Response ¶
type Response struct {
Ok bool `json:"ok"`
Result json.RawMessage `json:"result,omitempty"`
ErrorCode int `json:"error_code,omitempty"`
Description string `json:"description,omitempty"`
Parameters interface{} `json:"parameters,omitempty"`
HTTPStatus int `json:"-"`
}
Response پاسخ استاندارد API کدمیت
func (*Response) ParametersAsRetryAfter ¶
ParametersAsRetryAfter گرفتن retry_after از parameters
Click to show internal directories.
Click to hide internal directories.