Project Structure¶
toggl_api
├── client.py
├── config.py
├── _exceptions.py
├── __init__.py
├── meta
│ ├── base_endpoint.py
│ ├── body.py
│ ├── cache
│ │ ├── base_cache.py
│ │ ├── __init__.py
│ │ ├── json_cache.py
│ │ └── sqlite_cache.py
│ ├── cached_endpoint.py
│ ├── enums.py
│ └── __init__.py
├── models
│ ├── _decorators.py
│ ├── __init__.py
│ ├── models.py
│ └── schema.py
├── organization.py
├── project.py
├── py.typed
├── reports
│ ├── __init__.py
│ └── reports.py
├── tag.py
├── tracker.py
├── user.py
├── utility.py
├── version.py
└── workspace.py
5 directories, 28 files
Class Diagram¶
classDiagram
class AuthenticationError {
}
class BaseBody {
format(endpoint: str)* dict[str, Any]
verify_endpoint_parameter(parameter: str, endpoint: str) bool
}
class BulkEditParameter {
op : Literal['add', 'remove', 'replace']
path : str
value : Any
}
class ClientBody {
name : Optional[str]
notes : Optional[str]
status : Optional[CLIENT_STATUS]
format(endpoint: str) dict[str, Any]
}
class ClientEndpoint {
endpoint
model
workspace_id
add(body: ClientBody) TogglClient | None
collect(body: Optional[ClientBody]) list[TogglClient]
delete(client: TogglClient | int) None
edit(client: TogglClient | int, body: ClientBody) TogglClient | None
get(client_id: int | TogglClient) TogglClient | None
}
class Comparison {
name
}
class CustomDecoder {
MATCH_DICT : Final[dict[str, type[TogglClass]]]
decode(obj: Any) Any
}
class CustomEncoder {
default(obj: Any) Any
}
class DateTimeError {
}
class DetailedReportEndpoint {
endpoint
export_report(body: ReportBody, extension: REPORT_FORMATS, pagination: Optional[PaginationOptions]) PaginatedResult[bytes]
search_time_entries(body: ReportBody, pagination: Optional[PaginationOptions]) PaginatedResult[list]
totals_report(body: ReportBody) dict[str, int]
}
class Edits {
failures : list[int]
successes : list[int]
}
class JSONCache {
cache_path
parent
session : JSONSession[T]
add_entries(update: list[T] | T) None
add_entry(item: T) None
commit() None
delete_entries(update: list[T] | T) None
delete_entry(entry: T) None
find_entry(entry: T | dict[str, int]) T | None
load_cache() list[T]
query() list[TogglClass]
save_cache(update: Iterable[T] | T, method: RequestMethod) None
update_entries(update: list[T] | T) None
}
class JSONSession {
data : list[T]
max_length : int
modified : int
version : str
commit(path: Path) None
load(path: Path) None
process_data(data: list[T]) list[T]
refresh(path: Path) bool
}
class MissingParentError {
}
class NamingError {
}
class OrganizationEndpoint {
endpoint
model
add(name: str, workspace_name: str) TogglOrganization
collect() list[TogglOrganization]
delete(organization: TogglOrganization | int) None
edit(organization: TogglOrganization | int, name: str) TogglOrganization
get(organization: TogglOrganization | int) TogglOrganization | None
}
class PaginatedResult {
next_id : Optional[int]
next_row : Optional[int]
result : T
next_options(page_size: int) PaginationOptions
}
class PaginationOptions {
next_id : Optional[int]
next_row : Optional[int]
page_size : int
}
class ProjectBody {
active : bool | Literal['both']
client_id : Optional[int]
client_ids : list[int]
client_name : Optional[str]
color : Optional[str]
end_date : Optional[date]
group_ids : list[int]
is_private : Optional[bool]
name : Optional[str]
since : Optional[date | int]
start_date : Optional[date]
statuses : list[TogglProject.Status]
user_ids : list[int]
format(endpoint: str) dict[str, Any]
}
class ProjectEndpoint {
BASIC_COLORS : Final[dict[str, str]]
endpoint
model
workspace_id
add(body: ProjectBody) TogglProject
collect(body: Optional[ProjectBody]) list[TogglProject]
delete(project: TogglProject | int) None
edit(project: TogglProject | int, body: ProjectBody) TogglProject
get(project_id: int | TogglProject) TogglProject | None
get_color(name: str) str
get_color_id(color: str) int
status_to_query(status: TogglProject.Status) list[TogglQuery]
}
class ReportBody {
client_ids : list[int | None]
date_format : Literal['MM/DD/YYYY', 'DD-MM-YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD', 'DD/MM/YYYY', 'DD.MM.YYYY']
description : Optional[str]
duration_format : Literal['classic', 'decimal', 'improved']
end_date : Optional[date]
enrich_response : bool
group_ids : list[int]
grouped : bool
grouping : Optional[str]
include_time_entry_ids : bool
max_duration_seconds : Optional[int]
min_duration_seconds : Optional[int]
order_by : Optional[Literal['title', 'duration']]
order_dir : Optional[Literal['ASC', 'DESC']]
project_ids : list[int | None]
resolution : Optional[str]
rounding : Optional[int]
rounding_minutes : Optional[Literal[0, 1, 5, 6, 10, 12, 15, 30, 60, 240]]
start_date : Optional[date]
sub_grouping : Optional[str]
tag_ids : list[int | None]
time_entry_ids : list[int]
user_ids : list[int]
format(endpoint: str) dict[str, Any]
}
class ReportEndpoint {
BASE_ENDPOINT : str
model
}
class RequestMethod {
name
}
class SqliteCache {
cache_path
database
metadata
session
add_entries(entry: Iterable[T] | T) None
commit() None
delete_entries(entry: Iterable[T] | T) None
find_entry(query: T | dict[str, Any]) T | None
load_cache() Query[T]
query() Query[T]
save_cache(entry: list[T] | T, method: RequestMethod) None
update_entries(entry: Iterable[T] | T) None
}
class Status {
name
}
class SummaryReportEndpoint {
endpoint
export_report(body: ReportBody, extension: REPORT_FORMATS) bytes
export_summary(body: ReportBody, extension: REPORT_FORMATS) bytes
project_summaries(start_date: date | str, end_date: date | str) list[dict[str, int]]
project_summary(project: TogglProject | int, start_date: date | str, end_date: date | str) list[dict[str, int]]
search_time_entries(body: ReportBody) list[dict[str, int]]
time_entries(body: ReportBody) list[dict[str, int]]
}
class TagEndpoint {
endpoint
model
workspace_id
add(name: str) TogglTag
collect() list[TogglTag]
delete(tag: TogglTag | int) None
edit(tag: TogglTag | int, name: Optional[str]) TogglTag
get(tag: TogglTag | int) TogglTag | None
}
class TogglCache {
cache_path
expire_after
parent
add_entries(update: list[TC])* None
commit()* None
delete_entries(update: list[TC] | TC)* None
find_entry(entry: TC | dict[str, Any])* TC | None
find_method(method: RequestMethod) Callable | None
load_cache()* Iterable[TC]
query()* Iterable[TC]
save_cache(entry: list[TC] | TC, method: RequestMethod)* None
update_entries(update: list[TC] | TC)* None
}
class TogglCachedEndpoint {
cache
endpoint
load_cache() Iterable[T]
query() list[T]
request(parameters: str, headers: Optional[dict], body: Optional[dict | list], method: RequestMethod) Any
save_cache(response: list[T] | T, method: RequestMethod) None
}
class TogglClass {
id : int
name : str
timestamp : datetime
from_kwargs()* TogglClass
}
class TogglClient {
}
class TogglEndpoint {
BASE_ENDPOINT : ClassVar[str]
HEADERS : Final[dict]
endpoint
model
re_raise : bool
retries
workspace_id : int | None
api_status() bool
method(method: RequestMethod) Callable
process_models(data: list[dict[str, Any]]) list[T]
request(parameters: str, headers: Optional[dict], body: Optional[dict | list], method: RequestMethod) Any
}
class TogglOrganization {
from_kwargs() TogglOrganization
validate_name(name: str) None
}
class TogglProject {
active : bool
client : Optional[int]
color : str
end_date : Optional[date]
start_date : date
stop_date : date
from_kwargs() TogglProject
get_status() TogglProject.Status
}
class TogglQuery {
comparison
key : str
value : T | Sequence[T]
}
class TogglTag {
from_kwargs() TogglTag
}
class TogglTracker {
duration : Optional[timedelta]
project : Optional[int]
start : datetime
stop : Optional[datetime | str]
tags : list[TogglTag]
from_kwargs() TogglTracker
get_tags() list[TogglTag]
running() bool
}
class TogglWorkspace {
name : str
organization : int
from_kwargs() TogglWorkspace
validate_name(name: str) None
}
class TrackerBody {
created_with : str
description : Optional[str]
duration : Optional[int | timedelta]
project_id : Optional[int]
shared_with_user_ids : list[int]
start : Optional[datetime]
start_date : Optional[date]
stop : Optional[datetime]
tag_action : Optional[Literal['add', 'remove']]
tag_ids : list[int]
tags : list[str]
format(endpoint: str) dict[str, Any]
}
class TrackerEndpoint {
TRACKER_ALREADY_STOPPED : Final[int]
endpoint
model
workspace_id
add(body: TrackerBody) TogglTracker | None
bulk_edit() Edits
delete(tracker: TogglTracker | int) None
edit(tracker: TogglTracker | int, body: TrackerBody) TogglTracker
stop(tracker: TogglTracker | int) TogglTracker | None
}
class UTCDateTime {
cache_ok : bool
impl
process_bind_param(value: datetime, _) datetime | None
process_result_value(value: Optional[datetime], _) datetime | None
}
class User {
name : str
user_id : int
}
class UserEndpoint {
TRACKER_NOT_RUNNING : Final[int]
endpoint
model
workspace_id
check_authentication() bool
collect(since: Optional[int | datetime], before: Optional[date], start_date: Optional[date], end_date: Optional[date]) list[TogglTracker]
current() TogglTracker | None
get(tracker_id: int | TogglTracker) TogglTracker | None
get_details() dict[str, Any]
verify_authentication(auth: BasicAuth) bool
}
class WeeklyReportEndpoint {
endpoint
export_report(body: ReportBody, extension: REPORT_FORMATS) bytes
search_time_entries(body: ReportBody) list[dict[str, Any]]
}
class WorkspaceBody {
admins : list[int]
name : Optional[str]
only_admins_may_create_projects : bool
only_admins_may_create_tags : bool
only_admins_see_billable_rates : bool
only_admins_see_team_dashboard : bool
projects_billable_by_default : bool
projects_enforce_billable : bool
projects_private_by_default : bool
rate_change_mode : Optional[Literal['start-today', 'override-current', 'override-all']]
reports_collapse : bool
rounding : Optional[int]
rounding_minutes : Optional[int]
format(endpoint: str) dict[str, Any]
}
class WorkspaceChild {
workspace : int
from_kwargs() WorkspaceChild
}
class WorkspaceEndpoint {
endpoint
model
organization_id
add(body: WorkspaceBody) TogglWorkspace
collect(since: Optional[datetime | int]) list[TogglWorkspace]
edit(workspace_id: TogglWorkspace | int, body: WorkspaceBody) TogglWorkspace
get(workspace: Optional[TogglWorkspace | int]) TogglWorkspace | None
statistics(workspace_id: TogglWorkspace | int) WorkspaceStatistics
tracker_constraints(workspace_id: TogglWorkspace | int) dict[str, bool]
}
class WorkspaceStatistics {
admins : list[User]
groups_count : int
members_count : int
}
ClientBody --|> BaseBody
ClientEndpoint --|> TogglCachedEndpoint
JSONCache --|> TogglCache
SqliteCache --|> TogglCache
TogglCachedEndpoint --|> TogglEndpoint
TogglClient --|> WorkspaceChild
TogglOrganization --|> TogglClass
TogglProject --|> WorkspaceChild
TogglTag --|> WorkspaceChild
TogglTracker --|> WorkspaceChild
TogglWorkspace --|> TogglClass
WorkspaceChild --|> TogglClass
OrganizationEndpoint --|> TogglCachedEndpoint
ProjectBody --|> BaseBody
ProjectEndpoint --|> TogglCachedEndpoint
DetailedReportEndpoint --|> ReportEndpoint
ReportBody --|> BaseBody
ReportEndpoint --|> TogglEndpoint
SummaryReportEndpoint --|> ReportEndpoint
WeeklyReportEndpoint --|> ReportEndpoint
TagEndpoint --|> TogglCachedEndpoint
TrackerBody --|> BaseBody
TrackerEndpoint --|> TogglCachedEndpoint
UserEndpoint --|> TogglCachedEndpoint
WorkspaceBody --|> BaseBody
WorkspaceEndpoint --|> TogglCachedEndpoint
Comparison --* TogglQuery : comparison
TogglCache --o TogglCachedEndpoint : _cache
Press "Alt" / "Option" to enable Pan & Zoom
Package Diagram¶
classDiagram
class toggl_api {
}
class _exceptions {
}
class client {
}
class config {
}
class meta {
}
class base_endpoint {
}
class body {
}
class cache {
}
class base_cache {
}
class json_cache {
}
class sqlite_cache {
}
class cached_endpoint {
}
class enums {
}
class models {
}
class _decorators {
}
class models {
}
class schema {
}
class organization {
}
class project {
}
class reports {
}
class reports {
}
class tag {
}
class tracker {
}
class user {
}
class utility {
}
class version {
}
class workspace {
}
toggl_api --> _exceptions
toggl_api --> client
toggl_api --> config
toggl_api --> meta
toggl_api --> cache
toggl_api --> base_cache
toggl_api --> models
toggl_api --> organization
toggl_api --> project
toggl_api --> tag
toggl_api --> tracker
toggl_api --> user
toggl_api --> version
toggl_api --> workspace
client --> _exceptions
client --> meta
client --> base_cache
client --> models
meta --> base_endpoint
meta --> body
meta --> cache
meta --> cached_endpoint
meta --> enums
base_endpoint --> enums
base_endpoint --> models
cache --> base_cache
cache --> json_cache
base_cache --> enums
base_cache --> models
json_cache --> base_cache
json_cache --> models
json_cache --> utility
json_cache --> version
sqlite_cache --> base_cache
sqlite_cache --> models
sqlite_cache --> schema
sqlite_cache --> utility
cached_endpoint --> base_endpoint
cached_endpoint --> enums
cached_endpoint --> models
models --> models
models --> _exceptions
models --> utility
schema --> _decorators
schema --> models
schema --> utility
organization --> meta
organization --> meta
organization --> models
project --> _exceptions
project --> meta
project --> cache
project --> models
project --> utility
reports --> reports
reports --> meta
reports --> enums
reports --> models
reports --> utility
tag --> _exceptions
tag --> meta
tag --> base_cache
tag --> models
tracker --> _exceptions
tracker --> meta
tracker --> models
tracker --> utility
user --> toggl_api
user --> _exceptions
user --> meta
user --> models
user --> utility
workspace --> _exceptions
workspace --> meta
workspace --> body
workspace --> base_cache
workspace --> enums
workspace --> models
workspace --> utility
base_cache ..> meta
json_cache ..> meta
json_cache ..> cached_endpoint
sqlite_cache ..> meta
cached_endpoint ..> cache
cached_endpoint ..> base_cache
organization ..> base_cache
project ..> meta
tag ..> meta
tracker ..> toggl_api
user ..> models
Press "Alt" / "Option" to enable Pan & Zoom