mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 03:41:08 +00:00
Add support for 'visibility' attribute preview for Repositories (#1872)
Expose the new 'visibility' attribute for repository objects. Fixes #1446
This commit is contained in:
+14
-2
@@ -463,6 +463,7 @@ class Organization(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_wiki=github.GithubObject.NotSet,
|
||||
has_downloads=github.GithubObject.NotSet,
|
||||
@@ -506,6 +507,9 @@ class Organization(github.GithubObject.CompletableGithubObject):
|
||||
assert private is github.GithubObject.NotSet or isinstance(
|
||||
private, bool
|
||||
), private
|
||||
assert visibility is github.GithubObject.NotSet or isinstance(
|
||||
visibility, str
|
||||
), visibility
|
||||
assert has_issues is github.GithubObject.NotSet or isinstance(
|
||||
has_issues, bool
|
||||
), has_issues
|
||||
@@ -551,6 +555,8 @@ class Organization(github.GithubObject.CompletableGithubObject):
|
||||
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_wiki is not github.GithubObject.NotSet:
|
||||
@@ -576,7 +582,10 @@ class Organization(github.GithubObject.CompletableGithubObject):
|
||||
if delete_branch_on_merge is not github.GithubObject.NotSet:
|
||||
post_parameters["delete_branch_on_merge"] = delete_branch_on_merge
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"POST", f"{self.url}/repos", input=post_parameters
|
||||
"POST",
|
||||
f"{self.url}/repos",
|
||||
input=post_parameters,
|
||||
headers={"Accept": Consts.repoVisibilityPreview},
|
||||
)
|
||||
return github.Repository.Repository(
|
||||
self._requester, headers, data, completed=True
|
||||
@@ -987,7 +996,9 @@ class Organization(github.GithubObject.CompletableGithubObject):
|
||||
"""
|
||||
assert isinstance(name, str), name
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"GET", f"/repos/{self.login}/{name}"
|
||||
"GET",
|
||||
f"/repos/{self.login}/{name}",
|
||||
headers={"Accept": Consts.repoVisibilityPreview},
|
||||
)
|
||||
return github.Repository.Repository(
|
||||
self._requester, headers, data, completed=True
|
||||
@@ -1024,6 +1035,7 @@ class Organization(github.GithubObject.CompletableGithubObject):
|
||||
self._requester,
|
||||
f"{self.url}/repos",
|
||||
url_parameters,
|
||||
headers={"Accept": Consts.repoVisibilityPreview},
|
||||
)
|
||||
|
||||
def get_team(self, id):
|
||||
|
||||
Reference in New Issue
Block a user