UNPKG

@uppy/companion

Version:

OAuth helper and remote fetcher for Uppy's (https://uppy.io) extensible file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Dropbox and Google Drive, S3 and more :dog:

89 lines (88 loc) 2.64 kB
/** * Provider interface defines the specifications of any provider implementation */ export default class Provider { /** * config to extend the grant config */ static getExtraGrantConfig(): {}; /** * Name of the OAuth provider (passed to Grant). Return empty string if no OAuth provider is needed. * * @returns {string} */ static get oauthProvider(): string; static grantDynamicToUserSession({ grantDynamic }: { grantDynamic: any; }): {}; static get hasSimpleAuth(): boolean; static get authStateExpiry(): number; /** * * @param {{providerName: string, allowLocalUrls: boolean, providerGrantConfig?: object, secret: string}} options */ constructor({ allowLocalUrls, providerGrantConfig, secret }: { providerName: string; allowLocalUrls: boolean; providerGrantConfig?: object; secret: string; }); needsCookieAuth: boolean; allowLocalUrls: boolean; providerGrantConfig: any; secret: string; /** * list the files and folders in the provider account * * @param {object} options * @returns {Promise} */ list(options: object): Promise<any>; /** * search for files/folders in the provider account * * @param {object} options * @returns {Promise} */ search(options: object): Promise<any>; /** * download a certain file from the provider account * * @param {object} options * @returns {Promise} */ download(options: object): Promise<any>; /** * return a thumbnail for a provider file * * @param {object} options * @returns {Promise} */ thumbnail(options: object): Promise<any>; /** * first Companion will try to get the size from the content-length response header, * if that fails, it will call this method to get the size. * So if your provider has a different method for getting the size, you can return the size here * * @param {object} options * @returns {Promise} */ size(options: object): Promise<any>; /** * handle deauthorization notification from oauth providers * * @param {object} options * @returns {Promise} */ deauthorizationCallback(options: object): Promise<any>; /** * Generate a new access token based on the refresh token */ refreshToken(options: any): Promise<void>; /** * @param {any} param0 * @returns {Promise<any>} */ simpleAuth({ requestBody }: any): Promise<any>; } export function isOAuthProvider(oauthProvider: any): boolean;