Skip to content

Commit 13eb443

Browse files
authored
Merge pull request activepieces#6780 from maarteNNNN/main
feat(google-drive): add teamdrive to get-file-by-id step
2 parents 96131cc + e79988e commit 13eb443

File tree

2 files changed

+28
-25
lines changed

2 files changed

+28
-25
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"name": "@activepieces/piece-google-drive",
3-
"version": "0.5.35"
3+
"version": "0.5.36"
44
}
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,36 @@
11
import { googleDriveAuth } from '../../index';
2-
import { Property, createAction } from "@activepieces/pieces-framework";
2+
import { Property, createAction } from '@activepieces/pieces-framework';
33
import { google } from 'googleapis';
44
import { OAuth2Client } from 'googleapis-common';
55
import { common } from '../common';
66

77
export const googleDriveGetResourceById = createAction({
8-
auth: googleDriveAuth,
9-
name: 'get-file-or-folder-by-id',
10-
displayName: 'Get File',
11-
description: 'Get a file folder for files/sub-folders',
12-
props: {
13-
id: Property.ShortText({
14-
displayName: 'File / Folder Id',
15-
description: 'The Id of the file/folder to search for.',
16-
required: true,
17-
})
18-
},
19-
async run(context) {
20-
const authClient = new OAuth2Client();
21-
authClient.setCredentials(context.auth)
22-
const drive = google.drive({ version: 'v3', auth: authClient });
23-
const response = await drive.files.get({ fileId: context.propsValue.id });
8+
auth: googleDriveAuth,
9+
name: 'get-file-or-folder-by-id',
10+
displayName: 'Get File',
11+
description: 'Get a file folder for files/sub-folders',
12+
props: {
13+
id: Property.ShortText({
14+
displayName: 'File / Folder Id',
15+
description: 'The Id of the file/folder to search for.',
16+
required: true,
17+
}),
18+
include_team_drives: common.properties.include_team_drives,
19+
},
20+
async run(context) {
21+
const authClient = new OAuth2Client();
22+
authClient.setCredentials(context.auth);
23+
const drive = google.drive({ version: 'v3', auth: authClient });
24+
const response = await drive.files.get({
25+
fileId: context.propsValue.id,
26+
supportsAllDrives: context.propsValue.include_team_drives,
27+
});
2428

25-
if (response.data) {
26-
return response.data;
27-
} else {
28-
console.log('The specified ID corresponds to a folder. Returning null.');
29-
return null;
30-
}
31-
29+
if (response.data) {
30+
return response.data;
31+
} else {
32+
console.log('The specified ID corresponds to a folder. Returning null.');
33+
return null;
3234
}
35+
},
3336
});

0 commit comments

Comments
 (0)