Рефактор ClockifyConfig
This commit is contained in:
@@ -2,33 +2,17 @@ class ClockifyConfig:
|
|||||||
def __init__(self, workspace_id: str, user_id: str):
|
def __init__(self, workspace_id: str, user_id: str):
|
||||||
self.workspace_id = workspace_id
|
self.workspace_id = workspace_id
|
||||||
self.user_id = user_id
|
self.user_id = user_id
|
||||||
|
self.datetime_format = "%Y-%m-%dT%H:%M:%SZ"
|
||||||
@property
|
self.base_url = "https://api.clockify.me/api/v1"
|
||||||
def base_url(self):
|
self.workspace_url = f"/workspaces/{self.workspace_id}"
|
||||||
return "https://api.clockify.me/api/v1"
|
self.tags_url = f"{self.workspace_url}/tags"
|
||||||
|
self.time_entries_url = f"/{self.workspace_url}/user/{self.user_id}/time-entries"
|
||||||
@property
|
self.user_url = "/user"
|
||||||
def tags_url(self):
|
self.projects_url = f"{self.workspace_url}/projects"
|
||||||
return f"/workspaces/{self.workspace_id}/tags"
|
|
||||||
|
|
||||||
@property
|
|
||||||
def time_entries_url(self):
|
|
||||||
return f"/workspaces/{self.workspace_id}/user/{self.user_id}/time-entries"
|
|
||||||
|
|
||||||
@property
|
|
||||||
def user_url(self):
|
|
||||||
return "/user"
|
|
||||||
|
|
||||||
@property
|
|
||||||
def datetime_format(self):
|
|
||||||
return "%Y-%m-%dT%H:%M:%SZ"
|
|
||||||
|
|
||||||
def update_time_entry(self, activity_id):
|
def update_time_entry(self, activity_id):
|
||||||
return f"/workspaces/{self.workspace_id}/time-entries/{activity_id}"
|
return f"{self.workspace_url}/time-entries/{activity_id}"
|
||||||
|
|
||||||
@property
|
|
||||||
def projects_url(self):
|
|
||||||
return f"/workspaces/{self.workspace_id}/projects"
|
|
||||||
|
|
||||||
def tasks_url(self, project_id: str):
|
def tasks_url(self, project_id: str):
|
||||||
return f"{self.projects_url}/{project_id}/tasks"
|
return f"{self.projects_url}/{project_id}/tasks"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user