Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
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
12 changes: 5 additions & 7 deletions docs/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@ Getting started

monday.items.create_item(board_id='12345678', group_id='today', item_name='Do a thing')

Available methods
^^^^^^^^^^^^^^^^^
**Available methods:**
Comment thread
Lewandowski-commits marked this conversation as resolved.
Outdated

Items Resource (monday.items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

- ``create_item(board_id, group_id, item_name, column_values=None, create_labels_if_missing=False)``
- Create an item on a board in the given group with name item_name.
Items Resource (monday.items)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
``create_item(board_id, group_id, item_name, column_values=None, create_labels_if_missing=False)``
- Create an item on a board in the given group with name item_name.
Comment thread
Lewandowski-commits marked this conversation as resolved.
Outdated

- ``create_subitem(parent_item_id, subitem_name, column_values=None, create_labels_if_missing=False)``
- Create a subitem underneath a given parent item. Monday API will
Expand Down
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"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any breaking changes?

}

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