import cn.reghao.tnb.oss.sdk.model.OssConsoleConfig;
import cn.reghao.tnb.oss.sdk.OssConsoleClient;
import cn.reghao.tnb.oss.api.dto.media.VideoInfo;
import cn.reghao.tnb.oss.api.rest.UploadFileRet;

import java.io.*;

/**
 * @author reghao
 * @date 2023-06-02 16:19:04
 */
public class OssConsoleClientTest {
    public static void main(String[] args) throws Exception {
        String consoleUrl = "http://file.reghao.cn";
        String accessKeyId = "mDM6n1Hl";
        String accessKeySecret = "mTAzPhSS80gd0Iv2Fb";
        OssConsoleConfig ossConsoleConfig = new OssConsoleConfig(consoleUrl, accessKeyId, accessKeySecret);
        OssConsoleClient ossConsoleClient = new OssConsoleClient(ossConsoleConfig);

        String filePath = "/home/reghao/Downloads/夏天的较量又要开始啦#换装.mp4";
        File file = new File(filePath);
        int channelCode = 101;
        UploadFileRet uploadFileRet1 = ossConsoleClient.postObject(file, channelCode);
//        UploadFileRet uploadFileRet = ossConsoleClient.putObject(file, channelCode);
        //UploadFileRet uploadFileRet2 = ossConsoleClient.postObjectByMultiparts(file, channelCode);

//        String objectName = "video/playback/28d0fd95e224499c9f2cf1d98b4551a5.flv";
//        String localPath  = ossConsoleClient.getObject(objectName);

//        String sha256sum = "1234567890";
//        boolean exist = ossConsoleClient.headObject(sha256sum);

        VideoInfo videoInfo = ossConsoleClient.getVideoInfo(channelCode, uploadFileRet1.getUploadId());

        channelCode = 102;
        String objectId = uploadFileRet1.getUploadId();
        int loginUser = 2;
        //ImageInfo imageInfo = ossConsoleClient.getImageInfo(channelCode, objectId);
        System.out.println();
    }
}
