Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetErrorMessage ¶
GetErrorMessage reads the response body and returns the error message.
Types ¶
type Client ¶ added in v0.0.3
type Client struct {
BaseURL string `json:"baseUrl"`
APIKey string `json:"-"`
Writer io.Writer `json:"-"`
HTTPClient *http.Client `json:"-"`
}
Backlog represents a Backlog client.
type ClientOption ¶ added in v0.0.3
type ClientOption func(*Client)
func WithTransport ¶ added in v0.0.3
func WithTransport(transport http.RoundTripper) ClientOption
func WithWriter ¶ added in v0.0.3
func WithWriter(w io.Writer) ClientOption
type Error ¶
type Error struct {
Message string `json:"message"`
Code int `json:"code"`
MoreInfo string `json:"moreInfo"`
}
Error represents an error response from the Backlog API.
type ErrorResponse ¶
type ErrorResponse struct {
Errors []Error `json:"errors"`
}
ErrorResponse represents a response containing multiple errors from the Backlog API.
type RetryableTransport ¶ added in v0.0.3
type RetryableTransport struct {
Transport http.RoundTripper `json:"-"`
InitialInterval time.Duration `json:"initialInterval"`
MaxInterval time.Duration `json:"maxInterval"`
MaxRetryAttempts int `json:"maxRetryAttempts"`
MaxJitterMilli int `json:"maxJitterMilli"`
}
RetryableTransport is a custom HTTP transport that retries requests on certain status codes.
func NewRetryableTransport ¶ added in v0.0.3
func NewRetryableTransport(initialInterval, maxInterval time.Duration, maxRetryAttempts, maxJitterMilli int) *RetryableTransport
NewRetryableTransport creates a new Transport with the specified parameters.
func (*RetryableTransport) RoundTrip ¶ added in v0.0.3
RoundTrip sends an HTTP request and retries if the response status code is 429 (Too Many Requests). It waits for the time specified in the X-RateLimit-Reset header before retrying. The retry attempts are limited by MaxRetryAttempts and a random jitter is added to the wait time. The jitter is a random duration between 0 and MaxJitterMilli milliseconds.