From d82259f3343d2ac9902b290871cd70a91ed926f3 Mon Sep 17 00:00:00 2001 From: Aric Lasry Date: Wed, 6 Sep 2023 16:47:01 +0200 Subject: [PATCH] Put My Drive at the top of the list --- .../google_drive/temporal/activities.ts | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/connectors/src/connectors/google_drive/temporal/activities.ts b/connectors/src/connectors/google_drive/temporal/activities.ts index 1a158035facd..9efbd0d60adc 100644 --- a/connectors/src/connectors/google_drive/temporal/activities.ts +++ b/connectors/src/connectors/google_drive/temporal/activities.ts @@ -138,6 +138,16 @@ export async function getDrivesIds(nangoConnectionId: string): Promise< const drive = await getDriveClient(nangoConnectionId); let nextPageToken = undefined; const ids: { id: string; name: string; sharedDrive: boolean }[] = []; + const myDriveRes = await drive.files.get({ fileId: "root" }); + if (myDriveRes.status !== 200) { + throw new Error( + `Error getting my drive. status_code: ${myDriveRes.status}. status_text: ${myDriveRes.statusText}` + ); + } + if (!myDriveRes.data.id) { + throw new Error("My drive id is undefined"); + } + ids.push({ id: myDriveRes.data.id, name: "My Drive", sharedDrive: false }); do { const res = await drive.drives.list({ pageSize: 100, @@ -159,17 +169,6 @@ export async function getDrivesIds(nangoConnectionId: string): Promise< nextPageToken = res.data.nextPageToken; } while (nextPageToken); - const myDriveRes = await drive.files.get({ fileId: "root" }); - if (myDriveRes.status !== 200) { - throw new Error( - `Error getting my drive. status_code: ${myDriveRes.status}. status_text: ${myDriveRes.statusText}` - ); - } - if (!myDriveRes.data.id) { - throw new Error("My drive id is undefined"); - } - ids.push({ id: myDriveRes.data.id, name: "My Drive", sharedDrive: false }); - return ids; }