From 66d51afa4adbf36ee20c1f0a82ba7e2220133ce6 Mon Sep 17 00:00:00 2001 From: danieldietsch Date: Mon, 16 Nov 2020 17:18:18 +0100 Subject: [PATCH] add addTime and deleteTime to issue --- gitea/gitea.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gitea/gitea.py b/gitea/gitea.py index 92797ac..ee5239f 100644 --- a/gitea/gitea.py +++ b/gitea/gitea.py @@ -439,7 +439,6 @@ class Issue(GiteaApiObject): GET_TIME = """/repos/%s/%s/issues/%s/times""" # GET_COMMENTS = """/repos/%s/%s/issues/comments""" CREATE_ISSUE = """/repos/{owner}/{repo}/issues""" - DELETE_TIME = """/repos/{owner}/{repo}/issues/{index}/times/{id}""" OPENED = "closed" CLOSED = "open" @@ -495,8 +494,13 @@ class Issue(GiteaApiObject): ) def delete_time(self, time_id: str): - self.gitea.requests_delete( - Issue.DELETE_TIME % (self.owner.username, self.repo, self.number, time_id) + path = f"/repos/{self.owner.username}/{self.repo}/issues/{self.number}/times/{time_id}" + self.gitea.requests_delete(path) + + def add_time(self, time: int, created: str = None, user_name: str = None): + path = f"/repos/{self.owner.username}/{self.repo}/issues/{self.number}/times" + self.gitea.requests_post( + path, data={"created": created, "time": int(time), "user_name": user_name}, ) def get_comments(self) -> List[GiteaApiObject]: