@pipedream/google_drive 0.8.7 → 0.8.9
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.
@@ -20,7 +20,7 @@ export default {
|
|
20
20
|
name: "Share File or Folder",
|
21
21
|
description:
|
22
22
|
"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)",
|
23
|
-
version: "0.
|
23
|
+
version: "0.2.0",
|
24
24
|
type: "action",
|
25
25
|
props: {
|
26
26
|
googleDrive,
|
@@ -31,6 +31,16 @@ export default {
|
|
31
31
|
],
|
32
32
|
optional: true,
|
33
33
|
},
|
34
|
+
useFileOrFolder: {
|
35
|
+
type: "string",
|
36
|
+
label: "Use File or Folder",
|
37
|
+
description: "Whether to use a file or a folder for this action",
|
38
|
+
reloadProps: true,
|
39
|
+
options: [
|
40
|
+
"File",
|
41
|
+
"Folder",
|
42
|
+
],
|
43
|
+
},
|
34
44
|
fileId: {
|
35
45
|
propDefinition: [
|
36
46
|
googleDrive,
|
@@ -39,7 +49,7 @@ export default {
|
|
39
49
|
drive: c.drive,
|
40
50
|
}),
|
41
51
|
],
|
42
|
-
|
52
|
+
hidden: true,
|
43
53
|
description: "The file to share. You must specify either a file or a folder.",
|
44
54
|
},
|
45
55
|
folderId: {
|
@@ -50,7 +60,7 @@ export default {
|
|
50
60
|
drive: c.drive,
|
51
61
|
}),
|
52
62
|
],
|
53
|
-
|
63
|
+
hidden: true,
|
54
64
|
description: "The folder to share. You must specify either a file or a folder.",
|
55
65
|
},
|
56
66
|
type: {
|
@@ -61,11 +71,20 @@ export default {
|
|
61
71
|
reloadProps: true,
|
62
72
|
},
|
63
73
|
},
|
64
|
-
async additionalProps() {
|
65
|
-
const obj = {};
|
74
|
+
async additionalProps(previousProps) {
|
66
75
|
const {
|
67
|
-
fileId, folderId, type,
|
76
|
+
fileId, folderId, type, useFileOrFolder,
|
68
77
|
} = this;
|
78
|
+
|
79
|
+
if (useFileOrFolder === "File") {
|
80
|
+
previousProps.fileId.hidden = false;
|
81
|
+
previousProps.folderId.hidden = true;
|
82
|
+
} else if (useFileOrFolder === "Folder") {
|
83
|
+
previousProps.fileId.hidden = true;
|
84
|
+
previousProps.folderId.hidden = false;
|
85
|
+
}
|
86
|
+
|
87
|
+
const obj = {};
|
69
88
|
if (!(fileId || folderId) || !type) return obj;
|
70
89
|
|
71
90
|
const emailAddress = {
|
@@ -5,7 +5,7 @@ export default {
|
|
5
5
|
key: "google_drive-create-file-from-text",
|
6
6
|
name: "Create New File From Text",
|
7
7
|
description: "Create a new file from plain text. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/create) for more information",
|
8
|
-
version: "0.
|
8
|
+
version: "0.2.0",
|
9
9
|
type: "action",
|
10
10
|
props: {
|
11
11
|
googleDrive,
|
@@ -44,24 +44,66 @@ export default {
|
|
44
44
|
optional: true,
|
45
45
|
default: "",
|
46
46
|
},
|
47
|
+
mimeType: {
|
48
|
+
type: "string",
|
49
|
+
label: "Conversion Format",
|
50
|
+
description:
|
51
|
+
"The [format](https://developers.google.com/drive/api/v3/ref-export-formats) in which the text is presented",
|
52
|
+
optional: true,
|
53
|
+
default: "text/plain",
|
54
|
+
options: [
|
55
|
+
{
|
56
|
+
value: "text/plain",
|
57
|
+
label: "Plain Text",
|
58
|
+
},
|
59
|
+
{
|
60
|
+
value: "text/markdown",
|
61
|
+
label: "Markdown",
|
62
|
+
},
|
63
|
+
{
|
64
|
+
value: "text/html",
|
65
|
+
label: "HTML",
|
66
|
+
},
|
67
|
+
{
|
68
|
+
value: "application/rtf",
|
69
|
+
label: "Rich Text",
|
70
|
+
},
|
71
|
+
{
|
72
|
+
value: "text/csv",
|
73
|
+
label: "CSV",
|
74
|
+
},
|
75
|
+
],
|
76
|
+
},
|
47
77
|
},
|
48
78
|
async run({ $ }) {
|
49
79
|
const {
|
50
80
|
parentId,
|
51
81
|
name,
|
52
82
|
content,
|
83
|
+
mimeType,
|
53
84
|
} = this;
|
54
85
|
const file = Readable.from([
|
55
86
|
content,
|
56
87
|
]);
|
88
|
+
const drive = this.googleDrive.drive();
|
57
89
|
const driveId = this.googleDrive.getDriveId(this.drive);
|
58
|
-
const
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
90
|
+
const parent = parentId ?? driveId;
|
91
|
+
|
92
|
+
const { data: resp } = await drive.files.create({
|
93
|
+
supportsAllDrives: true,
|
94
|
+
media: {
|
95
|
+
mimeType,
|
96
|
+
body: file,
|
97
|
+
},
|
98
|
+
requestBody: {
|
99
|
+
name,
|
100
|
+
mimeType: "application/vnd.google-apps.document",
|
101
|
+
parents: [
|
102
|
+
parent,
|
103
|
+
],
|
104
|
+
},
|
64
105
|
});
|
106
|
+
|
65
107
|
$.export("$summary", `Successfully created a new file, "${resp.name}"`);
|
66
108
|
return resp;
|
67
109
|
},
|