com.cloudconvert.resource.params.converter.IncludesToNameValuePairsConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cloudconvert-java Show documentation
Show all versions of cloudconvert-java Show documentation
CloudConvert is an online file converter API - more than 200 different audio, video, document, ebook, archive, image, spreadsheet and presentation formats supported.
package com.cloudconvert.resource.params.converter;
import com.cloudconvert.resource.params.Include;
import com.google.common.collect.ImmutableList;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class IncludesToNameValuePairsConverter implements Converter, List> {
private static final String PARAMETER_INCLUDE = "include";
@Override
public List convert(@NotNull final List includes) {
return includes.stream().map(Include::getLabel).reduce((include1, include2) -> include1 + "," + include2)
.map(includesAsString -> new BasicNameValuePair(PARAMETER_INCLUDE, includesAsString)).map(ImmutableList::of).orElse(ImmutableList.of());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy