Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import common from "../common/column-values.mjs";

export default {
...common,
key: "monday-get-board-items-page",
name: "Get Board Items Page",
description: "Searches a column for items matching a value. [See the documentation](https://developer.monday.com/api-reference/reference/items-page-by-column-values)",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
type: "action",
props: {
...common.props,
},
async run({ $ }) {
const response = await this.monday.listBoardItemsPage({
boardId: +this.boardId,
});

if (response.errors) {
throw new Error(response.errors[0].message);
}

const {
data: {
boards: [
{ items_page: pageItems },
],
},
} = response;
const { items } = pageItems;
let cursor = pageItems?.cursor;
while (cursor) {
const {
data: {
boards: {
items_page: {
cursor: nextCursor, items: nextItems,
},
},
},
} = await this.monday.listBoardItemsPage({
boardId: +this.boardId,
cursor,
});
items.push(...nextItems);
cursor = nextCursor;
}

$.export("$summary", `Successfully retrieved ${items.length} item${items.length === 1
? ""
: "s"}.`);

return items;
},
};
13 changes: 13 additions & 0 deletions components/monday/common/queries.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,19 @@ export default {
}
}
`,
listBoardItemsPage: `
query listBoardItemsPage ($boardId: ID!, $cursor: String) {
boards (ids: [$boardId]){
items_page (cursor: $cursor) {
cursor
items {
id
name
}
}
}
}
`,
listColumnOptions: `
query listColumnOptions ($boardId: ID!) {
boards (ids: [$boardId]) {
Expand Down
8 changes: 8 additions & 0 deletions components/monday/monday.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,14 @@ export default {
});
return data?.boards[0]?.columns;
},
listBoardItemsPage(variables) {
return this.makeRequest({
query: queries.listBoardItemsPage,
options: {
variables,
},
});
},
async listUsers(variables) {
const { data } = await this.makeRequest({
query: queries.listUsers,
Expand Down
2 changes: 1 addition & 1 deletion components/monday/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/monday",
"version": "0.8.2",
"version": "0.9.0",
"description": "Pipedream Monday Components",
"main": "monday.app.mjs",
"keywords": [
Expand Down
Loading