/** * ------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. * See License in the project root for license information. * ------------------------------------------------------------------------------------------- */ /** * @module RetryHandlerOptions */ import type { RequestOption } from "@microsoft/kiota-abstractions"; import type { FetchResponse } from "../../utils/fetchDefinitions.js"; /** * * A type declaration for shouldRetry callback */ export type ShouldRetry = (delay: number, attempt: number, request: string, options: RequestInit | undefined, response: FetchResponse) => boolean; export declare const RetryHandlerOptionKey = "RetryHandlerOptionKey"; /** * Signature to define the RetryHandlerOptions constructor parameters */ export interface RetryHandlerOptionsParams { /** * The delay value in seconds * @default 3 */ delay?: number; /** * The maxRetries value * @default 3 */ maxRetries?: number; /** * The shouldRetry callback function */ shouldRetry?: ShouldRetry; } /** * RequestOption * Options * Class for RetryHandlerOptions */ export declare class RetryHandlerOptions implements RequestOption { /** * A member holding default delay value in seconds */ private static readonly DEFAULT_DELAY; /** * A member holding default maxRetries value */ private static readonly DEFAULT_MAX_RETRIES; /** * A member holding maximum delay value in seconds */ private static readonly MAX_DELAY; /** * A member holding maximum maxRetries value */ private static readonly MAX_MAX_RETRIES; /** * A member holding default shouldRetry callback * @returns true */ private static readonly defaultShouldRetry; delay: number; /** * * A member holding maxRetries value */ maxRetries: number; /** * * A member holding shouldRetry callback */ shouldRetry: ShouldRetry; /** * * To create an instance of RetryHandlerOptions * @param options - The RetryHandlerOptionsParams object * @returns An instance of RetryHandlerOptions * @example const options = new RetryHandlerOptions({ maxRetries: 4 }); */ constructor(options?: Partial); /** * * Creates an error object with a message and name * @param message - The error message * @param name - The error name * @returns An error object */ private createError; /** * * To get the maximum delay * @returns A maximum delay */ getMaxDelay(): number; getKey(): string; } //# sourceMappingURL=retryHandlerOptions.d.ts.map