@pipedream/google_drive 0.8.7 → 0.8.8
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.
@@ -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
|
},
|