opusr-client/.claude/commands/add-endpoint.md

22 lines
784 B
Markdown
Raw Permalink Normal View History

Add a new DB2 REST endpoint to the project. For the given endpoint:
1. **Models**: Create/update structs in `src/models/`
- Raw struct with `#[serde(rename = "UPPERCASE")]` fields
- Normalized struct with idiomatic Rust names
- `From<Raw>` impl that trims strings and handles defaults
2. **Service method**: Add to `src/api/services.rs`
- Typed method on `OpusrServices`
- Correct positional parameters (P1, P2, ...)
- Map raw response to normalized types
3. **CLI command**: Add subcommand variant to `src/config/settings.rs`
- Implement handler in `main.rs`
- Support both JSON and table output
4. **Tests**: Write tests in `tests/`
- Mock server with `wiremock`
- Test success, empty result, error cases
5. Run `/qa-cycle` to validate everything