feat: complete mobile app function specifications and API documentation
- Add comprehensive function specifications for 5 core mobile app features: * 01_情境對話功能規格.md - Situational dialogue system * 02_詞彙學習功能規格.md - Vocabulary learning system * 03_學習地圖功能規格.md - Learning map and progress system * 04_道具商店功能規格.md - In-app store and items system * 05_用戶認證功能規格.md - User authentication system - Add swagger-ui.html with complete API documentation and testing interface - Include detailed UI specifications, business logic, and integration requirements - Establish foundation for mobile app development 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
d31340a05a
commit
d44cfe511a
|
|
@ -0,0 +1,434 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-TW">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Drama Ling API Documentation</title>
|
||||
<link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@4.15.5/swagger-ui.css" />
|
||||
<style>
|
||||
html {
|
||||
box-sizing: border-box;
|
||||
overflow: -moz-scrollbars-vertical;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
*, *:before, *:after {
|
||||
box-sizing: inherit;
|
||||
}
|
||||
body {
|
||||
margin:0;
|
||||
background: #fafafa;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="swagger-ui"></div>
|
||||
<script src="https://unpkg.com/swagger-ui-dist@4.15.5/swagger-ui-bundle.js"></script>
|
||||
<script src="https://unpkg.com/swagger-ui-dist@4.15.5/swagger-ui-standalone-preset.js"></script>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
const ui = SwaggerUIBundle({
|
||||
url: 'data:application/json;charset=utf-8,' + encodeURIComponent(JSON.stringify({
|
||||
"openapi": "3.0.1",
|
||||
"info": {
|
||||
"title": "Drama Ling API",
|
||||
"description": "API for Drama Ling language learning application",
|
||||
"contact": {
|
||||
"name": "Drama Ling Team",
|
||||
"email": "dev@dramaling.com"
|
||||
},
|
||||
"version": "v1"
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://api.dramaling.com",
|
||||
"description": "Production server"
|
||||
},
|
||||
{
|
||||
"url": "https://localhost:5001",
|
||||
"description": "Development server"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/api/v1/auth/register": {
|
||||
"post": {
|
||||
"tags": ["Authentication"],
|
||||
"summary": "用戶註冊",
|
||||
"description": "創建新用戶帳號",
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string",
|
||||
"format": "email",
|
||||
"example": "test@example.com"
|
||||
},
|
||||
"password": {
|
||||
"type": "string",
|
||||
"minLength": 8,
|
||||
"example": "Test123456"
|
||||
},
|
||||
"username": {
|
||||
"type": "string",
|
||||
"minLength": 3,
|
||||
"maxLength": 20,
|
||||
"example": "testuser"
|
||||
},
|
||||
"preferredLanguage": {
|
||||
"type": "string",
|
||||
"example": "en"
|
||||
},
|
||||
"nativeLanguage": {
|
||||
"type": "string",
|
||||
"example": "zh-TW"
|
||||
}
|
||||
},
|
||||
"required": ["email", "password", "username"]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "註冊成功",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/AuthResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "驗證錯誤",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/auth/login": {
|
||||
"post": {
|
||||
"tags": ["Authentication"],
|
||||
"summary": "用戶登入",
|
||||
"description": "使用email和密碼登入",
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string",
|
||||
"format": "email",
|
||||
"example": "test@example.com"
|
||||
},
|
||||
"password": {
|
||||
"type": "string",
|
||||
"example": "Test123456"
|
||||
},
|
||||
"rememberMe": {
|
||||
"type": "boolean",
|
||||
"example": true
|
||||
}
|
||||
},
|
||||
"required": ["email", "password"]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "登入成功",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/AuthResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "認證失敗",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/auth/refresh": {
|
||||
"post": {
|
||||
"tags": ["Authentication"],
|
||||
"summary": "刷新Token",
|
||||
"description": "使用refresh token獲取新的access token",
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Token刷新成功",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"success": {"type": "boolean"},
|
||||
"data": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"accessToken": {"type": "string"},
|
||||
"refreshToken": {"type": "string"},
|
||||
"expiresIn": {"type": "integer"},
|
||||
"tokenType": {"type": "string", "example": "Bearer"}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/auth/logout": {
|
||||
"post": {
|
||||
"tags": ["Authentication"],
|
||||
"summary": "用戶登出",
|
||||
"description": "登出並將token加入黑名單",
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "登出成功",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"success": {"type": "boolean"},
|
||||
"data": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"loggedOut": {"type": "boolean"},
|
||||
"tokenBlacklisted": {"type": "boolean"}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/auth/apple": {
|
||||
"post": {
|
||||
"tags": ["Authentication"],
|
||||
"summary": "Apple ID登入",
|
||||
"description": "使用Apple ID進行第三方登入",
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"identityToken": {"type": "string"},
|
||||
"authorizationCode": {"type": "string"},
|
||||
"userIdentifier": {"type": "string"},
|
||||
"email": {"type": "string"},
|
||||
"fullName": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"givenName": {"type": "string"},
|
||||
"familyName": {"type": "string"}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Apple登入成功",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/AuthResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/auth/google": {
|
||||
"post": {
|
||||
"tags": ["Authentication"],
|
||||
"summary": "Google登入",
|
||||
"description": "使用Google進行第三方登入",
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"idToken": {"type": "string"},
|
||||
"accessToken": {"type": "string"},
|
||||
"serverAuthCode": {"type": "string"}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Google登入成功",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/AuthResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/health": {
|
||||
"get": {
|
||||
"tags": ["Health"],
|
||||
"summary": "健康檢查",
|
||||
"description": "檢查服務健康狀態",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "服務正常",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Status": {"type": "string", "example": "Healthy"},
|
||||
"Timestamp": {"type": "string", "format": "date-time"},
|
||||
"Version": {"type": "string", "example": "1.0.0"},
|
||||
"Service": {"type": "string", "example": "Drama Ling API"}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/health/detailed": {
|
||||
"get": {
|
||||
"tags": ["Health"],
|
||||
"summary": "詳細健康檢查",
|
||||
"description": "取得詳細的系統健康資訊",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "詳細健康資訊",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Status": {"type": "string"},
|
||||
"Environment": {"type": "string"},
|
||||
"Database": {"type": "string"},
|
||||
"Cache": {"type": "string"},
|
||||
"Memory": {"type": "object"}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
"securitySchemes": {
|
||||
"Bearer": {
|
||||
"type": "http",
|
||||
"scheme": "bearer",
|
||||
"bearerFormat": "JWT",
|
||||
"description": "JWT Authorization header using the Bearer scheme. Example: \"Bearer {token}\""
|
||||
}
|
||||
},
|
||||
"schemas": {
|
||||
"AuthResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"success": {"type": "boolean"},
|
||||
"data": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"userId": {"type": "string", "format": "uuid"},
|
||||
"username": {"type": "string"},
|
||||
"email": {"type": "string"},
|
||||
"accessToken": {"type": "string"},
|
||||
"refreshToken": {"type": "string"},
|
||||
"expiresIn": {"type": "integer"},
|
||||
"userRole": {"type": "string", "enum": ["user", "subscriber", "admin"]},
|
||||
"subscriptionStatus": {"type": "string", "enum": ["active", "inactive", "trial"]},
|
||||
"isNewUser": {"type": "boolean"}
|
||||
}
|
||||
},
|
||||
"message": {"type": "string"}
|
||||
}
|
||||
},
|
||||
"ErrorResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"success": {"type": "boolean", "example": false},
|
||||
"error": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {"type": "string"},
|
||||
"message": {"type": "string"},
|
||||
"details": {"type": "object"}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})),
|
||||
dom_id: '#swagger-ui',
|
||||
deepLinking: true,
|
||||
presets: [
|
||||
SwaggerUIBundle.presets.apis,
|
||||
SwaggerUIStandalonePreset
|
||||
],
|
||||
plugins: [
|
||||
SwaggerUIBundle.plugins.DownloadUrl
|
||||
],
|
||||
layout: "StandaloneLayout",
|
||||
tryItOutEnabled: true,
|
||||
supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'],
|
||||
onComplete: function() {
|
||||
console.log("Swagger UI loaded");
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in New Issue