diff --git a/gitea/apiobject.py b/gitea/apiobject.py index df92e54..3e533ec 100644 --- a/gitea/apiobject.py +++ b/gitea/apiobject.py @@ -344,6 +344,7 @@ class Repository(ApiObject): 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" @@ -470,7 +471,13 @@ class Repository(ApiObject): 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