nodejs-google-adwords
Version:
Google Ads API Client Library for Node.js
38 lines (37 loc) • 1.26 kB
TypeScript
import { Omit } from '../../types/core';
interface IOAuthCredential {
access_token?: string;
expires_in?: number;
refresh_token: string;
scope?: string;
token_type?: string;
}
interface IOAuthRefreshedCredential extends Required<Omit<IOAuthCredential, 'refresh_token'>> {
}
interface IAuthServiceOpts {
clientId: string;
clientSecret: string;
}
interface IAuthService {
refreshCredentials(): Promise<IOAuthCredential>;
setCredentials(credentials: IOAuthCredential): void;
getCredentials(): IOAuthCredential;
}
interface IAuthServiceClass {
new (): IAuthService;
getInstance(options: IAuthServiceOpts): IAuthService;
}
declare class AuthService implements IAuthService {
static getInstance(options: IAuthServiceOpts): AuthService;
private static instance;
private readonly authURL;
private clientId;
private clientSecret;
private credentials;
private tokenExpiresInMs;
constructor(options: IAuthServiceOpts);
setCredentials(credentials: IOAuthCredential): void;
getCredentials(): IOAuthCredential;
refreshCredentials(): Promise<IOAuthCredential>;
}
export { AuthService, IOAuthCredential, IOAuthRefreshedCredential, IAuthServiceOpts, IAuthServiceClass, IAuthService };