UNPKG

1.68 kBTypeScriptView Raw
1/// <reference types="node" />
2import * as stream from 'stream';
3import { JWTInput } from './credentials';
4import { GetTokenResponse, OAuth2Client, RefreshOptions } from './oauth2client';
5export interface UserRefreshClientOptions extends RefreshOptions {
6 clientId?: string;
7 clientSecret?: string;
8 refreshToken?: string;
9}
10export declare class UserRefreshClient extends OAuth2Client {
11 _refreshToken?: string | null;
12 /**
13 * User Refresh Token credentials.
14 *
15 * @param clientId The authentication client ID.
16 * @param clientSecret The authentication client secret.
17 * @param refreshToken The authentication refresh token.
18 */
19 constructor(clientId?: string, clientSecret?: string, refreshToken?: string);
20 constructor(options: UserRefreshClientOptions);
21 constructor(clientId?: string, clientSecret?: string, refreshToken?: string);
22 /**
23 * Refreshes the access token.
24 * @param refreshToken An ignored refreshToken..
25 * @param callback Optional callback.
26 */
27 protected refreshTokenNoCache(refreshToken?: string | null): Promise<GetTokenResponse>;
28 /**
29 * Create a UserRefreshClient credentials instance using the given input
30 * options.
31 * @param json The input object.
32 */
33 fromJSON(json: JWTInput): void;
34 /**
35 * Create a UserRefreshClient credentials instance using the given input
36 * stream.
37 * @param inputStream The input stream.
38 * @param callback Optional callback.
39 */
40 fromStream(inputStream: stream.Readable): Promise<void>;
41 fromStream(inputStream: stream.Readable, callback: (err?: Error) => void): void;
42 private fromStreamAsync;
43}