1 | import { Agent } from 'http';
|
2 | import { URL } from 'url';
|
3 | import { GaxiosOptions, GaxiosPromise, GaxiosResponse } from './common';
|
4 | import { GaxiosInterceptorManager } from './interceptor';
|
5 | export declare class Gaxios {
|
6 | #private;
|
7 | protected agentCache: Map<string | URL, Agent | ((parsedUrl: URL) => Agent)>;
|
8 | /**
|
9 | * Default HTTP options that will be used for every HTTP request.
|
10 | */
|
11 | defaults: GaxiosOptions;
|
12 | /**
|
13 | * Interceptors
|
14 | */
|
15 | interceptors: {
|
16 | request: GaxiosInterceptorManager<GaxiosOptions>;
|
17 | response: GaxiosInterceptorManager<GaxiosResponse>;
|
18 | };
|
19 | /**
|
20 | * The Gaxios class is responsible for making HTTP requests.
|
21 | * @param defaults The default set of options to be used for this instance.
|
22 | */
|
23 | constructor(defaults?: GaxiosOptions);
|
24 | /**
|
25 | * Perform an HTTP request with the given options.
|
26 | * @param opts Set of HTTP options that will be used for this HTTP request.
|
27 | */
|
28 | request<T = any>(opts?: GaxiosOptions): GaxiosPromise<T>;
|
29 | private _defaultAdapter;
|
30 | /**
|
31 | * Internal, retryable version of the `request` method.
|
32 | * @param opts Set of HTTP options that will be used for this HTTP request.
|
33 | */
|
34 | protected _request<T = any>(opts?: GaxiosOptions): GaxiosPromise<T>;
|
35 | private getResponseData;
|
36 | /**
|
37 | * By default, throw for any non-2xx status code
|
38 | * @param status status code from the HTTP response
|
39 | */
|
40 | private validateStatus;
|
41 | /**
|
42 | * Encode a set of key/value pars into a querystring format (?foo=bar&baz=boo)
|
43 | * @param params key value pars to encode
|
44 | */
|
45 | private paramsSerializer;
|
46 | private translateResponse;
|
47 | /**
|
48 | * Attempts to parse a response by looking at the Content-Type header.
|
49 | * @param {FetchResponse} response the HTTP response.
|
50 | * @returns {Promise<any>} a promise that resolves to the response data.
|
51 | */
|
52 | private getResponseDataFromContentType;
|
53 | /**
|
54 | * Creates an async generator that yields the pieces of a multipart/related request body.
|
55 | * This implementation follows the spec: https://www.ietf.org/rfc/rfc2387.txt. However, recursive
|
56 | * multipart/related requests are not currently supported.
|
57 | *
|
58 | * @param {GaxioMultipartOptions[]} multipartOptions the pieces to turn into a multipart/related body.
|
59 | * @param {string} boundary the boundary string to be placed between each part.
|
60 | */
|
61 | private getMultipartRequest;
|
62 | }
|
63 |
|
\ | No newline at end of file |