feat
This commit is contained in:
40
.kilo/command/new-api.md
Normal file
40
.kilo/command/new-api.md
Normal file
@@ -0,0 +1,40 @@
|
||||
# /new-api Command
|
||||
|
||||
Create a new API module with standard interfaces and functions.
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
/new-api <module-name> [base-path]
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
- `module-name`: The API module name (e.g., `url-device`, `server`, `alert`)
|
||||
- `base-path`: Optional API base path (defaults to `/DC-Control/v1/{module-name}`)
|
||||
|
||||
## What This Command Does
|
||||
|
||||
1. Creates API file: `src/api/ops/{module-name}.ts`
|
||||
|
||||
2. Generates standard interfaces:
|
||||
- `{Module}Item` - Single item type
|
||||
- `{Module}ListResponse` - List response type
|
||||
- `{Module}ListParams` - Query parameters
|
||||
- `{Module}CreateData` - Create payload
|
||||
- `{Module}UpdateData` - Update payload
|
||||
|
||||
3. Generates standard functions:
|
||||
- `fetch{Module}List` - GET list with pagination
|
||||
- `fetch{Module}Detail` - GET single item
|
||||
- `create{Module}` - POST create
|
||||
- `update{Module}` - PUT update
|
||||
- `delete{Module}` - DELETE remove
|
||||
|
||||
## Example
|
||||
|
||||
```
|
||||
/new-api alert-template /Alert/v1/templates
|
||||
```
|
||||
|
||||
Creates `src/api/ops/alert-template.ts` with full CRUD API functions.
|
||||
Reference in New Issue
Block a user