@microsoft/kiota-http-fetchlibrary
Version:
Kiota request adapter implementation with fetch
100 lines • 3.38 kB
TypeScript
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
/**
* @module RetryHandler
*/
import { type RequestOption } from "@microsoft/kiota-abstractions";
import { type Middleware } from "./middleware.js";
import { RetryHandlerOptions } from "./options/retryHandlerOptions.js";
/**
* Middleware
* Class for RetryHandler
*/
export declare class RetryHandler implements Middleware {
private readonly options;
/**
* A list of status codes that needs to be retried
*/
private static readonly RETRY_STATUS_CODES;
/**
* A member holding the name of retry attempt header
*/
private static readonly RETRY_ATTEMPT_HEADER;
/**
* A member holding the name of retry after header
*/
private static readonly RETRY_AFTER_HEADER;
/**
*
* The next middleware in the middleware chain
*/
next: Middleware | undefined;
/**
*
* To create an instance of RetryHandler
* @param [options] - The retry handler options value
* @returns An instance of RetryHandler
*/
constructor(options?: RetryHandlerOptions);
/**
*
*
* To check whether the response has the retry status code
* @param response - The response object
* @returns Whether the response has retry status code or not
*/
private isRetry;
/**
*
* To check whether the payload is buffered or not
* @param options - The options of a request
* @returns Whether the payload is buffered or not
*/
private isBuffered;
/**
*
* To get the delay for a retry
* @param response - The response object
* @param retryAttempts - The current attempt count
* @param delay - The delay value in seconds
* @returns A delay for a retry
*/
private getDelay;
/**
*
* To get an exponential back off value
* @param attempts - The current attempt count
* @returns An exponential back off value
*/
private getExponentialBackOffTime;
/**
* To add delay for the execution
* @param delaySeconds - The delay value in seconds
* @returns A Promise that resolves to nothing
*/
private sleep;
/**
* To execute the middleware with retries
* @param url - The request url
* @param fetchRequestInit - The request options
* @param retryAttempts - The current attempt count
* @param currentOptions - The current request options for the retry handler.
* @param requestOptions - The retry middleware options instance
* @param tracerName - The name to use for the tracer
* @returns A Promise that resolves to nothing
*/
private executeWithRetry;
/**
* To execute the current middleware
* @param url - The request url
* @param requestInit - The request options
* @param requestOptions - The request options
* @returns A Promise that resolves to nothing
*/
execute(url: string, requestInit: RequestInit, requestOptions?: Record<string, RequestOption>): Promise<Response>;
}
//# sourceMappingURL=retryHandler.d.ts.map