diff --git a/gitea/apiobject.py b/gitea/apiobject.py index 209f9fc..3e533ec 100644 --- a/gitea/apiobject.py +++ b/gitea/apiobject.py @@ -343,6 +343,8 @@ class Repository(ApiObject): REPO_ISSUES = """/repos/{owner}/{repo}/issues""" # REPO_DELETE = """/repos/%s/%s""" # , REPO_TIMES = """/repos/%s/%s/times""" # , + REPO_TOPICS = """/repos/%s/%s/topics""" # + REPO_TOPIC = """/repos/%s/%s/topics/%s""" # , REPO_USER_TIME = """/repos/%s/%s/times/%s""" # , , REPO_COMMITS = "/repos/%s/%s/commits" # , REPO_TRANSFER = "/repos/{owner}/{repo}/transfer" @@ -463,7 +465,19 @@ class Repository(ApiObject): Repository.REPO_TIMES % (self.owner.username, self.name) ) return results - + + def get_topics(self): + results = self.gitea.requests_get( + Repository.REPO_TOPICS % (self.owner.username, self.name) + ) + return results["topics"] + + def add_topic(self, topic: str): + """Add a topic to the repository""" + result = self.gitea.requests_put( + Repository.REPO_TOPIC % (self.owner.username, self.name, topic) + ) + def get_user_time(self, username) -> float: if isinstance(username, User): username = username.username