UNPKG

1.32 kBTypeScriptView Raw
1import { Gaxios, GaxiosError, GaxiosOptions, GaxiosPromise, GaxiosResponse } from 'gaxios';
2export interface Transporter {
3 defaults?: GaxiosOptions;
4 request<T>(opts: GaxiosOptions): GaxiosPromise<T>;
5}
6export interface BodyResponseCallback<T> {
7 (err: Error | null, res?: GaxiosResponse<T> | null): void;
8}
9export interface RequestError extends GaxiosError {
10 errors: Error[];
11}
12export declare class DefaultTransporter implements Transporter {
13 /**
14 * Default user agent.
15 */
16 static readonly USER_AGENT: string;
17 /**
18 * A configurable, replacable `Gaxios` instance.
19 */
20 instance: Gaxios;
21 /**
22 * Configures request options before making a request.
23 * @param opts GaxiosOptions options.
24 * @return Configured options.
25 */
26 configure(opts?: GaxiosOptions): GaxiosOptions;
27 /**
28 * Makes a request using Gaxios with given options.
29 * @param opts GaxiosOptions options.
30 * @param callback optional callback that contains GaxiosResponse object.
31 * @return GaxiosPromise, assuming no callback is passed.
32 */
33 request<T>(opts: GaxiosOptions): GaxiosPromise<T>;
34 get defaults(): GaxiosOptions;
35 set defaults(opts: GaxiosOptions);
36 /**
37 * Changes the error to include details from the body.
38 */
39 private processError;
40}