Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RateLimitHandler ¶
type RateLimitHandler struct {
// contains filtered or unexported fields
}
RateLimitHandler is a middleware that detects primary and secondary rate limits and retries requests after the appropriate time when necessary.
func NewRateLimitHandler ¶
func NewRateLimitHandler() *RateLimitHandler
NewRateLimitHandler creates a new RateLimitHandler with default options.
func (RateLimitHandler) Intercept ¶
func (handler RateLimitHandler) Intercept(pipeline kiotaHttp.Pipeline, middlewareIndex int, request *netHttp.Request) (*netHttp.Response, error)
Intercept tries a request. If the response shows it was rate-limited, it retries the request after the appropriate period of time.
type RateLimitHandlerOptions ¶
type RateLimitHandlerOptions struct{}
RateLimitHandlerOptions is a struct that holds options for the RateLimitHandler. In the future, this could hold different strategies for handling rate limits: e.g. exponential backoff, jitter, throttling, etc.
func (*RateLimitHandlerOptions) GetKey ¶
func (options *RateLimitHandlerOptions) GetKey() abs.RequestOptionKey
GetKey returns the unique RateLimitHandler key, used by Kiota to store request options.
func (*RateLimitHandlerOptions) IsRateLimited ¶
func (options *RateLimitHandlerOptions) IsRateLimited() func(req *netHttp.Request, resp *netHttp.Response) RateLimitType
IsRateLimited returns a function that determines if an HTTP response was rate-limited, and if so, what type of rate limit was hit.
type RateLimitType ¶
type RateLimitType int
RateLimitType is an enum that represents either None, Primary, or Secondary rate limiting
const ( None RateLimitType = iota Primary Secondary )