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

org.aarboard.nextcloud.api.utils.NextcloudSearch Maven / Gradle / Ivy

The newest version!
package org.aarboard.nextcloud.api.utils;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

import java.util.LinkedList;
import java.util.List;

public class NextcloudSearch {
    private final String search;
    private final int limit;
    private final int offset;

    public NextcloudSearch(String search, int limit, int offset) {
        this.search = search;
        this.limit = limit;
        this.offset = offset;
    }

    public List asQueryParameters() {
        List result = new LinkedList<>();

        if (limit != -1) {
            result.add(new BasicNameValuePair("limit", Integer.toString(limit)));
        }

        if (offset != -1) {
            result.add(new BasicNameValuePair("offset", Integer.toString(offset)));
        }

        if (search != null) {
            result.add(new BasicNameValuePair("search", search));
        }

        return result;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy