public void setConnectionValues(GitHub github, ConnectionValues values) { GitHubUserProfile profile = github.userOperations().getUserProfile(); values.setProviderUserId(String.valueOf(profile.getId())); values.setDisplayName(profile.getLogin()); values.setProfileUrl( "https://github.com/" + profile.getLogin()); // TODO: Expose and use HTML URL values.setImageUrl(profile.getAvatarUrl()); }
public UserProfile fetchUserProfile(GitHub github) { GitHubUserProfile profile = github.userOperations().getUserProfile(); return new UserProfileBuilder() .setName(profile.getName()) .setEmail(profile.getEmail()) .setUsername(profile.getLogin()) .build(); }
public boolean test(GitHub github) { try { github.userOperations().getUserProfile(); return true; } catch (HttpClientErrorException e) { // TODO : Beef up GitHub's error handling and trigger off of a more specific exception return false; } }