Skip to content

Closed#

pyticktick.models.v2.parameters.closed #

Model for getting closed tasks from the database.

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
GetClosedV2

Model for getting closed tasks from the database.

GetClosedV2 pydantic-model #

Bases: BaseModelV2

Model for getting closed tasks from the database.

These are tasks that have been marked as completed or abandoned. They will not show up in the normal task list.

Show JSON schema:
{
  "additionalProperties": false,
  "description": "Model for getting closed tasks from the database.\n\nThese are tasks that have been marked as completed or abandoned. They will not show\nup in the normal task list.",
  "properties": {
    "from_": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The earliest date to get tasks from",
      "title": "From"
    },
    "to": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The latest date to get tasks from",
      "title": "To"
    },
    "status": {
      "description": "Whether to get completed or \"won't do\" tasks",
      "enum": [
        "Completed",
        "Abandoned"
      ],
      "title": "Status",
      "type": "string"
    }
  },
  "required": [
    "status"
  ],
  "title": "GetClosedV2",
  "type": "object"
}

Fields:

  • from_ (datetime | None)
  • to (datetime | None)
  • status (Literal['Completed', 'Abandoned'])

Validators:

from_ pydantic-field #

from_: datetime | None = None

The earliest date to get tasks from

status pydantic-field #

status: Literal['Completed', 'Abandoned']

Whether to get completed or "won't do" tasks

to pydantic-field #

to: datetime | None = None

The latest date to get tasks from

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