XClient.java 1.18 KB
package com.xiniunet.open.api.client;

import com.xiniunet.open.api.client.contract.SessionEnum;

/**


 */
public interface XClient {
    /**
     * 执行API公开的请求
     *
     * @param request   请求对象
     * @param <T>       请求泛型
     * @return  响应对象
     * @throws ApiException 调用过程中出现的API异常
     */
    <T extends XResponse> T execute(XRequest<T> request) throws ApiException;

    /**
     * 执行API隐私的请求
     *
     * @param request   请求对象
     * @param session   会话参数
     * @param <T>       请求泛型
     * @return  响应对象
     * @throws ApiException 调用过程中出现的API异常
     */
    @Deprecated
    <T extends XResponse> T execute(XRequest<T> request, String session) throws ApiException;

    /**
     * 执行API隐私的请求
     *
     * @param request   请求对象
     * @param type      会话参数
     * @param sessionId 会话参数
     * @param <T>       请求泛型
     * @return  响应对象
     * @throws ApiException 调用过程中出现的API异常
     */
    <T extends XResponse> T execute(XRequest<T> request, SessionEnum type, String sessionId) throws ApiException;
}