You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 KiB

Protocol Documentation

Table of Contents

Top

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
document_id int64
user_id int64
score int32 评分
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
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
DownloadDocument Document DownloadDocumentReply
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)