Add missing attributes to Repository (#2742)

This commit is contained in:
Roberto Pastor Muela
2023-09-04 09:28:01 +02:00
committed by GitHub
parent b6a28a26f2
commit 65cfeb1b8b
5 changed files with 181 additions and 23 deletions
+134 -14
View File
@@ -623,6 +623,22 @@ class Repository(github.GithubObject.CompletableGithubObject):
self._completeIfNotSet(self._master_branch)
return self._master_branch.value
@property
def merge_commit_message(self):
"""
:type: string
"""
self._completeIfNotSet(self._merge_commit_message)
return self._merge_commit_message.value
@property
def merge_commit_title(self):
"""
:type: string
"""
self._completeIfNotSet(self._merge_commit_title)
return self._merge_commit_title.value
@property
def merges_url(self):
"""
@@ -767,6 +783,22 @@ class Repository(github.GithubObject.CompletableGithubObject):
self._completeIfNotSet(self._source)
return self._source.value
@property
def squash_merge_commit_message(self):
"""
:type: string
"""
self._completeIfNotSet(self._squash_merge_commit_message)
return self._squash_merge_commit_message.value
@property
def squash_merge_commit_title(self):
"""
:type: string
"""
self._completeIfNotSet(self._squash_merge_commit_title)
return self._squash_merge_commit_title.value
@property
def ssh_url(self):
"""
@@ -879,6 +911,14 @@ class Repository(github.GithubObject.CompletableGithubObject):
self._completeIfNotSet(self._url)
return self._url.value
@property
def use_squash_pr_title_as_default(self):
"""
:type: bool
"""
self._completeIfNotSet(self._use_squash_pr_title_as_default)
return self._use_squash_pr_title_as_default.value
@property
def visibility(self):
"""
@@ -903,6 +943,14 @@ class Repository(github.GithubObject.CompletableGithubObject):
self._completeIfNotSet(self._watchers_count)
return self._watchers_count.value
@property
def web_commit_signoff_required(self):
"""
:type: bool
"""
self._completeIfNotSet(self._web_commit_signoff_required)
return self._web_commit_signoff_required.value
def add_to_collaborators(self, collaborator, permission=github.GithubObject.NotSet):
"""
:calls: `PUT /repos/{owner}/{repo}/collaborators/{user} <https://docs.github.com/en/rest/reference/repos#collaborators>`_
@@ -1739,19 +1787,26 @@ class Repository(github.GithubObject.CompletableGithubObject):
description=github.GithubObject.NotSet,
homepage=github.GithubObject.NotSet,
private=github.GithubObject.NotSet,
visibility=github.GithubObject.NotSet,
has_issues=github.GithubObject.NotSet,
has_projects=github.GithubObject.NotSet,
has_wiki=github.GithubObject.NotSet,
has_downloads=github.GithubObject.NotSet,
is_template=github.GithubObject.NotSet,
default_branch=github.GithubObject.NotSet,
allow_auto_merge=github.GithubObject.NotSet,
allow_forking=github.GithubObject.NotSet,
allow_squash_merge=github.GithubObject.NotSet,
allow_merge_commit=github.GithubObject.NotSet,
allow_rebase_merge=github.GithubObject.NotSet,
allow_auto_merge=github.GithubObject.NotSet,
delete_branch_on_merge=github.GithubObject.NotSet,
allow_update_branch=github.GithubObject.NotSet,
use_squash_pr_title_as_default=github.GithubObject.NotSet,
squash_merge_commit_title=github.GithubObject.NotSet,
squash_merge_commit_message=github.GithubObject.NotSet,
merge_commit_title=github.GithubObject.NotSet,
merge_commit_message=github.GithubObject.NotSet,
archived=github.GithubObject.NotSet,
allow_forking=github.GithubObject.NotSet,
web_commit_signoff_required=github.GithubObject.NotSet,
):
"""
:calls: `PATCH /repos/{owner}/{repo} <https://docs.github.com/en/rest/reference/repos>`_
@@ -1759,18 +1814,26 @@ class Repository(github.GithubObject.CompletableGithubObject):
:param description: string
:param homepage: string
:param private: bool
:param visibility: string
:param has_issues: bool
:param has_projects: bool
:param has_wiki: bool
:param has_downloads: bool
:param is_template: bool
:param default_branch: string
:param allow_forking: bool
:param allow_squash_merge: bool
:param allow_merge_commit: bool
:param allow_rebase_merge: bool
:param allow_auto_merge: bool
:param delete_branch_on_merge: bool
:param allow_update_branch: bool
:param use_squash_pr_title_as_default: bool
:param squash_merge_commit_title : string
:param squash_merge_commit_message : string
:param merge_commit_title : string
:param merge_commit_message : string
:param archived: bool
:param allow_forking: bool
:param web_commit_signoff_required: bool
:rtype: None
"""
if name is None:
@@ -1779,13 +1842,14 @@ class Repository(github.GithubObject.CompletableGithubObject):
assert description is github.GithubObject.NotSet or isinstance(description, str), description
assert homepage is github.GithubObject.NotSet or isinstance(homepage, str), homepage
assert private is github.GithubObject.NotSet or isinstance(private, bool), private
assert visibility is github.GithubObject.NotSet or (
isinstance(visibility, str) and visibility in ["public", "private"]
), visibility
assert has_issues is github.GithubObject.NotSet or isinstance(has_issues, bool), has_issues
assert has_projects is github.GithubObject.NotSet or isinstance(has_projects, bool), has_projects
assert has_wiki is github.GithubObject.NotSet or isinstance(has_wiki, bool), has_wiki
assert has_downloads is github.GithubObject.NotSet or isinstance(has_downloads, bool), has_downloads
assert is_template is github.GithubObject.NotSet or isinstance(is_template, bool), is_template
assert default_branch is github.GithubObject.NotSet or isinstance(default_branch, str), default_branch
assert allow_auto_merge is github.GithubObject.NotSet or isinstance(allow_auto_merge, bool), allow_auto_merge
assert allow_forking is github.GithubObject.NotSet or isinstance(allow_forking, bool), allow_forking
assert allow_squash_merge is github.GithubObject.NotSet or isinstance(
allow_squash_merge, bool
), allow_squash_merge
@@ -1795,48 +1859,86 @@ class Repository(github.GithubObject.CompletableGithubObject):
assert allow_rebase_merge is github.GithubObject.NotSet or isinstance(
allow_rebase_merge, bool
), allow_rebase_merge
assert allow_auto_merge is github.GithubObject.NotSet or isinstance(allow_auto_merge, bool), allow_auto_merge
assert delete_branch_on_merge is github.GithubObject.NotSet or isinstance(
delete_branch_on_merge, bool
), delete_branch_on_merge
assert allow_update_branch is github.GithubObject.NotSet or isinstance(
allow_update_branch, bool
), allow_update_branch
assert use_squash_pr_title_as_default is github.GithubObject.NotSet or isinstance(
use_squash_pr_title_as_default, bool
), use_squash_pr_title_as_default
assert squash_merge_commit_title is github.GithubObject.NotSet or (
isinstance(squash_merge_commit_title, str)
and squash_merge_commit_title in ["PR_TITLE", "COMMIT_OR_PR_TITLE"]
), squash_merge_commit_title
assert squash_merge_commit_message is github.GithubObject.NotSet or (
isinstance(squash_merge_commit_message, str)
and squash_merge_commit_message in ["PR_BODY", "COMMIT_MESSAGES", "BLANK"]
), squash_merge_commit_message
assert merge_commit_title is github.GithubObject.NotSet or (
isinstance(merge_commit_title, str) and merge_commit_title in ["PR_TITLE", "MERGE_MESSAGE"]
), merge_commit_title
assert merge_commit_message is github.GithubObject.NotSet or (
isinstance(merge_commit_message, str) and merge_commit_message in ["PR_TITLE", "PR_BODY", "BLANK"]
), merge_commit_message
assert archived is github.GithubObject.NotSet or isinstance(archived, bool), archived
assert allow_forking is github.GithubObject.NotSet or isinstance(allow_forking, bool), allow_forking
assert web_commit_signoff_required is github.GithubObject.NotSet or isinstance(
web_commit_signoff_required, bool
), web_commit_signoff_required
post_parameters = {
"name": name,
}
if description is not github.GithubObject.NotSet:
post_parameters["description"] = description
if homepage is not github.GithubObject.NotSet:
post_parameters["homepage"] = homepage
if private is not github.GithubObject.NotSet:
post_parameters["private"] = private
if visibility is not github.GithubObject.NotSet:
post_parameters["visibility"] = visibility
if has_issues is not github.GithubObject.NotSet:
post_parameters["has_issues"] = has_issues
if has_projects is not github.GithubObject.NotSet:
post_parameters["has_projects"] = has_projects
if has_wiki is not github.GithubObject.NotSet:
post_parameters["has_wiki"] = has_wiki
if has_downloads is not github.GithubObject.NotSet:
post_parameters["has_downloads"] = has_downloads
if is_template is not github.GithubObject.NotSet:
post_parameters["is_template"] = is_template
if default_branch is not github.GithubObject.NotSet:
post_parameters["default_branch"] = default_branch
if allow_squash_merge is not github.GithubObject.NotSet:
post_parameters["allow_squash_merge"] = allow_squash_merge
if allow_auto_merge is not github.GithubObject.NotSet:
post_parameters["allow_auto_merge"] = allow_auto_merge
if allow_forking is not github.GithubObject.NotSet:
post_parameters["allow_forking"] = allow_forking
if allow_merge_commit is not github.GithubObject.NotSet:
post_parameters["allow_merge_commit"] = allow_merge_commit
if allow_rebase_merge is not github.GithubObject.NotSet:
post_parameters["allow_rebase_merge"] = allow_rebase_merge
if allow_auto_merge is not github.GithubObject.NotSet:
post_parameters["allow_auto_merge"] = allow_auto_merge
if delete_branch_on_merge is not github.GithubObject.NotSet:
post_parameters["delete_branch_on_merge"] = delete_branch_on_merge
if allow_update_branch is not github.GithubObject.NotSet:
post_parameters["allow_update_branch"] = allow_update_branch
if use_squash_pr_title_as_default is not github.GithubObject.NotSet:
post_parameters["use_squash_pr_title_as_default"] = use_squash_pr_title_as_default
if squash_merge_commit_title is not github.GithubObject.NotSet:
post_parameters["squash_merge_commit_title"] = squash_merge_commit_title
if squash_merge_commit_message is not github.GithubObject.NotSet:
post_parameters["squash_merge_commit_message"] = squash_merge_commit_message
if merge_commit_title is not github.GithubObject.NotSet:
post_parameters["merge_commit_title"] = merge_commit_title
if merge_commit_message is not github.GithubObject.NotSet:
post_parameters["merge_commit_message"] = merge_commit_message
if archived is not github.GithubObject.NotSet:
post_parameters["archived"] = archived
if allow_forking is not github.GithubObject.NotSet:
post_parameters["allow_forking"] = allow_forking
if web_commit_signoff_required is not github.GithubObject.NotSet:
post_parameters["web_commit_signoff_required"] = web_commit_signoff_required
headers, data = self._requester.requestJsonAndCheck("PATCH", self.url, input=post_parameters)
self._useAttributes(data)
@@ -3915,6 +4017,8 @@ class Repository(github.GithubObject.CompletableGithubObject):
self._language = github.GithubObject.NotSet
self._languages_url = github.GithubObject.NotSet
self._master_branch = github.GithubObject.NotSet
self._merge_commit_message = github.GithubObject.NotSet
self._merge_commit_title = github.GithubObject.NotSet
self._merges_url = github.GithubObject.NotSet
self._milestones_url = github.GithubObject.NotSet
self._mirror_url = github.GithubObject.NotSet
@@ -3933,6 +4037,8 @@ class Repository(github.GithubObject.CompletableGithubObject):
self._releases_url = github.GithubObject.NotSet
self._size = github.GithubObject.NotSet
self._source = github.GithubObject.NotSet
self._squash_merge_commit_message = github.GithubObject.NotSet
self._squash_merge_commit_title = github.GithubObject.NotSet
self._ssh_url = github.GithubObject.NotSet
self._stargazers_count = github.GithubObject.NotSet
self._stargazers_url = github.GithubObject.NotSet
@@ -3947,9 +4053,11 @@ class Repository(github.GithubObject.CompletableGithubObject):
self._trees_url = github.GithubObject.NotSet
self._updated_at = github.GithubObject.NotSet
self._url = github.GithubObject.NotSet
self._use_squash_pr_title_as_default = github.GithubObject.NotSet
self._visibility = github.GithubObject.NotSet
self._watchers = github.GithubObject.NotSet
self._watchers_count = github.GithubObject.NotSet
self._web_commit_signoff_required = github.GithubObject.NotSet
def _useAttributes(self, attributes: Dict[str, Any]) -> None:
if "allow_auto_merge" in attributes: # pragma no branch
@@ -4058,6 +4166,10 @@ class Repository(github.GithubObject.CompletableGithubObject):
self._master_branch = self._makeStringAttribute(attributes["master_branch"])
if "merges_url" in attributes: # pragma no branch
self._merges_url = self._makeStringAttribute(attributes["merges_url"])
if "merge_commit_message" in attributes: # pragma no branch
self._merge_commit_message = self._makeStringAttribute(attributes["merge_commit_message"])
if "merge_commit_title" in attributes: # pragma no branch
self._merge_commit_title = self._makeStringAttribute(attributes["merge_commit_title"])
if "milestones_url" in attributes: # pragma no branch
self._milestones_url = self._makeStringAttribute(attributes["milestones_url"])
if "mirror_url" in attributes: # pragma no branch
@@ -4092,6 +4204,10 @@ class Repository(github.GithubObject.CompletableGithubObject):
self._size = self._makeIntAttribute(attributes["size"])
if "source" in attributes: # pragma no branch
self._source = self._makeClassAttribute(Repository, attributes["source"])
if "squash_merge_commit_message" in attributes: # pragma no branch
self._squash_merge_commit_message = self._makeStringAttribute(attributes["squash_merge_commit_message"])
if "squash_merge_commit_title" in attributes: # pragma no branch
self._squash_merge_commit_title = self._makeStringAttribute(attributes["squash_merge_commit_title"])
if "ssh_url" in attributes: # pragma no branch
self._ssh_url = self._makeStringAttribute(attributes["ssh_url"])
if "stargazers_count" in attributes: # pragma no branch
@@ -4120,9 +4236,13 @@ class Repository(github.GithubObject.CompletableGithubObject):
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
if "url" in attributes: # pragma no branch
self._url = self._makeStringAttribute(attributes["url"])
if "use_squash_pr_title_as_default" in attributes: # pragma no branch
self._use_squash_pr_title_as_default = self._makeBoolAttribute(attributes["use_squash_pr_title_as_default"])
if "visibility" in attributes: # pragma no branch
self._visibility = self._makeStringAttribute(attributes["visibility"])
if "watchers" in attributes: # pragma no branch
self._watchers = self._makeIntAttribute(attributes["watchers"])
if "watchers_count" in attributes: # pragma no branch
self._watchers_count = self._makeIntAttribute(attributes["watchers_count"])
if "web_commit_signoff_required" in attributes: # pragma no branch
self._web_commit_signoff_required = self._makeBoolAttribute(attributes["web_commit_signoff_required"])