public UserMinerV3(final IGitHubClient ghc) { super(); service = new UserService(ghc); }
public User getUser(final String login) { User user = null; try { user = service.getUser(login); } catch (IOException e) { log.error("IOException in getting user {} {}", login, e); } catch (NullPointerException npe) { log.error("NullPointerException in getting user {}", login, npe); } return user; }
/** * Check if the currently authenticated user is following the given user * * @param user * @return true if following, false if not following * @throws IOException */ public boolean isFollowing(final String user) throws IOException { if (user == null) throw new IllegalArgumentException("User cannot be null"); //$NON-NLS-1$ if (user.length() == 0) throw new IllegalArgumentException("User cannot be empty"); //$NON-NLS-1$ StringBuilder uri = new StringBuilder(SEGMENT_USER + SEGMENT_FOLLOWING); uri.append('/').append(user); return check(uri.toString()); }
/** * Page followers of the currently authenticated user * * @param start * @param size * @return page iterator */ public PageIterator<User> pageFollowers(final int start, final int size) { PagedRequest<User> request = createFollowersRequest(start, size, null); return createPageIterator(request); }
/** * Page users being followed by the currently authenticated user * * @param start * @param size * @return page iterator */ public PageIterator<User> pageFollowing(final int start, final int size) { PagedRequest<User> request = createFollowingRequest(start, size, null); return createPageIterator(request); }
@Override public AccountInfo getAccountInfo(String hostUrl, String accountName) { UserService userService = new UserService(githubClientProvider.createClient(hostUrl)); try { userService.getUser(accountName); return new AccountInfo(GithubCommunicator.GITHUB); } catch (RequestException e) { log.debug("Unable to retrieve account information. hostUrl: {}, account: {} " + e.getMessage(), hostUrl, accountName); // GitHub Enterprise returns a 403 status for unauthorized requests. if (e.getStatus() == 403) { return new AccountInfo(GithubCommunicator.GITHUB); } } catch (IOException e) { log.debug("Unable to retrieve account information. hostUrl: {}, account: {} " + e.getMessage(), hostUrl, accountName); } return null; }
UserService userService = new UserService(service.getClient()); User user = userService.getUser(); author.setEmail(userService.getEmails().get(0)); author.setDate(new GregorianCalendar().getTime());
public User getUser() throws IOException { org.eclipse.egit.github.core.service.UserService service = new org.eclipse.egit.github.core.service.UserService(); service.getClient().setOAuth2Token(getAccessToken().getToken()); org.eclipse.egit.github.core.User eGitUser = service.getUser(); User user = new User(); user.setName(eGitUser.getName()); user.setLogin(eGitUser.getLogin()); user.setAvatarUrl(eGitUser.getAvatarUrl()); user.setFollowers(String.valueOf(eGitUser.getFollowers())); return user; } }
UserService userService = new UserService(client); User user = userService.getUser(); String userLogin = user.getLogin();
UserService userService = new UserService(service.getClient()); User user = userService.getUser(); author.setEmail(userService.getEmails().get(0)); author.setDate(new GregorianCalendar().getTime());
/** * Page followers of the given user * * @param start * @param size * @param user * @return page iterator */ public PageIterator<User> pageFollowers(final String user, final int start, final int size) { if (user == null) throw new IllegalArgumentException("User cannot be null"); //$NON-NLS-1$ if (user.length() == 0) throw new IllegalArgumentException("User cannot be empty"); //$NON-NLS-1$ PagedRequest<User> request = createFollowersRequest(start, size, user); return createPageIterator(request); }
/** * Page users being followed by the given user * * @param user * @param start * @param size * @return page iterator */ public PageIterator<User> pageFollowing(final String user, final int start, final int size) { if (user == null) throw new IllegalArgumentException("User cannot be null"); //$NON-NLS-1$ if (user.length() == 0) throw new IllegalArgumentException("User cannot be empty"); //$NON-NLS-1$ PagedRequest<User> request = createFollowingRequest(start, size, user); return createPageIterator(request); }
UserService userService = new UserService(client); User user = userService.getUser(); GitHubOrganization gho = new GitHubOrganization(); gho.setUserOrg(true);