@accounter/server
Version:
Accounter GraphQL server
30 lines (29 loc) • 1.11 kB
TypeScript
import type { Environment } from '../../../shared/types/index.js';
export declare class GoogleDriveProvider {
private env;
private apiKey;
constructor(env: Environment);
private fetchFolderContent;
private fetchFile;
private isRelevantFileType;
/**
* Whether a URL points at a single Google Drive *file* (as opposed to a
* folder, which {@link fetchFilesFromSharedFolder} handles).
*/
static isFileUrl(rawUrl: string): boolean;
/**
* Pull the file id out of the several share-link shapes Drive hands out:
* `/file/d/<id>/view`, `/open?id=<id>`, `/uc?id=<id>`.
*/
private static extractFileId;
private fetchFileMetadata;
/**
* Fetch a single file from a Drive share link.
*
* A share link is not a download link — `/file/d/<id>/view` answers with an
* HTML page — so the id is resolved through the Drive API for its real name
* and MIME type before the bytes are pulled.
*/
fetchFileFromUrl(fileUrl: string): Promise<File>;
fetchFilesFromSharedFolder(folderUrl: string): Promise<File[]>;
}