From b938999abf92e8dd02dde3a515b39221e9ba3878 Mon Sep 17 00:00:00 2001 From: Tricia Dynon Date: Tue, 7 Jul 2026 12:53:38 -0400 Subject: [PATCH 1/4] =?UTF-8?q?Connecting=20the=20item=20id=20of=20the=20r?= =?UTF-8?q?elated=20board=20in=20a=20board=20relation.=C2=A0=20Needed=20fo?= =?UTF-8?q?r=20some=20integrations=20that=20directly=20relate=20the=20boar?= =?UTF-8?q?ds.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/monday_sdk/query_templates.py | 254 +++++++++++---------- src/monday_sdk/types/api_response_types.py | 6 + 2 files changed, 142 insertions(+), 118 deletions(-) diff --git a/src/monday_sdk/query_templates.py b/src/monday_sdk/query_templates.py index 78583a4..5e3be10 100644 --- a/src/monday_sdk/query_templates.py +++ b/src/monday_sdk/query_templates.py @@ -10,10 +10,10 @@ def get_board_items_query( - board_ids: Union[int, str], - limit: int, - query_params: Optional[Mapping[str, Any]] = None, - cursor: Optional[str] = None, + board_ids: Union[int, str], + limit: int, + query_params: Optional[Mapping[str, Any]] = None, + cursor: Optional[str] = None, ) -> str: if cursor is None: return get_board_items_first_page_query(board_ids, query_params=query_params, limit=limit) @@ -22,7 +22,7 @@ def get_board_items_query( def get_board_items_first_page_query( - board_id: Union[str, int], limit: int, query_params: Optional[Mapping[str, Any]] = None + board_id: Union[str, int], limit: int, query_params: Optional[Mapping[str, Any]] = None ) -> str: raw_params = locals().items() items_page_params = gather_params(raw_params, excluded_params=["board_id"]) @@ -52,6 +52,9 @@ def get_board_items_first_page_query( } ... on BoardRelationValue { display_value + linked_items { + id + } } ... on DependencyValue { display_value @@ -84,6 +87,9 @@ def get_board_items_first_page_query( } ... on BoardRelationValue { display_value + linked_items { + id + } } text type @@ -126,6 +132,9 @@ def get_board_items_pagination_query(cursor: str, limit: int) -> str: } ... on BoardRelationValue { display_value + linked_items { + id + } } ... on DependencyValue { display_value @@ -155,6 +164,9 @@ def get_board_items_pagination_query(cursor: str, limit: int) -> str: } ... on BoardRelationValue { display_value + linked_items { + id + } } text type @@ -238,30 +250,30 @@ def get_item_query(board_id, column_id, value, limit, cursor=None): items_page_params = gather_params(raw_params, excluded_params=["column_id", "value"]) query = ( - """query - { - items_page_by_column_values (%s) { - cursor - items { - id - name - updates { - id - body - } - group { + """query + { + items_page_by_column_values (%s) { + cursor + items { id - title + name + updates { + id + body + } + group { + id + title + } + column_values { + id + text + value + } } - column_values { - id - text - value - } } - } - }""" - % items_page_params + }""" + % items_page_params ) return query @@ -287,6 +299,9 @@ def get_item_by_id_query(ids): } ... on BoardRelationValue { display_value + linked_items { + id + } } ... on DependencyValue { display_value @@ -318,6 +333,9 @@ def get_item_by_id_query(ids): } ... on BoardRelationValue { display_value + linked_items { + id + } } text type @@ -400,54 +418,54 @@ def move_item_to_group_query(item_id, group_id): def archive_item_query(item_id): query = ( - """ - mutation - { - archive_item (item_id: %s) + """ + mutation { - id - } - }""" - % item_id + archive_item (item_id: %s) + { + id + } + }""" + % item_id ) return query def delete_item_query(item_id): query = ( - """ - mutation - { - delete_item (item_id: %s) + """ + mutation { - id - } - }""" - % item_id + delete_item (item_id: %s) + { + id + } + }""" + % item_id ) return query def get_columns_by_board_query(board_id): return ( - """query - { - boards(ids: %s) { - id - name - groups { + """query + { + boards(ids: %s) { id - title + name + groups { + id + title + } + columns { + title + id + type + settings_str + } } - columns { - title - id - type - settings_str - } - } - }""" - % board_id + }""" + % board_id ) @@ -497,12 +515,12 @@ def create_update_query(item_id, update_value): def delete_update_query(item_id): query = ( - """mutation { - delete_update (id: %s) { - id - } - }""" - % item_id + """mutation { + delete_update (id: %s) { + id + } + }""" + % item_id ) return query @@ -552,12 +570,12 @@ def get_updates_for_item_query(item_id, limit: int): def get_updates_for_board(board_id, limit: int, page=1, from_date: Optional[str] = None, to_date: Optional[str] = None): # Build the updates parameters updates_params = f"limit: {limit}, page: {page}" - + if from_date: updates_params += f', from_date: "{from_date}"' if to_date: updates_params += f', to_date: "{to_date}"' - + query = """query { boards(ids: %s) { @@ -600,12 +618,12 @@ def get_update_query(limit, page=1): def get_boards_query( - ids: List[int], - limit: int, - page: int = 1, - board_kind: BoardKind = None, - state: BoardState = None, - order_by: BoardsOrderBy = None, + ids: List[int], + limit: int, + page: int = 1, + board_kind: BoardKind = None, + state: BoardState = None, + order_by: BoardsOrderBy = None, ): parameters = locals().items() query_params = [] @@ -618,28 +636,28 @@ def get_boards_query( joined_params = f"({', '.join(query_params)})" if query_params else "" query = ( - """query - { - boards %s { - id - name - permissions - tags { - id - name - } - groups { - id - title - } - columns { + """query + { + boards %s { id - title - type + name + permissions + tags { + id + name + } + groups { + id + title + } + columns { + id + title + type + } } - } - }""" - % joined_params + }""" + % joined_params ) return query @@ -647,29 +665,29 @@ def get_boards_query( def get_board_by_id_query(board_id: Union[int, str]): return ( - """query - { - boards (ids: %s) { - id - name - permissions - tags { - id - name - } - groups { - id - title - } - columns { + """query + { + boards (ids: %s) { id - title - type - settings_str + name + permissions + tags { + id + name + } + groups { + id + title + } + columns { + id + title + type + settings_str + } } - } - }""" - % board_id + }""" + % board_id ) @@ -715,11 +733,11 @@ def get_complexity_query(): def get_activity_logs_query( - board_id: Union[int, str], - limit: int, - page: Optional[int] = 1, - from_date: Optional[str] = None, - to_date: Optional[str] = None, + board_id: Union[int, str], + limit: int, + page: Optional[int] = 1, + from_date: Optional[str] = None, + to_date: Optional[str] = None, ): raw_params = locals().items() activity_logs_params = gather_params(raw_params, excluded_params=["board_id", "from_date", "to_date"]) diff --git a/src/monday_sdk/types/api_response_types.py b/src/monday_sdk/types/api_response_types.py index 9dfe614..a89da11 100644 --- a/src/monday_sdk/types/api_response_types.py +++ b/src/monday_sdk/types/api_response_types.py @@ -9,6 +9,11 @@ class Column: type: Optional[str] = field(default=None) +@dataclass +class LinkedItem: + id: Optional[str] = field(default=None) + + @dataclass class ColumnValue: value: Optional[str] = field(default=None) @@ -16,6 +21,7 @@ class ColumnValue: type: Optional[str] = field(default=None) column: Optional[Column] = field(default=None) display_value: Optional[str] = field(default=None) + linked_items: Optional[List[LinkedItem]] = field(default=None) @dataclass From d685ee027fb669f9ea15e4d2ecde99c49d82da71 Mon Sep 17 00:00:00 2001 From: dynontricia Date: Thu, 30 Jul 2026 14:13:37 -0400 Subject: [PATCH 2/4] Update query_templates.py For spacing. Push 1 --- src/monday_sdk/query_templates.py | 126 +++++++++++++++--------------- 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/src/monday_sdk/query_templates.py b/src/monday_sdk/query_templates.py index 5e3be10..99c3afe 100644 --- a/src/monday_sdk/query_templates.py +++ b/src/monday_sdk/query_templates.py @@ -10,10 +10,10 @@ def get_board_items_query( - board_ids: Union[int, str], - limit: int, - query_params: Optional[Mapping[str, Any]] = None, - cursor: Optional[str] = None, + board_ids: Union[int, str], + limit: int, + query_params: Optional[Mapping[str, Any]] = None, + cursor: Optional[str] = None, ) -> str: if cursor is None: return get_board_items_first_page_query(board_ids, query_params=query_params, limit=limit) @@ -22,7 +22,7 @@ def get_board_items_query( def get_board_items_first_page_query( - board_id: Union[str, int], limit: int, query_params: Optional[Mapping[str, Any]] = None + board_id: Union[str, int], limit: int, query_params: Optional[Mapping[str, Any]] = None ) -> str: raw_params = locals().items() items_page_params = gather_params(raw_params, excluded_params=["board_id"]) @@ -250,30 +250,30 @@ def get_item_query(board_id, column_id, value, limit, cursor=None): items_page_params = gather_params(raw_params, excluded_params=["column_id", "value"]) query = ( - """query - { - items_page_by_column_values (%s) { - cursor - items { + """query + { + items_page_by_column_values (%s) { + cursor + items { + id + name + updates { id - name - updates { - id - body - } - group { - id - title - } - column_values { - id - text - value - } + body + } + group { + id + title } + column_values { + id + text + value + } } - }""" - % items_page_params + } + }""" + % items_page_params ) return query @@ -418,54 +418,54 @@ def move_item_to_group_query(item_id, group_id): def archive_item_query(item_id): query = ( - """ - mutation + """ + mutation + { + archive_item (item_id: %s) { - archive_item (item_id: %s) - { - id - } - }""" - % item_id + id + } + }""" + % item_id ) return query def delete_item_query(item_id): query = ( - """ - mutation + """ + mutation + { + delete_item (item_id: %s) { - delete_item (item_id: %s) - { - id - } - }""" - % item_id + id + } + }""" + % item_id ) return query def get_columns_by_board_query(board_id): return ( - """query - { - boards(ids: %s) { + """query + { + boards(ids: %s) { + id + name + groups { id - name - groups { - id - title - } - columns { - title - id - type - settings_str - } + title } - }""" - % board_id + columns { + title + id + type + settings_str + } + } + }""" + % board_id ) @@ -733,11 +733,11 @@ def get_complexity_query(): def get_activity_logs_query( - board_id: Union[int, str], - limit: int, - page: Optional[int] = 1, - from_date: Optional[str] = None, - to_date: Optional[str] = None, + board_id: Union[int, str], + limit: int, + page: Optional[int] = 1, + from_date: Optional[str] = None, + to_date: Optional[str] = None, ): raw_params = locals().items() activity_logs_params = gather_params(raw_params, excluded_params=["board_id", "from_date", "to_date"]) From f41103a32a08abe7945a48c38fe5cc14a15587cc Mon Sep 17 00:00:00 2001 From: dynontricia Date: Thu, 30 Jul 2026 14:23:32 -0400 Subject: [PATCH 3/4] Update query_templates.py More spacing - Push 2 --- src/monday_sdk/query_templates.py | 106 +++++++++++++++--------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/src/monday_sdk/query_templates.py b/src/monday_sdk/query_templates.py index 99c3afe..c98eb30 100644 --- a/src/monday_sdk/query_templates.py +++ b/src/monday_sdk/query_templates.py @@ -515,12 +515,12 @@ def create_update_query(item_id, update_value): def delete_update_query(item_id): query = ( - """mutation { - delete_update (id: %s) { - id - } - }""" - % item_id + """mutation { + delete_update (id: %s) { + id + } + }""" + % item_id ) return query @@ -575,7 +575,7 @@ def get_updates_for_board(board_id, limit: int, page=1, from_date: Optional[str] updates_params += f', from_date: "{from_date}"' if to_date: updates_params += f', to_date: "{to_date}"' - + query = """query { boards(ids: %s) { @@ -613,17 +613,17 @@ def get_update_query(limit, page=1): limit, page, ) - + return query def get_boards_query( - ids: List[int], - limit: int, - page: int = 1, - board_kind: BoardKind = None, - state: BoardState = None, - order_by: BoardsOrderBy = None, + ids: List[int], + limit: int, + page: int = 1, + board_kind: BoardKind = None, + state: BoardState = None, + order_by: BoardsOrderBy = None, ): parameters = locals().items() query_params = [] @@ -636,28 +636,28 @@ def get_boards_query( joined_params = f"({', '.join(query_params)})" if query_params else "" query = ( - """query - { - boards %s { + """query + { + boards %s { + id + name + permissions + tags { id name - permissions - tags { - id - name - } - groups { - id - title - } - columns { - id - title - type - } } - }""" - % joined_params + groups { + id + title + } + columns { + id + title + type + } + } + }""" + % joined_params ) return query @@ -665,29 +665,29 @@ def get_boards_query( def get_board_by_id_query(board_id: Union[int, str]): return ( - """query - { - boards (ids: %s) { + """query + { + boards (ids: %s) { + id + name + permissions + tags { id name - permissions - tags { - id - name - } - groups { - id - title - } - columns { - id - title - type - settings_str - } } - }""" - % board_id + groups { + id + title + } + columns { + id + title + type + settings_str + } + } + }""" + % board_id ) From b3be63c3532fb78455f2da1f7a5e512cb0accc31 Mon Sep 17 00:00:00 2001 From: dynontricia Date: Thu, 30 Jul 2026 14:27:12 -0400 Subject: [PATCH 4/4] Update query_templates.py Final spacing to match original --- src/monday_sdk/query_templates.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/monday_sdk/query_templates.py b/src/monday_sdk/query_templates.py index c98eb30..215a96f 100644 --- a/src/monday_sdk/query_templates.py +++ b/src/monday_sdk/query_templates.py @@ -570,7 +570,7 @@ def get_updates_for_item_query(item_id, limit: int): def get_updates_for_board(board_id, limit: int, page=1, from_date: Optional[str] = None, to_date: Optional[str] = None): # Build the updates parameters updates_params = f"limit: {limit}, page: {page}" - + if from_date: updates_params += f', from_date: "{from_date}"' if to_date: @@ -613,7 +613,7 @@ def get_update_query(limit, page=1): limit, page, ) - + return query @@ -643,8 +643,8 @@ def get_boards_query( name permissions tags { - id - name + id + name } groups { id @@ -672,8 +672,8 @@ def get_board_by_id_query(board_id: Union[int, str]): name permissions tags { - id - name + id + name } groups { id