import { AtlassianErrorResponse } from '../common'; import { AnythingButUndefined, BadRequestError, UnauthorizedError, ForbiddenError, RequestValidationError, UnexpectedError, HttpError, Response, NotFoundError, TooManyRequestsError, ServerError } from '@avst-api/commons'; import { ErrorStrategyBuilder } from '../builders/errorStrategy'; export interface ErrorStrategyOption { errorStrategy?: ErrorStrategyHandlers | null; } export interface AssistedErrorStrategyOption { errorStrategy?: ErrorStrategyHandlers | AssistedErrorStrategyFunction | null; } export declare type AssistedErrorStrategyFunction = (builder: ErrorStrategyBuilder) => ErrorStrategyBuilder | ErrorStrategyHandlers; export interface ErrorStrategyHandlers { /** * Error handler for HTTP code 400 (Bad Request). Return the value you whish to continue with, or return 'retry()' for retrying the request, or return 'continuePropagation()' for allowing the error to propagate. * @param error Error that happened. * @param attempt How many times this request has already been executed. Starts with 1 and increases after each 'retry()'. */ handleHttp400Error?(error: BadRequestError, attempt: number): AnythingButUndefined; /** * Error handler for HTTP code 401 (Unauthorized). Return the value you whish to continue with, or return 'retry()' for retrying the request, or return 'continuePropagation()' for allowing the error to propagate. * @param error Error that happened. * @param attempt How many times this request has already been executed. Starts with 1 and increases after each 'retry()'. */ handleHttp401Error?(error: UnauthorizedError, attempt: number): AnythingButUndefined; /** * Error handler for HTTP code 403 (Forbidden). Return the value you whish to continue with, or return 'retry()' for retrying the request, or return 'continuePropagation()' for allowing the error to propagate. * @param error Error that happened. * @param attempt How many times this request has already been executed. Starts with 1 and increases after each 'retry()'. */ handleHttp403Error?(error: ForbiddenError, attempt: number): AnythingButUndefined; /** * Error handler for HTTP code 404 (Not Found). Return the value you whish to continue with, or return 'retry()' for retrying the request, or return 'continuePropagation()' for allowing the error to propagate. * @param error Error that happened. * @param attempt How many times this request has already been executed. Starts with 1 and increases after each 'retry()'. */ handleHttp404Error?(error: NotFoundError, attempt: number): AnythingButUndefined; /** * Error handler for HTTP code 429 (Too Many Requests). Return the value you whish to continue with, or return 'retry()' for retrying the request, or return 'continuePropagation()' for allowing the error to propagate. * @param error Error that happened. * @param attempt How many times this request has already been executed. Starts with 1 and increases after each 'retry()'. */ handleHttp429Error?(error: TooManyRequestsError, attempt: number): AnythingButUndefined; /** * Error handler for any HTTP code in 500 range (various server side errors). Return the value you whish to continue with, or return 'retry()' for retrying the request, or return 'continuePropagation()' for allowing the error to propagate. * @param error Error that happened. * @param attempt How many times this request has already been executed. Starts with 1 and increases after each 'retry()'. */ handleHttp5xxError?(error: ServerError, attempt: number): AnythingButUndefined; /** * Error handler for any invalid HTTP code (anything other than in 200 and 300 range). Return the value you whish to continue with, or return 'retry()' for retrying the request, or return 'continuePropagation()' for allowing the error to propagate. * @param error Error that happened. * @param attempt How many times this request has already been executed. Starts with 1 and increases after each 'retry()'. */ handleHttpAnyError?(error: HttpError, attempt: number): AnythingButUndefined; /** * Error handler for unexpected error, usually either network error or JSON parsing error. Return the value you whish to continue with, or return 'retry()' for retrying the request, or return 'continuePropagation()' for allowing the error to propagate. * @param error Error that happened. * @param attempt How many times this request has already been executed. Starts with 1 and increases after each 'retry()'. */ handleUnexpectedError?(error: UnexpectedError, attempt: number): AnythingButUndefined; /** * Error handler for any error. Return the value you whish to continue with, or return 'retry()' for retrying the request, or return 'continuePropagation()' for allowing the error to propagate. * @param error Error that happened. * @param attempt How many times this request has already been executed. Starts with 1 and increases after each 'retry()'. */ handleAnyError?(error: HttpError | RequestValidationError | UnexpectedError, attempt: number): AnythingButUndefined; } export declare function executeRequest(promise: () => Promise>, errorHandlers?: ErrorStrategyHandlers, attempt?: number): Promise; export declare function injectBuilders(options: any): any; //# sourceMappingURL=common.d.ts.map