MCPcopy Index your code
hub / github.com/CapSoftware/Cap / getGoogleDriveUserEmail

Function getGoogleDriveUserEmail

packages/web-backend/src/Storage/GoogleDrive.ts:492–513  ·  view source on GitHub ↗
(
	config: GoogleDriveIntegrationConfig,
	tokenStore?: GoogleDriveTokenStore,
)

Source from the content-addressed store, hash-verified

490 `${DRIVE_WARNING_OBJECT_PREFIX}/${folderPath}/${DRIVE_WARNING_FILE_NAME}`;
491
492export const getGoogleDriveUserEmail = (
493 config: GoogleDriveIntegrationConfig,
494 tokenStore?: GoogleDriveTokenStore,
495) =>
496 driveFetch(
497 config,
498 `${DRIVE_API_BASE}/about?fields=user(emailAddress)`,
499 undefined,
500 tokenStore,
501 ).pipe(
502 Effect.flatMap((response) =>
503 Effect.tryPromise({
504 try: async () => {
505 const body = (await parseDriveJson<{
506 user?: { emailAddress?: string };
507 }>(response)) as { user?: { emailAddress?: string } };
508 return body.user?.emailAddress;
509 },
510 catch: (cause) => new Storage.StorageError({ cause }),
511 }),
512 ),
513 );
514
515export const getGoogleDriveStorageQuota = (
516 config: GoogleDriveIntegrationConfig,

Callers 2

storage.tsFile · 0.90

Calls 1

driveFetchFunction · 0.85

Tested by

no test coverage detected