import { RequestBodyType } from './enums/RequestBodyType'
import { IHttpResponse } from './utils/http/IHttpResponse'
import { HttpMethodType } from "./enums/HttpMethodType";

/**
 * 微服务客户端使用接口
 * traceId -> 客户端内部处理，从当前request的header获取，不可为空，如果当前request无值，那么客户端生成一个uuid填入本次调用的header
 * @author WuFenglin
 **/
export interface ServiceClient {

    /**
     * 微服务调用
     * @return 成功调用微服务后，返回json转换后业务对象
     * @throws Exception 调用失败后抛出异常
     */
    call<T = any, R = IHttpResponse<T>>(httpMethod: HttpMethodType, header: object, params: object, bodyObj: object, bodyType: RequestBodyType): Promise<R>;

    get<T = any, R = IHttpResponse<T>>(header: object, params: object): Promise<R>;

    upload<T = any, R = IHttpResponse<T>>(header: object, params: object, formData: FormData): Promise<R>;

}