コード例 #1
0
 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());
 }
コード例 #2
0
 public UserProfile fetchUserProfile(GitHub github) {
   GitHubUserProfile profile = github.userOperations().getUserProfile();
   return new UserProfileBuilder()
       .setName(profile.getName())
       .setEmail(profile.getEmail())
       .setUsername(profile.getLogin())
       .build();
 }
コード例 #3
0
 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;
   }
 }