Commit 2e08099a by BetterXT

add file client and dto

parent 0b9ddf4e
package io.better.toutiao.api.util;
import io.better.toutiao.dto.BaseRespDTO;
import io.better.toutiao.dto.util.FileInfoInDTO;
import io.better.toutiao.dto.util.FileInfoOutDTO;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* The interface File manager api.
*
* @author better create in 2019-04-30 10:51
*/
@FeignClient(value = "https://ad.toutiao.com/open_api/2", url = "/file")
public interface FileManagerApi {
/**
* 工具-文件管理-上传广告主图片
*
* @param accessToken 访问凭证
* @param fileInfoOut 文件信息
* @return the base resp dto
*/
@PostMapping(value = "/image/advertiser")
BaseRespDTO<FileInfoInDTO> uploadAdvertiserImage(@RequestHeader("Access-Token") String accessToken,
@RequestBody FileInfoOutDTO fileInfoOut);
/**
* 工具-文件管理-上传广告图片
*
* @param accessToken 访问凭证
* @param fileInfoOut 文件信息
* @return the base resp dto
*/
@PostMapping(value = "/image/ad")
BaseRespDTO<FileInfoInDTO> uploadAdvertisingImage(@RequestHeader("Access-Token") String accessToken,
@RequestBody FileInfoOutDTO fileInfoOut);
/**
* 工具-文件管理-查询图片信息
*
* @param accessToken 访问凭证
* @param advertiserId 广告主ID
* @param imageIds 图片ID
* @return the image info
*/
@GetMapping(value = "/ad/get")
BaseRespDTO<FileInfoInDTO> getImageInfo(@RequestHeader("Access-Token") String accessToken,
@RequestParam("advertiser_id") Long advertiserId,
@RequestParam("image_ids") String[] imageIds);
/**
* 工具-文件管理-查询视频信息
*
* @param accessToken 访问凭证
* @param advertiserId 广告主ID
* @param videoIds 视频ID
* @return the video info
*/
@GetMapping(value = "/video/ad/get")
BaseRespDTO<FileInfoInDTO> getVideoInfo(@RequestHeader("Access-Token") String accessToken,
@RequestParam("advertiser_id") Long advertiserId,
@RequestParam("video_ids") String[] videoIds);
/**
* 工具-文件管理-获取图片素材
*
* @param accessToken 访问凭证
* @param advertiserId 广告中ID
* @param filtering 过滤条件
* @param page 当前页
* @param pageSize 每页记录数
* @return the image material info
*/
@GetMapping(value = "/image/get")
BaseRespDTO<FileInfoInDTO> getImageMaterialInfo(@RequestHeader("Access-Token") String accessToken,
@RequestParam("advertiser_id") Long advertiserId,
@RequestParam(value = "video_ids", required = false) Map<String, Object> filtering,
@RequestParam(value = "page", defaultValue = "1", required = false) Integer page,
@RequestParam(value = "page_size", defaultValue = "20", required = false) Integer pageSize);
/**
* 工具-文件管理-获取视频素材
*
* @param accessToken 访问凭证
* @param advertiserId 广告中ID
* @param filtering 过滤条件
* @param page 当前页
* @param pageSize 每页记录数
* @return the video material info
*/
@GetMapping(value = "/video/get")
BaseRespDTO<FileInfoInDTO> getVideoMaterialInfo(@RequestHeader("Access-Token") String accessToken,
@RequestParam("advertiser_id") Long advertiserId,
@RequestParam(value = "video_ids", required = false) Map<String, Object> filtering,
@RequestParam(value = "page", defaultValue = "1", required = false) Integer page,
@RequestParam(value = "page_size", defaultValue = "20", required = false) Integer pageSize);
}
package io.better.toutiao.dto.util;
import io.better.toutiao.dto.resp.PageRespDTO;
import lombok.Data;
/**
* @author better create in 2019-04-30 10:55
*/
@Data
public class FileInfoInDTO extends PageRespDTO {
// ==========图片信息 start==========
/**
* 图片ID
*/
private String id;
/**
* 图片大小
*/
private Long size;
/**
* 图片宽度
*/
private Integer width;
/**
* 图片高度
*/
private Integer height;
/**
* 预览地址(1小时内有效)
*/
private String url;
/**
* 图片格式
*/
private String format;
/**
* 图片md5
*/
private String signature;
// ==========图片信息 end============
// ==========视频信息 start==========
/**
* 视频ID
*/
private String videoId;
// ==========视频信息 end============
// ==========视频素材信息 start=======
/**
* 视频首帧截图
*/
private String posterUrl;
/**
* 码率
*/
private String bitRate;
/**
* 时长
*/
private Long duration;
// ==========视频素材信息 end=========
// ==========图片素材信息 start=======
// ==========图片素材信息 end=========
}
package io.better.toutiao.dto.util;
import io.better.toutiao.dto.BaseDTO;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.File;
/**
* @author better create in 2019-04-30 10:55
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class FileInfoOutDTO extends BaseDTO {
// ==========图片信息==========
/**
* 图片上传方式
* 默认值: UPLOAD_BY_FILE
* 允许值: "UPLOAD_BY_FILE", "UPLOAD_BY_URL"
*/
private String uploadType;
/**
* 图片的md5
*/
private String imageSignature;
/**
* 图片地址
* upload_type为UPLOAD_BY_FILE必填
*/
private File imageFile;
/**
* 图片地址url
* upload_type为UPLOAD_BY_URL必填
*/
private String imageUrl;
// ==========图片信息 end============
// ==========视频信息 start==========
/**
* 视频MD5
*/
private String videoSignature;
/**
* 视频文件
*/
private File videoFile;
// ==========视频信息 end============
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment