All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.cloudconvert.resource.params.converter.IncludesToNameValuePairsConverter Maven / Gradle / Ivy

Go to download

CloudConvert is an online file converter API - more than 200 different audio, video, document, ebook, archive, image, spreadsheet and presentation formats supported.

There is a newer version: 1.2.1
Show newest version
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