@pipedream/confluence_data_center 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/actions/create-content/create-content.mjs +89 -0
- package/actions/delete-content/delete-content.mjs +40 -0
- package/actions/get-page-by-id/get-page-by-id.mjs +33 -0
- package/actions/get-pages/get-pages.mjs +50 -0
- package/actions/search-content/search-content.mjs +48 -0
- package/actions/update-content/update-content.mjs +89 -0
- package/common/utils.mjs +33 -0
- package/confluence_data_center.app.mjs +184 -5
- package/package.json +4 -1
- package/sources/blogpost-updated/blogpost-updated.mjs +21 -0
- package/sources/blogpost-updated/test-event.mjs +8 -0
- package/sources/common/base-webhook.mjs +69 -0
- package/sources/common/events.mjs +45 -0
- package/sources/new-blogpost-created/new-blogpost-created.mjs +21 -0
- package/sources/new-blogpost-created/test-event.mjs +8 -0
- package/sources/new-page-created/new-page-created.mjs +21 -0
- package/sources/new-page-created/test-event.mjs +8 -0
- package/sources/new-webhook-event/new-webhook-event.mjs +27 -0
- package/sources/page-updated/page-updated.mjs +21 -0
- package/sources/page-updated/test-event.mjs +9 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import confluenceDataCenter from "../../confluence_data_center.app.mjs";
|
|
2
|
+
import { parseObjectEntries } from "../../common/utils.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
key: "confluence_data_center-create-content",
|
|
6
|
+
name: "Create Content",
|
|
7
|
+
description: "Creates a new page or blogpost in Confluence Data Center. [See the documentation](https://developer.atlassian.com/server/confluence/rest/v1022/api-group-content-resource/#api-rest-api-content-post)",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "action",
|
|
10
|
+
annotations: {
|
|
11
|
+
destructiveHint: false,
|
|
12
|
+
openWorldHint: true,
|
|
13
|
+
readOnlyHint: false,
|
|
14
|
+
},
|
|
15
|
+
props: {
|
|
16
|
+
confluenceDataCenter,
|
|
17
|
+
type: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
confluenceDataCenter,
|
|
20
|
+
"type",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
title: {
|
|
24
|
+
propDefinition: [
|
|
25
|
+
confluenceDataCenter,
|
|
26
|
+
"title",
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
status: {
|
|
30
|
+
propDefinition: [
|
|
31
|
+
confluenceDataCenter,
|
|
32
|
+
"status",
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
spaceKey: {
|
|
36
|
+
propDefinition: [
|
|
37
|
+
confluenceDataCenter,
|
|
38
|
+
"spaceKey",
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
position: {
|
|
42
|
+
propDefinition: [
|
|
43
|
+
confluenceDataCenter,
|
|
44
|
+
"position",
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
body: {
|
|
48
|
+
propDefinition: [
|
|
49
|
+
confluenceDataCenter,
|
|
50
|
+
"body",
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
metadata: {
|
|
54
|
+
propDefinition: [
|
|
55
|
+
confluenceDataCenter,
|
|
56
|
+
"metadata",
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
async run({ $ }) {
|
|
61
|
+
const response = await this.confluenceDataCenter.createContent({
|
|
62
|
+
$,
|
|
63
|
+
data: {
|
|
64
|
+
type: this.type,
|
|
65
|
+
title: this.title,
|
|
66
|
+
status: this.status,
|
|
67
|
+
space: this.spaceKey
|
|
68
|
+
? {
|
|
69
|
+
key: this.spaceKey,
|
|
70
|
+
}
|
|
71
|
+
: undefined,
|
|
72
|
+
position: this.position,
|
|
73
|
+
body: this.body
|
|
74
|
+
? {
|
|
75
|
+
storage: {
|
|
76
|
+
value: this.body,
|
|
77
|
+
representation: "storage",
|
|
78
|
+
},
|
|
79
|
+
}
|
|
80
|
+
: undefined,
|
|
81
|
+
metadata: this.metadata
|
|
82
|
+
? parseObjectEntries(this.metadata)
|
|
83
|
+
: undefined,
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
$.export("$summary", `Successfully created content with ID: ${response.id}`);
|
|
87
|
+
return response;
|
|
88
|
+
},
|
|
89
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import confluenceDataCenter from "../../confluence_data_center.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "confluence_data_center-delete-content",
|
|
5
|
+
name: "Delete Content",
|
|
6
|
+
description: "Deletes a page or blogpost in Confluence Data Center. [See the documentation](https://developer.atlassian.com/server/confluence/rest/v1022/api-group-content-resource/#api-rest-api-content-id-delete)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
annotations: {
|
|
10
|
+
destructiveHint: true,
|
|
11
|
+
openWorldHint: true,
|
|
12
|
+
readOnlyHint: false,
|
|
13
|
+
},
|
|
14
|
+
props: {
|
|
15
|
+
confluenceDataCenter,
|
|
16
|
+
type: {
|
|
17
|
+
propDefinition: [
|
|
18
|
+
confluenceDataCenter,
|
|
19
|
+
"type",
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
contentId: {
|
|
23
|
+
propDefinition: [
|
|
24
|
+
confluenceDataCenter,
|
|
25
|
+
"contentId",
|
|
26
|
+
({ type }) => ({
|
|
27
|
+
type,
|
|
28
|
+
}),
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
async run({ $ }) {
|
|
33
|
+
const response = await this.confluenceDataCenter.deleteContent({
|
|
34
|
+
$,
|
|
35
|
+
id: this.contentId,
|
|
36
|
+
});
|
|
37
|
+
$.export("$summary", `Successfully deleted content with ID: ${this.contentId}`);
|
|
38
|
+
return response;
|
|
39
|
+
},
|
|
40
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import confluenceDataCenter from "../../confluence_data_center.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "confluence_data_center-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/server/confluence/rest/v1022/api-group-content-resource/#api-rest-api-content-id-get)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
annotations: {
|
|
10
|
+
destructiveHint: false,
|
|
11
|
+
openWorldHint: true,
|
|
12
|
+
readOnlyHint: true,
|
|
13
|
+
},
|
|
14
|
+
props: {
|
|
15
|
+
confluenceDataCenter,
|
|
16
|
+
pageId: {
|
|
17
|
+
propDefinition: [
|
|
18
|
+
confluenceDataCenter,
|
|
19
|
+
"contentId",
|
|
20
|
+
],
|
|
21
|
+
label: "Page ID",
|
|
22
|
+
description: "Select a page or provide its ID",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
async run({ $ }) {
|
|
26
|
+
const response = await this.confluenceDataCenter.getContentById({
|
|
27
|
+
$,
|
|
28
|
+
id: this.pageId,
|
|
29
|
+
});
|
|
30
|
+
$.export("$summary", `Successfully retrieved page with ID: ${this.pageId}`);
|
|
31
|
+
return response;
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import confluenceDataCenter from "../../confluence_data_center.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "confluence_data_center-get-pages",
|
|
5
|
+
name: "Get Pages",
|
|
6
|
+
description: "Retrieve a list of pages in Confluence Data Center. [See the documentation](https://developer.atlassian.com/server/confluence/rest/v1022/api-group-content-resource/#api-rest-api-content-get)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
annotations: {
|
|
10
|
+
destructiveHint: false,
|
|
11
|
+
openWorldHint: true,
|
|
12
|
+
readOnlyHint: true,
|
|
13
|
+
},
|
|
14
|
+
props: {
|
|
15
|
+
confluenceDataCenter,
|
|
16
|
+
spaceKey: {
|
|
17
|
+
propDefinition: [
|
|
18
|
+
confluenceDataCenter,
|
|
19
|
+
"spaceKey",
|
|
20
|
+
],
|
|
21
|
+
optional: true,
|
|
22
|
+
},
|
|
23
|
+
limit: {
|
|
24
|
+
propDefinition: [
|
|
25
|
+
confluenceDataCenter,
|
|
26
|
+
"limit",
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
start: {
|
|
30
|
+
propDefinition: [
|
|
31
|
+
confluenceDataCenter,
|
|
32
|
+
"start",
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
async run({ $ }) {
|
|
37
|
+
const response = await this.confluenceDataCenter.listContent({
|
|
38
|
+
$,
|
|
39
|
+
params: {
|
|
40
|
+
spaceKey: this.spaceKey,
|
|
41
|
+
limit: this.limit,
|
|
42
|
+
start: this.start,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
$.export("$summary", `Successfully retrieved ${response.results.length} page${response.results.length === 1
|
|
46
|
+
? ""
|
|
47
|
+
: "s"}`);
|
|
48
|
+
return response;
|
|
49
|
+
},
|
|
50
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import confluenceDataCenter from "../../confluence_data_center.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "confluence_data_center-search-content",
|
|
5
|
+
name: "Search Content",
|
|
6
|
+
description: "Search for content in Confluence Data Center. [See the documentation](https://developer.atlassian.com/server/confluence/rest/v1022/api-group-content-resource/#api-rest-api-content-search-get)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
annotations: {
|
|
10
|
+
destructiveHint: false,
|
|
11
|
+
openWorldHint: true,
|
|
12
|
+
readOnlyHint: true,
|
|
13
|
+
},
|
|
14
|
+
props: {
|
|
15
|
+
confluenceDataCenter,
|
|
16
|
+
cql: {
|
|
17
|
+
type: "string",
|
|
18
|
+
label: "CQL",
|
|
19
|
+
description: "The CQL query to be used for the search. See [Advanced Searching using CQL](https://developer.atlassian.com/server/confluence/advanced-searching-using-cql/) for instructions on how to build a CQL query.",
|
|
20
|
+
},
|
|
21
|
+
limit: {
|
|
22
|
+
propDefinition: [
|
|
23
|
+
confluenceDataCenter,
|
|
24
|
+
"limit",
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
start: {
|
|
28
|
+
propDefinition: [
|
|
29
|
+
confluenceDataCenter,
|
|
30
|
+
"start",
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
async run({ $ }) {
|
|
35
|
+
const response = await this.confluenceDataCenter.searchContent({
|
|
36
|
+
$,
|
|
37
|
+
params: {
|
|
38
|
+
cql: this.cql,
|
|
39
|
+
limit: this.limit,
|
|
40
|
+
start: this.start,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
$.export("$summary", `Successfully found ${response.results.length} result${response.results.length === 1
|
|
44
|
+
? ""
|
|
45
|
+
: "s"}`);
|
|
46
|
+
return response;
|
|
47
|
+
},
|
|
48
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import confluenceDataCenter from "../../confluence_data_center.app.mjs";
|
|
2
|
+
import { parseObjectEntries } from "../../common/utils.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
key: "confluence_data_center-update-content",
|
|
6
|
+
name: "Update Content",
|
|
7
|
+
description: "Updates a page or blogpost in Confluence Data Center. [See the documentation](https://developer.atlassian.com/server/confluence/rest/v1022/api-group-content-resource/#api-rest-api-content-contentid-put)",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "action",
|
|
10
|
+
annotations: {
|
|
11
|
+
destructiveHint: true,
|
|
12
|
+
openWorldHint: true,
|
|
13
|
+
readOnlyHint: false,
|
|
14
|
+
},
|
|
15
|
+
props: {
|
|
16
|
+
confluenceDataCenter,
|
|
17
|
+
type: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
confluenceDataCenter,
|
|
20
|
+
"type",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
contentId: {
|
|
24
|
+
propDefinition: [
|
|
25
|
+
confluenceDataCenter,
|
|
26
|
+
"contentId",
|
|
27
|
+
({ type }) => ({
|
|
28
|
+
type,
|
|
29
|
+
}),
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
title: {
|
|
33
|
+
propDefinition: [
|
|
34
|
+
confluenceDataCenter,
|
|
35
|
+
"title",
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
position: {
|
|
39
|
+
propDefinition: [
|
|
40
|
+
confluenceDataCenter,
|
|
41
|
+
"position",
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
body: {
|
|
45
|
+
propDefinition: [
|
|
46
|
+
confluenceDataCenter,
|
|
47
|
+
"body",
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
metadata: {
|
|
51
|
+
propDefinition: [
|
|
52
|
+
confluenceDataCenter,
|
|
53
|
+
"metadata",
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
async run({ $ }) {
|
|
58
|
+
const { version: { number } } = await this.confluenceDataCenter.getContentById({
|
|
59
|
+
$,
|
|
60
|
+
id: this.contentId,
|
|
61
|
+
});
|
|
62
|
+
const version = number + 1;
|
|
63
|
+
const response = await this.confluenceDataCenter.updateContent({
|
|
64
|
+
$,
|
|
65
|
+
id: this.contentId,
|
|
66
|
+
data: {
|
|
67
|
+
type: this.type,
|
|
68
|
+
title: this.title,
|
|
69
|
+
position: this.position,
|
|
70
|
+
body: this.body
|
|
71
|
+
? {
|
|
72
|
+
storage: {
|
|
73
|
+
value: this.body,
|
|
74
|
+
representation: "storage",
|
|
75
|
+
},
|
|
76
|
+
}
|
|
77
|
+
: undefined,
|
|
78
|
+
metadata: this.metadata
|
|
79
|
+
? parseObjectEntries(this.metadata)
|
|
80
|
+
: undefined,
|
|
81
|
+
version: {
|
|
82
|
+
number: version,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
$.export("$summary", `Successfully updated content with ID: ${this.contentId}`);
|
|
87
|
+
return response;
|
|
88
|
+
},
|
|
89
|
+
};
|
package/common/utils.mjs
ADDED
|
@@ -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
|
+
}
|
|
@@ -1,11 +1,190 @@
|
|
|
1
|
+
import { axios } from "@pipedream/platform";
|
|
2
|
+
const DEFAULT_LIMIT = 50;
|
|
3
|
+
|
|
1
4
|
export default {
|
|
2
5
|
type: "app",
|
|
3
6
|
app: "confluence_data_center",
|
|
4
|
-
propDefinitions: {
|
|
7
|
+
propDefinitions: {
|
|
8
|
+
spaceKey: {
|
|
9
|
+
type: "string",
|
|
10
|
+
label: "Space Key",
|
|
11
|
+
description: "Select a space or provide its key",
|
|
12
|
+
async options({ page }) {
|
|
13
|
+
const { results } = await this.listSpaces({
|
|
14
|
+
params: {
|
|
15
|
+
limit: DEFAULT_LIMIT,
|
|
16
|
+
start: page * DEFAULT_LIMIT,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
return results?.map(({
|
|
20
|
+
key: value, name: label,
|
|
21
|
+
}) => ({
|
|
22
|
+
value,
|
|
23
|
+
label,
|
|
24
|
+
})) || [];
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
contentId: {
|
|
28
|
+
type: "string",
|
|
29
|
+
label: "Content ID",
|
|
30
|
+
description: "Select a page or blogpost or provide its ID",
|
|
31
|
+
async options({
|
|
32
|
+
page, type,
|
|
33
|
+
}) {
|
|
34
|
+
const { results } = await this.listContent({
|
|
35
|
+
params: {
|
|
36
|
+
type,
|
|
37
|
+
limit: DEFAULT_LIMIT,
|
|
38
|
+
start: page * DEFAULT_LIMIT,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
return results?.map(({
|
|
42
|
+
id: value, title: label,
|
|
43
|
+
}) => ({
|
|
44
|
+
value,
|
|
45
|
+
label,
|
|
46
|
+
})) || [];
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
type: {
|
|
50
|
+
type: "string",
|
|
51
|
+
label: "Type",
|
|
52
|
+
description: "The type of the content",
|
|
53
|
+
async options() {
|
|
54
|
+
return [
|
|
55
|
+
"page",
|
|
56
|
+
"blogpost",
|
|
57
|
+
];
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
title: {
|
|
61
|
+
type: "string",
|
|
62
|
+
label: "Title",
|
|
63
|
+
description: "The title of the content",
|
|
64
|
+
},
|
|
65
|
+
status: {
|
|
66
|
+
type: "string",
|
|
67
|
+
label: "Status",
|
|
68
|
+
description: "The status of the content",
|
|
69
|
+
optional: true,
|
|
70
|
+
options: [
|
|
71
|
+
"current",
|
|
72
|
+
"draft",
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
position: {
|
|
76
|
+
type: "integer",
|
|
77
|
+
label: "Position",
|
|
78
|
+
description: "The position of the content",
|
|
79
|
+
optional: true,
|
|
80
|
+
},
|
|
81
|
+
body: {
|
|
82
|
+
type: "string",
|
|
83
|
+
label: "Body",
|
|
84
|
+
description: "The body content of the content",
|
|
85
|
+
optional: true,
|
|
86
|
+
},
|
|
87
|
+
metadata: {
|
|
88
|
+
type: "object",
|
|
89
|
+
label: "Metadata",
|
|
90
|
+
description: "The metadata of the content",
|
|
91
|
+
optional: true,
|
|
92
|
+
},
|
|
93
|
+
limit: {
|
|
94
|
+
type: "integer",
|
|
95
|
+
label: "Limit",
|
|
96
|
+
description: "Maximum number of results to return",
|
|
97
|
+
optional: true,
|
|
98
|
+
default: 100,
|
|
99
|
+
},
|
|
100
|
+
start: {
|
|
101
|
+
type: "integer",
|
|
102
|
+
label: "Start",
|
|
103
|
+
description: "Start index of the results to return",
|
|
104
|
+
optional: true,
|
|
105
|
+
},
|
|
106
|
+
},
|
|
5
107
|
methods: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
108
|
+
_baseUrl() {
|
|
109
|
+
return `${this.$auth.api_url}/rest/api`;
|
|
110
|
+
},
|
|
111
|
+
_makeRequest({
|
|
112
|
+
$ = this, path, ...opts
|
|
113
|
+
}) {
|
|
114
|
+
return axios($, {
|
|
115
|
+
url: `${this._baseUrl()}${path}`,
|
|
116
|
+
headers: {
|
|
117
|
+
"Authorization": `Bearer ${this.$auth.personal_access_token}`,
|
|
118
|
+
},
|
|
119
|
+
...opts,
|
|
120
|
+
});
|
|
121
|
+
},
|
|
122
|
+
createWebhook(opts = {}) {
|
|
123
|
+
return this._makeRequest({
|
|
124
|
+
path: "/webhooks",
|
|
125
|
+
method: "POST",
|
|
126
|
+
...opts,
|
|
127
|
+
});
|
|
128
|
+
},
|
|
129
|
+
deleteWebhook({
|
|
130
|
+
hookId, ...opts
|
|
131
|
+
}) {
|
|
132
|
+
return this._makeRequest({
|
|
133
|
+
path: `/webhooks/${hookId}`,
|
|
134
|
+
method: "DELETE",
|
|
135
|
+
...opts,
|
|
136
|
+
});
|
|
137
|
+
},
|
|
138
|
+
getContentById({
|
|
139
|
+
id, ...opts
|
|
140
|
+
}) {
|
|
141
|
+
return this._makeRequest({
|
|
142
|
+
path: `/content/${id}`,
|
|
143
|
+
...opts,
|
|
144
|
+
});
|
|
145
|
+
},
|
|
146
|
+
listSpaces(opts = {}) {
|
|
147
|
+
return this._makeRequest({
|
|
148
|
+
path: "/space",
|
|
149
|
+
...opts,
|
|
150
|
+
});
|
|
151
|
+
},
|
|
152
|
+
listContent(opts = {}) {
|
|
153
|
+
return this._makeRequest({
|
|
154
|
+
path: "/content",
|
|
155
|
+
...opts,
|
|
156
|
+
});
|
|
157
|
+
},
|
|
158
|
+
searchContent(opts = {}) {
|
|
159
|
+
return this._makeRequest({
|
|
160
|
+
path: "/content/search",
|
|
161
|
+
...opts,
|
|
162
|
+
});
|
|
163
|
+
},
|
|
164
|
+
createContent(opts = {}) {
|
|
165
|
+
return this._makeRequest({
|
|
166
|
+
path: "/content",
|
|
167
|
+
method: "POST",
|
|
168
|
+
...opts,
|
|
169
|
+
});
|
|
170
|
+
},
|
|
171
|
+
updateContent({
|
|
172
|
+
id, ...opts
|
|
173
|
+
}) {
|
|
174
|
+
return this._makeRequest({
|
|
175
|
+
path: `/content/${id}`,
|
|
176
|
+
method: "PUT",
|
|
177
|
+
...opts,
|
|
178
|
+
});
|
|
179
|
+
},
|
|
180
|
+
deleteContent({
|
|
181
|
+
id, ...opts
|
|
182
|
+
}) {
|
|
183
|
+
return this._makeRequest({
|
|
184
|
+
path: `/content/${id}`,
|
|
185
|
+
method: "DELETE",
|
|
186
|
+
...opts,
|
|
187
|
+
});
|
|
9
188
|
},
|
|
10
189
|
},
|
|
11
|
-
};
|
|
190
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/confluence_data_center",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Pipedream Confluence Data Center Components",
|
|
5
5
|
"main": "confluence_data_center.app.mjs",
|
|
6
6
|
"keywords": [
|
|
@@ -11,5 +11,8 @@
|
|
|
11
11
|
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
|
|
12
12
|
"publishConfig": {
|
|
13
13
|
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@pipedream/platform": "^3.1.1"
|
|
14
17
|
}
|
|
15
18
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import common from "../common/base-webhook.mjs";
|
|
2
|
+
import sampleEmit from "./test-event.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...common,
|
|
6
|
+
key: "confluence_data_center-blogpost-updated",
|
|
7
|
+
name: "Blogpost Updated (Instant)",
|
|
8
|
+
description: "Emit new event when a blogpost is updated in Confluence Data Center.",
|
|
9
|
+
version: "0.0.1",
|
|
10
|
+
type: "source",
|
|
11
|
+
dedupe: "unique",
|
|
12
|
+
methods: {
|
|
13
|
+
...common.methods,
|
|
14
|
+
getEvents() {
|
|
15
|
+
return [
|
|
16
|
+
"blog_updated",
|
|
17
|
+
];
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
sampleEmit,
|
|
21
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import confluenceDataCenter from "../../confluence_data_center.app.mjs";
|
|
2
|
+
import { ConfigurationError } from "@pipedream/platform";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
props: {
|
|
6
|
+
confluenceDataCenter,
|
|
7
|
+
db: "$.service.db",
|
|
8
|
+
http: {
|
|
9
|
+
type: "$.interface.http",
|
|
10
|
+
customResponse: true,
|
|
11
|
+
},
|
|
12
|
+
name: {
|
|
13
|
+
type: "string",
|
|
14
|
+
label: "Webhook Name",
|
|
15
|
+
description: "The name of the webhook to identify in Confluence Data Center",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
hooks: {
|
|
19
|
+
async activate() {
|
|
20
|
+
const response = await this.confluenceDataCenter.createWebhook({
|
|
21
|
+
data: {
|
|
22
|
+
name: this.name,
|
|
23
|
+
url: this.http.endpoint,
|
|
24
|
+
events: this.getEvents(),
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
this._setHookId(response.id);
|
|
28
|
+
},
|
|
29
|
+
async deactivate() {
|
|
30
|
+
const hookId = this._getHookId();
|
|
31
|
+
if (hookId) {
|
|
32
|
+
await this.confluenceDataCenter.deleteWebhook({
|
|
33
|
+
hookId,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
methods: {
|
|
39
|
+
_setHookId(hookId) {
|
|
40
|
+
this.db.set("hookId", hookId);
|
|
41
|
+
},
|
|
42
|
+
_getHookId() {
|
|
43
|
+
return this.db.get("hookId");
|
|
44
|
+
},
|
|
45
|
+
generateMeta(body) {
|
|
46
|
+
return {
|
|
47
|
+
id: body.timestamp,
|
|
48
|
+
summary: `New ${body.event} event`,
|
|
49
|
+
ts: body.timestamp,
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
getEvents() {
|
|
53
|
+
throw new ConfigurationError("getEvents is not implemented");
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
async run(event) {
|
|
57
|
+
this.http.respond({
|
|
58
|
+
status: 200,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const { body } = event;
|
|
62
|
+
|
|
63
|
+
if (!body) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
this.$emit(body, this.generateMeta(body));
|
|
68
|
+
},
|
|
69
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export default [
|
|
2
|
+
"attachment_created",
|
|
3
|
+
"attachment_removed",
|
|
4
|
+
"attachment_restored",
|
|
5
|
+
"attachment_trashed",
|
|
6
|
+
"attachment_updated",
|
|
7
|
+
"blog_created",
|
|
8
|
+
"blog_removed",
|
|
9
|
+
"blog_restored",
|
|
10
|
+
"blog_trashed",
|
|
11
|
+
"blog_updated",
|
|
12
|
+
"blueprint_page_created",
|
|
13
|
+
"comment_created",
|
|
14
|
+
"comment_removed",
|
|
15
|
+
"comment_updated",
|
|
16
|
+
"content_created",
|
|
17
|
+
"content_restored",
|
|
18
|
+
"content_trashed",
|
|
19
|
+
"content_updated",
|
|
20
|
+
"content_permissions_updated",
|
|
21
|
+
"group_created",
|
|
22
|
+
"group_removed",
|
|
23
|
+
"label_added",
|
|
24
|
+
"label_created",
|
|
25
|
+
"label_deleted",
|
|
26
|
+
"label_removed",
|
|
27
|
+
"page_children_reordered",
|
|
28
|
+
"page_created",
|
|
29
|
+
"page_moved",
|
|
30
|
+
"page_removed",
|
|
31
|
+
"page_restored",
|
|
32
|
+
"page_trashed",
|
|
33
|
+
"page_updated",
|
|
34
|
+
"space_created",
|
|
35
|
+
"space_logo_updated",
|
|
36
|
+
"space_permissions_updated",
|
|
37
|
+
"space_removed",
|
|
38
|
+
"space_updated",
|
|
39
|
+
"theme_enabled",
|
|
40
|
+
"user_created",
|
|
41
|
+
"user_deactivated",
|
|
42
|
+
"user_followed",
|
|
43
|
+
"user_reactivated",
|
|
44
|
+
"user_removed",
|
|
45
|
+
];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import common from "../common/base-webhook.mjs";
|
|
2
|
+
import sampleEmit from "./test-event.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...common,
|
|
6
|
+
key: "confluence_data_center-new-blogpost-created",
|
|
7
|
+
name: "New Blogpost Created (Instant)",
|
|
8
|
+
description: "Emit new event when a new blogpost is created in Confluence Data Center.",
|
|
9
|
+
version: "0.0.1",
|
|
10
|
+
type: "source",
|
|
11
|
+
dedupe: "unique",
|
|
12
|
+
methods: {
|
|
13
|
+
...common.methods,
|
|
14
|
+
getEvents() {
|
|
15
|
+
return [
|
|
16
|
+
"blog_created",
|
|
17
|
+
];
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
sampleEmit,
|
|
21
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import common from "../common/base-webhook.mjs";
|
|
2
|
+
import sampleEmit from "./test-event.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...common,
|
|
6
|
+
key: "confluence_data_center-new-page-created",
|
|
7
|
+
name: "New Page Created (Instant)",
|
|
8
|
+
description: "Emit new event when a new page is created in Confluence Data Center.",
|
|
9
|
+
version: "0.0.1",
|
|
10
|
+
type: "source",
|
|
11
|
+
dedupe: "unique",
|
|
12
|
+
methods: {
|
|
13
|
+
...common.methods,
|
|
14
|
+
getEvents() {
|
|
15
|
+
return [
|
|
16
|
+
"page_created",
|
|
17
|
+
];
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
sampleEmit,
|
|
21
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import common from "../common/base-webhook.mjs";
|
|
2
|
+
import events from "../common/events.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...common,
|
|
6
|
+
key: "confluence_data_center-new-webhook-event",
|
|
7
|
+
name: "New Webhook Event (Instant)",
|
|
8
|
+
description: "Emit new event when a webhook event is received from Confluence Data Center.",
|
|
9
|
+
version: "0.0.1",
|
|
10
|
+
type: "source",
|
|
11
|
+
dedupe: "unique",
|
|
12
|
+
props: {
|
|
13
|
+
...common.props,
|
|
14
|
+
events: {
|
|
15
|
+
type: "string[]",
|
|
16
|
+
label: "Events",
|
|
17
|
+
description: "The events to listen for",
|
|
18
|
+
options: events,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
methods: {
|
|
22
|
+
...common.methods,
|
|
23
|
+
getEvents() {
|
|
24
|
+
return this.events;
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import common from "../common/base-webhook.mjs";
|
|
2
|
+
import sampleEmit from "./test-event.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...common,
|
|
6
|
+
key: "confluence_data_center-page-updated",
|
|
7
|
+
name: "Page Updated (Instant)",
|
|
8
|
+
description: "Emit new event when a page is updated in Confluence Data Center.",
|
|
9
|
+
version: "0.0.1",
|
|
10
|
+
type: "source",
|
|
11
|
+
dedupe: "unique",
|
|
12
|
+
methods: {
|
|
13
|
+
...common.methods,
|
|
14
|
+
getEvents() {
|
|
15
|
+
return [
|
|
16
|
+
"page_updated",
|
|
17
|
+
];
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
sampleEmit,
|
|
21
|
+
};
|