mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-01 03:11:09 +00:00
Implement organization.cancel_invitation() (#2072)
Implement a new function cancel_invitation for github.Organization objects, allowing for cancellation of organization invitations.
This commit is contained in:
@@ -1111,6 +1111,18 @@ class Organization(github.GithubObject.CompletableGithubObject):
|
||||
input=parameters,
|
||||
)
|
||||
|
||||
def cancel_invitation(self, invitee):
|
||||
"""
|
||||
:calls: `DELETE /orgs/{org}/invitations/{invitation_id} <https://docs.github.com/en/rest/reference/orgs#cancel-an-organization-invitation>`_
|
||||
:param invitee: :class:`github.NamedUser.NamedUser`
|
||||
:rtype: None
|
||||
"""
|
||||
assert isinstance(invitee, github.NamedUser.NamedUser), invitee
|
||||
status, headers, data = self._requester.requestJson(
|
||||
"DELETE", f"{self.url}/invitations/{invitee.id}"
|
||||
)
|
||||
return status == 204
|
||||
|
||||
def has_in_members(self, member):
|
||||
"""
|
||||
:calls: `GET /orgs/{org}/members/{user} <https://docs.github.com/en/rest/reference/orgs#members>`_
|
||||
|
||||
@@ -178,6 +178,7 @@ class Organization(CompletableGithubObject):
|
||||
role: Union[str, _NotSetType] = ...,
|
||||
teams: Union[List[Team], _NotSetType] = ...,
|
||||
) -> None: ...
|
||||
def cancel_invitation(self, invitee: NamedUser) -> bool: ...
|
||||
@property
|
||||
def location(self) -> str: ...
|
||||
@property
|
||||
|
||||
Reference in New Issue
Block a user