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

Change GHRepository getIssue and getPullRequest to not mentiond ID and make it clear it is number #2033

Open
rnveach opened this issue Feb 15, 2025 · 1 comment · May be fixed by #2034
Open

Comments

@rnveach
Copy link
Contributor

rnveach commented Feb 15, 2025

GHRepository#getIssue takes id as an int. Same with getPullRequest.

public GHIssue getIssue(int id) throws IOException {

public GHPullRequest getPullRequest(int i) throws IOException {

GHIssue and GHPullRequest which extend GHObject returns a long for an id.

To call either, with the original object requires you to downcast.

			if (issue) {
				final GHIssue issue = repository.getIssue((int) item.getId());
			} else {
				final GHPullRequest pullRequest = repository.getPullRequest((int) item.getId());
			}

It seems to me both should be updated to be a long to make everything consistent and not require down casting.

@rnveach rnveach changed the title Change GHRepository getIssue and getPullRequest to support GHObject long id Change GHRepository getIssue and getPullRequest to not mentiond ID and make it clear it is number Feb 17, 2025
@rnveach
Copy link
Contributor Author

rnveach commented Feb 17, 2025

After actually trying to use the methods, I realize I was in error on how they should be used.

I thought they were asking for the ID, but they actually want the numbers. I am not sure if this was from reading the code, which some parts do say ID or I (which I thought was short for ID), or from asking AI to explain how to do things. But after failing to use them with ID and looking at the underlying code a bit more, I understand now these are numbers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant