Add API documentation in English and Chinese

Co-authored-by: krau <71133316+krau@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-01-19 04:44:20 +00:00
parent ac10c32215
commit 2f6b2470a4
3 changed files with 550 additions and 0 deletions

26
api/README.md Normal file
View File

@@ -0,0 +1,26 @@
# API Module
This module provides a RESTful HTTP API for programmatic file downloads from Telegram.
## Features
- **RESTful API endpoints** for creating, querying, and canceling download tasks
- **Bearer token authentication** for API access control
- **IP whitelist** support for additional security
- **Webhook callbacks** for task completion notifications
- **Task status tracking** (queued, running, completed, failed, canceled)
- **Graceful shutdown** with proper cleanup
## Usage
See the full documentation at:
- English: `/docs/content/en/usage/api.md`
- Chinese: `/docs/content/zh/usage/api.md`
## Architecture
- `server.go` - HTTP server initialization and route registration
- `handlers.go` - API endpoint handlers and business logic
- `middleware.go` - Authentication and logging middleware
The API integrates with the existing task queue system and uses the bot's Telegram client to fetch messages.