Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update allowed values for Repository collaborator permissions #1996

Merged
merged 5 commits into from
Dec 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions github/Repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -1036,11 +1036,13 @@ def web_commit_signoff_required(self) -> bool:

def add_to_collaborators(self, collaborator: str | NamedUser, permission: Opt[str] = NotSet) -> Invitation | None:
"""
:calls: `PUT /repos/{owner}/{repo}/collaborators/{user} <https://docs.github.com/en/rest/reference/repos#collaborators>`_
:param permission: string 'pull', 'push' or 'admin'
:calls: `PUT /repos/{owner}/{repo}/collaborators/{user} <https://docs.github.com/en/rest/collaborators/collaborators#add-a-repository-collaborator>`_
:param collaborator: string or :class:`github.NamedUser.NamedUser`
:param permission: string 'pull', 'push', 'admin', 'maintain', or 'triage'
:rtype: None
"""
assert isinstance(collaborator, github.NamedUser.NamedUser) or isinstance(collaborator, str), collaborator
assert is_optional(permission, str), permission
assert permission in ["pull", "push", "admin", "maintain", "triage", NotSet], permission

if isinstance(collaborator, github.NamedUser.NamedUser):
collaborator = collaborator._identity
Expand Down