From a14add248847923cc144a931f4c94ec14c949ec5 Mon Sep 17 00:00:00 2001 From: Alvis Zhao Date: Tue, 31 Mar 2020 05:31:33 +0000 Subject: [PATCH] =?UTF-8?q?docs:=20=E5=8A=A0=E5=85=A5swagger=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/api.yml | 0 docs/docker-compose.yml | 7 ++ docs/swagger.yml | 176 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 183 insertions(+) create mode 100644 docs/api.yml create mode 100644 docs/docker-compose.yml create mode 100644 docs/swagger.yml diff --git a/docs/api.yml b/docs/api.yml new file mode 100644 index 0000000..e69de29 diff --git a/docs/docker-compose.yml b/docs/docker-compose.yml new file mode 100644 index 0000000..71d6a26 --- /dev/null +++ b/docs/docker-compose.yml @@ -0,0 +1,7 @@ +version: '2' +services: + swagger-editor: + image: swaggerapi/swagger-editor:v3.8.0 + ports: + - 11080:8080 + diff --git a/docs/swagger.yml b/docs/swagger.yml new file mode 100644 index 0000000..1b544ce --- /dev/null +++ b/docs/swagger.yml @@ -0,0 +1,176 @@ +openapi: "3.0.0" +info: + title: 书签同步助手后端接口 + version: 0.0.1 +tags: + - name: User + description: 用户管理 + - name: Bookmark + description: 书签管理 +paths: + /user/login: + post: + operationId: userLogin + summary: 用户登录 + tags: + - User + requestBody: + description: 登录信息。 + required: true + content: + application/json: + schema: + type: object + properties: + account: + description: 账号 + type: string + example: 'admin' + password: + description: 密码 + type: string + example: 'secret' + responses: + '200': + description: 200 response + content: + application/json: + schema: + type: object + properties: + code: + $ref: '#/components/schemas/ResponseCode' + message: + type: string + description: 响应信息,响应码为非20000时表示错误信息 + examples: + 20000: + value: { + "code": 20000, + "message": "OK" + } + /user/logout: + post: + operationId: userLogout + summary: 登录注销 + tags: + - User + responses: + '200': + description: 200 response + content: + application/json: + schema: + type: object + properties: + code: + $ref: '#/components/schemas/ResponseCode' + message: + type: string + description: 响应信息,响应码为非20000时表示错误信息 + examples: + 20000: + value: { + "code": 20000, + "message": "OK" + } + /bookmark: + get: + operationId: downloadBookmark + summary: 下载服务器书签列表 + tags: + - Bookmark + responses: + '200': + description: |- + 200 response + content: + application/json: + schema: + type: object + properties: + code: + $ref: '#/components/schemas/ResponseCode' + message: + type: string + description: 响应信息,响应码为非20000时表示错误信息 + data: + type: object + properties: + total: + description: 书签总数 + type: integer + list: + type: array + items: + $ref: '#/components/schemas/Bookmark' + post: + operationId: uploadBookmark + summary: 上传本地书签 + tags: + - Bookmark + requestBody: + description: 需要添加的职工信息,注意 employeeId 字段是无效的。 + required: true + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Bookmark' + responses: + '200': + description: 200 response + content: + application/json: + schema: + type: object + properties: + code: + $ref: '#/components/schemas/ResponseCode' + message: + type: string + description: 响应信息,响应码为非20000时表示错误信息 + examples: + 20000: + value: { + "code": 20000, + "message": "OK" + } +components: + schemas: + ResponseCode: + type: integer + enum: + - 20000 + - 40000 + - 40100 + description: > + 响应码: + * `20000` - 表明调用成功 + * `40000` - 用户名或密码错误 + * `40001` - token已过期 + Bookmark: + type: object + properties: + id: + description: 节点的唯一标识, id 在当前配置文件中是唯一的,浏览器重启后依然有效。 + type: string + parentId: + description: 父节点的ID,根节点没有此属性 + type: string + dateAdded: + description: 书签节点创建时的时间戳 + type: integer + dateGroupModified: + description: 书签文件夹内容的最后更新时间戳,书签节点没有此属性 + type: integer + index: + description: 书签在父节点中的索引,根节点没有此属性 + type: integer + title: + description: 书签标题 + type: string + url: + description: 书签的url,书签文件夹没有此属性 + type: string \ No newline at end of file