package cn.hztech.sdk.api;

import cn.hztech.sdk.client.SdkHttpClient;
import cn.hztech.sdk.model.PageResult;
import cn.hztech.sdk.model.entity.ApiMetadata;
import cn.hztech.sdk.model.request.GateWayRequest;
import com.fasterxml.jackson.core.type.TypeReference;
import lombok.extern.slf4j.Slf4j;

import java.util.Map;

/**
 * 网关API
 *
 */
@Slf4j
public class GateWayApiClient {

    private static final String API_PREFIX = "/gateway/call";

    private final SdkHttpClient httpClient;

    public GateWayApiClient(SdkHttpClient httpClient) {
        this.httpClient = httpClient;
    }
    public Map<String,Object> callApp(GateWayRequest request){
        log.info("创建接口元数据, request: {}", request);
        return httpClient.post(API_PREFIX , request, new TypeReference<Map<String,Object>>() {});
    }
}
