Skip to content

Project#

pyticktick.models.v2.parameters.project #

Parameters for creating and updating projects via the V2 API.

Unofficial API

These models are part of the unofficial TickTick API. They were created by reverse engineering the API. They may be incomplete or inaccurate.

Classes:

Name Description
CreateProjectV2

Model for creating a project via the V2 API.

PostBatchProjectV2

Model for batch project operations via the V2 API.

UpdateProjectV2

Model for updating a project via the V2 API.

CreateProjectV2 pydantic-model #

Bases: BaseModelV2

Model for creating a project via the V2 API.

This model is used to create a project via the V2 API. It mostly maps to the create project documentation in the API docs. The main differences are the addition of the id and group_id fields. This is used in the PostBatchProjectV2 model.

Show JSON schema:
{
  "additionalProperties": false,
  "description": "Model for creating a project via the V2 API.\n\nThis model is used to create a project via the V2 API. It mostly maps to the\n[create project](https://developer.ticktick.com/docs#/openapi?id=create-project)\ndocumentation in the API docs. The main differences are the addition of the `id`\nand `group_id` fields. This is used in the `PostBatchProjectV2` model.",
  "properties": {
    "name": {
      "description": "name of the project",
      "title": "Name",
      "type": "string"
    },
    "color": {
      "anyOf": [
        {
          "format": "color",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "color of project, eg. '#F18181'",
      "title": "Color"
    },
    "group_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "ID of the project group to add the project to",
      "title": "Group Id"
    },
    "id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "ID of the project to create",
      "title": "Id"
    },
    "kind": {
      "anyOf": [
        {
          "enum": [
            "TASK",
            "NOTE"
          ],
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "\"TASK\" or \"NOTE\"",
      "title": "Kind"
    },
    "view_mode": {
      "anyOf": [
        {
          "enum": [
            "list",
            "kanban",
            "timeline"
          ],
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "view mode, \"list\", \"kanban\", \"timeline\"",
      "title": "View Mode"
    },
    "sort_order": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Sort Order"
    }
  },
  "required": [
    "name"
  ],
  "title": "CreateProjectV2",
  "type": "object"
}

Fields:

Validators:

color pydantic-field #

color: Color | None = None

color of project, eg. '#F18181'

group_id pydantic-field #

group_id: ObjectId | None = None

ID of the project group to add the project to

id pydantic-field #

id: ObjectId | None = None

ID of the project to create

kind pydantic-field #

kind: Literal['TASK', 'NOTE'] | None = None

"TASK" or "NOTE"

name pydantic-field #

name: str

name of the project

view_mode pydantic-field #

view_mode: Literal["list", "kanban", "timeline"] | None = (
    None
)

view mode, "list", "kanban", "timeline"

empty_str_to_none pydantic-validator #

empty_str_to_none(v: Any) -> Any

Convert empty strings to None.

TickTick API responses sometimes conflates None and empty strings for optional fields. This validator ensures that empty strings are converted to None, which then allows for more consistent handling of the data within the library.

Parameters:

Name Type Description Default
v Any

The value to validate.

required

Returns:

Name Type Description
Any Any

The input value if it is not an empty string, otherwise None.

Source code in src/pyticktick/models/v2/models.py
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
@field_validator("*", mode="before")
@classmethod
def empty_str_to_none(cls, v: Any) -> Any:
    """Convert empty strings to None.

    TickTick API responses sometimes conflates `None` and empty strings for
    optional fields. This validator ensures that empty strings are converted to
    `None`, which then allows for more consistent handling of the data within the
    library.

    Args:
        v (Any): The value to validate.

    Returns:
        Any: The input value if it is not an empty string, otherwise `None`.
    """
    if isinstance(v, str) and len(v) == 0:
        return None
    return v

PostBatchProjectV2 pydantic-model #

Bases: BaseModelV2

Model for batch project operations via the V2 API.

This model is used to create, update, and delete projects in bulk against the V2 API endpoint POST /batch/project.

Show JSON schema:
{
  "$defs": {
    "CreateProjectV2": {
      "additionalProperties": false,
      "description": "Model for creating a project via the V2 API.\n\nThis model is used to create a project via the V2 API. It mostly maps to the\n[create project](https://developer.ticktick.com/docs#/openapi?id=create-project)\ndocumentation in the API docs. The main differences are the addition of the `id`\nand `group_id` fields. This is used in the `PostBatchProjectV2` model.",
      "properties": {
        "name": {
          "description": "name of the project",
          "title": "Name",
          "type": "string"
        },
        "color": {
          "anyOf": [
            {
              "format": "color",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "color of project, eg. '#F18181'",
          "title": "Color"
        },
        "group_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "ID of the project group to add the project to",
          "title": "Group Id"
        },
        "id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "ID of the project to create",
          "title": "Id"
        },
        "kind": {
          "anyOf": [
            {
              "enum": [
                "TASK",
                "NOTE"
              ],
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "\"TASK\" or \"NOTE\"",
          "title": "Kind"
        },
        "view_mode": {
          "anyOf": [
            {
              "enum": [
                "list",
                "kanban",
                "timeline"
              ],
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "view mode, \"list\", \"kanban\", \"timeline\"",
          "title": "View Mode"
        },
        "sort_order": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Sort Order"
        }
      },
      "required": [
        "name"
      ],
      "title": "CreateProjectV2",
      "type": "object"
    },
    "UpdateProjectV2": {
      "additionalProperties": false,
      "description": "Model for updating a project via the V2 API.\n\nThis model is used to update a project via the V2 API. It mostly maps to the\n[update project](https://developer.ticktick.com/docs#/openapi?id=update-project)\ndocumentation in the API docs. The main differences are the addition of the `id`\nand `group_id` fields. This is used in the `PostBatchProjectV2` model.",
      "properties": {
        "id": {
          "description": "ID of the project to update",
          "title": "Id",
          "type": "string"
        },
        "name": {
          "description": "name of the project, must be set even on update",
          "title": "Name",
          "type": "string"
        },
        "color": {
          "anyOf": [
            {
              "format": "color",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "color of project, eg. '#F18181'",
          "title": "Color"
        },
        "group_id": {
          "anyOf": [
            {
              "const": "NONE",
              "type": "string"
            },
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "ID of the project group to move the project to, `\"NONE\"` to actively be ungrouped, `None` to be set to the group it was in before",
          "title": "Group Id"
        },
        "kind": {
          "anyOf": [
            {
              "enum": [
                "TASK",
                "NOTE"
              ],
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "\"TASK\" or \"NOTE\"",
          "title": "Kind"
        },
        "view_mode": {
          "anyOf": [
            {
              "enum": [
                "list",
                "kanban",
                "timeline"
              ],
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "view mode, \"list\", \"kanban\", \"timeline\"",
          "title": "View Mode"
        },
        "sort_order": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Sort Order"
        }
      },
      "required": [
        "id",
        "name"
      ],
      "title": "UpdateProjectV2",
      "type": "object"
    }
  },
  "additionalProperties": false,
  "description": "Model for batch project operations via the V2 API.\n\nThis model is used to create, update, and delete projects in bulk against the V2 API\nendpoint `POST /batch/project`.",
  "properties": {
    "add": {
      "default": [],
      "description": "List of projects to add",
      "items": {
        "$ref": "#/$defs/CreateProjectV2"
      },
      "title": "Add",
      "type": "array"
    },
    "delete": {
      "default": [],
      "description": "List of project IDs to delete",
      "items": {
        "type": "string"
      },
      "title": "Delete",
      "type": "array"
    },
    "update": {
      "default": [],
      "description": "List of projects to update",
      "items": {
        "$ref": "#/$defs/UpdateProjectV2"
      },
      "title": "Update",
      "type": "array"
    }
  },
  "title": "PostBatchProjectV2",
  "type": "object"
}

Fields:

Validators:

add pydantic-field #

add: list[CreateProjectV2] = []

List of projects to add

delete pydantic-field #

delete: list[ObjectId] = []

List of project IDs to delete

update pydantic-field #

update: list[UpdateProjectV2] = []

List of projects to update

empty_str_to_none pydantic-validator #

empty_str_to_none(v: Any) -> Any

Convert empty strings to None.

TickTick API responses sometimes conflates None and empty strings for optional fields. This validator ensures that empty strings are converted to None, which then allows for more consistent handling of the data within the library.

Parameters:

Name Type Description Default
v Any

The value to validate.

required

Returns:

Name Type Description
Any Any

The input value if it is not an empty string, otherwise None.

Source code in src/pyticktick/models/v2/models.py
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
@field_validator("*", mode="before")
@classmethod
def empty_str_to_none(cls, v: Any) -> Any:
    """Convert empty strings to None.

    TickTick API responses sometimes conflates `None` and empty strings for
    optional fields. This validator ensures that empty strings are converted to
    `None`, which then allows for more consistent handling of the data within the
    library.

    Args:
        v (Any): The value to validate.

    Returns:
        Any: The input value if it is not an empty string, otherwise `None`.
    """
    if isinstance(v, str) and len(v) == 0:
        return None
    return v

UpdateProjectV2 pydantic-model #

Bases: BaseModelV2

Model for updating a project via the V2 API.

This model is used to update a project via the V2 API. It mostly maps to the update project documentation in the API docs. The main differences are the addition of the id and group_id fields. This is used in the PostBatchProjectV2 model.

Show JSON schema:
{
  "additionalProperties": false,
  "description": "Model for updating a project via the V2 API.\n\nThis model is used to update a project via the V2 API. It mostly maps to the\n[update project](https://developer.ticktick.com/docs#/openapi?id=update-project)\ndocumentation in the API docs. The main differences are the addition of the `id`\nand `group_id` fields. This is used in the `PostBatchProjectV2` model.",
  "properties": {
    "id": {
      "description": "ID of the project to update",
      "title": "Id",
      "type": "string"
    },
    "name": {
      "description": "name of the project, must be set even on update",
      "title": "Name",
      "type": "string"
    },
    "color": {
      "anyOf": [
        {
          "format": "color",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "color of project, eg. '#F18181'",
      "title": "Color"
    },
    "group_id": {
      "anyOf": [
        {
          "const": "NONE",
          "type": "string"
        },
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "ID of the project group to move the project to, `\"NONE\"` to actively be ungrouped, `None` to be set to the group it was in before",
      "title": "Group Id"
    },
    "kind": {
      "anyOf": [
        {
          "enum": [
            "TASK",
            "NOTE"
          ],
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "\"TASK\" or \"NOTE\"",
      "title": "Kind"
    },
    "view_mode": {
      "anyOf": [
        {
          "enum": [
            "list",
            "kanban",
            "timeline"
          ],
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "view mode, \"list\", \"kanban\", \"timeline\"",
      "title": "View Mode"
    },
    "sort_order": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Sort Order"
    }
  },
  "required": [
    "id",
    "name"
  ],
  "title": "UpdateProjectV2",
  "type": "object"
}

Fields:

Validators:

color pydantic-field #

color: Color | None = None

color of project, eg. '#F18181'

group_id pydantic-field #

group_id: Union[Literal['NONE'], None, ObjectId] = None

ID of the project group to move the project to, "NONE" to actively be ungrouped, None to be set to the group it was in before

id pydantic-field #

id: ObjectId

ID of the project to update

kind pydantic-field #

kind: Literal['TASK', 'NOTE'] | None = None

"TASK" or "NOTE"

name pydantic-field #

name: str

name of the project, must be set even on update

view_mode pydantic-field #

view_mode: Literal["list", "kanban", "timeline"] | None = (
    None
)

view mode, "list", "kanban", "timeline"

empty_str_to_none pydantic-validator #

empty_str_to_none(v: Any) -> Any

Convert empty strings to None.

TickTick API responses sometimes conflates None and empty strings for optional fields. This validator ensures that empty strings are converted to None, which then allows for more consistent handling of the data within the library.

Parameters:

Name Type Description Default
v Any

The value to validate.

required

Returns:

Name Type Description
Any Any

The input value if it is not an empty string, otherwise None.

Source code in src/pyticktick/models/v2/models.py
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
@field_validator("*", mode="before")
@classmethod
def empty_str_to_none(cls, v: Any) -> Any:
    """Convert empty strings to None.

    TickTick API responses sometimes conflates `None` and empty strings for
    optional fields. This validator ensures that empty strings are converted to
    `None`, which then allows for more consistent handling of the data within the
    library.

    Args:
        v (Any): The value to validate.

    Returns:
        Any: The input value if it is not an empty string, otherwise `None`.
    """
    if isinstance(v, str) and len(v) == 0:
        return None
    return v