Skip to content

Models

Abstract Base Classes

toggl_api.modules.models.TogglClass dataclass

Bases: ABC

Base class for all Toggl dataclasses.

Attributes:

  • id (int) –

    Toggl API / Database ID (Primary Key) of the Toggl object.

  • name (str) –

    Name or description of the Toggl object.

  • timestamp (Optional[datetime]) –

    Timestamp of when the Toggl object was last modified.

toggl_api.modules.models.WorkspaceChild dataclass

Bases: TogglClass

Base class for all Toggl workspace objects.


Main Models

toggl_api.modules.models.TogglWorkspace dataclass

Bases: TogglClass

Data structure for Toggl workspaces.

toggl_api.modules.models.TogglClient dataclass

Bases: WorkspaceChild

Data structure for Toggl clients.

toggl_api.modules.models.TogglProject dataclass

Bases: WorkspaceChild

Data structure for Toggl projects.

Attributes:

  • color (str) –

    Color of the project. Defaults to blue. Refer to ProjectEndpoint for all colors.

  • client (Optional[int]) –

    ID of the client the project belongs to. Defaults to None.

  • active (bool) –

    Whether the project is archived or not. Defaults to True.

toggl_api.modules.models.TogglTracker dataclass

Bases: WorkspaceChild

Data structure for trackers.

Attributes:

  • name

    Description of the tracker. Refers to tracker description inside the Toggl API. Inherited.

  • start (datetime) –

    Start time of the tracker. Defaults to time created if nothing is passed.

  • duration (Optional[timedelta]) –

    Duration of the tracker

  • stop (Optional[datetime | str]) –

    Stop time of the tracker

  • project (Optional[int]) –

    ID of the project

  • tags (list[TogglTag]) –

    List of tags

Methods:

  • active

    Whether the tracker is running.

toggl_api.modules.models.TogglTag dataclass

Bases: WorkspaceChild

Data structure for Toggl tags.