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

Add API to retrieve list of contributors #147

Closed
vbauer opened this issue Jan 20, 2015 · 1 comment
Closed

Add API to retrieve list of contributors #147

vbauer opened this issue Jan 20, 2015 · 1 comment

Comments

@vbauer
Copy link

vbauer commented Jan 20, 2015

Now, I'm using the following workaround:

java

    public GHUser[] getContributors(final GHRepository repository) throws Exception {
        final Field field = GHRepository.class.getDeclaredField("root");
        field.setAccessible(true);
        final GitHub gitHub = (GitHub) field.get(repository);

        final GHUser owner = repository.getOwner();
        final String login = owner.getLogin();
        final String name = repository.getName();

        final Method retrieveMethod = GitHub.class.getDeclaredMethod("retrieve");
        retrieveMethod.setAccessible(true);
        final Object request = retrieveMethod.invoke(gitHub);

        final Method toMethod = request.getClass().getDeclaredMethod("to", String.class, Class.class);
        toMethod.setAccessible(true);
        return (GHUser[]) toMethod.invoke(request, "/repos/" + login + "/" + name + "/contributors", GHUser[].class);
    }
@kohsuke
Copy link
Collaborator

kohsuke commented Feb 15, 2015

Implemented toward 1.62.

@kohsuke kohsuke closed this as completed Feb 15, 2015
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

No branches or pull requests

2 participants