backlog

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 27, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetErrorMessage

func GetErrorMessage(resp *http.Response) string

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.

func NewClient added in v0.0.3

func NewClient(url, apiKey string, opts ...ClientOption) (*Client, error)

NewClient creates a new 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

func (o *RetryableTransport) RoundTrip(req *http.Request) (*http.Response, error)

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL