package com.tzy.common.utils.http.forest;

import com.dtflys.forest.annotation.*;
import com.dtflys.forest.http.ForestResponse;
import com.tzy.common.dto.IpAddrDTO;

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

/**
 * @author by po'yi
 * @Classname CommonForestClient
 * @Description 通用http请求
 * @Date 2021/12/1 15:57
 */
public interface CommonForestClient {

	@Get("{url}")
	String sendGet(@Var("url") String url);

	@Get("{url}")
	ForestResponse<IpAddrDTO> getIpAddr(@Var("url") String url);

	@Get(url="{url}")
	String sendGet(@Var("url") String url,@Header Map<String, Object> headerMap,@Body Object data);

	@Post(url="{url}")
	String sendPost(@Var("url") String url,@Header Map<String, Object> headerMap,@Body Object data);

	@Post(url="{url}")
	String sendJSONPost(@Var("url") String url, @Header Map<String, Object> headerMap, @JSONBody Object data);

	/**
	 * 开播短信通知
	 * @param url
	 * @param merchant 商户
	 * @param phones 手机号
	 * @return
	 */
	@Post(url="{url}",headers = {"Content-Type:application/json"})
	String sendSmsPost(@Var("url") String url,@Query("merchant") String merchant,@Body List<String> phones);


	@Put("{url}")
	String sendPut(@Var("url") String url,@Header Map<String, Object> headerMap,@Body Object data);

	@Delete
	String sendDel(@Var("url") String url);

	@Delete(url="{url}")
	String sendDel(@Var("url") String url, @Header Map<String, Object> headerMap, @JSONBody Object data);

	@Get(value = "{url}", connectTimeout = 1500, readTimeout = 1500)
	String sendGetSecond(@Var("url") String url);

	@Post(url="{url}", connectTimeout = 1500, readTimeout = 1500)
	String sendPostSecond(@Var("url") String url, @Header Map<String, Object> headerMap, @Body Object data);
}
