859 lines
20 KiB
YAML
859 lines
20 KiB
YAML
definitions:
|
||
dto.AddWorkspaceMemberRequest:
|
||
properties:
|
||
user_id:
|
||
$ref: '#/definitions/user.ID'
|
||
required:
|
||
- user_id
|
||
type: object
|
||
dto.CreateBlockRequest:
|
||
properties:
|
||
after_block_id:
|
||
type: integer
|
||
content:
|
||
type: string
|
||
type:
|
||
type: string
|
||
required:
|
||
- type
|
||
type: object
|
||
dto.CreateCollectionRequest:
|
||
properties:
|
||
name:
|
||
type: string
|
||
workspace_id:
|
||
type: integer
|
||
required:
|
||
- workspace_id
|
||
type: object
|
||
dto.CreateDocumentRequest:
|
||
properties:
|
||
collection_id:
|
||
type: integer
|
||
name:
|
||
type: string
|
||
parent_id:
|
||
type: integer
|
||
workspace_id:
|
||
type: integer
|
||
required:
|
||
- collection_id
|
||
- workspace_id
|
||
type: object
|
||
dto.CreateWorkspaceRequest:
|
||
properties:
|
||
name:
|
||
type: string
|
||
type: object
|
||
dto.DocumentDTO:
|
||
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
|
||
type: object
|
||
dto.MoveBlockRequest:
|
||
properties:
|
||
after_block_id:
|
||
type: integer
|
||
type: object
|
||
dto.Response:
|
||
type: object
|
||
dto.UpdateBlockRequest:
|
||
properties:
|
||
content:
|
||
type: string
|
||
required:
|
||
- content
|
||
type: object
|
||
dto.UpdateCollectionRequest:
|
||
properties:
|
||
name:
|
||
type: string
|
||
type: object
|
||
dto.UpdateDocumentRequest:
|
||
properties:
|
||
name:
|
||
type: string
|
||
type: object
|
||
dto.ValidateError:
|
||
properties:
|
||
message:
|
||
type: string
|
||
type: object
|
||
entity.Document:
|
||
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
|
||
type: object
|
||
entity.DocumentBlock:
|
||
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
|
||
type: object
|
||
entity.Workspace:
|
||
properties:
|
||
created_at:
|
||
type: string
|
||
deleted_at:
|
||
$ref: '#/definitions/gorm.DeletedAt'
|
||
id:
|
||
type: integer
|
||
name:
|
||
type: string
|
||
updated_at:
|
||
type: string
|
||
user_id:
|
||
$ref: '#/definitions/user.ID'
|
||
type: object
|
||
entity.WorkspaceMember:
|
||
properties:
|
||
created_at:
|
||
type: string
|
||
id:
|
||
type: integer
|
||
updated_at:
|
||
type: string
|
||
user_id:
|
||
$ref: '#/definitions/user.ID'
|
||
workspace:
|
||
$ref: '#/definitions/entity.Workspace'
|
||
workspace_id:
|
||
type: integer
|
||
type: object
|
||
gorm.DeletedAt:
|
||
properties:
|
||
time:
|
||
type: string
|
||
valid:
|
||
description: Valid is true if Time is not NULL
|
||
type: boolean
|
||
type: object
|
||
leafdev_top_Leaf_leaf-library-3_internal_entity.Collection:
|
||
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
|
||
type: object
|
||
user.ID:
|
||
enum:
|
||
- anonymous
|
||
type: string
|
||
x-enum-varnames:
|
||
- AnonymousUser
|
||
info:
|
||
contact: {}
|
||
title: API Docs
|
||
version: "1.0"
|
||
paths:
|
||
/blocks/{block_id}:
|
||
delete:
|
||
consumes:
|
||
- application/json
|
||
description: 删除指定的文档块
|
||
parameters:
|
||
- description: 文档块ID
|
||
in: path
|
||
name: block_id
|
||
required: true
|
||
type: integer
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
"404":
|
||
description: 文档块不存在
|
||
schema:
|
||
$ref: '#/definitions/dto.Response'
|
||
summary: 删除文档块
|
||
tags:
|
||
- Document
|
||
put:
|
||
consumes:
|
||
- application/json
|
||
description: 更新文档块的内容
|
||
parameters:
|
||
- description: 文档块ID
|
||
in: path
|
||
name: block_id
|
||
required: true
|
||
type: integer
|
||
- description: 更新文档块请求
|
||
in: body
|
||
name: request
|
||
required: true
|
||
schema:
|
||
$ref: '#/definitions/dto.UpdateBlockRequest'
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
$ref: '#/definitions/entity.DocumentBlock'
|
||
"400":
|
||
description: 参数验证失败
|
||
schema:
|
||
items:
|
||
$ref: '#/definitions/dto.ValidateError'
|
||
type: array
|
||
"404":
|
||
description: 文档块不存在
|
||
schema:
|
||
$ref: '#/definitions/dto.Response'
|
||
summary: 更新文档块
|
||
tags:
|
||
- Document
|
||
/blocks/{block_id}/move:
|
||
post:
|
||
consumes:
|
||
- application/json
|
||
description: 移动文档块的位置
|
||
parameters:
|
||
- description: 文档块ID
|
||
in: path
|
||
name: block_id
|
||
required: true
|
||
type: integer
|
||
- description: 移动文档块请求
|
||
in: body
|
||
name: request
|
||
required: true
|
||
schema:
|
||
$ref: '#/definitions/dto.MoveBlockRequest'
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
"400":
|
||
description: 参数验证失败
|
||
schema:
|
||
items:
|
||
$ref: '#/definitions/dto.ValidateError'
|
||
type: array
|
||
"404":
|
||
description: 文档块不存在
|
||
schema:
|
||
$ref: '#/definitions/dto.Response'
|
||
summary: 移动文档块
|
||
tags:
|
||
- Document
|
||
/collections:
|
||
post:
|
||
consumes:
|
||
- application/json
|
||
description: 在工作空间下创建新的集合
|
||
parameters:
|
||
- description: 创建集合请求
|
||
in: body
|
||
name: request
|
||
required: true
|
||
schema:
|
||
$ref: '#/definitions/dto.CreateCollectionRequest'
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
$ref: '#/definitions/leafdev_top_Leaf_leaf-library-3_internal_entity.Collection'
|
||
"400":
|
||
description: 参数验证失败
|
||
schema:
|
||
items:
|
||
$ref: '#/definitions/dto.ValidateError'
|
||
type: array
|
||
"404":
|
||
description: 工作空间不存在
|
||
schema:
|
||
$ref: '#/definitions/dto.Response'
|
||
summary: 创建集合
|
||
tags:
|
||
- Collection
|
||
/collections/{collection_id}/documents:
|
||
get:
|
||
consumes:
|
||
- application/json
|
||
description: 获取指定集合下的文档树,如果指定了父文档ID则获取该文档下的子树
|
||
parameters:
|
||
- description: 集合ID
|
||
in: path
|
||
name: collection_id
|
||
required: true
|
||
type: integer
|
||
- description: 父文档ID,不传则获取根文档
|
||
in: query
|
||
name: parent_id
|
||
type: integer
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
items:
|
||
$ref: '#/definitions/dto.DocumentDTO'
|
||
type: array
|
||
"403":
|
||
description: 无权访问
|
||
schema:
|
||
$ref: '#/definitions/dto.Response'
|
||
"404":
|
||
description: 集合不存在或父文档不存在
|
||
schema:
|
||
$ref: '#/definitions/dto.Response'
|
||
summary: 列出文档树
|
||
tags:
|
||
- Document
|
||
/collections/{id}:
|
||
delete:
|
||
consumes:
|
||
- application/json
|
||
description: 删除指定的集合
|
||
parameters:
|
||
- description: 集合ID
|
||
in: path
|
||
name: id
|
||
required: true
|
||
type: integer
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
$ref: '#/definitions/dto.Response'
|
||
"404":
|
||
description: 集合不存在
|
||
schema:
|
||
$ref: '#/definitions/dto.Response'
|
||
summary: 删除集合
|
||
tags:
|
||
- Collection
|
||
get:
|
||
consumes:
|
||
- application/json
|
||
description: 根据集合ID获取集合详情
|
||
parameters:
|
||
- description: 集合ID
|
||
in: path
|
||
name: id
|
||
required: true
|
||
type: integer
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
$ref: '#/definitions/leafdev_top_Leaf_leaf-library-3_internal_entity.Collection'
|
||
"404":
|
||
description: 集合不存在
|
||
schema:
|
||
$ref: '#/definitions/dto.Response'
|
||
summary: 获取集合
|
||
tags:
|
||
- Collection
|
||
put:
|
||
consumes:
|
||
- application/json
|
||
description: 更新集合的名称等信息
|
||
parameters:
|
||
- description: 集合ID
|
||
in: path
|
||
name: id
|
||
required: true
|
||
type: integer
|
||
- description: 更新集合请求
|
||
in: body
|
||
name: request
|
||
required: true
|
||
schema:
|
||
$ref: '#/definitions/dto.UpdateCollectionRequest'
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
$ref: '#/definitions/leafdev_top_Leaf_leaf-library-3_internal_entity.Collection'
|
||
"400":
|
||
description: 参数验证失败
|
||
schema:
|
||
items:
|
||
$ref: '#/definitions/dto.ValidateError'
|
||
type: array
|
||
"404":
|
||
description: 集合不存在
|
||
schema:
|
||
$ref: '#/definitions/dto.Response'
|
||
summary: 更新集合
|
||
tags:
|
||
- Collection
|
||
/documents:
|
||
post:
|
||
consumes:
|
||
- application/json
|
||
description: 创建一个新的文档,可以是根文档或子文档
|
||
parameters:
|
||
- description: 创建文档请求
|
||
in: body
|
||
name: request
|
||
required: true
|
||
schema:
|
||
$ref: '#/definitions/dto.CreateDocumentRequest'
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
$ref: '#/definitions/dto.DocumentDTO'
|
||
"400":
|
||
description: 参数验证失败
|
||
schema:
|
||
items:
|
||
$ref: '#/definitions/dto.ValidateError'
|
||
type: array
|
||
"403":
|
||
description: 无权访问
|
||
schema:
|
||
$ref: '#/definitions/dto.Response'
|
||
"404":
|
||
description: 集合不存在或父文档不存在
|
||
schema:
|
||
$ref: '#/definitions/dto.Response'
|
||
summary: 创建文档
|
||
tags:
|
||
- Document
|
||
/documents/{document_id}/blocks:
|
||
get:
|
||
consumes:
|
||
- application/json
|
||
description: 获取指定文档下的所有文档块
|
||
parameters:
|
||
- description: 文档ID
|
||
in: path
|
||
name: document_id
|
||
required: true
|
||
type: integer
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
items:
|
||
$ref: '#/definitions/entity.DocumentBlock'
|
||
type: array
|
||
"404":
|
||
description: 文档不存在
|
||
schema:
|
||
$ref: '#/definitions/dto.Response'
|
||
summary: 列出文档块列表
|
||
tags:
|
||
- Document
|
||
post:
|
||
consumes:
|
||
- application/json
|
||
description: 在文档中创建新的文档块
|
||
parameters:
|
||
- description: 文档ID
|
||
in: path
|
||
name: document_id
|
||
required: true
|
||
type: integer
|
||
- description: 创建文档块请求
|
||
in: body
|
||
name: request
|
||
required: true
|
||
schema:
|
||
$ref: '#/definitions/dto.CreateBlockRequest'
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
$ref: '#/definitions/entity.DocumentBlock'
|
||
"400":
|
||
description: 参数验证失败
|
||
schema:
|
||
items:
|
||
$ref: '#/definitions/dto.ValidateError'
|
||
type: array
|
||
"404":
|
||
description: 文档不存在
|
||
schema:
|
||
$ref: '#/definitions/dto.Response'
|
||
summary: 创建文档块
|
||
tags:
|
||
- Document
|
||
/documents/{id}:
|
||
delete:
|
||
consumes:
|
||
- application/json
|
||
description: 删除指定的文档
|
||
parameters:
|
||
- description: 文档ID
|
||
in: path
|
||
name: id
|
||
required: true
|
||
type: integer
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
"404":
|
||
description: 文档不存在
|
||
schema:
|
||
$ref: '#/definitions/dto.Response'
|
||
summary: 删除文档
|
||
tags:
|
||
- Document
|
||
get:
|
||
consumes:
|
||
- application/json
|
||
description: 根据文档ID获取文档详情
|
||
parameters:
|
||
- description: 文档ID
|
||
in: path
|
||
name: id
|
||
required: true
|
||
type: integer
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
$ref: '#/definitions/dto.DocumentDTO'
|
||
"403":
|
||
description: 无权访问
|
||
schema:
|
||
$ref: '#/definitions/dto.Response'
|
||
"404":
|
||
description: 文档不存在
|
||
schema:
|
||
$ref: '#/definitions/dto.Response'
|
||
summary: 获取文档
|
||
tags:
|
||
- Document
|
||
put:
|
||
consumes:
|
||
- application/json
|
||
description: 更新文档的名称等信息
|
||
parameters:
|
||
- description: 文档ID
|
||
in: path
|
||
name: id
|
||
required: true
|
||
type: integer
|
||
- description: 更新文档请求
|
||
in: body
|
||
name: request
|
||
required: true
|
||
schema:
|
||
$ref: '#/definitions/dto.UpdateDocumentRequest'
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
$ref: '#/definitions/entity.Document'
|
||
"400":
|
||
description: 参数验证失败
|
||
schema:
|
||
items:
|
||
$ref: '#/definitions/dto.ValidateError'
|
||
type: array
|
||
"404":
|
||
description: 文档不存在
|
||
schema:
|
||
$ref: '#/definitions/dto.Response'
|
||
summary: 更新文档
|
||
tags:
|
||
- Document
|
||
/workspaces:
|
||
get:
|
||
consumes:
|
||
- application/json
|
||
description: 获取当前用户的所有工作空间
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
items:
|
||
$ref: '#/definitions/entity.Workspace'
|
||
type: array
|
||
summary: 列出工作空间列表
|
||
tags:
|
||
- Workspace
|
||
post:
|
||
consumes:
|
||
- application/json
|
||
description: 创建一个新的工作空间
|
||
parameters:
|
||
- description: 创建工作空间请求
|
||
in: body
|
||
name: request
|
||
required: true
|
||
schema:
|
||
$ref: '#/definitions/dto.CreateWorkspaceRequest'
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
$ref: '#/definitions/entity.Workspace'
|
||
"400":
|
||
description: 参数验证失败
|
||
schema:
|
||
items:
|
||
$ref: '#/definitions/dto.ValidateError'
|
||
type: array
|
||
summary: 创建工作空间
|
||
tags:
|
||
- Workspace
|
||
/workspaces/{id}:
|
||
delete:
|
||
consumes:
|
||
- application/json
|
||
description: 删除指定的工作空间
|
||
parameters:
|
||
- description: 工作空间ID
|
||
in: path
|
||
name: id
|
||
required: true
|
||
type: integer
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
"404":
|
||
description: 工作空间不存在
|
||
schema:
|
||
$ref: '#/definitions/dto.Response'
|
||
summary: 删除工作空间
|
||
tags:
|
||
- Workspace
|
||
get:
|
||
consumes:
|
||
- application/json
|
||
description: 根据工作空间ID获取工作空间详情
|
||
parameters:
|
||
- description: 工作空间ID
|
||
in: path
|
||
name: id
|
||
required: true
|
||
type: integer
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
$ref: '#/definitions/entity.Workspace'
|
||
"404":
|
||
description: 工作空间不存在
|
||
schema:
|
||
$ref: '#/definitions/dto.Response'
|
||
summary: 获取工作空间
|
||
tags:
|
||
- Workspace
|
||
/workspaces/{id}/members:
|
||
get:
|
||
consumes:
|
||
- application/json
|
||
description: 根据工作空间ID获取工作空间的成员
|
||
parameters:
|
||
- description: 工作空间ID
|
||
in: path
|
||
name: id
|
||
required: true
|
||
type: integer
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
$ref: '#/definitions/entity.Workspace'
|
||
"404":
|
||
description: 工作空间不存在
|
||
schema:
|
||
$ref: '#/definitions/dto.Response'
|
||
summary: 获取工作空间的成员
|
||
tags:
|
||
- Workspace
|
||
post:
|
||
consumes:
|
||
- application/json
|
||
description: 向工作空间添加新成员
|
||
parameters:
|
||
- description: 工作空间ID
|
||
in: path
|
||
name: id
|
||
required: true
|
||
type: integer
|
||
- description: 添加成员请求
|
||
in: body
|
||
name: request
|
||
required: true
|
||
schema:
|
||
$ref: '#/definitions/dto.AddWorkspaceMemberRequest'
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
$ref: '#/definitions/entity.WorkspaceMember'
|
||
"400":
|
||
description: 参数验证失败
|
||
schema:
|
||
items:
|
||
$ref: '#/definitions/dto.ValidateError'
|
||
type: array
|
||
"404":
|
||
description: 工作空间不存在
|
||
schema:
|
||
$ref: '#/definitions/dto.Response'
|
||
"409":
|
||
description: 成员已存在
|
||
schema:
|
||
$ref: '#/definitions/dto.Response'
|
||
summary: 添加工作空间成员
|
||
tags:
|
||
- Workspace
|
||
/workspaces/{id}/members/{user_id}:
|
||
delete:
|
||
consumes:
|
||
- application/json
|
||
description: 从工作空间移除成员
|
||
parameters:
|
||
- description: 工作空间ID
|
||
in: path
|
||
name: id
|
||
required: true
|
||
type: integer
|
||
- description: 用户ID
|
||
in: path
|
||
name: user_id
|
||
required: true
|
||
type: string
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
$ref: '#/definitions/dto.Response'
|
||
"404":
|
||
description: 工作空间不存在或成员不存在
|
||
schema:
|
||
$ref: '#/definitions/dto.Response'
|
||
summary: 移除工作空间成员
|
||
tags:
|
||
- Workspace
|
||
/workspaces/{workspace_id}/collections:
|
||
get:
|
||
consumes:
|
||
- application/json
|
||
description: 获取指定工作空间下的所有集合
|
||
parameters:
|
||
- description: 工作空间ID
|
||
in: path
|
||
name: workspace_id
|
||
required: true
|
||
type: integer
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
items:
|
||
$ref: '#/definitions/leafdev_top_Leaf_leaf-library-3_internal_entity.Collection'
|
||
type: array
|
||
"404":
|
||
description: 工作空间不存在
|
||
schema:
|
||
$ref: '#/definitions/dto.Response'
|
||
summary: 列出集合列表
|
||
tags:
|
||
- Collection
|
||
securityDefinitions:
|
||
ApiKeyAuth:
|
||
in: header
|
||
name: Authorization
|
||
type: apiKey
|
||
swagger: "2.0"
|