1 | import { GaxiosError, GaxiosOptions, GaxiosResponse } from './common';
|
2 | /**
|
3 | * Interceptors that can be run for requests or responses. These interceptors run asynchronously.
|
4 | */
|
5 | export interface GaxiosInterceptor<T extends GaxiosOptions | GaxiosResponse> {
|
6 | /**
|
7 | * Function to be run when applying an interceptor.
|
8 | *
|
9 | * @param {T} configOrResponse The current configuration or response.
|
10 | * @returns {Promise<T>} Promise that resolves to the modified set of options or response.
|
11 | */
|
12 | resolved?: (configOrResponse: T) => Promise<T>;
|
13 | /**
|
14 | * Function to be run if the previous call to resolved throws / rejects or the request results in an invalid status
|
15 | * as determined by the call to validateStatus.
|
16 | *
|
17 | * @param {GaxiosError} err The error thrown from the previously called resolved function.
|
18 | */
|
19 | rejected?: (err: GaxiosError) => void;
|
20 | }
|
21 | /**
|
22 | * Class to manage collections of GaxiosInterceptors for both requests and responses.
|
23 | */
|
24 | export declare class GaxiosInterceptorManager<T extends GaxiosOptions | GaxiosResponse> extends Set<GaxiosInterceptor<T> | null> {
|
25 | }
|