leaf-document-web/api/swagger.json
2023-12-02 23:51:22 +08:00

317 lines
9.8 KiB
JSON

{
"swagger": "2.0",
"info": {
"description": "This is a sample server celler server.",
"title": "Swagger Example API",
"contact": {},
"version": "1.0"
},
"paths": {
"/document/{Id}": {
"delete": {
"security": [
{
"BearerToken": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Documents"
],
"summary": "删除文档",
"parameters": [
{
"type": "string",
"description": "文档 ID",
"name": "Id",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "资料库 ID",
"name": "LibraryId",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/model.Document"
}
}
}
}
},
"/library/:LibraryId/documents": {
"get": {
"security": [
{
"BearerToken": []
}
],
"description": "获取当前账号的文档列表",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Documents"
],
"summary": "获取文档列表",
"parameters": [
{
"type": "integer",
"description": "页码",
"name": "Page",
"in": "query",
"required": true
},
{
"type": "integer",
"description": "资料库 ID",
"name": "LibraryId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/pkg.ResponsePaginated"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/pkg.ResponseError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/pkg.ResponseError"
}
}
}
}
},
"/library/{LibraryId}/document/{DocumentId}": {
"get": {
"security": [
{
"BearerToken": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Documents"
],
"summary": "显示文档",
"parameters": [
{
"type": "string",
"description": "资料库 ID",
"name": "LibraryId",
"in": "path",
"required": true
},
{
"type": "string",
"description": "文档 ID",
"name": "DocumentId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/model.Document"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/pkg.ResponseError"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/pkg.ResponseError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/pkg.ResponseError"
}
}
}
}
},
"/library/{LibraryId}/documents": {
"post": {
"security": [
{
"BearerToken": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Documents"
],
"summary": "新建文档",
"parameters": [
{
"type": "string",
"description": "标题",
"name": "LibraryId",
"in": "path",
"required": true
},
{
"type": "string",
"description": "标题",
"name": "Title",
"in": "query",
"required": true
},
{
"type": "string",
"description": "描述",
"name": "Description",
"in": "query"
},
{
"type": "string",
"description": "文档内容",
"name": "Content",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/model.Document"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/pkg.ResponseError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/pkg.ResponseError"
}
}
}
}
}
},
"definitions": {
"gorm.DeletedAt": {
"type": "object",
"properties": {
"time": {
"type": "string"
},
"valid": {
"description": "Valid is true if Time is not NULL",
"type": "boolean"
}
}
},
"model.Document": {
"type": "object",
"properties": {
"chunked": {
"type": "boolean"
},
"content": {
"type": "string"
},
"createdAt": {
"type": "string"
},
"deletedAt": {
"$ref": "#/definitions/gorm.DeletedAt"
},
"description": {
"type": "string"
},
"id": {
"type": "integer"
},
"libraryId": {
"type": "integer"
},
"title": {
"type": "string"
},
"updatedAt": {
"type": "string"
},
"userId": {
"type": "integer"
}
}
},
"pkg.ResponseError": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
},
"pkg.ResponsePaginated": {
"type": "object",
"properties": {
"Data": {},
"Limit": {
"type": "integer"
},
"Page": {
"type": "integer"
},
"Total": {
"type": "integer"
}
}
}
},
"securityDefinitions": {
"BearerToken": {
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
}
}