/** * Get contents at path in the given repository on master branch * * @param repository * @param path * @return list of contents at path * @throws IOException */ public List<RepositoryContents> getContents( IRepositoryIdProvider repository, String path) throws IOException { return getContents(repository, path, null); }
/** * Get repository README * * @param repository * @return README * @throws Exception */ public RepositoryContents getReadme(IRepositoryIdProvider repository) throws Exception { return getReadme(repository, null); }
/** * Get repository README * * @param repository * @param ref * @return README * @throws IOException */ public RepositoryContents getReadme(IRepositoryIdProvider repository, String ref) throws IOException { String id = getId(repository); StringBuilder uri = new StringBuilder(SEGMENT_REPOS); uri.append('/').append(id); uri.append(SEGMENT_README); GitHubRequest request = createRequest(); request.setUri(uri); if (ref != null && ref.length() > 0) request.setParams(Collections.singletonMap("ref", ref)); request.setType(RepositoryContents.class); return (RepositoryContents) client.get(request).getBody(); }
IRepositoryIdProvider repository, String path, String ref) throws IOException { String id = getId(repository); uri.append(path); GitHubRequest request = createRequest(); request.setUri(uri); request.setType(RepositoryContents.class);
/** * Get contents at the root of the given repository on master branch * * @param repository * @return list of contents at root * @throws IOException */ public List<RepositoryContents> getContents(IRepositoryIdProvider repository) throws IOException { return getContents(repository, null); }