api/v1/document.proto

CreateDocumentItem

创建文档

Field Type Label Description
title string 文档标题
attachment_id int64 文档附件ID
price int32 文档价格

CreateDocumentRequest

创建文档

Field Type Label Description
overwrite bool 是否覆盖。暂时用不到
category_id int64 repeated 文档分类ID
document CreateDocumentItem repeated 文档列表

DeleteDocumentRequest

删除文档,放入回收站

Field Type Label Description
id int64 repeated

Document

文档

Field Type Label Description
id int64 文档ID
title string 文档标题
keywords string 文档关键字
description string 文档描述
user_id int64 文档作者
cover string 文档封面
width int32 文档宽度
height int32 文档高度
preview int32 文档可预览页数,0表示不限制
pages int32 文档页数
uuid string 文档UUID
download_count int32 文档下载次数
view_count int32 文档浏览次数
favorite_count int32 文档收藏次数
comment_count int32 文档评论次数
score int32 文档评分
score_count int32 文档评分次数
price int32 文档价格
size int64 文档大小
status int32 文档状态,见 web/utils/enum.js
created_at google.protobuf.Timestamp 文档创建时间
updated_at google.protobuf.Timestamp 文档更新时间
deleted_at google.protobuf.Timestamp 文档删除时间
recommend_at google.protobuf.Timestamp 文档推荐时间
deleted_user_id int64 删除文档的用户
username string 文档作者用户名
category_id int64 repeated 文档分类ID
deleted_username string 删除文档的用户名
ext string 文档扩展名
attachment Attachment 文档附件
user User 文档作者
enable_gzip bool 是否启用gzip压缩
convert_error string 转换错误信息

DocumentScore

文档评分

Field Type Label Description
id int64 评分ID
document_id int64 文档ID
user_id int64 用户ID
score int32 评分,100~500,100为1分,500为5分
created_at google.protobuf.Timestamp 评分时间
updated_at google.protobuf.Timestamp 更新时间

DownloadDocumentReply

文档下载

Field Type Label Description
url string

GetDocumentRequest

查询文档

Field Type Label Description
id int64 文档ID
with_author bool 是否查询作者信息

ListDocumentForHomeItem

首页文档查询返回项

Field Type Label Description
category_id int64 分类ID
category_cover string 分类封面
category_name string 分类名称
document Document repeated 文档列表

ListDocumentForHomeRequest

查询文档(针对首页的查询)

Field Type Label Description
limit int64

ListDocumentForHomeResponse

查询文档(针对首页的查询)

Field Type Label Description
document ListDocumentForHomeItem repeated 文档列表

ListDocumentReply

文档列表

Field Type Label Description
total int64 文档总数
document Document repeated 文档列表

ListDocumentRequest

文档列表

Field Type Label Description
page int64 页码
size int64 每页数量
wd string 搜索关键字
field string repeated 查询字段
order string 排序
category_id int64 repeated 分类ID
user_id int64 repeated 用户ID
status int32 repeated 文档状态
is_recommend bool repeated 是否推荐
limit int64 查询数量显示。当该值大于0时,page和size无效

RecoverRecycleDocumentRequest

恢复文档

Field Type Label Description
id int64 repeated

SearchDocumentReply

文档搜索响应

Field Type Label Description
total int64 文档总数
spend string 搜索耗时
document Document repeated 文档列表

SearchDocumentRequest

文档搜索

Field Type Label Description
page int32 页码
size int32 每页数量
wd string 搜索关键字
category_id int64 repeated 分类
sort string 排序
ext string 类型

SetDocumentRecommendRequest

设置文档推荐

Field Type Label Description
id int64 repeated 文档ID
type int32 0, 取消推荐,1:推荐 2:重新推荐

DocumentAPI

文档服务

Method Name Request Type Response Type Description
ListDocumentForHome ListDocumentForHomeRequest ListDocumentForHomeResponse 针对首页的文档查询
SetDocumentRecommend SetDocumentRecommendRequest .google.protobuf.Empty 设置文档推荐
CreateDocument CreateDocumentRequest .google.protobuf.Empty 创建文档
UpdateDocument Document .google.protobuf.Empty 更新文档
DeleteDocument DeleteDocumentRequest .google.protobuf.Empty 删除文档
GetDocument GetDocumentRequest Document 查询文档
GetRelatedDocuments Document ListDocumentReply 根据文档ID查询当前文档的相关文档
DownloadDocument Document DownloadDocumentReply 根据文档ID,获取文档下载链接
ListDocument ListDocumentRequest ListDocumentReply 文档列表查询
SearchDocument SearchDocumentRequest SearchDocumentReply 文档搜索
SetDocumentScore DocumentScore .google.protobuf.Empty 设置文档评分
GetDocumentScore DocumentScore DocumentScore 获取当前登录用户的文档评分
SetDocumentReconvert .google.protobuf.Empty .google.protobuf.Empty 将文档一键设置为重转

RecycleAPI

Method Name Request Type Response Type Description
ListRecycleDocument ListDocumentRequest ListDocumentReply 文档回收站列表
RecoverRecycleDocument RecoverRecycleDocumentRequest .google.protobuf.Empty 恢复回收站文档,支持恢复单个文档或者是批量恢复
DeleteRecycleDocument DeleteDocumentRequest .google.protobuf.Empty 删除回收站文档
ClearRecycleDocument .google.protobuf.Empty .google.protobuf.Empty 清空回收站文档

Scalar Value Types

.proto Type Notes C++ Java Python Go C# PHP Ruby
double double double float float64 double float Float
float float float float float32 float float Float
int32 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. int32 int int int32 int integer Bignum or Fixnum (as required)
int64 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. int64 long int/long int64 long integer/string Bignum
uint32 Uses variable-length encoding. uint32 int int/long uint32 uint integer Bignum or Fixnum (as required)
uint64 Uses variable-length encoding. uint64 long int/long uint64 ulong integer/string Bignum or Fixnum (as required)
sint32 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. int32 int int int32 int integer Bignum or Fixnum (as required)
sint64 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. int64 long int/long int64 long integer/string Bignum
fixed32 Always four bytes. More efficient than uint32 if values are often greater than 2^28. uint32 int int uint32 uint integer Bignum or Fixnum (as required)
fixed64 Always eight bytes. More efficient than uint64 if values are often greater than 2^56. uint64 long int/long uint64 ulong integer/string Bignum
sfixed32 Always four bytes. int32 int int int32 int integer Bignum or Fixnum (as required)
sfixed64 Always eight bytes. int64 long int/long int64 long integer/string Bignum
bool bool boolean boolean bool bool boolean TrueClass/FalseClass
string A string must always contain UTF-8 encoded or 7-bit ASCII text. string String str/unicode string string string String (UTF-8)
bytes May contain any arbitrary sequence of bytes. string ByteString str []byte ByteString string String (ASCII-8BIT)