-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* [App:pCloud] Importing changes from PR #1392 * [App:pCloud] Description adjustments * [App:pCloud] Syntax adjustments * [App:pCloud] Linking doc in description * [App:pCloud] Creating common action and $summary * [App;pCloud] Improving prop sharing and naming * [App:pCloud] Further refining descriptions, plus fixes * [App:pCloud] Prop sharing improvements * [App:pCloud] Customizing shared prop descriptions per component * [App:pCloud] Creating location validation * Initial PR adjustments * [App:pCloud] Creating file validation * [App:pCloud] Watch folder improvements * [App:pCloud] Description updates * [App:pCloud] Including docs in descriptions * pnpm-lock.yaml pCloud #938 * [App:pCloud] Code review requested adjustments #1 * [App:pCloud] Adjusting custom description props * [App:pCloud] Changing common props to propDefinitions * [App:pCloud] Code review adjustments * [App:pCloud] Fixing await inside try/catch
- Loading branch information
Showing
11 changed files
with
2,186 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
); | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
); | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
37
components/pcloud/actions/download-files/download-files.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
); | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.
ee6395d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
pipedream-docs – ./docs
pipedream-docs-test.vercel.app
docs-proxy.pipedream.com
docs-proxy.pipedream.net
pipedream-docs-git-master-pipedreamers.vercel.app
pipedream-docs-pipedreamers.vercel.app