Skip to content
Open
2 changes: 1 addition & 1 deletion monday/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
UserResource, GroupResource, ComplexityResource, WorkspaceResource, NotificationResource, MeResource

_DEFAULT_HEADERS = {
"API-Version": "2023-10"
"API-Version": "2026-01"
}

DEFAULT_TIMEOUT = 60
Expand Down
4 changes: 4 additions & 0 deletions monday/query_joins.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ def create_column(
column_title,
)
else:
if isinstance(column_type, str):
column_type = ColumnType(column_type)

column_type.is_defaults_have_recommended_keys(defaults)
query = """mutation{
create_column(board_id: %s, title: "%s", description: "%s", column_type: %s, defaults: %s) {
id
Expand Down
50 changes: 46 additions & 4 deletions monday/resources/types.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,41 @@
from enum import Enum
from typing import Mapping
from warnings import warn


class DuplicateType(Enum):
"""Board duplication types"""

WITH_STRUCTURE = "duplicate_board_with_structure"
WITH_PULSES = "duplicate_board_with_pulses"
WITH_PULSES_AND_UPDATES = "duplicate_board_with_pulses_and_updates"


class ColumnType(Enum):
AUTO_NUMBER = "auto_number" # Number items according to their order in the group/board
AUTO_NUMBER = (
"auto_number" # Number items according to their order in the group/board
)
CHECKBOX = "checkbox" # Check off items and see what's done at a glance
COUNTRY = "country" # Choose a country
COLOR_PICKER = "color_picker" # Manage a design system using a color palette
CREATION_LOG = "creation_log" # Add the item's creator and creation date automatically
CREATION_LOG = (
"creation_log" # Add the item's creator and creation date automatically
)
DATE = "date" # Add dates like deadlines to ensure you never drop the ball
DEPENDENCY = "dependency" # Set up dependencies between items in the board
DROPDOWN = "dropdown" # Create a dropdown list of options
EMAIL = "email" # Email team members and clients directly from your board
FILE = "file" # Add files & docs to your item
HOUR = "hour" # Add times to manage and schedule tasks, shifts and more
ITEM_ID = "item_id" # Show a unique ID for each item
LAST_UPDATED = "last_updated" # Add the person that last updated the item and the date
LAST_UPDATED = (
"last_updated" # Add the person that last updated the item and the date
)
LINK = "link" # Simply hyperlink to any website
BOARD_RELATION = "board_relation" # Relationship with another board
LOCATION = "location" # Place multiple locations on a geographic map
LONG_TEXT = "long_text" # Add large amounts of text without changing column width
MIRROR = "mirror" # Display a value from another board through a linked item. If linked item is in another board, BOARD_RELATION also needs to be set up in the board
NUMBERS = "numbers" # Add revenue, costs, time estimations and more
PEOPLE = "people" # Assign people to improve team work
PHONE = "phone" # Call your contacts directly from monday.com
Expand All @@ -35,11 +46,42 @@ class ColumnType(Enum):
TAGS = "tags" # Add tags to categorize items across multiple boards
TEXT = "text" # Add textual information e.g. addresses, names or keywords
TIMELINE = "timeline" # Visually see a breakdown of your team's workload by time
TIME_TRACKING = "time_tracking" # Easily track time spent on each item, group, and board
TIME_TRACKING = (
"time_tracking" # Easily track time spent on each item, group, and board
)
VOTE = "vote" # Vote on an item e.g. pick a new feature or a favorite lunch place
WEEK = "week" # Select the week on which each item should be completed
WORLD_CLOCK = "world_clock" # Keep track of the time anywhere in the world

@classmethod
def is_defaults_have_recommended_keys(cls, defaults: Mapping[str, any] = None):
mirror_recommended_default_keys = (
"relation_column",
"displayed_linked_columns",
)

board_relation_recommended_default_keys = (
"boardId",
"boardIds",
)

if (cls == "mirror") & (mirror_recommended_default_keys not in defaults):
warn(
f"Defaults for mirror column type missing recommended keys: {[x for x in mirror_recommended_default_keys if x not in defaults]}. Column will appear blank.",
UserWarning,
)
elif (cls == "board_relation") & (
board_relation_recommended_default_keys not in defaults
):
warn(
f"Defaults for board_relation column type missing recommended keys: {[x for x in board_relation_recommended_default_keys if x not in defaults]}. Items from the related board(s) will not be linkable.",
UserWarning,
)
else:
pass

return None


class BoardKind(Enum):
"""Board kinds"""
Expand Down