package com.heyu.api.alibaba.handle.facebody;


import com.aliyun.facebody20191230.models.RecognizeExpressionRequest;
import com.aliyun.facebody20191230.models.RecognizeExpressionResponse;
import com.aliyun.teautil.models.RuntimeOptions;
import com.heyu.api.data.annotation.CustomPath;
import com.heyu.api.alibaba.AlibabaBaseHandle;
import com.heyu.api.alibaba.request.facebody.ARecognizeExpressionRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * https://next.api.aliyun.com/api/facebody/2019-12-30/RecognizeExpression
 * <p>
 * 表情识别
 * <p>
 * RecognizeExpression
 */
@Component
@Slf4j
@CustomPath("expression")
public class ARecognizeExpressionHandle extends AlibabaBaseHandle<ARecognizeExpressionRequest, RecognizeExpressionResponse> {

    @Autowired
    private com.aliyun.facebody20191230.Client client;

    @Override
    public String check(ARecognizeExpressionRequest aRecognizeExpressionRequest) {
        return checkUrlBase64(aRecognizeExpressionRequest);
    }




    @Override
    public RecognizeExpressionResponse run(ARecognizeExpressionRequest aRecognizeExpressionRequest, RuntimeOptions runtime) throws Exception {
        RecognizeExpressionRequest recognizeExpressionRequest = new RecognizeExpressionRequest();
        recognizeExpressionRequest.setImageURL(aRecognizeExpressionRequest.getImageUrl());
        // 复制代码运行请自行打印 API 的返回值
        return client.recognizeExpressionWithOptions(recognizeExpressionRequest, runtime);
    }
}
