UNPKG

@gravityforms/gulp-tasks

Version:
108 lines (107 loc) 4.16 kB
import * as google from '@googleapis/drive'; import { RateLimiter } from 'limiter'; import { Token$GoogleApi } from './utils/getDrive'; import { batch } from './methods/batch'; import { call } from './methods/call'; import { del } from './methods/del'; import { download } from './methods/download'; import { getFileId } from './methods/getFileId'; import { getFileName } from './methods/getFileName'; import { getFiles } from './methods/getFiles'; import { getMimeType } from './methods/getMimeType'; import { listChildren } from './methods/listChildren'; import { listFiles } from './methods/listFiles'; import { makeFolder } from './methods/makeFolder'; import { makeNestedFolder } from './methods/makeNestedFolder'; import { move } from './methods/move'; import { rename } from './methods/rename'; import { updateFiles } from './methods/updateFiles'; import { upload } from './methods/upload'; import { Credentials$GoogleApi } from './utils/getOAuth2Client'; import { Opts$ExpBack } from './utils/ApplyExpBack'; export { Identifiers } from './utils/utilsMethods'; export { Call$Batch, Response$Batch } from './methods/batch'; export { Resource$Call, Method$Call } from './methods/call'; export { Identifiers$Download } from './methods/download'; export { Identifiers$GetFileId } from './methods/getFileId'; export { Params$MakeFolder } from './methods/makeFolder'; export { Params$Upload } from './methods/upload'; export { drive_v3, StreamMethodOptions } from '@googleapis/drive'; /** * Authentication parameters for initializing `UtilsGDrive` base class. */ export interface Auth$UtilsGDrive { /** * The credentials used for authentication. */ credentials?: Credentials$GoogleApi | string; /** * The token used for authentication. */ token?: Token$GoogleApi | string; /** * Path to file containing credentials. */ pathCredentials?: string; /** * Path to file containing token. */ pathToken?: string; } export { Credentials$GoogleApi, Token$GoogleApi }; /** * Options for UtilsGDrive base class. */ export interface Opts$UtilsGDrive { rateLimiter?: { /** * Number of API calls that can be made within given interval. */ tokensPerInterval: number; /** * Interval of time in miliseconds. */ interval: number; }; expBack?: Opts$ExpBack; } export { Opts$ExpBack }; export { getTokenGDrive, Params$GetTokenGDrive } from './utils/getTokenGDrive'; export declare class UtilsGDrive { limiter: RateLimiter; protected optsExpBack: Opts$ExpBack; drive: google.drive_v3.Drive; batch: typeof batch; call: typeof call; del: typeof del; download: typeof download; getFileId: typeof getFileId; getFileName: typeof getFileName; getFiles: typeof getFiles; getMimeType: typeof getMimeType; listChildren: typeof listChildren; listFiles: typeof listFiles; makeFolder: typeof makeFolder; makeNestedFolder: typeof makeNestedFolder; move: typeof move; rename: typeof rename; updateFiles: typeof updateFiles; upload: typeof upload; /** * Base class containing utils-google-drive methods. * * The token and credentials used for authentication can be * provided as strings or objects during initialization (`auth.token` and `auth.credentials`). * Alternatively, paths to the token and credentials can be provided (`auth.pathToken` and `auth.pathCredentials`). * * The token is retreived from ./tokenGDrive.json when * neither `auth.token` nor `auth.pathToken` is specified. * Similarly, the credentials are retreived from ./credentialsGDrive.json when * neither `auth.credentials` nor `auth.pathCredentials` is specified. * * Use `opts.rateLimiter` and `opts.expBack` to set rate-limiting and exponential backoff behaviors for API calls. * The default rate limit is 1,000 requests per 100 seconds. * The default behavior for exponential backoff is retrying up to three times for any error thrown. */ constructor(auth?: Auth$UtilsGDrive, opts?: Opts$UtilsGDrive); }