RestClient { public Resource listPublicResources(final ResourcesArgs args) throws IOException, ServerIOException { final Resource resource = cloudApi.listPublicResources(args.getPublicKey(), args.getPath(), args.getFields(), args.getLimit(), args.getOffset(), args.getSort(), args.getPreviewSize(), args.getPreviewCrop()); if (args.getParsingHandler() != null) { parseListResponse(resource, args.getParsingHandler()); } return resource; } RestClient(final Credentials credentials);  RestClient(final Credentials credentials, final OkHttpClient client);  RestClient(final Credentials credentials, final OkHttpClient client, final String serverUrl); ApiVersion getApiVersion(); Operation getOperation(final String operationId); Operation getOperation(final Link link); Operation waitProgress(final Link link, final Runnable waiting); DiskInfo getDiskInfo(); DiskInfo getDiskInfo(final String fields); Resource getResources(final ResourcesArgs args); ResourceList getFlatResourceList(final ResourcesArgs args); ResourceList getLastUploadedResources(final ResourcesArgs args); Resource patchResource(final ResourcesArgs args); Resource listPublicResources(final ResourcesArgs args); Resource getTrashResources(final ResourcesArgs args); Link deleteFromTrash(final String path); Link restoreFromTrash(final String path, final String name, final Boolean overwrite); void downloadFile(final String path, final File saveTo, final ProgressListener progressListener); void downloadFile(final String path, final DownloadListener downloadListener); Link saveFromUrl(final String url, final String serverPath); Link getUploadLink(final String serverPath, final boolean overwrite); void uploadFile(final Link link, final boolean resumeUpload, final File localSource,
                           final ProgressListener progressListener); Link delete(final String path, final boolean permanently); Link makeFolder(final String path); Link copy(final String from, final String path, final boolean overwrite); Link move(final String from, final String path, final boolean overwrite); Link publish(final String path); Link unpublish(final String path); void downloadPublicResource(final String publicKey, final String path, final File saveTo,
                                       final ProgressListener progressListener); Link savePublicResource(final String publicKey, final String path, final String name);  }
@Test public void testListPublicResources() throws Exception { String path = "/0-test/list-public-resources-test"; try { client.delete(path, true); } catch (ServerIOException ex) { ex.printStackTrace(); } try { client.makeFolder(path); } catch (ServerIOException ex) { ex.printStackTrace(); } for (int i = 1; i < 6; i++) { try { client.makeFolder(path + "/folder-" + i); } catch (ServerIOException ex) { ex.printStackTrace(); } } Link link = client.publish(path); logger.info("link: " + link); try { final String[] publicKey = new String[1]; client.getResources(new ResourcesArgs.Builder() .setPath(path) .setParsingHandler(new ResourcesHandler() { @Override public void handleSelf(Resource item) { publicKey[0] = item.getPublicKey(); } }) .build()); logger.info("publicKey: " + publicKey[0]); client.listPublicResources(new ResourcesArgs.Builder() .setPublicKey(publicKey[0]) .setParsingHandler(new ResourcesHandler() { final List<Resource> items = new ArrayList<>(); @Override public void handleItem(Resource item) { items.add(item); logger.info("item: " + item); } @Override public void onFinished(int itemsOnPage) { assertThat(items, hasSize(itemsOnPage)); assertThat(items.get(0).getName(), not(isEmptyOrNullString())); } }) .build()); } finally { try { client.unpublish(path); } catch (ServerIOException ex) { ex.printStackTrace(); } client.delete(path, true); } }