Skip to content

Commit aa3854d

Browse files
committed
new components
1 parent 90cc73c commit aa3854d

File tree

5 files changed

+295
-1
lines changed

5 files changed

+295
-1
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import confluence from "../../confluence.app.mjs";
2+
3+
export default {
4+
key: "confluence-get-page-by-id",
5+
name: "Get Page by ID",
6+
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.1",
8+
type: "action",
9+
props: {
10+
confluence,
11+
pageId: {
12+
propDefinition: [
13+
confluence,
14+
"pageId",
15+
],
16+
},
17+
},
18+
async run({ $ }) {
19+
const cloudId = await this.confluence.getCloudId({
20+
$,
21+
});
22+
const response = await this.confluence.getPageById({
23+
$,
24+
cloudId,
25+
pageId: this.pageId,
26+
});
27+
$.export("$summary", `Successfully retrieved page with ID: ${this.pageId}`);
28+
return response;
29+
},
30+
};
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import confluence from "../../confluence.app.mjs";
2+
3+
export default {
4+
key: "confluence-get-pages-in-space",
5+
name: "Get Pages in Space",
6+
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.1",
8+
type: "action",
9+
props: {
10+
confluence,
11+
spaceId: {
12+
propDefinition: [
13+
confluence,
14+
"spaceId",
15+
],
16+
},
17+
sort: {
18+
propDefinition: [
19+
confluence,
20+
"pageSort",
21+
],
22+
},
23+
status: {
24+
propDefinition: [
25+
confluence,
26+
"pageStatus",
27+
],
28+
},
29+
pageTitle: {
30+
propDefinition: [
31+
confluence,
32+
"pageTitle",
33+
],
34+
},
35+
bodyFormat: {
36+
propDefinition: [
37+
confluence,
38+
"bodyFormat",
39+
],
40+
},
41+
subType: {
42+
propDefinition: [
43+
confluence,
44+
"subType",
45+
],
46+
},
47+
cursor: {
48+
propDefinition: [
49+
confluence,
50+
"cursor",
51+
],
52+
},
53+
limit: {
54+
propDefinition: [
55+
confluence,
56+
"limit",
57+
],
58+
},
59+
},
60+
async run({ $ }) {
61+
const cloudId = await this.confluence.getCloudId({
62+
$,
63+
});
64+
const response = await this.confluence.listPagesInSpace({
65+
$,
66+
cloudId,
67+
spaceId: this.spaceId,
68+
params: {
69+
sort: this.sort,
70+
status: this.status,
71+
title: this.pageTitle,
72+
bodyFormat: this.bodyFormat,
73+
subType: this.subType,
74+
cursor: this.cursor,
75+
limit: this.limit,
76+
},
77+
});
78+
$.export("$summary", `Successfully retrieved ${response.results.length} page${response.results.length === 1
79+
? ""
80+
: "s"}`);
81+
return response;
82+
},
83+
};
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import confluence from "../../confluence.app.mjs";
2+
3+
export default {
4+
key: "confluence-get-pages",
5+
name: "Get Pages",
6+
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.1",
8+
type: "action",
9+
props: {
10+
confluence,
11+
sort: {
12+
propDefinition: [
13+
confluence,
14+
"pageSort",
15+
],
16+
},
17+
status: {
18+
propDefinition: [
19+
confluence,
20+
"pageStatus",
21+
],
22+
},
23+
pageTitle: {
24+
propDefinition: [
25+
confluence,
26+
"pageTitle",
27+
],
28+
},
29+
bodyFormat: {
30+
propDefinition: [
31+
confluence,
32+
"bodyFormat",
33+
],
34+
},
35+
subType: {
36+
propDefinition: [
37+
confluence,
38+
"subType",
39+
],
40+
},
41+
cursor: {
42+
propDefinition: [
43+
confluence,
44+
"cursor",
45+
],
46+
},
47+
limit: {
48+
propDefinition: [
49+
confluence,
50+
"limit",
51+
],
52+
},
53+
},
54+
async run({ $ }) {
55+
const cloudId = await this.confluence.getCloudId({
56+
$,
57+
});
58+
const response = await this.confluence.listPages({
59+
$,
60+
cloudId,
61+
params: {
62+
sort: this.sort,
63+
status: this.status,
64+
title: this.pageTitle,
65+
bodyFormat: this.bodyFormat,
66+
subType: this.subType,
67+
cursor: this.cursor,
68+
limit: this.limit,
69+
},
70+
});
71+
$.export("$summary", `Successfully retrieved ${response.results.length} page${response.results.length === 1
72+
? ""
73+
: "s"}`);
74+
return response;
75+
},
76+
};

components/confluence/confluence.app.mjs

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,103 @@ export default {
123123
};
124124
},
125125
},
126+
pageId: {
127+
type: "string",
128+
label: "Page ID",
129+
description: "Select a page or provide its ID",
130+
async options({ prevContext }) {
131+
const params = prevContext?.cursor
132+
? {
133+
cursor: prevContext.cursor,
134+
}
135+
: {};
136+
const cloudId = await this.getCloudId();
137+
const {
138+
results, _links: links,
139+
} = await this.listPages({
140+
cloudId,
141+
params,
142+
});
143+
const options = results?.map(({
144+
id: value, title: label,
145+
}) => ({
146+
value,
147+
label,
148+
})) || [];
149+
return {
150+
options,
151+
context: {
152+
cursor: this._extractCursorFromLink(links?.next),
153+
},
154+
};
155+
},
156+
},
157+
pageSort: {
158+
type: "string",
159+
label: "Sort",
160+
description: "Used to sort the result by a particular field",
161+
options: [
162+
"id",
163+
"-id",
164+
"created-date",
165+
"-created-date",
166+
"modified-date",
167+
"-modified-date",
168+
"title",
169+
"-title",
170+
],
171+
optional: true,
172+
},
173+
pageStatus: {
174+
type: "string",
175+
label: "Status",
176+
description: "Filter the results to pages based on their status",
177+
options: [
178+
"current",
179+
"archived",
180+
"deleted",
181+
"trashed",
182+
],
183+
optional: true,
184+
},
185+
pageTitle: {
186+
type: "string",
187+
label: "Title",
188+
description: "Filter the results to pages based on their title",
189+
optional: true,
190+
},
191+
bodyFormat: {
192+
type: "string",
193+
label: "Body Format",
194+
description: "The content format types to be returned in the body field of the response. If available, the representation will be available under a response field of the same name under the body field.",
195+
options: [
196+
"storage",
197+
"atlas_doc_format",
198+
],
199+
optional: true,
200+
},
201+
subType: {
202+
type: "string",
203+
label: "Subtype",
204+
description: "Filter the results to pages based on their subtype",
205+
options: [
206+
"live",
207+
"page",
208+
],
209+
optional: true,
210+
},
211+
cursor: {
212+
type: "string",
213+
label: "Cursor",
214+
description: "Used for pagination, this opaque cursor will be returned in the next URL in the Link response header. Use the relative URL in the Link header to retrieve the next set of results.",
215+
optional: true,
216+
},
217+
limit: {
218+
type: "integer",
219+
label: "Limit",
220+
description: "Maximum number of pages per result to return",
221+
optional: true,
222+
},
126223
},
127224
methods: {
128225
_baseUrl(cloudId) {
@@ -179,6 +276,14 @@ export default {
179276
...opts,
180277
});
181278
},
279+
getPageById({
280+
pageId, ...opts
281+
}) {
282+
return this._makeRequest({
283+
path: `/pages/${pageId}`,
284+
...opts,
285+
});
286+
},
182287
listSpaces(opts = {}) {
183288
return this._makeRequest({
184289
path: "/spaces",

components/confluence/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/confluence",
3-
"version": "0.2.1",
3+
"version": "0.3.0",
44
"description": "Pipedream Confluence Components",
55
"main": "confluence.app.mjs",
66
"keywords": [

0 commit comments

Comments
 (0)