File tree Expand file tree Collapse file tree 4 files changed +81
-1
lines changed
actions/get-board-items-page Expand file tree Collapse file tree 4 files changed +81
-1
lines changed Original file line number Diff line number Diff line change 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+ } ;
Original file line number Diff line number Diff 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]) {
Original file line number Diff line number Diff 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 ,
Original file line number Diff line number Diff line change 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" : [
You can’t perform that action at this time.
0 commit comments