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

com.baidu.haotianjing.sdk.risk.RiskAnalyzeClient Maven / Gradle / Ivy

The newest version!
package com.baidu.haotianjing.sdk.risk;

import com.baidu.haotianjing.core.client.Client;
import com.baidu.haotianjing.core.client.ClientProfile;
import com.baidu.haotianjing.core.client.DefaultClient;
import com.baidu.haotianjing.core.endpoint.EndpointResolver;
import com.baidu.haotianjing.core.utils.AssertUtils;
import com.baidu.haotianjing.sdk.risk.model.RiskAnalyzeRequest;
import com.baidu.haotianjing.sdk.risk.model.RiskAnalyzeResponse;
import com.baidu.haotianjing.sdk.risk.resolver.RiskAnalyzeEndpointResolver;

import static com.baidu.haotianjing.sdk.constants.RiskSdkConstants.BEIJING;
import static com.baidu.haotianjing.sdk.constants.RiskSdkConstants.RISK;

public class RiskAnalyzeClient {

    private final Client client;

    private final EndpointResolver endpointResolver;

    public RiskAnalyzeClient(String accountId, String appkey, String seckey) {
        ClientProfile clientProfile = ClientProfile.defaultProfile(accountId, appkey, seckey);
        clientProfile.serviceCode(RISK);
        clientProfile.setRegionCodes(BEIJING);
        this.client = new DefaultClient(clientProfile);
        this.endpointResolver = new RiskAnalyzeEndpointResolver(clientProfile, client);
    }

    public RiskAnalyzeClient(ClientProfile clientProfile) {
        AssertUtils.notNull(clientProfile, "client profile should not be null");
        clientProfile.serviceCode(RISK);
        this.client = new DefaultClient(clientProfile);
        this.endpointResolver = new RiskAnalyzeEndpointResolver(clientProfile, client);
    }

    public RiskAnalyzeResponse analyze(RiskAnalyzeRequest riskAnalyzeRequest) {
        return client.execute(riskAnalyzeRequest);
    }

    public Client getClient() {
        return client;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy