Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
toutiao-api
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
chenmingyang
toutiao-api
Commits
2e08099a
Commit
2e08099a
authored
Apr 30, 2019
by
BetterXT
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add file client and dto
parent
0b9ddf4e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
242 additions
and
0 deletions
+242
-0
FileManagerApi.java
src/main/java/io/better/toutiao/api/util/FileManagerApi.java
+103
-0
FileInfoInDTO.java
src/main/java/io/better/toutiao/dto/util/FileInfoInDTO.java
+82
-0
FileInfoOutDTO.java
src/main/java/io/better/toutiao/dto/util/FileInfoOutDTO.java
+57
-0
No files found.
src/main/java/io/better/toutiao/api/util/FileManagerApi.java
0 → 100644
View file @
2e08099a
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
);
}
src/main/java/io/better/toutiao/dto/util/FileInfoInDTO.java
0 → 100644
View file @
2e08099a
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=========
}
src/main/java/io/better/toutiao/dto/util/FileInfoOutDTO.java
0 → 100644
View file @
2e08099a
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============
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment