Skip to content

Commit 9e7c4a2

Browse files
committed
Add the "Update Document" action.
1 parent f64d548 commit 9e7c4a2

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import app from "../docugenerate.app.mjs";
2+
3+
export default {
4+
key: "docugenerate-update-document",
5+
name: "Update Document",
6+
description: "Updates a specific document",
7+
version: "0.0.2",
8+
type: "action",
9+
props: {
10+
app,
11+
documentId: {
12+
type: "string",
13+
label: "Document",
14+
description: "The ID of the document",
15+
},
16+
name: {
17+
type: "string",
18+
label: "Name",
19+
description: "The new name for the document",
20+
},
21+
},
22+
async run({ $ }) {
23+
const response = await this.app.updateDocument($, this.documentId, {
24+
name: this.name
25+
});
26+
27+
$.export("$summary", `Successfully updated the document ${this.documentId}`);
28+
return response;
29+
},
30+
};

components/docugenerate/docugenerate.app.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,13 @@ export default {
7272
path: `/document/${documentId}`,
7373
});
7474
},
75+
async updateDocument($ = this, documentId, body) {
76+
return this.makeRequest({
77+
$,
78+
method: "PUT",
79+
path: `/document/${documentId}`,
80+
data: body,
81+
});
82+
},
7583
},
7684
};

0 commit comments

Comments
 (0)