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

com.baidu.haotianjing.sdk.device.DeviceAnalyzeClient Maven / Gradle / Ivy

package com.baidu.haotianjing.sdk.device;

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.device.model.DeviceAnalyzeRequest;
import com.baidu.haotianjing.sdk.device.model.DeviceAnalyzeResponse;
import com.baidu.haotianjing.sdk.device.resolver.DeviceAnalyzeEndpointResolver;

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

public class DeviceAnalyzeClient {

    private final Client client;

    private final EndpointResolver endpointResolver;

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

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

    public DeviceAnalyzeResponse analyze(DeviceAnalyzeRequest deviceAnalyzeRequest) {
        return client.execute(deviceAnalyzeRequest);
    }

    public Client getClient() {
        return client;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy