All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.com.antcloud.api.product.AntCloudProdClient Maven / Gradle / Ivy

Go to download

Ant Fin Tech API SDK For Java Copyright (c) 2015-present Alipay.com, https://www.alipay.com

The newest version!
/*
 * Copyright (c) 2015-present Alipay.com, https://www.alipay.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package cn.com.antcloud.api.product;

import cn.com.antcloud.api.acapi.AntCloudHttpClient;
import cn.com.antcloud.api.common.BaseGwClient;

import java.util.Map;

/**
 * 返泛化请求client
 */
public class AntCloudProdClient extends
                                BaseGwClient {

    /**
     * 构造函数
     * @param endpoint
     * @param accessKey
     * @param accessSecret
     * @param checkSign
     * @param enableAutoRetry
     * @param autoRetryLimit
     * @param client
     * @param securityToken
     * @param clientId
     */
    private AntCloudProdClient(String endpoint, String accessKey, String accessSecret,
                               boolean checkSign, boolean enableAutoRetry, int autoRetryLimit,
                               AntCloudHttpClient client, String securityToken, String clientId) {
        super(endpoint, accessKey, accessSecret, checkSign, enableAutoRetry, autoRetryLimit,
            client, securityToken, clientId);
    }

    /**
     * builder
     * @return
     */
    public static Builder newBuilder() {
        return new Builder();
    }

    /**
     * 执行类
     * @param request
     * @return
     * @throws Exception
     */
    @Override
    public AntCloudProdClientResponse execute(AntCloudProdClientRequest request) throws Exception {
        return super.execute(request);
    }

    /**
     * 实际执行类
     * @param request
     * @param 
     * @return
     * @throws Exception
     */
    public  T execute(AntCloudProdRequest request) throws Exception {
        return execute(request, null);
    }
        public  T execute(AntCloudProdRequest request, Map headers) throws Exception {
        AntCloudProdClientRequest clientRequest = new AntCloudProdClientRequest();
        clientRequest.putParametersFromObject(request);

        if(headers != null) {
            clientRequest.getHeadersParameters().putAll(headers);
        }

        AntCloudProdClientResponse clientResponse = execute(clientRequest);

        T response = clientResponse.getData(request.responseClass());
        response.setResultCode(clientResponse.getResultCode());
        response.setResultMsg(clientResponse.getResultMsg());
        response.setReqMsgId(clientResponse.getReqMsgId());

        return response;
    }

    /**
     * Builder
     */
    public static class Builder extends BaseGwClient.Builder {
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy