Skip to content

Commit a1f47db

Browse files
committed
[ACTION] Document360 - new components
1 parent 070d248 commit a1f47db

File tree

8 files changed

+387
-10
lines changed

8 files changed

+387
-10
lines changed

components/document360/actions/create-document/create-document.mjs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "document360-create-document",
55
name: "Create Document",
66
description: "Creates a new document in Document360 from text. [See the documentation](https://apidocs.document360.com/apidocs/how-to-create-and-publish-an-article)",
7-
version: "0.0.1",
7+
version: "0.0.2",
88
type: "action",
99
props: {
1010
document360,
@@ -34,6 +34,26 @@ export default {
3434
"userId",
3535
],
3636
},
37+
contentType: {
38+
type: "string",
39+
label: "Content Type",
40+
description: "The type of content of the new document.",
41+
options: [
42+
{
43+
value: "0",
44+
label: "Markdown",
45+
},
46+
{
47+
value: "1",
48+
label: "WYSIWYG(HTML)",
49+
},
50+
{
51+
value: "2",
52+
label: "Advanced WYSIWYG(HTML)",
53+
},
54+
],
55+
optional: true,
56+
},
3757
content: {
3858
type: "string",
3959
label: "Document Content",
@@ -56,6 +76,7 @@ export default {
5676
user_id: this.userId,
5777
content: this.content,
5878
order: this.order,
79+
content_type: this.contentType,
5980
},
6081
});
6182

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import app from "../../document360.app.mjs";
2+
3+
export default {
4+
key: "document360-drive-search-files-and-folders",
5+
name: "Drive Search - Files and Folders",
6+
description: "Search for files and folders in Document360 Drive. [See the documentation](https://apidocs.document360.com/apidocs/drive-search-files-and-folders)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
searchKeyword: {
12+
type: "string",
13+
label: "Search Keyword",
14+
description: "Keyword to search file items from drive",
15+
},
16+
pageNo: {
17+
type: "integer",
18+
label: "Page Number",
19+
description: "Specify the page to retrieve. Page numbers are zero-based. Therefore, to retrieve the 10th page, you need to set `9`",
20+
optional: true,
21+
},
22+
take: {
23+
type: "integer",
24+
label: "Take",
25+
description: "The number of results per page",
26+
optional: true,
27+
},
28+
allowImagesOnly: {
29+
type: "boolean",
30+
label: "Allow Images Only",
31+
description: "Allow images only in response",
32+
optional: true,
33+
},
34+
userIds: {
35+
type: "string[]",
36+
label: "User IDs",
37+
description: "Find by userId",
38+
optional: true,
39+
propDefinition: [
40+
app,
41+
"userId",
42+
],
43+
},
44+
filterFromDate: {
45+
type: "string",
46+
label: "Filter From Date",
47+
description: "Filter using from-date (date-time format). Example: `2025-01-01T00:00:00Z`",
48+
optional: true,
49+
},
50+
filterToDate: {
51+
type: "string",
52+
label: "Filter To Date",
53+
description: "Filter using to-date (date-time format). Example: `2025-01-01T00:00:00Z`",
54+
optional: true,
55+
},
56+
filterTags: {
57+
type: "string[]",
58+
label: "Filter Tags",
59+
description: "Filter using tagIds",
60+
optional: true,
61+
},
62+
},
63+
async run({ $ }) {
64+
const {
65+
app,
66+
searchKeyword,
67+
pageNo,
68+
take,
69+
allowImagesOnly,
70+
userIds,
71+
filterFromDate,
72+
filterToDate,
73+
filterTags,
74+
} = this;
75+
76+
const response = await app.driveSearchFilesAndFolders({
77+
$,
78+
params: {
79+
searchKeyword,
80+
pageNo,
81+
take,
82+
allowImagesOnly,
83+
userIds,
84+
filterFromDate,
85+
filterToDate,
86+
filterTags,
87+
},
88+
});
89+
90+
$.export("$summary", `Successfully searched for files and folders with keyword \`${searchKeyword}\``);
91+
return response;
92+
},
93+
};
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import app from "../../document360.app.mjs";
2+
3+
export default {
4+
key: "document360-get-article",
5+
name: "Get Article",
6+
description: "Gets an article from Document360. [See the documentation](https://apidocs.document360.com/apidocs/get-article)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
projectVersionId: {
12+
propDefinition: [
13+
app,
14+
"projectVersionId",
15+
],
16+
},
17+
articleId: {
18+
propDefinition: [
19+
app,
20+
"articleId",
21+
({ projectVersionId }) => ({
22+
projectVersionId,
23+
}),
24+
],
25+
},
26+
langCode: {
27+
propDefinition: [
28+
app,
29+
"langCode",
30+
({ projectVersionId }) => ({
31+
projectVersionId,
32+
}),
33+
],
34+
default: "en",
35+
},
36+
isForDisplay: {
37+
type: "boolean",
38+
label: "Is For Display",
39+
description: "Set this to `true`, if you are displaying the article to the end-user. If `, the content of snippets or variables appears in the article. Note: If the value is true, ensure that the article content is not passed for update article endpoints.",
40+
optional: true,
41+
},
42+
isPublished: {
43+
type: "boolean",
44+
label: "Is Published",
45+
description: "`true` : You will get the latest published version of the article. (If there are no published versions, then it will return the latest version) `false` : To get the the latest version of the article",
46+
optional: true,
47+
},
48+
appendSASToken: {
49+
type: "boolean",
50+
label: "Append SAS Token",
51+
description: "Set this to `false` to exclude appending SAS token for images/files",
52+
optional: true,
53+
},
54+
},
55+
async run({ $ }) {
56+
const {
57+
app,
58+
articleId,
59+
langCode,
60+
isForDisplay,
61+
isPublished,
62+
appendSASToken,
63+
} = this;
64+
65+
const response = await app.getArticle({
66+
$,
67+
articleId,
68+
langCode,
69+
params: {
70+
isForDisplay,
71+
isPublished,
72+
appendSASToken,
73+
},
74+
});
75+
76+
$.export("$summary", `Successfully retrieved article ID \`${articleId}\` (${langCode})`);
77+
return response;
78+
},
79+
};
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import app from "../../document360.app.mjs";
2+
3+
export default {
4+
key: "document360-get-file-information",
5+
name: "Get File Information",
6+
description: "Gets file information from Document360 Drive. [See the documentation](https://apidocs.document360.com/apidocs/gets-file-information)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
folderId: {
12+
propDefinition: [
13+
app,
14+
"folderId",
15+
],
16+
},
17+
fileId: {
18+
propDefinition: [
19+
app,
20+
"fileId",
21+
({ folderId }) => ({
22+
folderId,
23+
}),
24+
],
25+
},
26+
appendSASToken: {
27+
type: "boolean",
28+
label: "Append SAS Token",
29+
description: "Set this to false to exclude appending SAS token for images/files",
30+
optional: true,
31+
},
32+
},
33+
async run({ $ }) {
34+
const {
35+
app,
36+
folderId,
37+
fileId,
38+
appendSASToken,
39+
} = this;
40+
41+
const response = await app.getFileInformation({
42+
$,
43+
folderId,
44+
fileId,
45+
params: {
46+
appendSASToken,
47+
},
48+
});
49+
50+
$.export("$summary", `Successfully retrieved file information for file ID \`${fileId}\``);
51+
return response;
52+
},
53+
};

0 commit comments

Comments
 (0)