@pipedream/google_drive 0.4.2 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
ADDED
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
key: "google_drive-create-file",
|
|
8
8
|
name: "Create a New File",
|
|
9
9
|
description: "Create a new file from a URL or /tmp/filepath. [See the docs](https://developers.google.com/drive/api/v3/reference/files/create) for more information",
|
|
10
|
-
version: "0.0.
|
|
10
|
+
version: "0.0.8",
|
|
11
11
|
type: "action",
|
|
12
12
|
props: {
|
|
13
13
|
googleDrive,
|
|
@@ -135,7 +135,7 @@ export default {
|
|
|
135
135
|
label: "Copy Requires Writer Permission",
|
|
136
136
|
description: toSingleLineString(`
|
|
137
137
|
Whether the options to copy, print, or download this file, should be disabled for
|
|
138
|
-
readers and
|
|
138
|
+
readers and commentators
|
|
139
139
|
`),
|
|
140
140
|
optional: true,
|
|
141
141
|
},
|
|
@@ -4,13 +4,16 @@ import {
|
|
|
4
4
|
toSingleLineString,
|
|
5
5
|
} from "../../utils.mjs";
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
MY_DRIVE_VALUE,
|
|
9
|
+
GOOGLE_DRIVE_FOLDER_MIME_TYPE,
|
|
10
|
+
} from "../../constants.mjs";
|
|
8
11
|
|
|
9
12
|
export default {
|
|
10
13
|
key: "google_drive-create-folder",
|
|
11
14
|
name: "Create Folder",
|
|
12
15
|
description: "Create a new empty folder. [See the docs](https://developers.google.com/drive/api/v3/reference/files/create) for more information",
|
|
13
|
-
version: "0.0.
|
|
16
|
+
version: "0.0.7",
|
|
14
17
|
type: "action",
|
|
15
18
|
props: {
|
|
16
19
|
googleDrive,
|
|
@@ -29,8 +32,10 @@ export default {
|
|
|
29
32
|
drive: c.drive,
|
|
30
33
|
}),
|
|
31
34
|
],
|
|
32
|
-
description:
|
|
33
|
-
|
|
35
|
+
description: toSingleLineString(`
|
|
36
|
+
Select a folder in which to place the new folder.
|
|
37
|
+
If not specified, the folder will be placed directly in the drive's top-level folder.
|
|
38
|
+
`),
|
|
34
39
|
optional: true,
|
|
35
40
|
},
|
|
36
41
|
name: {
|
|
@@ -42,42 +47,46 @@ export default {
|
|
|
42
47
|
description: "The name of the new folder",
|
|
43
48
|
optional: true,
|
|
44
49
|
},
|
|
45
|
-
|
|
50
|
+
createIfUnique: {
|
|
46
51
|
type: "boolean",
|
|
47
|
-
label: "Create If
|
|
52
|
+
label: "Create Only If Filename Is Unique?",
|
|
48
53
|
description: toSingleLineString(`
|
|
49
|
-
If the folder already exists
|
|
50
|
-
backwards
|
|
54
|
+
If the folder already exists, **do not** create. This option defaults to \`false\` for
|
|
55
|
+
backwards compatibility and to be consistent with default Google Drive behavior.
|
|
51
56
|
`),
|
|
52
57
|
optional: true,
|
|
53
|
-
default:
|
|
58
|
+
default: false,
|
|
54
59
|
},
|
|
55
60
|
},
|
|
56
61
|
async run({ $ }) {
|
|
57
62
|
const {
|
|
63
|
+
drive,
|
|
58
64
|
parentId,
|
|
59
65
|
name,
|
|
60
|
-
|
|
66
|
+
createIfUnique,
|
|
61
67
|
} = this;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
|
|
69
|
+
const driveId = await this.googleDrive.getDriveId(drive);
|
|
70
|
+
|
|
71
|
+
if (createIfUnique) {
|
|
72
|
+
let q = `mimeType = '${GOOGLE_DRIVE_FOLDER_MIME_TYPE}' and name = '${name}' and trashed = false`;
|
|
73
|
+
if (parentId) {
|
|
74
|
+
q += ` and '${parentId}' in parents`;
|
|
75
|
+
} else if (drive === MY_DRIVE_VALUE) {
|
|
76
|
+
q += " and 'root' in parents";
|
|
77
|
+
} else {
|
|
78
|
+
q += ` and '${driveId}' in parents`;
|
|
72
79
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
80
|
+
const folders = (await this.googleDrive.listFilesInPage(null, getListFilesOpts(drive, {
|
|
81
|
+
q,
|
|
82
|
+
}))).files;
|
|
76
83
|
|
|
77
|
-
|
|
84
|
+
if (folders.length) {
|
|
85
|
+
$.export("$summary", "Found existing folder, therefore not creating folder. Returning found folder.");
|
|
86
|
+
return this.googleDrive.getFile(folders[0].id);
|
|
78
87
|
}
|
|
79
88
|
}
|
|
80
|
-
|
|
89
|
+
|
|
81
90
|
const resp = await this.googleDrive.createFolder({
|
|
82
91
|
name,
|
|
83
92
|
parentId,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "google_drive-update-shared-drive",
|
|
5
5
|
name: "Update Shared Drive",
|
|
6
6
|
description: "Update an existing shared drive. [See the docs](https://developers.google.com/drive/api/v3/reference/drives/update) for more information",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.4",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
googleDrive,
|
|
@@ -27,7 +27,7 @@ export default {
|
|
|
27
27
|
type: "string",
|
|
28
28
|
label: "Background Image Link",
|
|
29
29
|
description:
|
|
30
|
-
"A link to the new
|
|
30
|
+
"A link to the new background image for the shared drive. Cannot be set if `Theme ID` is set in the same request.",
|
|
31
31
|
optional: true,
|
|
32
32
|
},
|
|
33
33
|
colorRgb: {
|