/** * Get organizations that the currently authenticated user is a member of * * @return list of organizations * @throws IOException */ public List<User> getOrganizations() throws IOException { PagedRequest<User> request = createOrgRequest(null, PAGE_FIRST, PAGE_SIZE); return getAll(request); }
/** * Get organizations that the given user is a member of * * @param user * @return list of organizations * @throws IOException */ public List<User> getOrganizations(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$ PagedRequest<User> request = createOrgRequest(user, PAGE_FIRST, PAGE_SIZE); return getAll(request); }
/** * Get public members of organization * * @param organization * @return list of public organization members * @throws IOException */ public List<User> getPublicMembers(String organization) throws IOException { if (organization == null) throw new IllegalArgumentException("Organization cannot be null"); //$NON-NLS-1$ if (organization.length() == 0) throw new IllegalArgumentException("Organization cannot be empty"); //$NON-NLS-1$ StringBuilder uri = new StringBuilder(SEGMENT_ORGS); uri.append('/').append(organization); uri.append(SEGMENT_PUBLIC_MEMBERS); PagedRequest<User> request = createPagedRequest(); request.setUri(uri); request.setType(new TypeToken<List<User>>() { }.getType()); return getAll(request); }
/** * Get members of organization * * @param organization * @return list of all organization members * @throws IOException */ public List<User> getMembers(String organization) throws IOException { if (organization == null) throw new IllegalArgumentException("Organization cannot be null"); //$NON-NLS-1$ if (organization.length() == 0) throw new IllegalArgumentException("Organization cannot be empty"); //$NON-NLS-1$ StringBuilder uri = new StringBuilder(SEGMENT_ORGS); uri.append('/').append(organization); uri.append(SEGMENT_MEMBERS); PagedRequest<User> request = createPagedRequest(); request.setUri(uri); request.setType(new TypeToken<List<User>>() { }.getType()); return getAll(request); }