Skip to content

Commit 8f23625

Browse files
committed
Add the "Delete Document" action.
1 parent 9e7c4a2 commit 8f23625

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import app from "../docugenerate.app.mjs";
2+
3+
export default {
4+
key: "docugenerate-delete-document",
5+
name: "Delete Document",
6+
description: "Deletes a specific document",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
documentId: {
12+
type: "string",
13+
label: "Document",
14+
description: "The ID of the document",
15+
},
16+
},
17+
async run({ $ }) {
18+
const response = await this.app.deleteDocument($, this.documentId);
19+
20+
$.export("$summary", `Successfully deleted the document ${this.documentId}`);
21+
return response;
22+
},
23+
};

components/docugenerate/docugenerate.app.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,12 @@ export default {
8080
data: body,
8181
});
8282
},
83+
async deleteDocument($ = this, documentId) {
84+
return this.makeRequest({
85+
$,
86+
method: "DELETE",
87+
path: `/document/${documentId}`,
88+
});
89+
},
8390
},
8491
};

0 commit comments

Comments
 (0)