com.cloudconvert.resource.params.converter.PaginationToNameValuePairsConverter 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.Pagination;
import com.google.common.collect.ImmutableList;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.jetbrains.annotations.Nullable;
import java.util.List;
import java.util.Optional;
public class PaginationToNameValuePairsConverter implements Converter> {
private static final String PARAMETER_PER_PAGE = "per_page";
private static final String PARAMETER_PAGE = "page";
@Override
public List convert(@Nullable final Pagination pagination) {
return Optional.ofNullable(pagination)
.map(paginationNotNull -> ImmutableList.of(
new BasicNameValuePair(PARAMETER_PER_PAGE, String.valueOf(paginationNotNull.getPerPage())),
new BasicNameValuePair(PARAMETER_PAGE, String.valueOf(paginationNotNull.getPage()))
)).orElse(ImmutableList.of());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy