Skip to content

Client

toggl_api.modules.client.ClientBody dataclass

JSON body dataclass for PUT, POST & PATCH requests.

name: Optional[str] = field(default=None) class-attribute instance-attribute

Name of the project. Defaults to None. Will be required if its a POST request.

format_body(workspace_id: int) -> dict[str, Any]

Formats the body for JSON requests.

Gets called by the endpoint methods before requesting.

Parameters:

  • workspace_id (int) –

    Alternate Workspace ID for the request if the body does not contain a workspace_id.

Returns:

  • dict[str, Any]

    dict[str, Any]: JSON compatible formatted body.

toggl_api.modules.client.ClientEndpoint

Bases: TogglCachedEndpoint

create_client(body: ClientBody) -> Optional[TogglClient]

get_client(client_id: int | TogglClient, *, refresh: bool = False) -> Optional[TogglClient]

update_client(client: TogglClient | int, body: ClientBody) -> Optional[TogglClient]

delete_client(client: TogglClient | int) -> None

get_clients(status: Optional[str] = None, name: Optional[str] = None, *, refresh: bool = False) -> list[TogglClient]