Swagger Room加入TcpSocketClient Swagger room 加入 設備註冊,設備開關 Swagger room 有異動需要寫記錄 20250519
509 lines
19 KiB
JSON
509 lines
19 KiB
JSON
{
|
||
"openapi": "3.0.0",
|
||
"info": {
|
||
"title": "My API",
|
||
"description": "API documentation using L5 Swagger",
|
||
"version": "1.0.0"
|
||
},
|
||
"servers": [
|
||
{
|
||
"url": "https://KTV.test/",
|
||
"description": "API Server"
|
||
}
|
||
],
|
||
"paths": {
|
||
"/api/artists/search": {
|
||
"get": {
|
||
"tags": [
|
||
"Artist"
|
||
],
|
||
"summary": "搜尋藝人名稱",
|
||
"operationId": "f96ef111c1fadd6241138fd9840bf697",
|
||
"parameters": [
|
||
{
|
||
"name": "search",
|
||
"in": "query",
|
||
"description": "關鍵字搜尋藝人名稱",
|
||
"required": false,
|
||
"schema": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
{
|
||
"name": "selected",
|
||
"in": "query",
|
||
"description": "已選擇藝人 ID 陣列",
|
||
"required": false,
|
||
"schema": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "integer"
|
||
}
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "搜尋結果"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/profile": {
|
||
"get": {
|
||
"tags": [
|
||
"Auth"
|
||
],
|
||
"summary": "Get current user profile",
|
||
"operationId": "d32e56b6274eb68e980da6d91fbe9fd8",
|
||
"parameters": [
|
||
{
|
||
"name": "Accept",
|
||
"in": "header",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"default": "application/json"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "User profile",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/components/schemas/ApiResponse"
|
||
},
|
||
{
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/components/schemas/User"
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"description": "Unauthorized",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/components/schemas/ApiResponse"
|
||
},
|
||
{
|
||
"properties": {
|
||
"code": {
|
||
"type": "string",
|
||
"example": "UNAUTHORIZED"
|
||
},
|
||
"message": {
|
||
"type": "string",
|
||
"example": "Unauthorized"
|
||
},
|
||
"data": {
|
||
"type": "null"
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"security": [
|
||
{
|
||
"Authorization": []
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"/api/room/receiveRegister": {
|
||
"post": {
|
||
"tags": [
|
||
"Room Control"
|
||
],
|
||
"summary": "包廂註冊控制指令",
|
||
"description": "依據傳入的 branch_id 與 room_name,知道過來的設備來之於那個IP設備。",
|
||
"operationId": "registerRoomCommand",
|
||
"parameters": [
|
||
{
|
||
"name": "Accept",
|
||
"in": "header",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"default": "application/json"
|
||
}
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/ReceiveRoomRegisterRequest"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功傳送指令並回傳 TCP 回應",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/components/schemas/ApiResponse"
|
||
},
|
||
{
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/components/schemas/Room"
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"description": "Unauthorized",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/components/schemas/ApiResponse"
|
||
},
|
||
{
|
||
"properties": {
|
||
"code": {
|
||
"type": "string",
|
||
"example": "UNAUTHORIZED"
|
||
},
|
||
"message": {
|
||
"type": "string",
|
||
"example": "Unauthorized"
|
||
},
|
||
"data": {
|
||
"type": "null"
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"security": [
|
||
{
|
||
"Authorization": []
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"/api/room/sendSwitch": {
|
||
"post": {
|
||
"tags": [
|
||
"Room Control"
|
||
],
|
||
"summary": "送出包廂控制指令",
|
||
"description": "依據傳入的 room_id 與 command,透過 TCP 傳送對應指令給包廂電腦。",
|
||
"operationId": "sendRoomSwitchCommand",
|
||
"parameters": [
|
||
{
|
||
"name": "Accept",
|
||
"in": "header",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"default": "application/json"
|
||
}
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/SendRoomSwitchCommandRequest"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功傳送指令並回傳 TCP 回應",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/components/schemas/ApiResponse"
|
||
},
|
||
{
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/components/schemas/Room"
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"description": "Unauthorized",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/components/schemas/ApiResponse"
|
||
},
|
||
{
|
||
"properties": {
|
||
"code": {
|
||
"type": "string",
|
||
"example": "UNAUTHORIZED"
|
||
},
|
||
"message": {
|
||
"type": "string",
|
||
"example": "Unauthorized"
|
||
},
|
||
"data": {
|
||
"type": "null"
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"security": [
|
||
{
|
||
"Authorization": []
|
||
}
|
||
]
|
||
}
|
||
}
|
||
},
|
||
"components": {
|
||
"schemas": {
|
||
"RoomStatus": {
|
||
"type": "string",
|
||
"enum": [
|
||
"active",
|
||
"closed",
|
||
"fire",
|
||
"error",
|
||
"maintenance"
|
||
],
|
||
"example": "error"
|
||
},
|
||
"UserGender": {
|
||
"type": "string",
|
||
"enum": [
|
||
"male",
|
||
"female",
|
||
"other",
|
||
"unset"
|
||
],
|
||
"example": "male"
|
||
},
|
||
"UserStatus": {
|
||
"description": "User status: 0=Active, 1=Suspended, 2=Deleting",
|
||
"type": "string",
|
||
"enum": [
|
||
"Active",
|
||
"Suspended",
|
||
"Deleting"
|
||
],
|
||
"example": "0"
|
||
},
|
||
"ReceiveRoomRegisterRequest": {
|
||
"required": [
|
||
"branch_id",
|
||
"room_id",
|
||
"ip"
|
||
],
|
||
"properties": {
|
||
"branch_id": {
|
||
"type": "integer",
|
||
"example": "5"
|
||
},
|
||
"room_name": {
|
||
"type": "string",
|
||
"example": "pc102"
|
||
},
|
||
"ip": {
|
||
"type": "string",
|
||
"example": "192.168.x.x"
|
||
}
|
||
},
|
||
"type": "object"
|
||
},
|
||
"SendRoomSwitchCommandRequest": {
|
||
"required": [
|
||
"room_id",
|
||
"command"
|
||
],
|
||
"properties": {
|
||
"branch_id": {
|
||
"type": "integer",
|
||
"example": "5"
|
||
},
|
||
"room_name": {
|
||
"type": "string",
|
||
"example": "pc102"
|
||
},
|
||
"command": {
|
||
"type": "string",
|
||
"enum": [
|
||
"active",
|
||
"closed",
|
||
"maintenance"
|
||
],
|
||
"example": "active"
|
||
},
|
||
"started_at": {
|
||
"type": "string",
|
||
"example": "2025-05-19 09:31:00",
|
||
"nullable": true
|
||
},
|
||
"ended_at": {
|
||
"type": "string",
|
||
"example": "2025-05-19 09:31:00",
|
||
"nullable": true
|
||
}
|
||
},
|
||
"type": "object"
|
||
},
|
||
"ApiResponse": {
|
||
"properties": {
|
||
"code": {
|
||
"type": "string",
|
||
"example": "OK"
|
||
},
|
||
"message": {
|
||
"type": "string",
|
||
"example": "Success"
|
||
},
|
||
"data": {
|
||
"type": "object",
|
||
"nullable": true
|
||
}
|
||
},
|
||
"type": "object"
|
||
},
|
||
"Room": {
|
||
"properties": {
|
||
"id": {
|
||
"type": "integer",
|
||
"example": 16
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"example": "pc102"
|
||
},
|
||
"internal_ip": {
|
||
"type": "string",
|
||
"example": "192.168.11.7"
|
||
},
|
||
"port": {
|
||
"type": "integer",
|
||
"example": "9000"
|
||
},
|
||
"status": {
|
||
"$ref": "#/components/schemas/RoomStatus"
|
||
},
|
||
"started_at": {
|
||
"type": "string",
|
||
"format": "date-time",
|
||
"example": "2025-05-11T16:00:00.000000Z"
|
||
},
|
||
"ended_at": {
|
||
"type": "string",
|
||
"format": "date-time",
|
||
"example": null
|
||
}
|
||
},
|
||
"type": "object"
|
||
},
|
||
"User": {
|
||
"properties": {
|
||
"id": {
|
||
"type": "integer",
|
||
"example": 1
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"example": "John Doe"
|
||
},
|
||
"email": {
|
||
"type": "string",
|
||
"example": "john@example.com"
|
||
},
|
||
"phone": {
|
||
"type": "string",
|
||
"example": "0900000000"
|
||
},
|
||
"birthday": {
|
||
"type": "string",
|
||
"format": "date-time",
|
||
"example": "2025-05-11T16:00:00.000000Z"
|
||
},
|
||
"gender": {
|
||
"$ref": "#/components/schemas/UserGender"
|
||
},
|
||
"status": {
|
||
"$ref": "#/components/schemas/UserStatus"
|
||
}
|
||
},
|
||
"type": "object"
|
||
}
|
||
},
|
||
"securitySchemes": {
|
||
"Authorization": {
|
||
"type": "http",
|
||
"bearerFormat": "JWT",
|
||
"scheme": "bearer"
|
||
}
|
||
}
|
||
},
|
||
"tags": [
|
||
{
|
||
"name": "Artist",
|
||
"description": "藝人資料搜尋"
|
||
},
|
||
{
|
||
"name": "Auth",
|
||
"description": "包廂控制"
|
||
},
|
||
{
|
||
"name": "Room Control",
|
||
"description": "Room Control"
|
||
}
|
||
]
|
||
} |