appcore_api/api.rs
1// =============================================================================
2// #######
3// ### ### F: api.rs
4// ## ## ## ## P: AppCore-Runtime
5// ## ##
6// C: 2026/05/31 13:38:42 by dnettoRaw
7// ## ## ## ## U: 2026/06/04 11:51:28 by dnettoRaw
8// ########### S: 0.6.0
9// =============================================================================
10
11//! Raw API request/response contracts.
12
13/// Supported API method kinds.
14#[derive(Debug, Clone, Copy, PartialEq, Eq)]
15pub enum ApiMethod {
16 /// Mutating or important command.
17 Command,
18 /// Side-effect-free query.
19 Query,
20 /// Runtime health probe.
21 Health,
22}
23
24/// Transport-neutral API request.
25#[derive(Debug, Clone, PartialEq, Eq)]
26pub struct ApiRequest {
27 /// Logical request method.
28 pub method: ApiMethod,
29 /// Transport-neutral endpoint or capability path.
30 pub path: String,
31 /// Opaque request bytes owned by the caller.
32 pub payload: Vec<u8>,
33}
34
35/// Transport-neutral API response.
36#[derive(Debug, Clone, PartialEq, Eq)]
37pub struct ApiResponse {
38 /// HTTP-compatible status code.
39 pub status_code: u16,
40 /// Opaque response bytes owned by the endpoint.
41 pub payload: Vec<u8>,
42}
43
44#[cfg(test)]
45#[path = "api_tests.rs"]
46mod tests;