package com.yd.oss.feign.client;

import com.yd.common.result.Result;
import com.yd.oss.feign.fallback.ApiOssStsFeignFallbackFactory;
import com.yd.oss.feign.request.ApiBatchSaveFilesRequest;
import com.yd.oss.feign.response.ApiBatchSaveFilesResponse;
import com.yd.oss.feign.response.ApiGetStsTokenResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * OSS-分片服务信息Feign客户端
 */
@FeignClient(name = "yd-oss-api", fallbackFactory = ApiOssStsFeignFallbackFactory.class)
public interface ApiOssStsFeignClient {

    /**
     * 获取STS凭证
     * @param projectBizId
     * @return
     */
    @GetMapping("/sts-token")
    Result<ApiGetStsTokenResponse> getStsToken(@RequestParam(value = "projectBizId") String projectBizId);

    /**
     * 批量保存文件列表
     * @return
     */
    @PostMapping("/batch/save/files")
    Result<ApiBatchSaveFilesResponse> batchSaveFiles(@Validated @RequestBody ApiBatchSaveFilesRequest request);
}
