Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8163a48
[App:pCloud] Importing changes from PR #1392
GTFalcao Jun 16, 2022
1dec849
[App:pCloud] Description adjustments
GTFalcao Jun 16, 2022
aad601c
[App:pCloud] Syntax adjustments
GTFalcao Jun 17, 2022
31254e6
[App:pCloud] Linking doc in description
GTFalcao Jun 17, 2022
f5f4e61
Merge branch 'master' into 938-pcloud-new-actions
GTFalcao Jun 21, 2022
5ac196b
[App:pCloud] Creating common action and $summary
GTFalcao Jun 21, 2022
dfc841b
[App;pCloud] Improving prop sharing and naming
GTFalcao Jun 21, 2022
bcdc203
[App:pCloud] Further refining descriptions, plus fixes
GTFalcao Jun 21, 2022
2cfc399
[App:pCloud] Prop sharing improvements
GTFalcao Jun 22, 2022
a2bf74f
[App:pCloud] Customizing shared prop descriptions per component
GTFalcao Jun 22, 2022
41afdc0
[App:pCloud] Creating location validation
GTFalcao Jun 22, 2022
b20e587
Initial PR adjustments
GTFalcao Jun 23, 2022
3bb90c9
[App:pCloud] Creating file validation
GTFalcao Jun 23, 2022
3427f31
[App:pCloud] Watch folder improvements
GTFalcao Jun 23, 2022
87dd3a0
[App:pCloud] Description updates
GTFalcao Jun 23, 2022
81b7c70
[App:pCloud] Including docs in descriptions
GTFalcao Jun 24, 2022
b16c4c2
Merge branch 'master' into 938-pcloud-new-actions
GTFalcao Jun 24, 2022
db4fdb9
Merge branch 'master' into 938-pcloud-new-actions
GTFalcao Jun 27, 2022
abf8105
pnpm-lock.yaml pCloud #938
GTFalcao Jun 27, 2022
503088f
Merge remote-tracking branch 'origin/master' into 938-pcloud-new-actions
GTFalcao Jun 27, 2022
045ab5b
[App:pCloud] Code review requested adjustments #1
GTFalcao Jun 28, 2022
22a5832
[App:pCloud] Adjusting custom description props
GTFalcao Jun 29, 2022
87b5952
[App:pCloud] Changing common props to propDefinitions
GTFalcao Jun 29, 2022
133b567
[App:pCloud] Code review adjustments
GTFalcao Jun 29, 2022
4c32d7f
[App:pCloud] Fixing await inside try/catch
GTFalcao Jun 29, 2022
cb703df
Merge branch 'master' into 938-pcloud-new-actions
GTFalcao Jul 1, 2022
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
43 changes: 43 additions & 0 deletions components/pcloud/actions/common/base.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import pcloud from "../../pcloud.app.mjs";

export default {
props: {
pcloud,
},
methods: {
validateLocationId() {
const VALID_LOCATIONS = [
"0",
"1",
];
const locationId = this.pcloud.$auth.locationid;

if (!VALID_LOCATIONS.includes(locationId)) {
return "Unable to retrieve your account's Location ID - try reconnecting your pCloud account to Pipedream";
}

return true;
},
async validateInputs() {
return true;
},
},
async run({ $ }) {
const validations = [
this.validateLocationId(),
await this.validateInputs(),
];

const errors = validations.filter((result) => result !== true);
if (errors.length) {
throw new Error(errors.join("; "));
}

const requestMethod = this.requestMethod;
const response = await this.pcloud._withRetries(() => requestMethod());

$.export("$summary", this.getSummary());

return response;
},
};
76 changes: 76 additions & 0 deletions components/pcloud/actions/copy-file/copy-file.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import pcloud from "../../pcloud.app.mjs";
import common from "../common/base.mjs";

export default {
...common,
key: "pcloud-copy-file",
name: "Copy File",
description:
"Copy a file to the specified destination. [See the docs here](https://docs.pcloud.com/methods/file/copyfile.html)",
version: "0.0.1",
type: "action",
props: {
...common.props,
fileId: {
propDefinition: [
pcloud,
"fileId",
],
description: `Select a **File** to copy.
\\
Alternatively, you can provide a custom *File ID*.`,
},
toFolderId: {
propDefinition: [
pcloud,
"folderId",
],
label: "Destination Folder ID",
description: `Select a **Destination Folder** to receive the copied file.
\\
Alternatively, you can provide a custom *Folder ID*.`,
},
name: {
propDefinition: [
pcloud,
"name",
],
label: "New File Name",
description: "Name of the destination file.",
},
overwrite: {
propDefinition: [
pcloud,
"overwrite",
],
},
modifiedTime: {
propDefinition: [
pcloud,
"modifiedTime",
],
},
createdTime: {
propDefinition: [
pcloud,
"createdTime",
],
},
},
methods: {
...common.methods,
getSummary() {
return `Copied file "${this.name}" successfully`;
},
async requestMethod() {
return this.pcloud.copyFile(
this.fileId,
this.toFolderId,
this.name,
!this.overwrite,
this.modifiedTime,
this.createdTime,
);
},
},
};
61 changes: 61 additions & 0 deletions components/pcloud/actions/copy-folder/copy-folder.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import pcloud from "../../pcloud.app.mjs";
import common from "../common/base.mjs";

export default {
...common,
key: "pcloud-copy-folder",
name: "Copy Folder",
description: "Copy a folder to the specified folder. [See the docs here](https://docs.pcloud.com/methods/folder/copyfolder.html)",
version: "0.0.1",
type: "action",
props: {
...common.props,
folderId: {
propDefinition: [
pcloud,
"folderId",
],
description: `Select a **Folder** to copy.
\\
Alternatively, you can provide a custom *Folder ID*.`,
},
toFolderId: {
propDefinition: [
pcloud,
"folderId",
],
label: "Destination Folder ID",
description: `Select a **Destination Folder** where the folder will be copied to.
\\
Alternatively, you can provide a custom *Folder ID*.`,
},
overwrite: {
propDefinition: [
pcloud,
"overwrite",
],
},
copyContentOnly: {
type: "boolean",
label: "Copy Content Only?",
description:
"If true, only the contents of source folder will be copied, otherwise the folder itself is copied.",
default: false,
optional: true,
},
},
methods: {
...common.methods,
getSummary() {
return "Copied folder successfully";
},
async requestMethod() {
return this.pcloud.copyFolder(
this.folderId,
this.toFolderId,
!this.overwrite,
this.copyContentOnly,
);
},
},
};
40 changes: 40 additions & 0 deletions components/pcloud/actions/create-folder/create-folder.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import pcloud from "../../pcloud.app.mjs";
import common from "../common/base.mjs";

export default {
...common,
key: "pcloud-create-folder",
name: "Create Folder",
description:
"Create a folder in the specified folder. [See the docs here](https://docs.pcloud.com/methods/folder/createfolder.html)",
version: "0.0.1",
type: "action",
props: {
...common.props,
folderId: {
propDefinition: [
pcloud,
"folderId",
],
description: `Select a **Folder** to create the new folder within.
\\
Alternatively, you can provide a custom *Folder ID*.`,
label: "Parent Folder ID",
},
name: {
propDefinition: [
pcloud,
"name",
],
},
},
methods: {
...common.methods,
getSummary() {
return `Created folder "${this.name}" successfully`;
},
async requestMethod() {
return this.pcloud.createFolder(this.name, this.folderId);
},
},
};
37 changes: 37 additions & 0 deletions components/pcloud/actions/download-files/download-files.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import pcloud from "../../pcloud.app.mjs";
import common from "../common/base.mjs";

export default {
...common,
key: "pcloud-download-files",
name: "Download File(s)",
description: "Download one or more files to a folder. [See the docs here](https://docs.pcloud.com/methods/file/downloadfile.html)",
version: "0.0.1",
type: "action",
props: {
...common.props,
urls: {
type: "string[]",
label: "URLs",
description: "URL(s) of the files to download.",
},
folderId: {
propDefinition: [
pcloud,
"folderId",
],
description: `Select a **Folder** to receive the downloaded files.
\\
Alternatively, you can provide a custom *Folder ID*.`,
},
},
methods: {
...common.methods,
getSummary() {
return `Downloaded ${this.urls.length} files successfully`;
},
async requestMethod() {
return this.pcloud.downloadFiles(this.urls, this.folderId);
},
},
};
64 changes: 64 additions & 0 deletions components/pcloud/actions/list-contents/list-contents.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import pcloud from "../../pcloud.app.mjs";
import common from "../common/base.mjs";

export default {
...common,
key: "pcloud-list-contents",
name: "List Contents",
description: "Get the contents of the specified folder. [See the docs here](https://docs.pcloud.com/methods/folder/listfolder.html)",
version: "0.0.1",
type: "action",
props: {
...common.props,
folderId: {
propDefinition: [
pcloud,
"folderId",
],
description: `Select a **Folder** to get the contents of.
\\
Alternatively, you can provide a custom *Folder ID*.`,
},
recursive: {
type: "boolean",
label: "Recursive?",
description:
"If true, returns contents of the folder **and all subfolders,** recursively.",
default: false,
},
showDeleted: {
propDefinition: [
pcloud,
"showDeleted",
],
},
noFiles: {
type: "boolean",
label: "Folders Only?",
description:
"If true, only the **folder** (sub)structure will be returned.",
default: false,
},
noShares: {
type: "boolean",
label: "Exclude Shares?",
description: "If true, excludes shared files and folders.",
default: true,
},
},
methods: {
...common.methods,
getSummary() {
return "Listed folder contents successfully";
},
async requestMethod() {
return this.pcloud.listContents(
this.folderId,
this.recursive,
this.showDeleted,
this.noFiles,
this.noShares,
);
},
},
};
Loading