Skip to content

Commit 09f750e

Browse files
committed
Implement 'Get Board Items Page' action and update version to 0.9.0
- Added a new action to retrieve items from a specified board page. - Introduced GraphQL query for fetching board items with pagination support. - Updated package version to 0.9.0.
1 parent 0b409f1 commit 09f750e

File tree

4 files changed

+81
-1
lines changed

4 files changed

+81
-1
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import common from "../common/column-values.mjs";
2+
3+
export default {
4+
...common,
5+
key: "monday-get-board-items-page",
6+
name: "Get Board Items Page",
7+
description: "Searches a column for items matching a value. [See the documentation](https://developer.monday.com/api-reference/reference/items-page-by-column-values)",
8+
version: "0.0.1",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: true,
13+
},
14+
type: "action",
15+
props: {
16+
...common.props,
17+
},
18+
async run({ $ }) {
19+
const response = await this.monday.listBoardItemsPage({
20+
boardId: +this.boardId,
21+
});
22+
23+
if (response.errors) {
24+
throw new Error(response.errors[0].message);
25+
}
26+
27+
const {
28+
data: {
29+
boards: [
30+
{ items_page: pageItems },
31+
],
32+
},
33+
} = response;
34+
const { items } = pageItems;
35+
let cursor = pageItems?.cursor;
36+
while (cursor) {
37+
const {
38+
data: {
39+
boards: {
40+
items_page: {
41+
cursor: nextCursor, items: nextItems,
42+
},
43+
},
44+
},
45+
} = await this.monday.listBoardItemsPage({
46+
boardId: +this.boardId,
47+
cursor,
48+
});
49+
items.push(...nextItems);
50+
cursor = nextCursor;
51+
}
52+
53+
$.export("$summary", `Successfully retrieved ${items.length} item${items.length === 1
54+
? ""
55+
: "s"}.`);
56+
57+
return items;
58+
},
59+
};

components/monday/common/queries.mjs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,19 @@ export default {
105105
}
106106
}
107107
`,
108+
listBoardItemsPage: `
109+
query listBoardItemsPage ($boardId: ID!, $cursor: String) {
110+
boards (ids: [$boardId]){
111+
items_page (cursor: $cursor) {
112+
cursor
113+
items {
114+
id
115+
name
116+
}
117+
}
118+
}
119+
}
120+
`,
108121
listColumnOptions: `
109122
query listColumnOptions ($boardId: ID!) {
110123
boards (ids: [$boardId]) {

components/monday/monday.app.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,14 @@ export default {
325325
});
326326
return data?.boards[0]?.columns;
327327
},
328+
listBoardItemsPage(variables) {
329+
return this.makeRequest({
330+
query: queries.listBoardItemsPage,
331+
options: {
332+
variables,
333+
},
334+
});
335+
},
328336
async listUsers(variables) {
329337
const { data } = await this.makeRequest({
330338
query: queries.listUsers,

components/monday/package.json

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

0 commit comments

Comments
 (0)