|
|
|
@ -0,0 +1,404 @@
|
|
|
|
|
# Protocol Documentation
|
|
|
|
|
<a name="top"></a>
|
|
|
|
|
|
|
|
|
|
## Table of Contents
|
|
|
|
|
|
|
|
|
|
- [api/v1/document.proto](#api_v1_document-proto)
|
|
|
|
|
- [CreateDocumentItem](#api-v1-CreateDocumentItem)
|
|
|
|
|
- [CreateDocumentRequest](#api-v1-CreateDocumentRequest)
|
|
|
|
|
- [DeleteDocumentRequest](#api-v1-DeleteDocumentRequest)
|
|
|
|
|
- [Document](#api-v1-Document)
|
|
|
|
|
- [DocumentScore](#api-v1-DocumentScore)
|
|
|
|
|
- [DownloadDocumentReply](#api-v1-DownloadDocumentReply)
|
|
|
|
|
- [GetDocumentRequest](#api-v1-GetDocumentRequest)
|
|
|
|
|
- [ListDocumentForHomeItem](#api-v1-ListDocumentForHomeItem)
|
|
|
|
|
- [ListDocumentForHomeRequest](#api-v1-ListDocumentForHomeRequest)
|
|
|
|
|
- [ListDocumentForHomeResponse](#api-v1-ListDocumentForHomeResponse)
|
|
|
|
|
- [ListDocumentReply](#api-v1-ListDocumentReply)
|
|
|
|
|
- [ListDocumentRequest](#api-v1-ListDocumentRequest)
|
|
|
|
|
- [RecoverRecycleDocumentRequest](#api-v1-RecoverRecycleDocumentRequest)
|
|
|
|
|
- [SearchDocumentReply](#api-v1-SearchDocumentReply)
|
|
|
|
|
- [SearchDocumentRequest](#api-v1-SearchDocumentRequest)
|
|
|
|
|
- [SetDocumentRecommendRequest](#api-v1-SetDocumentRecommendRequest)
|
|
|
|
|
|
|
|
|
|
- [DocumentAPI](#api-v1-DocumentAPI)
|
|
|
|
|
- [RecycleAPI](#api-v1-RecycleAPI)
|
|
|
|
|
|
|
|
|
|
- [Scalar Value Types](#scalar-value-types)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a name="api_v1_document-proto"></a>
|
|
|
|
|
<p align="right"><a href="#top">Top</a></p>
|
|
|
|
|
|
|
|
|
|
## api/v1/document.proto
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a name="api-v1-CreateDocumentItem"></a>
|
|
|
|
|
|
|
|
|
|
### CreateDocumentItem
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Field | Type | Label | Description |
|
|
|
|
|
| ----- | ---- | ----- | ----------- |
|
|
|
|
|
| title | [string](#string) | | |
|
|
|
|
|
| attachment_id | [int64](#int64) | | |
|
|
|
|
|
| price | [int32](#int32) | | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a name="api-v1-CreateDocumentRequest"></a>
|
|
|
|
|
|
|
|
|
|
### CreateDocumentRequest
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Field | Type | Label | Description |
|
|
|
|
|
| ----- | ---- | ----- | ----------- |
|
|
|
|
|
| overwrite | [bool](#bool) | | |
|
|
|
|
|
| category_id | [int64](#int64) | repeated | |
|
|
|
|
|
| document | [CreateDocumentItem](#api-v1-CreateDocumentItem) | repeated | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a name="api-v1-DeleteDocumentRequest"></a>
|
|
|
|
|
|
|
|
|
|
### DeleteDocumentRequest
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Field | Type | Label | Description |
|
|
|
|
|
| ----- | ---- | ----- | ----------- |
|
|
|
|
|
| id | [int64](#int64) | repeated | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a name="api-v1-Document"></a>
|
|
|
|
|
|
|
|
|
|
### Document
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Field | Type | Label | Description |
|
|
|
|
|
| ----- | ---- | ----- | ----------- |
|
|
|
|
|
| id | [int64](#int64) | | |
|
|
|
|
|
| title | [string](#string) | | |
|
|
|
|
|
| keywords | [string](#string) | | |
|
|
|
|
|
| description | [string](#string) | | |
|
|
|
|
|
| user_id | [int64](#int64) | | |
|
|
|
|
|
| cover | [string](#string) | | |
|
|
|
|
|
| width | [int32](#int32) | | |
|
|
|
|
|
| height | [int32](#int32) | | |
|
|
|
|
|
| preview | [int32](#int32) | | |
|
|
|
|
|
| pages | [int32](#int32) | | |
|
|
|
|
|
| uuid | [string](#string) | | |
|
|
|
|
|
| download_count | [int32](#int32) | | |
|
|
|
|
|
| view_count | [int32](#int32) | | |
|
|
|
|
|
| favorite_count | [int32](#int32) | | |
|
|
|
|
|
| comment_count | [int32](#int32) | | |
|
|
|
|
|
| score | [int32](#int32) | | |
|
|
|
|
|
| score_count | [int32](#int32) | | |
|
|
|
|
|
| price | [int32](#int32) | | |
|
|
|
|
|
| size | [int64](#int64) | | |
|
|
|
|
|
| status | [int32](#int32) | | |
|
|
|
|
|
| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |
|
|
|
|
|
| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |
|
|
|
|
|
| deleted_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |
|
|
|
|
|
| recommend_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |
|
|
|
|
|
| deleted_user_id | [int64](#int64) | | |
|
|
|
|
|
| username | [string](#string) | | |
|
|
|
|
|
| category_id | [int64](#int64) | repeated | |
|
|
|
|
|
| deleted_username | [string](#string) | | |
|
|
|
|
|
| ext | [string](#string) | | |
|
|
|
|
|
| attachment | [Attachment](#api-v1-Attachment) | | |
|
|
|
|
|
| user | [User](#api-v1-User) | | |
|
|
|
|
|
| enable_gzip | [bool](#bool) | | |
|
|
|
|
|
| convert_error | [string](#string) | | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a name="api-v1-DocumentScore"></a>
|
|
|
|
|
|
|
|
|
|
### DocumentScore
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Field | Type | Label | Description |
|
|
|
|
|
| ----- | ---- | ----- | ----------- |
|
|
|
|
|
| id | [int64](#int64) | | |
|
|
|
|
|
| document_id | [int64](#int64) | | |
|
|
|
|
|
| user_id | [int64](#int64) | | |
|
|
|
|
|
| score | [int32](#int32) | | |
|
|
|
|
|
| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |
|
|
|
|
|
| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a name="api-v1-DownloadDocumentReply"></a>
|
|
|
|
|
|
|
|
|
|
### DownloadDocumentReply
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Field | Type | Label | Description |
|
|
|
|
|
| ----- | ---- | ----- | ----------- |
|
|
|
|
|
| url | [string](#string) | | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a name="api-v1-GetDocumentRequest"></a>
|
|
|
|
|
|
|
|
|
|
### GetDocumentRequest
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Field | Type | Label | Description |
|
|
|
|
|
| ----- | ---- | ----- | ----------- |
|
|
|
|
|
| id | [int64](#int64) | | |
|
|
|
|
|
| with_author | [bool](#bool) | | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a name="api-v1-ListDocumentForHomeItem"></a>
|
|
|
|
|
|
|
|
|
|
### ListDocumentForHomeItem
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Field | Type | Label | Description |
|
|
|
|
|
| ----- | ---- | ----- | ----------- |
|
|
|
|
|
| category_id | [int64](#int64) | | |
|
|
|
|
|
| category_cover | [string](#string) | | |
|
|
|
|
|
| category_name | [string](#string) | | |
|
|
|
|
|
| document | [Document](#api-v1-Document) | repeated | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a name="api-v1-ListDocumentForHomeRequest"></a>
|
|
|
|
|
|
|
|
|
|
### ListDocumentForHomeRequest
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Field | Type | Label | Description |
|
|
|
|
|
| ----- | ---- | ----- | ----------- |
|
|
|
|
|
| limit | [int64](#int64) | | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a name="api-v1-ListDocumentForHomeResponse"></a>
|
|
|
|
|
|
|
|
|
|
### ListDocumentForHomeResponse
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Field | Type | Label | Description |
|
|
|
|
|
| ----- | ---- | ----- | ----------- |
|
|
|
|
|
| document | [ListDocumentForHomeItem](#api-v1-ListDocumentForHomeItem) | repeated | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a name="api-v1-ListDocumentReply"></a>
|
|
|
|
|
|
|
|
|
|
### ListDocumentReply
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Field | Type | Label | Description |
|
|
|
|
|
| ----- | ---- | ----- | ----------- |
|
|
|
|
|
| total | [int64](#int64) | | |
|
|
|
|
|
| document | [Document](#api-v1-Document) | repeated | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a name="api-v1-ListDocumentRequest"></a>
|
|
|
|
|
|
|
|
|
|
### ListDocumentRequest
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Field | Type | Label | Description |
|
|
|
|
|
| ----- | ---- | ----- | ----------- |
|
|
|
|
|
| page | [int64](#int64) | | |
|
|
|
|
|
| size | [int64](#int64) | | |
|
|
|
|
|
| wd | [string](#string) | | |
|
|
|
|
|
| field | [string](#string) | repeated | |
|
|
|
|
|
| order | [string](#string) | | |
|
|
|
|
|
| category_id | [int64](#int64) | repeated | |
|
|
|
|
|
| user_id | [int64](#int64) | repeated | |
|
|
|
|
|
| status | [int32](#int32) | repeated | |
|
|
|
|
|
| is_recommend | [bool](#bool) | repeated | |
|
|
|
|
|
| limit | [int64](#int64) | | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a name="api-v1-RecoverRecycleDocumentRequest"></a>
|
|
|
|
|
|
|
|
|
|
### RecoverRecycleDocumentRequest
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Field | Type | Label | Description |
|
|
|
|
|
| ----- | ---- | ----- | ----------- |
|
|
|
|
|
| id | [int64](#int64) | repeated | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a name="api-v1-SearchDocumentReply"></a>
|
|
|
|
|
|
|
|
|
|
### SearchDocumentReply
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Field | Type | Label | Description |
|
|
|
|
|
| ----- | ---- | ----- | ----------- |
|
|
|
|
|
| total | [int64](#int64) | | |
|
|
|
|
|
| spend | [string](#string) | | 搜索耗时 |
|
|
|
|
|
| document | [Document](#api-v1-Document) | repeated | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a name="api-v1-SearchDocumentRequest"></a>
|
|
|
|
|
|
|
|
|
|
### SearchDocumentRequest
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Field | Type | Label | Description |
|
|
|
|
|
| ----- | ---- | ----- | ----------- |
|
|
|
|
|
| page | [int32](#int32) | | |
|
|
|
|
|
| size | [int32](#int32) | | |
|
|
|
|
|
| wd | [string](#string) | | |
|
|
|
|
|
| category_id | [int64](#int64) | repeated | 分类 |
|
|
|
|
|
| sort | [string](#string) | | 排序 |
|
|
|
|
|
| ext | [string](#string) | | 类型 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a name="api-v1-SetDocumentRecommendRequest"></a>
|
|
|
|
|
|
|
|
|
|
### SetDocumentRecommendRequest
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Field | Type | Label | Description |
|
|
|
|
|
| ----- | ---- | ----- | ----------- |
|
|
|
|
|
| id | [int64](#int64) | repeated | |
|
|
|
|
|
| type | [int32](#int32) | | 0, 取消推荐,1:推荐 2:重新推荐 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a name="api-v1-DocumentAPI"></a>
|
|
|
|
|
|
|
|
|
|
### DocumentAPI
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Method Name | Request Type | Response Type | Description |
|
|
|
|
|
| ----------- | ------------ | ------------- | ------------|
|
|
|
|
|
| ListDocumentForHome | [ListDocumentForHomeRequest](#api-v1-ListDocumentForHomeRequest) | [ListDocumentForHomeResponse](#api-v1-ListDocumentForHomeResponse) | |
|
|
|
|
|
| SetDocumentRecommend | [SetDocumentRecommendRequest](#api-v1-SetDocumentRecommendRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |
|
|
|
|
|
| CreateDocument | [CreateDocumentRequest](#api-v1-CreateDocumentRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |
|
|
|
|
|
| UpdateDocument | [Document](#api-v1-Document) | [.google.protobuf.Empty](#google-protobuf-Empty) | |
|
|
|
|
|
| DeleteDocument | [DeleteDocumentRequest](#api-v1-DeleteDocumentRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |
|
|
|
|
|
| GetDocument | [GetDocumentRequest](#api-v1-GetDocumentRequest) | [Document](#api-v1-Document) | |
|
|
|
|
|
| GetRelatedDocuments | [Document](#api-v1-Document) | [ListDocumentReply](#api-v1-ListDocumentReply) | |
|
|
|
|
|
| DownloadDocument | [Document](#api-v1-Document) | [DownloadDocumentReply](#api-v1-DownloadDocumentReply) | |
|
|
|
|
|
| ListDocument | [ListDocumentRequest](#api-v1-ListDocumentRequest) | [ListDocumentReply](#api-v1-ListDocumentReply) | |
|
|
|
|
|
| SearchDocument | [SearchDocumentRequest](#api-v1-SearchDocumentRequest) | [SearchDocumentReply](#api-v1-SearchDocumentReply) | |
|
|
|
|
|
| SetDocumentScore | [DocumentScore](#api-v1-DocumentScore) | [.google.protobuf.Empty](#google-protobuf-Empty) | 设置文档评分 |
|
|
|
|
|
| GetDocumentScore | [DocumentScore](#api-v1-DocumentScore) | [DocumentScore](#api-v1-DocumentScore) | 获取当前登录用户的文档评分 |
|
|
|
|
|
| SetDocumentReconvert | [.google.protobuf.Empty](#google-protobuf-Empty) | [.google.protobuf.Empty](#google-protobuf-Empty) | 将文档一键设置为重转 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a name="api-v1-RecycleAPI"></a>
|
|
|
|
|
|
|
|
|
|
### RecycleAPI
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Method Name | Request Type | Response Type | Description |
|
|
|
|
|
| ----------- | ------------ | ------------- | ------------|
|
|
|
|
|
| ListRecycleDocument | [ListDocumentRequest](#api-v1-ListDocumentRequest) | [ListDocumentReply](#api-v1-ListDocumentReply) | 文档回收站列表 |
|
|
|
|
|
| RecoverRecycleDocument | [RecoverRecycleDocumentRequest](#api-v1-RecoverRecycleDocumentRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 恢复回收站文档,支持恢复单个文档或者是批量恢复 |
|
|
|
|
|
| DeleteRecycleDocument | [DeleteDocumentRequest](#api-v1-DeleteDocumentRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | 删除回收站文档 |
|
|
|
|
|
| ClearRecycleDocument | [.google.protobuf.Empty](#google-protobuf-Empty) | [.google.protobuf.Empty](#google-protobuf-Empty) | 清空回收站文档 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Scalar Value Types
|
|
|
|
|
|
|
|
|
|
| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby |
|
|
|
|
|
| ----------- | ----- | --- | ---- | ------ | -- | -- | --- | ---- |
|
|
|
|
|
| <a name="double" /> double | | double | double | float | float64 | double | float | Float |
|
|
|
|
|
| <a name="float" /> float | | float | float | float | float32 | float | float | Float |
|
|
|
|
|
| <a name="int32" /> 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) |
|
|
|
|
|
| <a name="int64" /> 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 |
|
|
|
|
|
| <a name="uint32" /> uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) |
|
|
|
|
|
| <a name="uint64" /> uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) |
|
|
|
|
|
| <a name="sint32" /> 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) |
|
|
|
|
|
| <a name="sint64" /> 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 |
|
|
|
|
|
| <a name="fixed32" /> 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) |
|
|
|
|
|
| <a name="fixed64" /> 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 |
|
|
|
|
|
| <a name="sfixed32" /> sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
|
|
|
|
|
| <a name="sfixed64" /> sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum |
|
|
|
|
|
| <a name="bool" /> bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass |
|
|
|
|
|
| <a name="string" /> string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) |
|
|
|
|
|
| <a name="bytes" /> bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) |
|
|
|
|
|
|