Setting up basic API Structure

This commit is contained in:
2026-08-28 14:54:54 +02:00
parent 968228cbc3
commit b3a13cd5a2
18 changed files with 974 additions and 0 deletions
@@ -0,0 +1,24 @@
import 'package:ac_web/Api/ApiClient.dart';
/// Base class for every service that maps onto one backend controller.
///
/// Adding support for a new controller means:
/// 1. create the dtos under `Api/Dtos`
/// 2. create a `<Name>Service extends ApiServiceBase` with `controllerRoute`
/// 3. expose it as a lazy getter on [AcApi]
abstract class ApiServiceBase {
const ApiServiceBase(this.client);
final ApiClient client;
/// Route of the controller without leading slash, e.g. `agents`.
String get controllerRoute;
/// Combines the controller route with an optional relative sub path.
String route([String? subPath]) {
if (subPath == null || subPath.isEmpty) {
return controllerRoute;
}
return '$controllerRoute/$subPath';
}
}