package com.elab.spring.callback;

import org.springframework.http.HttpHeaders;

/**
 * http请求失败回调
 *
 * @author ： liukx
 * @time ： 2020/6/17 - 13:57
 */
public interface IRestFallback<T> {
    /**
     * post异常执行请求
     *
     * @param url         请求URL
     * @param httpHeaders 请求头
     * @param reqParam    请求参数
     * @param clazz       转换接口
     * @param e           异常类型
     * @return
     */
    T post(String url, HttpHeaders httpHeaders, Object reqParam, Class clazz, Exception e);

    /**
     * GET 异常执行请求
     *
     * @param url
     * @param clazz
     * @param e
     * @return
     */
    T get(String url, Class clazz, Exception e);

    /**
     * 请求之前触发
     *
     * @param url
     * @throws Exception
     */
    void requestBefore(String url, HttpHeaders httpHeaders, Object reqParam, Class clazz) throws Exception;

    /**
     * 请求之后触发
     *
     * @param url
     * @throws Exception
     */
    void requestAfter(String url, HttpHeaders httpHeaders, Object reqParam, Class clazz) throws Exception;
}
