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.

59 KiB

Protocol Documentation

Table of Contents

Top

api/v1/article.proto

Article

Field Type Label Description
id int64
identifier string
author string
view_count int64
title string
keywords string
description string
content string
created_at google.protobuf.Timestamp
updated_at google.protobuf.Timestamp

DeleteArticleRequest

Field Type Label Description
id int64 repeated

GetArticleRequest

根据ID或者文章标识获取文章

Field Type Label Description
id int64
identifier string

ListArticleReply

Field Type Label Description
total int64
article Article repeated

ListArticleRequest

Field Type Label Description
page int64
size int64
wd string
field string repeated
order string

ArticleAPI

Method Name Request Type Response Type Description
CreateArticle Article .google.protobuf.Empty
UpdateArticle Article .google.protobuf.Empty
DeleteArticle DeleteArticleRequest .google.protobuf.Empty
GetArticle GetArticleRequest Article
ListArticle ListArticleRequest ListArticleReply

Top

api/v1/attachment.proto

Attachment

Field Type Label Description
id int64
hash string
user_id int64
type_id int64
type int32
enable bool
path string
name string
size int64
width int64
height int64
ext string
ip string
username string 用户名称
type_name string 附件类型名称
description string 附件描述、备注
created_at google.protobuf.Timestamp
updated_at google.protobuf.Timestamp

DeleteAttachmentRequest

Field Type Label Description
id int64 repeated

GetAttachmentRequest

Field Type Label Description
id int64

ListAttachmentReply

Field Type Label Description
total int64
attachment Attachment repeated

ListAttachmentRequest

Field Type Label Description
page int64
size int64
wd string 搜索关键字
enable bool repeated
user_id int64 repeated 用户ID
type int64 repeated 类型
ext string 扩展名

AttachmentAPI

附件服务。只有管理员才有权限操作

Method Name Request Type Response Type Description
UpdateAttachment Attachment .google.protobuf.Empty
DeleteAttachment DeleteAttachmentRequest .google.protobuf.Empty
GetAttachment GetAttachmentRequest Attachment
ListAttachment ListAttachmentRequest ListAttachmentReply

Top

api/v1/banner.proto

Banner

Field Type Label Description
id int64
title string
path string
sort int32
enable bool
type int32
url string
description string
created_at google.protobuf.Timestamp
updated_at google.protobuf.Timestamp

DeleteBannerRequest

Field Type Label Description
id int64 repeated

GetBannerRequest

Field Type Label Description
id int64

ListBannerReply

Field Type Label Description
total int64
banner Banner repeated

ListBannerRequest

Field Type Label Description
page int64
size int64
type int32 repeated
enable bool repeated
wd string
field string repeated

BannerAPI

Method Name Request Type Response Type Description
CreateBanner Banner Banner
UpdateBanner Banner .google.protobuf.Empty
DeleteBanner DeleteBannerRequest .google.protobuf.Empty
GetBanner GetBannerRequest Banner
ListBanner ListBannerRequest ListBannerReply

Top

api/v1/category.proto

Category

Field Type Label Description
id int32
parent_id int32
title string
doc_count int32
sort int32
enable bool
cover string 分类封面
created_at google.protobuf.Timestamp
updated_at google.protobuf.Timestamp

DeleteCategoryRequest

Field Type Label Description
id int64 repeated

GetCategoryRequest

Field Type Label Description
id int64

ListCategoryReply

Field Type Label Description
total int64
category Category repeated

ListCategoryRequest

Field Type Label Description
page int64
size int64
parent_id int64 repeated
wd string
enable bool repeated
field string repeated

CategoryAPI

Method Name Request Type Response Type Description
CreateCategory Category .google.protobuf.Empty
UpdateCategory Category .google.protobuf.Empty
DeleteCategory DeleteCategoryRequest .google.protobuf.Empty
GetCategory GetCategoryRequest Category
ListCategory ListCategoryRequest ListCategoryReply

Top

api/v1/comment.proto

CheckCommentRequest

Field Type Label Description
id int64 repeated
status int32

Comment

Field Type Label Description
created_at google.protobuf.Timestamp
updated_at google.protobuf.Timestamp
id int64
parent_id int64
content string
document_id int64
status int32
comment_count int32
user_id int64
user User
document_title string

CreateCommentRequest

Field Type Label Description
document_id int64
parent_id int64
content string
captcha_id string
captcha string

DeleteCommentRequest

Field Type Label Description
id int64 repeated

GetCommentRequest

Field Type Label Description
id int64

ListCommentReply

Field Type Label Description
total int64
comment Comment repeated

ListCommentRequest

Field Type Label Description
page int64
size int64
wd string
field string repeated
order string
status int32 repeated
document_id int64
user_id int64
parent_id int64 repeated
with_document_title bool

CommentAPI

Method Name Request Type Response Type Description
CreateComment CreateCommentRequest .google.protobuf.Empty
UpdateComment Comment .google.protobuf.Empty 更新评论,仅限管理员操作
DeleteComment DeleteCommentRequest .google.protobuf.Empty 管理员或用户自己删除自己的评论
GetComment GetCommentRequest Comment 获取单个评论
ListComment ListCommentRequest ListCommentReply 获取评论列表
CheckComment CheckCommentRequest .google.protobuf.Empty 审核评论

Top

api/v1/config.proto

Config

Field Type Label Description
id int64
label string
name string
value string
placeholder string
input_type string
category string
sort int32
options string
created_at google.protobuf.Timestamp
updated_at google.protobuf.Timestamp

ConfigCaptcha

验证码配置

Field Type Label Description
length int32
width int32
height int32
type string

ConfigFooter

底链配置项

Field Type Label Description
about string
contact string
agreement string
copyright string
feedback string

ConfigSecurity

安全配置

Field Type Label Description
is_close bool
close_statement string
enable_register bool
enable_captcha_login bool
enable_captcha_register bool
enable_captcha_comment bool
enable_captcha_find_password bool
enable_captcha_upload bool
max_document_size int32
document_allowed_ext string repeated

ConfigSystem

系统配置项

Field Type Label Description
domain string
title string
keywords string
description string
logo string
favicon string
icp string
analytics string
sitename string
copyright_start_year string
register_background string
login_background string
recommend_words string repeated
version string 程序版本号

Configs

Field Type Label Description
config Config repeated

EnvDependent

Field Type Label Description
name string 依赖名称
description string 依赖描述
is_installed bool 是否已安装
error string 错误信息
checked_at google.protobuf.Timestamp 检测时间
cmd string 检测命令
is_required bool 是否必须

Envs

Field Type Label Description
envs EnvDependent repeated

ListConfigRequest

Field Type Label Description
category string repeated

Settings

Field Type Label Description
system ConfigSystem
footer ConfigFooter
security ConfigSecurity ConfigCaptcha captcha = 4;

Stats

Field Type Label Description
user_count int64
document_count int64
category_count int64
article_count int64
comment_count int64
banner_count int64
friendlink_count int64
os string
version string
hash string
build_at string
report_count int64

ConfigAPI

Method Name Request Type Response Type Description
GetSettings .google.protobuf.Empty Settings 获取系统配置(针对所有用户,只读)
UpdateConfig Configs .google.protobuf.Empty UpdateConfig 更新配置
ListConfig ListConfigRequest Configs ListConfig 查询配置项
GetStats .google.protobuf.Empty Stats 获取系统配置
GetEnvs .google.protobuf.Empty Envs 获取系统环境依赖检测
UpdateSitemap .google.protobuf.Empty .google.protobuf.Empty 更新站点地图

Top

api/v1/document.proto

CreateDocumentItem

Field Type Label Description
title string
attachment_id int64
price int32

CreateDocumentRequest

Field Type Label Description
overwrite bool
category_id int64 repeated
document CreateDocumentItem repeated

DeleteDocumentRequest

Field Type Label Description
id int64 repeated

Document

Field Type Label Description
id int64
title string
keywords string
description string
user_id int64
cover string
width int32
height int32
preview int32
pages int32
uuid string
download_count int32
view_count int32
favorite_count int32
comment_count int32
score int32
score_count int32
price int32
size int64
status int32
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
deleted_username string
ext string
attachment Attachment
user User
enable_gzip bool

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
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
user_id int64 repeated
status int32 repeated
is_recommend bool repeated
limit int64

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
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 获取当前登录用户的文档评分

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 清空回收站文档

Top

api/v1/favorite.proto

DeleteFavoriteRequest

Field Type Label Description
id int64 repeated

Favorite

Field Type Label Description
id int64
user_id int64
document_id int64
title string
ext string
score int32
size int64
pages int32
created_at google.protobuf.Timestamp
updated_at google.protobuf.Timestamp

GetFavoriteRequest

Field Type Label Description
document_id int64

ListFavoriteReply

Field Type Label Description
total int64
favorite Favorite repeated

ListFavoriteRequest

Field Type Label Description
page int64
size int64
user_id int64

FavoriteAPI

Method Name Request Type Response Type Description
CreateFavorite Favorite Favorite 添加收藏
DeleteFavorite DeleteFavoriteRequest .google.protobuf.Empty 取消收藏
GetFavorite GetFavoriteRequest Favorite 根据文章id查询用户是否有收藏某篇文档
ListFavorite ListFavoriteRequest ListFavoriteReply 查询用户的收藏

Top

DeleteFriendlinkRequest

Field Type Label Description
id int64 repeated

Field Type Label Description
id int32
title string
link string
description string
sort int32
enable bool
created_at google.protobuf.Timestamp
updated_at google.protobuf.Timestamp

GetFriendlinkRequest

Field Type Label Description
id int64

ListFriendlinkReply

Field Type Label Description
friendlink Friendlink repeated
total int64

ListFriendlinkRequest

Field Type Label Description
page int32
size int32
wd string
enable bool repeated
field string repeated

FriendlinkAPI

Method Name Request Type Response Type Description
CreateFriendlink Friendlink Friendlink
UpdateFriendlink Friendlink .google.protobuf.Empty
DeleteFriendlink DeleteFriendlinkRequest .google.protobuf.Empty
GetFriendlink GetFriendlinkRequest Friendlink
ListFriendlink ListFriendlinkRequest ListFriendlinkReply

Top

api/v1/group.proto

DeleteGroupRequest

Field Type Label Description
id int64 repeated

GetGroupPermissionRequest

Field Type Label Description
id int64

GetGroupRequest

根据组名或者ID获取用户组

Field Type Label Description
id int64
title string

Group

Field Type Label Description
id int64
title string
color string
is_default bool
is_display bool
description string
user_count int32
sort int32
enable_upload bool
enable_comment_approval bool
created_at google.protobuf.Timestamp
updated_at google.protobuf.Timestamp

GroupPermissions

Field Type Label Description
permission_id int64 repeated

ListGroupReply

Field Type Label Description
group Group repeated
total int64

ListGroupRequest

查询用户组列表。不需要分页,直接返回全部用户组,只是可以指定查询哪些字段

Field Type Label Description
wd string
page int64
size int64
sort string
field string repeated

UpdateGroupPermissionRequest

Field Type Label Description
group_id int64
permission_id int64 repeated

GroupAPI

Method Name Request Type Response Type Description
CreateGroup Group Group 创建用户组
UpdateGroup Group .google.protobuf.Empty 更新用户组
DeleteGroup DeleteGroupRequest .google.protobuf.Empty 删除用户组
GetGroup GetGroupRequest Group 获取用户组列表
ListGroup ListGroupRequest ListGroupReply
GetGroupPermission GetGroupPermissionRequest GroupPermissions 获取用户组权限列表
UpdateGroupPermission UpdateGroupPermissionRequest .google.protobuf.Empty 更新用户组权限,给用户组设置权限

Top

api/v1/health.proto

PingRequest

Field Type Label Description
name string

PongReply

Field Type Label Description
name string
created_at google.protobuf.Timestamp

HealthAPI

Method Name Request Type Response Type Description
Health .google.protobuf.Empty .google.protobuf.Empty
Ping .PingRequest .PongReply

Top

api/v1/permission.proto

DeletePermissionRequest

Field Type Label Description
id int64 repeated

GetPermissionReply

Field Type Label Description
permission Permission

GetPermissionRequest

Field Type Label Description
id int64

ListPermissionReply

Field Type Label Description
total int64
permission Permission repeated

ListPermissionRequest

Field Type Label Description
page int64
size int64
wd string
method string repeated
path string

Permission

Field Type Label Description
id int64
method string
path string
title string
description string
created_at google.protobuf.Timestamp
updated_at google.protobuf.Timestamp

PermissionAPI

Method Name Request Type Response Type Description
UpdatePermission Permission .google.protobuf.Empty
GetPermission GetPermissionRequest Permission
ListPermission ListPermissionRequest ListPermissionReply

Top

api/v1/report.proto

DeleteReportRequest

Field Type Label Description
id int64 repeated

ListReportReply

Field Type Label Description
total int64
report Report repeated

ListReportRequest

Field Type Label Description
page int64
size int64
wd string
field string repeated
order string
status bool repeated

Report

这里是proto文件中的结构体可以根据需要删除或者调整

Field Type Label Description
id int64
document_id int64
user_id int64
reason int32
status bool
created_at google.protobuf.Timestamp
updated_at google.protobuf.Timestamp
document_title string
remark string
username string

ReportAPI

Method Name Request Type Response Type Description
CreateReport Report .google.protobuf.Empty
UpdateReport Report .google.protobuf.Empty
DeleteReport DeleteReportRequest .google.protobuf.Empty
ListReport ListReportRequest ListReportReply

Top

api/v1/user.proto

DeleteUserRequest

Field Type Label Description
id int64 repeated

Dynamic

Field Type Label Description
id int64
user_id int64
content string
type int32 类型
username string
created_at google.protobuf.Timestamp
updated_at google.protobuf.Timestamp

FindPasswordRequest

Field Type Label Description
email string
token string
password string
captcha string
captcha_id string

GetUserCaptchaReply

Field Type Label Description
enable bool
id string
captcha string
type string

GetUserCaptchaRequest

Field Type Label Description
type string 验证码类型register、login、comment、find_password、upload

GetUserPermissionsReply

Field Type Label Description
permission Permission repeated

GetUserRequest

Field Type Label Description
id int64

ListUserDynamicReply

Field Type Label Description
total int64
dynamic Dynamic repeated

ListUserDynamicRequest

Field Type Label Description
page int64
size int64
id int64

ListUserReply

Field Type Label Description
total int64
user User repeated

ListUserRequest

Field Type Label Description
page int64
size int64
wd string
sort string
id int64 repeated
group_id int64 repeated
status int32 repeated
limit int64

LoginReply

Field Type Label Description
token string
user User

RegisterAndLoginRequest

Field Type Label Description
username string
password string
captcha string
captcha_id string
email string

SetUserRequest

Field Type Label Description
id int64
username string
password string
group_id int64 repeated

Sign

Field Type Label Description
id int64
user_id int64
sign_at int32
ip string
created_at google.protobuf.Timestamp
award int32 签到积分奖励

UpdateUserPasswordRequest

修改用户密码

Field Type Label Description
id int64
old_password string
new_password string

User

Field Type Label Description
login_at google.protobuf.Timestamp
created_at google.protobuf.Timestamp
updated_at google.protobuf.Timestamp
id int64
username string
mobile string
email string
address string
signature string
last_login_ip string
register_ip string
doc_count int32
follow_count int32
fans_count int32
favorite_count int32
comment_count int32
status int32
avatar string
identity string
realname string
group_id int64 repeated
credit_count int32

UserAPI

Method Name Request Type Response Type Description
Register RegisterAndLoginRequest LoginReply 用户注册
Login RegisterAndLoginRequest LoginReply 用户登录
Logout .google.protobuf.Empty .google.protobuf.Empty 退出登录
GetUser GetUserRequest User 查询用户信息。如果传递了Id参数则表示查询用户的公开信息否则查询当前用户的私有信息
UpdateUserPassword UpdateUserPasswordRequest .google.protobuf.Empty 更新用户密码。如果不传用户ID则表示更新当前用户的密码 如果穿了用户ID则表示更新指定用户的密码这时需要验证当前用户的权限
UpdateUserProfile User .google.protobuf.Empty 更新用户密码。如果不传用户ID则表示更新当前用户的密码 如果穿了用户ID则表示更新指定用户的密码这时需要验证当前用户的权限
DeleteUser DeleteUserRequest .google.protobuf.Empty 删除用户。需要验证用户权限
AddUser SetUserRequest .google.protobuf.Empty 新增用户
SetUser SetUserRequest .google.protobuf.Empty 设置用户
ListUser ListUserRequest ListUserReply 查询用户列表。对于非管理员,返回相应用户的公开信息; 对于管理员,返回相应用户的绝大部分信息
GetUserCaptcha GetUserCaptchaRequest GetUserCaptchaReply GetUserCaptcha 获取用户验证码
GetUserPermissions .google.protobuf.Empty GetUserPermissionsReply GetUserCaptcha 获取用户验证码
CanIUploadDocument .google.protobuf.Empty .google.protobuf.Empty 用户是否可以上传文档
ListUserDynamic ListUserDynamicRequest ListUserDynamicReply 获取用户动态,包括获取关注的用户的动态
SignToday .google.protobuf.Empty Sign 每日签到
GetSignedToday .google.protobuf.Empty Sign 获取今日已签到记录
FindPasswordStepOne FindPasswordRequest .google.protobuf.Empty
FindPasswordStepTwo FindPasswordRequest .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)