recommender/docs/swagger.yaml

623 lines
15 KiB
YAML
Raw Normal View History

2024-11-06 10:47:56 +00:00
definitions:
2024-11-07 10:09:13 +00:00
entity.Application:
2024-11-06 10:47:56 +00:00
properties:
2024-11-07 10:09:13 +00:00
created_at:
2024-11-06 10:47:56 +00:00
type: string
2024-11-07 10:09:13 +00:00
id:
type: integer
name:
2024-11-06 10:47:56 +00:00
type: string
2024-11-07 10:09:13 +00:00
updated_at:
2024-11-06 10:47:56 +00:00
type: string
2024-11-07 10:09:13 +00:00
user_id:
type: string
type: object
entity.ApplicationToken:
properties:
application:
$ref: '#/definitions/entity.Application'
application_id:
type: integer
created_at:
type: string
id:
type: integer
token:
type: string
updated_at:
type: string
type: object
2024-11-07 18:25:15 +00:00
entity.Category:
2024-11-07 10:09:13 +00:00
properties:
2024-11-07 18:25:15 +00:00
application:
$ref: '#/definitions/entity.Application'
application_id:
type: integer
id:
type: integer
2024-11-07 10:09:13 +00:00
name:
2024-11-06 10:47:56 +00:00
type: string
type: object
2024-11-07 18:25:15 +00:00
entity.Post:
properties:
application:
$ref: '#/definitions/entity.Application'
application_id:
type: integer
category:
$ref: '#/definitions/entity.Category'
category_id:
type: integer
content:
type: string
created_at:
type: string
id:
type: integer
processed:
type: boolean
target_id:
type: string
title:
type: string
updated_at:
type: string
type: object
page.PagedResult-entity_Category:
properties:
count:
type: integer
data:
items:
$ref: '#/definitions/entity.Category'
type: array
page:
description: 当前页码
type: integer
page_size:
description: 每页大小
type: integer
total_count:
description: 数据总条数
type: integer
total_pages:
description: 总页数
type: integer
type: object
page.PagedResult-entity_Post:
properties:
count:
type: integer
data:
items:
$ref: '#/definitions/entity.Post'
type: array
page:
description: 当前页码
type: integer
page_size:
description: 每页大小
type: integer
total_count:
description: 数据总条数
type: integer
total_pages:
description: 总页数
type: integer
type: object
request.ApplicationCreateRequest:
properties:
name:
type: string
type: object
request.CategorySaveRequest:
properties:
name:
type: string
required:
- name
type: object
request.PostSaveRequest:
properties:
category_id:
type: integer
content:
type: string
target_id:
type: string
title:
type: string
required:
- category_id
- content
- target_id
- title
type: object
2024-11-09 16:11:00 +00:00
request.UserLikePost:
properties:
external_user_id:
type: string
post_id:
type: integer
type: object
2024-11-07 18:25:15 +00:00
response.ResponseBody:
2024-11-06 10:47:56 +00:00
properties:
data: {}
error:
type: string
message:
type: string
success:
type: boolean
type: object
info:
contact: {}
2024-11-07 10:09:13 +00:00
title: Recommender API
2024-11-06 10:47:56 +00:00
version: "1.0"
paths:
2024-11-07 10:09:13 +00:00
/api/v1/application/{application_id}/tokens:
get:
consumes:
- application/json
description: 获取应用程序的 Token 列表
parameters:
- in: path
name: application_id
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
2024-11-07 18:25:15 +00:00
- $ref: '#/definitions/response.ResponseBody'
2024-11-07 10:09:13 +00:00
- properties:
data:
items:
$ref: '#/definitions/entity.ApplicationToken'
type: array
type: object
"400":
description: Bad Request
schema:
2024-11-07 18:25:15 +00:00
$ref: '#/definitions/response.ResponseBody'
2024-11-07 10:09:13 +00:00
security:
- ApiKeyAuth: []
summary: 获取应用程序的 Token 列表
tags:
- applications
post:
consumes:
- application/json
description: 获取应用程序的 Token 列表
parameters:
- in: path
name: application_id
type: integer
- description: 创建应用程序的请求
in: body
name: ApplicationCreateRequest
required: true
schema:
2024-11-07 18:25:15 +00:00
$ref: '#/definitions/request.ApplicationCreateRequest'
2024-11-07 10:09:13 +00:00
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
2024-11-07 18:25:15 +00:00
- $ref: '#/definitions/response.ResponseBody'
2024-11-07 10:09:13 +00:00
- properties:
data:
$ref: '#/definitions/entity.ApplicationToken'
type: object
"400":
description: Bad Request
schema:
2024-11-07 18:25:15 +00:00
$ref: '#/definitions/response.ResponseBody'
2024-11-07 10:09:13 +00:00
security:
- ApiKeyAuth: []
summary: 获取应用程序的 Token 列表
tags:
- applications
/api/v1/applications:
2024-11-06 10:47:56 +00:00
get:
consumes:
- application/json
2024-11-07 10:09:13 +00:00
description: 列出当前用户下的应用程序列表
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
2024-11-07 18:25:15 +00:00
- $ref: '#/definitions/response.ResponseBody'
2024-11-07 10:09:13 +00:00
- properties:
data:
items:
$ref: '#/definitions/entity.Application'
type: array
type: object
"400":
description: Bad Request
schema:
2024-11-07 18:25:15 +00:00
$ref: '#/definitions/response.ResponseBody'
2024-11-07 10:09:13 +00:00
security:
- ApiKeyAuth: []
summary: List Applications
tags:
- applications
post:
consumes:
- application/json
description: 创建一个应用程序
parameters:
- description: 创建应用程序的请求
in: body
name: ApplicationCreateRequest
required: true
schema:
2024-11-07 18:25:15 +00:00
$ref: '#/definitions/request.ApplicationCreateRequest'
2024-11-06 10:47:56 +00:00
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
2024-11-07 18:25:15 +00:00
- $ref: '#/definitions/response.ResponseBody'
2024-11-06 10:47:56 +00:00
- properties:
data:
2024-11-07 10:09:13 +00:00
items:
$ref: '#/definitions/entity.Application'
type: array
2024-11-06 10:47:56 +00:00
type: object
"400":
description: Bad Request
schema:
2024-11-07 18:25:15 +00:00
$ref: '#/definitions/response.ResponseBody'
2024-11-06 10:47:56 +00:00
security:
- ApiKeyAuth: []
2024-11-07 10:09:13 +00:00
summary: 创建并保存一个应用程序
2024-11-06 10:47:56 +00:00
tags:
2024-11-07 10:09:13 +00:00
- applications
2024-11-07 18:25:15 +00:00
/applications/v1/categories:
get:
consumes:
- application/json
description: 列出分类
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.ResponseBody'
- properties:
data:
$ref: '#/definitions/page.PagedResult-entity_Category'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.ResponseBody'
security:
- ApiKeyAuth: []
summary: 列出分类
tags:
- application_api
post:
consumes:
- application/json
description: 新建分类
parameters:
- description: body
in: body
name: CategorySaveRequest
required: true
schema:
$ref: '#/definitions/request.CategorySaveRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.ResponseBody'
- properties:
data:
$ref: '#/definitions/entity.Application'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.ResponseBody'
security:
- ApiKeyAuth: []
summary: 新建分类
tags:
- application_api
/applications/v1/categories/{category_id}:
delete:
consumes:
- application/json
description: 删除分类
parameters:
- in: path
name: category_id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.ResponseBody'
- properties:
data:
$ref: '#/definitions/entity.Category'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.ResponseBody'
security:
- ApiKeyAuth: []
summary: 删除分类
tags:
- application_api
get:
consumes:
- application/json
description: 获取 Post
parameters:
- in: path
name: category_id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.ResponseBody'
- properties:
data:
$ref: '#/definitions/entity.Category'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.ResponseBody'
security:
- ApiKeyAuth: []
summary: 获取 Post
tags:
- application_api
2024-11-07 12:00:06 +00:00
/applications/v1/info:
get:
consumes:
- application/json
description: 当前的应用程序信息
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
2024-11-07 18:25:15 +00:00
- $ref: '#/definitions/response.ResponseBody'
2024-11-07 12:00:06 +00:00
- properties:
data:
$ref: '#/definitions/entity.Application'
type: object
"400":
description: Bad Request
schema:
2024-11-07 18:25:15 +00:00
$ref: '#/definitions/response.ResponseBody'
2024-11-07 12:00:06 +00:00
security:
- ApiKeyAuth: []
summary: Current Application Info
tags:
- application_api
2024-11-07 18:25:15 +00:00
/applications/v1/post/{post_id}:
delete:
consumes:
- application/json
description: 删除 Post
parameters:
- in: path
name: post_id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.ResponseBody'
- properties:
data:
$ref: '#/definitions/entity.Post'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.ResponseBody'
security:
- ApiKeyAuth: []
summary: 删除 Post
tags:
- application_api
get:
consumes:
- application/json
description: 获取 Post
parameters:
- in: path
name: post_id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.ResponseBody'
- properties:
data:
$ref: '#/definitions/entity.Post'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.ResponseBody'
security:
- ApiKeyAuth: []
summary: 获取 Post
tags:
- application_api
/applications/v1/posts:
get:
consumes:
- application/json
description: 列出 Posts
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.ResponseBody'
- properties:
data:
$ref: '#/definitions/page.PagedResult-entity_Post'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.ResponseBody'
security:
- ApiKeyAuth: []
summary: 列出 Posts
tags:
- application_api
post:
consumes:
- application/json
description: 新建资源
parameters:
- description: body
in: body
name: PostSaveRequest
required: true
schema:
$ref: '#/definitions/request.PostSaveRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.ResponseBody'
- properties:
data:
$ref: '#/definitions/entity.Post'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.ResponseBody'
security:
- ApiKeyAuth: []
summary: 新建资源
tags:
- application_api
2024-11-09 16:11:00 +00:00
/applications/v1/users/_dislike:
post:
consumes:
- application/json
description: 从用户的标签喜好中移除内容
parameters:
- description: UserLikePost
in: body
name: UserLikePost
required: true
schema:
$ref: '#/definitions/request.UserLikePost'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.ResponseBody'
- properties:
data:
$ref: '#/definitions/entity.Category'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.ResponseBody'
security:
- ApiKeyAuth: []
summary: Dislike
tags:
- application_api
/applications/v1/users/_like:
post:
consumes:
- application/json
description: 将标签附加到用户名
parameters:
- description: UserLikePost
in: body
name: UserLikePost
required: true
schema:
$ref: '#/definitions/request.UserLikePost'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.ResponseBody'
- properties:
data:
$ref: '#/definitions/entity.Category'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.ResponseBody'
security:
- ApiKeyAuth: []
summary: Like
tags:
- application_api
2024-11-06 10:47:56 +00:00
securityDefinitions:
ApiKeyAuth:
in: header
name: Authorization
type: apiKey
swagger: "2.0"