kopia lustrzana https://github.com/Langenfeld/py-gitea
Method to add a topic to a repository
rodzic
2716eef153
commit
6102ca7d30
|
@ -344,6 +344,7 @@ class Repository(ApiObject):
|
|||
REPO_DELETE = """/repos/%s/%s""" # <owner>, <reponame>
|
||||
REPO_TIMES = """/repos/%s/%s/times""" # <owner>, <reponame>
|
||||
REPO_TOPICS = """/repos/%s/%s/topics""" # <owner, <reponame>
|
||||
REPO_TOPIC = """/repos/%s/%s/topics/%s""" # <owner, <reponame>, <topicname>
|
||||
REPO_USER_TIME = """/repos/%s/%s/times/%s""" # <owner>, <reponame>, <username>
|
||||
REPO_COMMITS = "/repos/%s/%s/commits" # <owner>, <reponame>
|
||||
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
|
||||
|
|
Ładowanie…
Reference in New Issue