Skip to content

Commit 64f3488

Browse files
GTFalcaocoderabbitai[bot]michelle0927
authored
Confluence adjustments (#19226)
* Adding missing parameters to get-page-by-id * Version bumps * Improving object check * Update components/confluence/common/utils.mjs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * versions * use bodyFormat propDefinition * Adjusting options --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Michelle Bergeron <[email protected]>
1 parent 2cf74d8 commit 64f3488

File tree

15 files changed

+123
-36
lines changed

15 files changed

+123
-36
lines changed

components/confluence/actions/create-page/create-page.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "confluence-create-page",
55
name: "Create Page",
66
description: "Creates a new page in the space. [See the documentation](https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-page/#api-pages-post)",
7-
version: "0.0.4",
7+
version: "0.0.5",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,

components/confluence/actions/create-post/create-post.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "confluence-create-post",
55
name: "Create Post",
66
description: "Creates a new page or blog post on Confluence. [See the documentation](https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-blog-post/#api-blogposts-post)",
7-
version: "0.0.6",
7+
version: "0.0.7",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,

components/confluence/actions/delete-post/delete-post.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "confluence-delete-post",
55
name: "Delete Post",
66
description: "Removes a blog post from Confluence by its ID. Use with caution, the action is irreversible. [See the documentation](https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-blog-post/#api-blogposts-id-delete)",
7-
version: "0.0.6",
7+
version: "0.0.7",
88
annotations: {
99
destructiveHint: true,
1010
openWorldHint: true,

components/confluence/actions/get-page-by-id/get-page-by-id.mjs

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import confluence from "../../confluence.app.mjs";
2+
import { parseObjectEntries } from "../../common/utils.mjs";
3+
import { BODY_FORMAT_FULL_OPTIONS } from "../../common/constants.mjs";
24

35
export default {
46
key: "confluence-get-page-by-id",
57
name: "Get Page by ID",
68
description: "Retrieve a page by its ID. [See the documentation](https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-page/#api-pages-id-get)",
7-
version: "0.0.2",
9+
version: "0.1.0",
810
annotations: {
911
destructiveHint: false,
1012
openWorldHint: true,
@@ -19,6 +21,47 @@ export default {
1921
"pageId",
2022
],
2123
},
24+
bodyFormat: {
25+
propDefinition: [
26+
confluence,
27+
"bodyFormat",
28+
],
29+
options: BODY_FORMAT_FULL_OPTIONS,
30+
},
31+
getDraft: {
32+
type: "boolean",
33+
label: "Get Draft",
34+
description: "If true, retrieves the draft version of this page.",
35+
optional: true,
36+
default: false,
37+
},
38+
status: {
39+
type: "string[]",
40+
label: "Status",
41+
description: "Filter the page being retrieved by its status.",
42+
optional: true,
43+
options: [
44+
"current",
45+
"archived",
46+
"trashed",
47+
"deleted",
48+
"historical",
49+
"draft",
50+
],
51+
},
52+
version: {
53+
type: "integer",
54+
label: "Version",
55+
description: "Allows you to retrieve a previously published version. Specify the previous version's number to retrieve its details.",
56+
optional: true,
57+
},
58+
additionalOptions: {
59+
type: "object",
60+
label: "Additional Options",
61+
description:
62+
"Additional parameters to send in the request. [See the documentation](https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-page/#api-pages-id-get) for available parameters. Values will be parsed as JSON where applicable.",
63+
optional: true,
64+
},
2265
},
2366
async run({ $ }) {
2467
const cloudId = await this.confluence.getCloudId({
@@ -28,6 +71,13 @@ export default {
2871
$,
2972
cloudId,
3073
pageId: this.pageId,
74+
params: {
75+
"body-format": this.bodyFormat,
76+
"get-draft": this.getDraft,
77+
"status": this.status,
78+
"version": this.version,
79+
...parseObjectEntries(this.additionalOptions),
80+
},
3181
});
3282
$.export("$summary", `Successfully retrieved page with ID: ${this.pageId}`);
3383
return response;

components/confluence/actions/get-pages-in-space/get-pages-in-space.mjs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "confluence-get-pages-in-space",
55
name: "Get Pages in Space",
66
description: "Retrieve a list of pages in a space. [See the documentation](https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-page/#api-spaces-id-pages-get)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,
@@ -43,12 +43,6 @@ export default {
4343
"bodyFormat",
4444
],
4545
},
46-
subType: {
47-
propDefinition: [
48-
confluence,
49-
"subType",
50-
],
51-
},
5246
cursor: {
5347
propDefinition: [
5448
confluence,
@@ -71,13 +65,12 @@ export default {
7165
cloudId,
7266
spaceId: this.spaceId,
7367
params: {
74-
sort: this.sort,
75-
status: this.status,
76-
title: this.pageTitle,
77-
bodyFormat: this.bodyFormat,
78-
subType: this.subType,
79-
cursor: this.cursor,
80-
limit: this.limit,
68+
"sort": this.sort,
69+
"status": this.status,
70+
"title": this.pageTitle,
71+
"body-format": this.bodyFormat,
72+
"cursor": this.cursor,
73+
"limit": this.limit,
8174
},
8275
});
8376
$.export("$summary", `Successfully retrieved ${response.results.length} page${response.results.length === 1

components/confluence/actions/get-pages/get-pages.mjs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "confluence-get-pages",
55
name: "Get Pages",
66
description: "Retrieve a list of pages. [See the documentation](https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-page/#api-pages-get)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,
@@ -64,13 +64,13 @@ export default {
6464
$,
6565
cloudId,
6666
params: {
67-
sort: this.sort,
68-
status: this.status,
69-
title: this.pageTitle,
70-
bodyFormat: this.bodyFormat,
71-
subType: this.subType,
72-
cursor: this.cursor,
73-
limit: this.limit,
67+
"sort": this.sort,
68+
"status": this.status,
69+
"title": this.pageTitle,
70+
"body-format": this.bodyFormat,
71+
"subtype": this.subType,
72+
"cursor": this.cursor,
73+
"limit": this.limit,
7474
},
7575
});
7676
$.export("$summary", `Successfully retrieved ${response.results.length} page${response.results.length === 1

components/confluence/actions/search-content/search-content.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "confluence-search-content",
55
name: "Search Content",
66
description: "Searches for content using the Confluence Query Language (CQL). [See the documentation](https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-search#api-wiki-rest-api-search-get)",
7-
version: "0.0.5",
7+
version: "0.0.6",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,

components/confluence/actions/update-post/update-post.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "confluence-update-post",
66
name: "Update a Post",
77
description: "Updates a page or blog post on Confluence by its ID. [See the documentation](https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-blog-post/#api-blogposts-id-put)",
8-
version: "0.0.6",
8+
version: "0.0.7",
99
annotations: {
1010
destructiveHint: true,
1111
openWorldHint: true,
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export const BODY_FORMAT_OPTIONS = [
2+
"storage",
3+
"atlas_doc_format",
4+
];
5+
6+
export const BODY_FORMAT_FULL_OPTIONS = [
7+
...BODY_FORMAT_OPTIONS,
8+
"view",
9+
"export_view",
10+
"anonymous_export_view",
11+
"styled_view",
12+
"editor",
13+
];
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { ConfigurationError } from "@pipedream/platform";
2+
3+
function optionalParseAsJSON(value) {
4+
if (typeof value !== "string") {
5+
return value;
6+
}
7+
8+
try {
9+
return JSON.parse(value);
10+
} catch (e) {
11+
return value;
12+
}
13+
}
14+
15+
export function parseObjectEntries(obj = {}) {
16+
if (typeof obj === "string") {
17+
try {
18+
obj = JSON.parse(obj);
19+
} catch (e) {
20+
throw new ConfigurationError(`Invalid JSON string provided: ${e.message}`);
21+
}
22+
}
23+
24+
return Object.fromEntries(
25+
Object.entries(obj || {}).map(([
26+
key,
27+
value,
28+
]) => [
29+
key,
30+
optionalParseAsJSON(value),
31+
]),
32+
);
33+
}

0 commit comments

Comments
 (0)