/** * Copies the {@code source} item to given {@code target} with {@code newName}. * * @param source the source path to be copied * @param target the target path, should be a container (project or folder) * @param newName the new name of the copied item * @param overwrite overwrite target is such has already exists * @return {@link Promise} with empty response * @see Path * @since 4.4.0 */ public Promise<Void> copy(Path source, Path target, String newName, boolean overwrite) { final String url = getBaseUrl() + COPY + encodePath(source) + "?to=" + encodePath(target); final CopyOptions copyOptions = dtoFactory.createDto(CopyOptions.class); copyOptions.setName(newName); copyOptions.setOverWrite(overwrite); return reqFactory .createPostRequest(url, copyOptions) .loader(loaderFactory.newLoader("Copying...")) .send(); }