Summary
Add core infrastructure for the API plugin to act as a clean delegation wrapper to Abilities API. This transforms the API plugin from containing business logic to being a pure interface layer.
Current State
- API plugin contains 60+ REST routes with embedded business logic
- No Abilities API integration for delegation
- Direct function calls to other plugins throughout route handlers
Proposed Changes
- Add request/response transformation utilities between REST ↔ Abilities API
- Create helper functions for converting REST params to ability inputs
- Add error handling and response formatting for ability delegation
- Add ability discovery and validation utilities
- Maintain backward compatibility for existing REST endpoints
Technical Details
- New file:
inc/core/ability-delegation.php with transformation utilities
- Helper functions:
extrachill_api_rest_to_ability_input(), extrachill_api_ability_to_rest_response()
- Error mapping: Convert ability errors to appropriate HTTP status codes
- Input validation: Transform REST args to JSON schema validation
Success Criteria
- All existing REST endpoints continue to work unchanged
- Infrastructure ready to delegate to abilities as they become available
- Clean separation between interface (API) and implementation (plugin abilities)
Implementation Notes
- This is infrastructure only - no route conversions yet
- Test with mock abilities to ensure delegation pipeline works
- Document the delegation pattern for future route conversions
Summary
Add core infrastructure for the API plugin to act as a clean delegation wrapper to Abilities API. This transforms the API plugin from containing business logic to being a pure interface layer.
Current State
Proposed Changes
Technical Details
inc/core/ability-delegation.phpwith transformation utilitiesextrachill_api_rest_to_ability_input(),extrachill_api_ability_to_rest_response()Success Criteria
Implementation Notes