telegoapi

package
v1.15.2 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMaxRetryAttempts = errors.New("max retry attempts reached")

ErrMaxRetryAttempts returned when max retry attempts reached

Functions

This section is empty.

Types

type MultipartRequestConstructor added in v1.15.2

type MultipartRequestConstructor struct{}

MultipartRequestConstructor creates a streaming multipart body without an io.Pipe producer goroutine. File data remains in the original readers and is consumed only as the HTTP client reads the request body.

func (MultipartRequestConstructor) JSONRequest added in v1.15.2

func (MultipartRequestConstructor) JSONRequest(parameters any) (*ta.RequestData, error)

func (MultipartRequestConstructor) MultipartRequest added in v1.15.2

func (MultipartRequestConstructor) MultipartRequest(
	parameters map[string]string, filesParameters map[string]ta.NamedReader,
) (*ta.RequestData, error)

type RetryRateLimitCaller

type RetryRateLimitCaller struct {
	// Underling caller
	Caller telegoapi.Caller
	// Max number of attempts to make a call
	MaxAttempts int
	// Exponent base for delay
	ExponentBase float64
	// Starting delay duration
	StartDelay time.Duration
	// Maximum delay duration
	MaxDelay time.Duration
	// Rate limit behavior
	RateLimit telegoapi.RetryRateLimit
	// Buffer request data, if set to true requests that usually stream body using io.Reader will be buffered
	// to support retrying such requests
	//
	// Warning: Enabling this may lead to excessive memory consumption and OOMKill
	BufferRequestData bool
}

RetryRateLimitCaller decorator over [Caller] that provides retries with exponential backoff on rate limit errors Depending on [RetryRateLimit] will wait for rate limit timeout to reset or abort, defaults to do nothing Delay = min((ExponentBase ^ AttemptNumber) * StartDelay, MaxDelay)

func (*RetryRateLimitCaller) Call

func (r *RetryRateLimitCaller) Call(ctx context.Context, url string, data *telegoapi.RequestData) (response *telegoapi.Response, err error)

Call makes calls using provided caller with retries

Jump to

Keyboard shortcuts

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