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

fr.ouestfrance.querydsl.postgrest.PostgrestClient Maven / Gradle / Ivy

package fr.ouestfrance.querydsl.postgrest;

import fr.ouestfrance.querydsl.postgrest.model.BulkResponse;
import fr.ouestfrance.querydsl.postgrest.model.CountItem;
import fr.ouestfrance.querydsl.postgrest.model.RangeResponse;

import java.util.List;
import java.util.Map;

/**
 * Rest interface for querying postgrest
 */
public interface PostgrestClient {
    /**
     * Search method
     *
     * @param resource resource name
     * @param params   query params
     * @param       return type
     * @param headers  header params
     * @param clazz    type of return
     * @return ResponseEntity containing the results
     */

     RangeResponse search(String resource, Map> params,
                                Map> headers, Class clazz);

    /**
     * Save body
     *
     * @param resource resource name
     * @param value    data to save
     * @param headers  headers to pass
     * @param       return type
     * @param clazz    type of return
     * @return list of inserted objects
     */
     BulkResponse post(String resource, Map> queryParams, List value, Map> headers, Class clazz);

    /**
     * Patch data
     *
     * @param resource resource name
     * @param params   criteria to apply on patch
     * @param value    object to patch
     * @param headers  headers to pass
     * @param       return type
     * @param clazz    type of return
     * @return list of patched objects
     */
     BulkResponse patch(String resource, Map> params, Object value, Map> headers, Class clazz);

    /**
     * Delete data
     *
     * @param resource resource name
     * @param params   query params
     * @param headers  headers to pass
     * @param       return type
     * @param clazz    type of return
     * @return list of deleted objects
     */
     BulkResponse delete(String resource, Map> params, Map> headers, Class clazz);

    /**
     * Count data
     *
     * @param resource resource name
     * @param map      query params
     * @return list of count items
     */
    List count(String resource, Map> map);
}