Skip to content

Commit 95393b8

Browse files
authored
Confluence - Search Content (#16207)
* search-content * pnpm-lock.yaml
1 parent 90d7de9 commit 95393b8

File tree

3 files changed

+64
-4
lines changed

3 files changed

+64
-4
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import confluence from "../../confluence.app.mjs";
2+
3+
export default {
4+
key: "confluence-search-content",
5+
name: "Search Content",
6+
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.1",
8+
type: "action",
9+
props: {
10+
confluence,
11+
cql: {
12+
type: "string",
13+
label: "CQL",
14+
description: "The CQL query to be used for the search. See [Advanced Searching using CQL](https://developer.atlassian.com/cloud/confluence/advanced-searching-using-cql/) for instructions on how to build a CQL query.",
15+
},
16+
maxResults: {
17+
type: "integer",
18+
label: "Max Results",
19+
description: "The maximum number of results to return",
20+
default: 100,
21+
optional: true,
22+
},
23+
},
24+
methods: {
25+
searchContent({
26+
cloudId, ...opts
27+
}) {
28+
return this.confluence._makeRequest({
29+
url: `https://api.atlassian.com/ex/confluence/${cloudId}/wiki/rest/api/search`,
30+
...opts,
31+
});
32+
},
33+
},
34+
async run({ $ }) {
35+
const cloudId = await this.confluence.getCloudId({
36+
$,
37+
});
38+
const items = this.confluence.paginate({
39+
resourceFn: this.searchContent,
40+
args: {
41+
$,
42+
cloudId,
43+
params: {
44+
cql: this.cql,
45+
},
46+
},
47+
max: this.maxResults,
48+
});
49+
50+
const results = [];
51+
for await (const item of items) {
52+
results.push(item);
53+
}
54+
55+
$.export("$summary", `Successfully found ${results.length} result${results.length === 1
56+
? ""
57+
: "s"}`);
58+
return results;
59+
},
60+
};

components/confluence/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/confluence",
3-
"version": "0.0.2",
3+
"version": "0.1.0",
44
"description": "Pipedream Confluence Components",
55
"main": "confluence.app.mjs",
66
"keywords": [
@@ -13,6 +13,6 @@
1313
"access": "public"
1414
},
1515
"dependencies": {
16-
"@pipedream/platform": "^1.6.0"
16+
"@pipedream/platform": "^3.0.3"
1717
}
1818
}

pnpm-lock.yaml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)