Files
juwan-backend/desc/api/docs/notification-api.json

307 lines
6.2 KiB
JSON

{
"swagger": "2.0",
"info": {
"title": "聚玩通知服务",
"description": "管理站内消息通知。ID 字段(int64)以 string 传输",
"version": "1.0"
},
"schemes": [
"http",
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/api/v1/notifications": {
"get": {
"summary": "获取通知列表",
"operationId": "ListNotifications",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/NotificationListResp"
}
}
},
"parameters": [
{
"name": "offset",
"in": "query",
"required": true,
"type": "integer",
"format": "int64",
"default": "0"
},
{
"name": "limit",
"in": "query",
"required": true,
"type": "integer",
"format": "int64",
"default": "20"
}
],
"tags": [
"notification"
],
"consumes": [
"multipart/form-data"
]
}
},
"/api/v1/notifications/read-all": {
"put": {
"summary": "全部已读",
"operationId": "ReadAllNotifications",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/EmptyResp"
}
}
},
"parameters": [
{
"name": "body",
"description": " 空响应",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/EmptyResp"
}
}
],
"tags": [
"notification"
]
}
},
"/api/v1/notifications/{id}/read": {
"put": {
"summary": "标记已读",
"operationId": "ReadNotification",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/EmptyResp"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/PathId"
}
}
],
"tags": [
"notification"
]
}
}
},
"definitions": {
"EmptyResp": {
"type": "object",
"title": "EmptyResp"
},
"Notification": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"type": {
"type": "string"
},
"title": {
"type": "string"
},
"content": {
"type": "string"
},
"read": {
"type": "boolean",
"format": "boolean"
},
"link": {
"type": "string"
},
"createdAt": {
"type": "string"
}
},
"title": "Notification",
"required": [
"id",
"type",
"title",
"content",
"read",
"createdAt"
]
},
"NotificationListResp": {
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/Notification"
}
},
"meta": {
"$ref": "#/definitions/PageMeta"
}
},
"title": "NotificationListResp",
"required": [
"items",
"meta"
]
},
"PageMeta": {
"type": "object",
"properties": {
"total": {
"type": "integer",
"format": "int64"
},
"offset": {
"type": "integer",
"format": "int64"
},
"limit": {
"type": "integer",
"format": "int64"
}
},
"title": "PageMeta",
"required": [
"total",
"offset",
"limit"
]
},
"PageReq": {
"type": "object",
"properties": {
"offset": {
"type": "integer",
"format": "int64",
"default": "0"
},
"limit": {
"type": "integer",
"format": "int64",
"default": "20"
}
},
"title": "PageReq",
"required": [
"offset",
"limit"
]
},
"PathId": {
"type": "object",
"title": "PathId"
},
"SimpleUser": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"nickname": {
"type": "string"
},
"avatar": {
"type": "string"
}
},
"title": "SimpleUser",
"required": [
"id",
"nickname",
"avatar"
]
},
"UserProfile": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"username": {
"type": "string"
},
"nickname": {
"type": "string"
},
"avatar": {
"type": "string"
},
"role": {
"type": "string",
"description": " consumer, player, owner, admin"
},
"verifiedRoles": {
"type": "array",
"items": {
"type": "string"
}
},
"verificationStatus": {
"type": "object"
},
"phone": {
"type": "string"
},
"bio": {
"type": "string"
},
"createdAt": {
"type": "string"
}
},
"title": "UserProfile",
"required": [
"id",
"username",
"nickname",
"avatar",
"role",
"verifiedRoles",
"verificationStatus",
"createdAt"
]
}
},
"securityDefinitions": {
"apiKey": {
"type": "apiKey",
"description": "Enter JWT Bearer token **_only_**",
"name": "Authorization",
"in": "header"
}
}
}