// Package docs Code generated by swaggo/swag. DO NOT EDIT package docs import "github.com/swaggo/swag" const docTemplate = `{ "schemes": {{ marshal .Schemes }}, "swagger": "2.0", "info": { "description": "{{escape .Description}}", "title": "{{.Title}}", "contact": {}, "version": "{{.Version}}" }, "host": "{{.Host}}", "basePath": "{{.BasePath}}", "paths": { "/blocks/{block_id}": { "put": { "description": "更新文档块的内容", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Document" ], "summary": "更新文档块", "parameters": [ { "type": "integer", "description": "文档块ID", "name": "block_id", "in": "path", "required": true }, { "description": "更新文档块请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.UpdateBlockRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/entity.DocumentBlock" } }, "400": { "description": "参数验证失败", "schema": { "type": "array", "items": { "$ref": "#/definitions/response.ValidateError" } } }, "404": { "description": "文档块不存在", "schema": { "$ref": "#/definitions/response.Response" } } } }, "delete": { "description": "删除指定的文档块", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Document" ], "summary": "删除文档块", "parameters": [ { "type": "integer", "description": "文档块ID", "name": "block_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK" }, "404": { "description": "文档块不存在", "schema": { "$ref": "#/definitions/response.Response" } } } } }, "/blocks/{block_id}/move": { "post": { "description": "移动文档块的位置", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Document" ], "summary": "移动文档块", "parameters": [ { "type": "integer", "description": "文档块ID", "name": "block_id", "in": "path", "required": true }, { "description": "移动文档块请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.MoveBlockRequest" } } ], "responses": { "200": { "description": "OK" }, "400": { "description": "参数验证失败", "schema": { "type": "array", "items": { "$ref": "#/definitions/response.ValidateError" } } }, "404": { "description": "文档块不存在", "schema": { "$ref": "#/definitions/response.Response" } } } } }, "/collections": { "post": { "description": "在工作空间下创建新的集合", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Collection" ], "summary": "创建集合", "parameters": [ { "description": "创建集合请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.CreateCollectionRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/leafdev_top_Leaf_leaf-library-3_internal_entity.Collection" } }, "400": { "description": "参数验证失败", "schema": { "type": "array", "items": { "$ref": "#/definitions/response.ValidateError" } } }, "404": { "description": "工作空间不存在", "schema": { "$ref": "#/definitions/response.Response" } } } } }, "/collections/{collection_id}/documents": { "get": { "description": "获取指定集合下的文档树,如果指定了父文档ID则获取该文档下的子树", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Document" ], "summary": "列出文档树", "parameters": [ { "type": "integer", "description": "集合ID", "name": "collection_id", "in": "path", "required": true }, { "type": "integer", "description": "父文档ID,不传则获取根文档", "name": "parent_id", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/dto.DocumentDTO" } } }, "403": { "description": "无权访问", "schema": { "$ref": "#/definitions/response.Response" } }, "404": { "description": "集合不存在或父文档不存在", "schema": { "$ref": "#/definitions/response.Response" } } } } }, "/collections/{id}": { "get": { "description": "根据集合ID获取集合详情", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Collection" ], "summary": "获取集合", "parameters": [ { "type": "integer", "description": "集合ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/leafdev_top_Leaf_leaf-library-3_internal_entity.Collection" } }, "404": { "description": "集合不存在", "schema": { "$ref": "#/definitions/response.Response" } } } }, "put": { "description": "更新集合的名称等信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Collection" ], "summary": "更新集合", "parameters": [ { "type": "integer", "description": "集合ID", "name": "id", "in": "path", "required": true }, { "description": "更新集合请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.UpdateCollectionRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/leafdev_top_Leaf_leaf-library-3_internal_entity.Collection" } }, "400": { "description": "参数验证失败", "schema": { "type": "array", "items": { "$ref": "#/definitions/response.ValidateError" } } }, "404": { "description": "集合不存在", "schema": { "$ref": "#/definitions/response.Response" } } } }, "delete": { "description": "删除指定的集合", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Collection" ], "summary": "删除集合", "parameters": [ { "type": "integer", "description": "集合ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.Response" } }, "404": { "description": "集合不存在", "schema": { "$ref": "#/definitions/response.Response" } } } } }, "/documents": { "post": { "description": "创建一个新的文档,可以是根文档或子文档", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Document" ], "summary": "创建文档", "parameters": [ { "description": "创建文档请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.CreateDocumentRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/dto.DocumentDTO" } }, "400": { "description": "参数验证失败", "schema": { "type": "array", "items": { "$ref": "#/definitions/response.ValidateError" } } }, "403": { "description": "无权访问", "schema": { "$ref": "#/definitions/response.Response" } }, "404": { "description": "集合不存在或父文档不存在", "schema": { "$ref": "#/definitions/response.Response" } } } } }, "/documents/{document_id}/blocks": { "get": { "description": "获取指定文档下的所有文档块", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Document" ], "summary": "列出文档块列表", "parameters": [ { "type": "integer", "description": "文档ID", "name": "document_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/entity.DocumentBlock" } } }, "404": { "description": "文档不存在", "schema": { "$ref": "#/definitions/response.Response" } } } }, "post": { "description": "在文档中创建新的文档块", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Document" ], "summary": "创建文档块", "parameters": [ { "type": "integer", "description": "文档ID", "name": "document_id", "in": "path", "required": true }, { "description": "创建文档块请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.CreateBlockRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/entity.DocumentBlock" } }, "400": { "description": "参数验证失败", "schema": { "type": "array", "items": { "$ref": "#/definitions/response.ValidateError" } } }, "404": { "description": "文档不存在", "schema": { "$ref": "#/definitions/response.Response" } } } } }, "/documents/{id}": { "get": { "description": "根据文档ID获取文档详情", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Document" ], "summary": "获取文档", "parameters": [ { "type": "integer", "description": "文档ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/dto.DocumentDTO" } }, "403": { "description": "无权访问", "schema": { "$ref": "#/definitions/response.Response" } }, "404": { "description": "文档不存在", "schema": { "$ref": "#/definitions/response.Response" } } } }, "put": { "description": "更新文档的名称等信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Document" ], "summary": "更新文档", "parameters": [ { "type": "integer", "description": "文档ID", "name": "id", "in": "path", "required": true }, { "description": "更新文档请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.UpdateDocumentRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/entity.Document" } }, "400": { "description": "参数验证失败", "schema": { "type": "array", "items": { "$ref": "#/definitions/response.ValidateError" } } }, "404": { "description": "文档不存在", "schema": { "$ref": "#/definitions/response.Response" } } } }, "delete": { "description": "删除指定的文档", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Document" ], "summary": "删除文档", "parameters": [ { "type": "integer", "description": "文档ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK" }, "404": { "description": "文档不存在", "schema": { "$ref": "#/definitions/response.Response" } } } } }, "/workspaces": { "get": { "description": "获取当前用户的所有工作空间", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Workspace" ], "summary": "列出工作空间列表", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/entity.Workspace" } } } } }, "post": { "description": "创建一个新的工作空间", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Workspace" ], "summary": "创建工作空间", "parameters": [ { "description": "创建工作空间请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.CreateWorkspaceRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/entity.Workspace" } }, "400": { "description": "参数验证失败", "schema": { "type": "array", "items": { "$ref": "#/definitions/response.ValidateError" } } } } } }, "/workspaces/{id}": { "get": { "description": "根据工作空间ID获取工作空间详情", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Workspace" ], "summary": "获取工作空间", "parameters": [ { "type": "integer", "description": "工作空间ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/entity.Workspace" } }, "404": { "description": "工作空间不存在", "schema": { "$ref": "#/definitions/response.Response" } } } }, "delete": { "description": "删除指定的工作空间", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Workspace" ], "summary": "删除工作空间", "parameters": [ { "type": "integer", "description": "工作空间ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK" }, "404": { "description": "工作空间不存在", "schema": { "$ref": "#/definitions/response.Response" } } } } }, "/workspaces/{id}/members": { "get": { "description": "根据工作空间ID获取工作空间的成员", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Workspace" ], "summary": "获取工作空间的成员", "parameters": [ { "type": "integer", "description": "工作空间ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/entity.WorkspaceMember" } } }, "404": { "description": "工作空间不存在", "schema": { "$ref": "#/definitions/response.Response" } } } }, "post": { "description": "向工作空间添加新成员", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Workspace" ], "summary": "添加工作空间成员", "parameters": [ { "type": "integer", "description": "工作空间ID", "name": "id", "in": "path", "required": true }, { "description": "添加成员请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.AddWorkspaceMemberRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/entity.WorkspaceMember" } }, "400": { "description": "参数验证失败", "schema": { "type": "array", "items": { "$ref": "#/definitions/response.ValidateError" } } }, "404": { "description": "工作空间不存在", "schema": { "$ref": "#/definitions/response.Response" } }, "409": { "description": "成员已存在", "schema": { "$ref": "#/definitions/response.Response" } } } } }, "/workspaces/{id}/members/{user_id}": { "delete": { "description": "从工作空间移除成员", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Workspace" ], "summary": "移除工作空间成员", "parameters": [ { "type": "integer", "description": "工作空间ID", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "用户ID", "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.Response" } }, "404": { "description": "工作空间不存在或成员不存在", "schema": { "$ref": "#/definitions/response.Response" } } } } }, "/workspaces/{workspace_id}/collections": { "get": { "description": "获取指定工作空间下的所有集合", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Collection" ], "summary": "列出集合列表", "parameters": [ { "type": "integer", "description": "工作空间ID", "name": "workspace_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/leafdev_top_Leaf_leaf-library-3_internal_entity.Collection" } } }, "404": { "description": "工作空间不存在", "schema": { "$ref": "#/definitions/response.Response" } } } } } }, "definitions": { "dto.AddWorkspaceMemberRequest": { "type": "object", "required": [ "user_id" ], "properties": { "user_id": { "type": "string" } } }, "dto.CreateBlockRequest": { "type": "object", "required": [ "type" ], "properties": { "after_block_id": { "type": "integer" }, "content": { "type": "string" }, "type": { "type": "string" } } }, "dto.CreateCollectionRequest": { "type": "object", "required": [ "workspace_id" ], "properties": { "name": { "type": "string" }, "workspace_id": { "type": "integer" } } }, "dto.CreateDocumentRequest": { "type": "object", "required": [ "collection_id", "workspace_id" ], "properties": { "collection_id": { "type": "integer" }, "name": { "type": "string" }, "parent_id": { "type": "integer" }, "workspace_id": { "type": "integer" } } }, "dto.CreateWorkspaceRequest": { "type": "object", "properties": { "name": { "type": "string" } } }, "dto.DocumentDTO": { "type": "object", "properties": { "collection_id": { "type": "integer" }, "created_at": { "type": "string" }, "has_children": { "type": "boolean" }, "id": { "type": "integer" }, "name": { "type": "string" }, "parent_id": { "type": "integer" }, "updated_at": { "type": "string" }, "workspace_id": { "type": "integer" } } }, "dto.MoveBlockRequest": { "type": "object", "properties": { "after_block_id": { "type": "integer" } } }, "dto.UpdateBlockRequest": { "type": "object", "required": [ "content" ], "properties": { "content": { "type": "string" } } }, "dto.UpdateCollectionRequest": { "type": "object", "properties": { "name": { "type": "string" } } }, "dto.UpdateDocumentRequest": { "type": "object", "properties": { "name": { "type": "string" } } }, "entity.Document": { "type": "object", "properties": { "collection": { "$ref": "#/definitions/leafdev_top_Leaf_leaf-library-3_internal_entity.Collection" }, "collection_id": { "type": "integer" }, "created_at": { "type": "string" }, "deleted_at": { "$ref": "#/definitions/gorm.DeletedAt" }, "id": { "type": "integer" }, "name": { "type": "string" }, "parent": { "$ref": "#/definitions/entity.Document" }, "parent_id": { "type": "integer" }, "updated_at": { "type": "string" }, "workspace": { "$ref": "#/definitions/entity.Workspace" }, "workspace_id": { "type": "integer" } } }, "entity.DocumentBlock": { "type": "object", "properties": { "content": { "type": "string" }, "created_at": { "type": "string" }, "document": { "$ref": "#/definitions/entity.Document" }, "document_id": { "type": "integer" }, "hash": { "type": "string" }, "id": { "type": "integer" }, "order": { "type": "number" }, "type": { "type": "string" }, "updated_at": { "type": "string" } } }, "entity.Workspace": { "type": "object", "properties": { "created_at": { "type": "string" }, "deleted_at": { "$ref": "#/definitions/gorm.DeletedAt" }, "id": { "type": "integer" }, "name": { "type": "string" }, "updated_at": { "type": "string" }, "user_id": { "type": "string" } } }, "entity.WorkspaceMember": { "type": "object", "properties": { "created_at": { "type": "string" }, "id": { "type": "integer" }, "updated_at": { "type": "string" }, "user_id": { "type": "string" }, "workspace": { "$ref": "#/definitions/entity.Workspace" }, "workspace_id": { "type": "integer" } } }, "gorm.DeletedAt": { "type": "object", "properties": { "time": { "type": "string" }, "valid": { "description": "Valid is true if Time is not NULL", "type": "boolean" } } }, "leafdev_top_Leaf_leaf-library-3_internal_entity.Collection": { "type": "object", "properties": { "created_at": { "type": "string" }, "deleted_at": { "$ref": "#/definitions/gorm.DeletedAt" }, "id": { "type": "integer" }, "name": { "type": "string" }, "updated_at": { "type": "string" }, "workspace": { "$ref": "#/definitions/entity.Workspace" }, "workspace_id": { "type": "integer" } } }, "response.Response": { "type": "object" }, "response.ValidateError": { "type": "object", "properties": { "message": { "type": "string" } } } }, "securityDefinitions": { "ApiKeyAuth": { "type": "apiKey", "name": "Authorization", "in": "header" } } }` // SwaggerInfo holds exported Swagger Info so clients can modify it var SwaggerInfo = &swag.Spec{ Version: "1.0", Host: "", BasePath: "", Schemes: []string{}, Title: "API Docs", Description: "", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, LeftDelim: "{{", RightDelim: "}}", } func init() { swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) }