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


import com.aliyun.imagerecog20190930.models.TaggingAdImageRequest;
import com.aliyun.imagerecog20190930.models.TaggingAdImageResponse;
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.imagerecog.ATaggingAdImageRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * https://next.api.aliyun.com/api/imagerecog/2019-09-30/TaggingAdImage?tab=DEMO&lang=JAVA
 * <p>
 * 广告素材分析 TaggingAdimage
 */
@Component
@Slf4j
@CustomPath("taggingAdImage")
public class ATaggingAdImageHandle extends AlibabaBaseHandle<ATaggingAdImageRequest, TaggingAdImageResponse> {

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

    @Override
    public String check(ATaggingAdImageRequest aTaggingAdImageRequest) {
        return checkUrlBase64(aTaggingAdImageRequest);
    }



    @Override
    public TaggingAdImageResponse run(ATaggingAdImageRequest aTaggingAdImageRequest, RuntimeOptions runtime) throws Exception {
        TaggingAdImageRequest taggingAdImageRequest = new TaggingAdImageRequest();
        taggingAdImageRequest.setImageURL(aTaggingAdImageRequest.getImageUrl());
        // 复制代码运行请自行打印 API 的返回值
        return client.taggingAdImageWithOptions(taggingAdImageRequest, runtime);
    }
}
