Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default {
name: "Share File or Folder",
description:
"Add a [sharing permission](https://support.google.com/drive/answer/7166529) to the sharing preferences of a file or folder and provide a sharing URL. [See the documentation](https://developers.google.com/drive/api/v3/reference/permissions/create)",
version: "0.2.0",
version: "0.2.1",
type: "action",
props: {
googleDrive,
Expand Down
2 changes: 1 addition & 1 deletion components/google_drive/actions/copy-file/copy-file.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_drive-copy-file",
name: "Copy File",
description: "Create a copy of the specified file. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/copy) for more information",
version: "0.1.7",
version: "0.1.8",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "google_drive-create-file-from-template",
name: "Create New File From Template",
description: "Create a new Google Docs file from a template. Optionally include placeholders in the template document that will get replaced from this action. [See documentation](https://www.npmjs.com/package/google-docs-mustaches)",
version: "0.1.7",
version: "0.1.8",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "google_drive-create-file-from-text",
name: "Create New File From Text",
description: "Create a new file from plain text. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/create) for more information",
version: "0.2.0",
version: "0.2.1",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default {
key: "google_drive-create-folder",
name: "Create Folder",
description: "Create a new empty folder. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/create) for more information",
version: "0.1.8",
version: "0.1.9",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_drive-create-shared-drive",
name: "Create Shared Drive",
description: "Create a new shared drive. [See the documentation](https://developers.google.com/drive/api/v3/reference/drives/create) for more information",
version: "0.1.8",
version: "0.1.9",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
name: "Delete File",
description:
"Permanently delete a file or folder without moving it to the trash. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/delete) for more information",
version: "0.1.8",
version: "0.1.9",
type: "action",
props: {
googleDrive,
infoAlert: {

Check warning on line 12 in components/google_drive/actions/delete-file/delete-file.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop infoAlert must have a label. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 12 in components/google_drive/actions/delete-file/delete-file.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop infoAlert must have a description. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "warning",
content: "This action will **permanently** delete a file. If you want to move it to the trash instead, use the **[Move File to Trash](https://pipedream.com/apps/google-drive/actions/move-file-to-trash)** action.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_drive-delete-shared-drive",
name: "Delete Shared Drive",
description: "Delete a shared drive without any content. [See the documentation](https://developers.google.com/drive/api/v3/reference/drives/delete) for more information",
version: "0.1.7",
version: "0.1.8",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default {
key: "google_drive-download-file",
name: "Download File",
description: "Download a file. [See the documentation](https://developers.google.com/drive/api/v3/manage-downloads) for more information",
version: "0.1.7",
version: "0.1.8",
type: "action",
props: {
googleDrive,
Expand Down
2 changes: 1 addition & 1 deletion components/google_drive/actions/find-file/find-file.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "google_drive-find-file",
name: "Find File",
description: "Search for a specific file by name. [See the documentation](https://developers.google.com/drive/api/v3/search-files) for more information",
version: "0.1.7",
version: "0.1.8",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "google_drive-find-folder",
name: "Find Folder",
description: "Search for a specific folder by name. [See the documentation](https://developers.google.com/drive/api/v3/search-files) for more information",
version: "0.1.7",
version: "0.1.8",
type: "action",
props: {
googleDrive,
Expand Down
2 changes: 1 addition & 1 deletion components/google_drive/actions/find-forms/find-forms.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
key: "google_drive-find-forms",
name: "Find Forms",
description: "List Google Form documents or search for a Form by name. [See the documentation](https://developers.google.com/drive/api/v3/search-files) for more information",
version: "0.0.8",
version: "0.0.9",
type: "action",
props: {
googleDrive,
Expand All @@ -29,13 +29,13 @@
description: "The ID of the parent folder which contains the file. If not specified, it will list files from the drive's top-level folder.",
optional: true,
},
queryAlert: {

Check warning on line 32 in components/google_drive/actions/find-forms/find-forms.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop queryAlert must have a label. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 32 in components/google_drive/actions/find-forms/find-forms.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop queryAlert must have a description. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: "If no query or search name is specified, all forms in the selected drive/folder will be returned.",
},
...commonSearchQuery.props,
searchQuery: {

Check warning on line 38 in components/google_drive/actions/find-forms/find-forms.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop searchQuery must have a label. See https://pipedream.com/docs/components/guidelines/#props
...commonSearchQuery.props.searchQuery,
description:
"Search for a file with a query. [See the documentation](https://developers.google.com/drive/api/guides/ref-search-terms) for more information. If specified, `Search Name` and `Parent Folder` will be ignored.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
key: "google_drive-find-spreadsheets",
name: "Find Spreadsheets",
description: "Search for a specific spreadsheet by name. [See the documentation](https://developers.google.com/drive/api/v3/search-files) for more information",
version: "0.1.7",
version: "0.1.8",
type: "action",
props: {
googleDrive,
Expand All @@ -29,13 +29,13 @@
description: "The ID of the parent folder which contains the file. If not specified, it will list files from the drive's top-level folder.",
optional: true,
},
queryAlert: {

Check warning on line 32 in components/google_drive/actions/find-spreadsheets/find-spreadsheets.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop queryAlert must have a label. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 32 in components/google_drive/actions/find-spreadsheets/find-spreadsheets.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop queryAlert must have a description. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: "If no query or search name is specified, all spreadsheets in the selected drive/folder will be returned.",
},
...commonSearchQuery.props,
searchQuery: {

Check warning on line 38 in components/google_drive/actions/find-spreadsheets/find-spreadsheets.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop searchQuery must have a label. See https://pipedream.com/docs/components/guidelines/#props
...commonSearchQuery.props.searchQuery,
description:
"Search for a file with a query. [See the documentation](https://developers.google.com/drive/api/guides/ref-search-terms) for more information. If specified, `Search Name` and `Parent Folder` will be ignored.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
key: "google_drive-get-file-by-id",
name: "Get File By ID",
description: "Get info on a specific file. [See the documentation](https://developers.google.com/drive/api/reference/rest/v3/files/get) for more information",
version: "0.0.4",
version: "0.0.5",
type: "action",
props: {
googleDrive,
Expand All @@ -16,7 +16,7 @@
],
optional: true,
},
fileIdTip: {

Check warning on line 19 in components/google_drive/actions/get-file-by-id/get-file-by-id.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop fileIdTip must have a label. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 19 in components/google_drive/actions/get-file-by-id/get-file-by-id.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop fileIdTip must have a description. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: "You can use actions such as **Find File** or **List Files** to obtain a file ID, and use its value here.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default {
key: "google_drive-get-folder-id-for-path",
name: "Get Folder ID for a Path",
description: "Retrieve a folderId for a path. [See the documentation](https://developers.google.com/drive/api/v3/search-files) for more information",
version: "0.1.9",
version: "0.1.10",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_drive-get-shared-drive",
name: "Get Shared Drive",
description: "Get metadata for one or all shared drives. [See the documentation](https://developers.google.com/drive/api/v3/reference/drives/get) for more information",
version: "0.1.7",
version: "0.1.8",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import googleDrive from "../../google_drive.app.mjs";

export default {
key: "google_drive-list-access-proposals",
name: "List Access Proposals",
description: "List access proposals for a file or folder. [See the documentation](https://developers.google.com/workspace/drive/api/reference/rest/v3/accessproposals/list)",
version: "0.0.1",
type: "action",
props: {
googleDrive,
drive: {
propDefinition: [
googleDrive,
"watchedDrive",
],
},
fileOrFolderId: {
propDefinition: [
googleDrive,
"fileOrFolderId",
(c) => ({
drive: c.drive,
}),
],
},
maxResults: {
type: "integer",
label: "Max Results",
description: "The maximum number of results to return",
default: 100,
optional: true,
},
},
async run({ $ }) {
const results = [];
let pageToken;

do {
const {
accessProposals, nextPageToken,
} = await this.googleDrive.listAccessProposals({
fileId: this.fileOrFolderId,
pageToken,
});
if (!accessProposals) {
break;
}
results.push(...accessProposals);
if (this.maxResults && results.length >= this.maxResults) {
results.length = this.maxResults;
break;
}
pageToken = nextPageToken;
} while (pageToken);

$.export("$summary", `Successfully retrieved ${results.length} access proposal${results.length === 1
? ""
: "s"}.`);
return results;
},
};
2 changes: 1 addition & 1 deletion components/google_drive/actions/list-files/list-files.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "google_drive-list-files",
name: "List Files",
description: "List files from a specific folder. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/list) for more information",
version: "0.1.11",
version: "0.1.12",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "google_drive-move-file-to-trash",
name: "Move File to Trash",
description: "Move a file or folder to trash. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/update) for more information",
version: "0.1.7",
version: "0.1.8",
type: "action",
props: {
googleDrive,
Expand Down
2 changes: 1 addition & 1 deletion components/google_drive/actions/move-file/move-file.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_drive-move-file",
name: "Move File",
description: "Move a file from one folder to another. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/update) for more information",
version: "0.1.7",
version: "0.1.8",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import googleDrive from "../../google_drive.app.mjs";
import { ConfigurationError } from "@pipedream/platform";

export default {
key: "google_drive-resolve-access-proposal",
name: "Resolve Access Proposals",
description: "Accept or deny a request for access to a file or folder in Google Drive. [See the documentation](https://developers.google.com/workspace/drive/api/reference/rest/v3/accessproposals/resolve)",
version: "0.0.1",
type: "action",
props: {
googleDrive,
drive: {
propDefinition: [
googleDrive,
"watchedDrive",
],
},
fileOrFolderId: {
propDefinition: [
googleDrive,
"fileOrFolderId",
(c) => ({
drive: c.drive,
}),
],
},
accessProposalId: {
propDefinition: [
googleDrive,
"accessProposalId",
(c) => ({
fileId: c.fileOrFolderId,
}),
],
},
action: {
type: "string",
label: "Action",
description: "The action to take on the AccessProposal",
options: [
"ACCEPT",
"DENY",
],
},
roles: {
type: "string[]",
label: "Roles",
description: "The roles to allow. Note: This field is required for the `ACCEPT` action.",
options: [
"writer",
"commenter",
"reader",
],
optional: true,
},
sendNotification: {
type: "boolean",
label: "Send Notification",
description: "Whether to send an email to the requester when the AccessProposal is denied or accepted",
optional: true,
},
},
async run({ $ }) {
if (this.action === "ACCEPT" && !this.roles?.length) {
throw new ConfigurationError("A Role is required for the `ACCEPT` action");
}

const response = await this.googleDrive.resolveAccessProposal({
fileId: this.fileOrFolderId,
proposalId: this.accessProposalId,
action: this.action,
role: this.roles,
sendNotification: this.sendNotification,
});

$.export("$summary", `Successfully resolved proposal with ID: ${this.accessProposalId}`);
return response;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_drive-search-shared-drives",
name: "Search for Shared Drives",
description: "Search for shared drives with query options. [See the documentation](https://developers.google.com/drive/api/v3/search-shareddrives) for more information",
version: "0.1.8",
version: "0.1.9",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
key: "google_drive-update-file",
name: "Update File",
description: "Update a file's metadata and/or content. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/update) for more information",
version: "1.0.0",
version: "1.0.1",
type: "action",
additionalProps,
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_drive-update-shared-drive",
name: "Update Shared Drive",
description: "Update an existing shared drive. [See the documentation](https://developers.google.com/drive/api/v3/reference/drives/update) for more information",
version: "0.1.7",
version: "0.1.8",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default {
key: "google_drive-upload-file",
name: "Upload File",
description: "Upload a file to Google Drive. [See the documentation](https://developers.google.com/drive/api/v3/manage-uploads) for more information",
version: "1.0.0",
version: "1.0.1",
type: "action",
additionalProps,
props: {
Expand Down
38 changes: 38 additions & 0 deletions components/google_drive/google_drive.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,36 @@ export default {
`),
optional: true,
},
accessProposalId: {
type: "string",
label: "Access Proposal ID",
description: "The identifier of an access proposal (when a user requests access to a file/folder)",
async options({
fileId, prevContext,
}) {
if (!fileId) {
return [];
}
const { pageToken } = prevContext;
const {
accessProposals, nextPageToken,
} = await this.listAccessProposals({
fileId,
pageToken,
});
return {
options: accessProposals?.map(({
proposalId: value, requesterEmailAddress: label,
}) => ({
label,
value,
})) || [],
context: {
pageToken: nextPageToken,
},
};
},
},
},
methods: {
// Static methods
Expand Down Expand Up @@ -1437,5 +1467,13 @@ export default {
async getExportFormats() {
return (await this.getAbout("exportFormats")).exportFormats;
},
async listAccessProposals(opts = {}) {
const drive = this.drive();
return (await drive.accessproposals.list(opts)).data;
},
async resolveAccessProposal(opts = {}) {
const drive = this.drive();
return (await drive.accessproposals.resolve(opts)).data;
},
},
};
Loading
Loading