github-api icon indicating copy to clipboard operation
github-api copied to clipboard

GHInvitation getId always returns 0

Open noah-lawrence opened this issue 2 years ago • 1 comments

Describe the bug GHInvitation getId returns 'id' from GHObject, which defaults to 0. However, the correct invitation id is available in the private 'id' field on GHInvitation.

To Reproduce

  1. Create a GitHub repository
  2. Add a collaborator (an invitation will be sent)
  3. Run below code:
ghRepository.listInvitations().forEach(invitation -> System.out.println(invitation.getId()));
  1. 0 is printed for each invitation, rather than the invitation id.

Expected behavior The correct invitation id is printed, instead of 0.

Additional context I would like to be able to delete a GitHub invitation as an account owner of a repository. GitHub's API has this endpoint to delete an invitation manually, but the invitation id is required.

noah-lawrence avatar Jan 10 '23 16:01 noah-lawrence

@bitwiseman I'd be happy to contribute a solution to this. Would you be able to invite me to hub4j-test-org organization please?

noah-lawrence avatar Jan 31 '23 20:01 noah-lawrence