11from datetime import datetime
2- from typing import Any , Callable , Dict , List , Optional , Union
2+ from typing import Callable , List , Optional , Union
33
4- from pydantic import BaseModel , EmailStr , HttpUrl
4+ from pydantic import BaseModel , EmailStr , Field , HttpUrl
55
66
77class BaseEntity (BaseModel ):
@@ -17,7 +17,7 @@ class Client(BaseEntity):
1717
1818class Group (BaseEntity ):
1919 name : str
20- wid : int
20+ wid : int = Field ( alias = "workspace_id" )
2121
2222
2323class Project (BaseEntity ):
@@ -28,7 +28,7 @@ class Project(BaseEntity):
2828 is_private : bool = True
2929 template : Optional [bool ] = None
3030 template_id : Optional [int ] = None
31- billable : bool = True
31+ billable : Optional [ bool ] = True
3232 auto_estimates : Optional [bool ] = False
3333 estimated_hours : Optional [int ] = None
3434 color : Union [str , int ] = 0
@@ -48,15 +48,16 @@ class ProjectUser(BaseEntity):
4848
4949class Tag (BaseEntity ):
5050 name : str
51- wid : int
51+ wid : int = Field ( alias = "workspace_id" )
5252
5353
5454class Task (BaseEntity ):
5555 name : str
56- pid : int
57- wid : int
58- uid : Optional [int ] = None
56+ pid : int = Field ( alias = "project_id" )
57+ wid : int = Field ( alias = "workspace_id" )
58+ uid : Optional [int ] = Field ( alias = "user_id" , default = None )
5959 estimated_seconds : Optional [int ] = None
60+ tracked_seconds : Optional [int ] = None
6061 active : Optional [bool ] = True
6162
6263
@@ -89,33 +90,11 @@ class ReportTimeEntry(BaseEntity):
8990 tags : List [str ] = []
9091
9192
92- class User (BaseEntity ):
93- api_token : Optional [str ] = None
94- default_wid : Optional [int ] = None
95- email : EmailStr
96- fullname : str
97- jquery_timeofday_format : str
98- jquery_date_format : str
99- timeofday_format : str
100- date_format : str
101- store_start_and_stop_time : bool
102- beginning_of_week : int = 0
103- language : str
104- image_url : HttpUrl
105- sidebar_piechart : bool
106- new_blog_post : Optional [Dict [str , Any ]] = None
107- send_product_emails : bool
108- send_weekly_report : bool
109- send_timer_notifications : bool
110- openid_enabled : bool
111- timezone : str
112-
113-
11493class Workspace (BaseEntity ):
11594 name : str
11695 premium : bool
11796 admin : bool
118- default_hourly_rate : float
97+ default_hourly_rate : Optional [ float ] = None
11998 default_currency : str
12099 only_admins_may_create_projects : bool
121100 only_admins_see_billable_rates : bool
@@ -124,6 +103,24 @@ class Workspace(BaseEntity):
124103 logo_url : Optional [HttpUrl ] = None
125104
126105
106+ class User (BaseEntity ):
107+ api_token : Optional [str ] = None
108+ default_wid : Optional [int ] = Field (alias = "default_workspace_id" , default = None )
109+ email : EmailStr
110+ fullname : str
111+ beginning_of_week : int = 0
112+ image_url : Optional [HttpUrl ] = None
113+ openid_enabled : Optional [bool ] = None
114+ timezone : Optional [str ] = None
115+ country_id : Optional [int ] = None
116+ projects : Optional [Project ] = None
117+ tags : Optional [Tag ] = None
118+ tasks : Optional [Task ] = None
119+ time_entries : Optional [TimeEntry ] = None
120+ updated_at : str
121+ workspaces : Optional [Workspace ] = None
122+
123+
127124class WorkspaceUser (BaseEntity ):
128125 uid : int
129126 wid : int
0 commit comments