1 | import { AuthClient, GoogleAuth, GoogleAuthOptions } from 'google-auth-library';
|
2 | import * as r from 'teeny-request';
|
3 | import { Interceptor } from './service-object';
|
4 | import { BodyResponseCallback, DecorateRequestOptions, MakeAuthenticatedRequest, PackageJson } from './util';
|
5 | export declare const DEFAULT_PROJECT_ID_TOKEN = "{{projectId}}";
|
6 | export interface StreamRequestOptions extends DecorateRequestOptions {
|
7 | shouldReturnStream: true;
|
8 | }
|
9 | export interface ServiceConfig {
|
10 | |
11 |
|
12 |
|
13 | baseUrl: string;
|
14 | |
15 |
|
16 |
|
17 |
|
18 | apiEndpoint: string;
|
19 | |
20 |
|
21 |
|
22 | scopes: string[];
|
23 | projectIdRequired?: boolean;
|
24 | packageJson: PackageJson;
|
25 | |
26 |
|
27 |
|
28 | authClient?: AuthClient | GoogleAuth;
|
29 | }
|
30 | export interface ServiceOptions extends Omit<GoogleAuthOptions, 'authClient'> {
|
31 | authClient?: AuthClient | GoogleAuth;
|
32 | interceptors_?: Interceptor[];
|
33 | email?: string;
|
34 | token?: string;
|
35 | timeout?: number;
|
36 | userAgent?: string;
|
37 | useAuthWithCustomEndpoint?: boolean;
|
38 | }
|
39 | export declare class Service {
|
40 | baseUrl: string;
|
41 | private globalInterceptors;
|
42 | interceptors: Interceptor[];
|
43 | private packageJson;
|
44 | projectId: string;
|
45 | private projectIdRequired;
|
46 | providedUserAgent?: string;
|
47 | makeAuthenticatedRequest: MakeAuthenticatedRequest;
|
48 | authClient: GoogleAuth<AuthClient>;
|
49 | private getCredentials;
|
50 | readonly apiEndpoint: string;
|
51 | timeout?: number;
|
52 | |
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 | constructor(config: ServiceConfig, options?: ServiceOptions);
|
68 | /**
|
69 | * Return the user's custom request interceptors.
|
70 | */
|
71 | getRequestInterceptors(): Function[];
|
72 | /**
|
73 | * Get and update the Service's project ID.
|
74 | *
|
75 | * @param {function} callback - The callback function.
|
76 | */
|
77 | getProjectId(): Promise<string>;
|
78 | getProjectId(callback: (err: Error | null, projectId?: string) => void): void;
|
79 | protected getProjectIdAsync(): Promise<string>;
|
80 | |
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 | private request_;
|
90 | |
91 |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 |
|
97 | request(reqOpts: DecorateRequestOptions, callback: BodyResponseCallback): void;
|
98 | |
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 | requestStream(reqOpts: DecorateRequestOptions): r.Request;
|
105 | }
|