romm_cli/endpoints/mod.rs
1use serde_json::Value;
2
3pub mod collections;
4pub mod platforms;
5pub mod roms;
6
7/// Generic description of a ROMM API endpoint.
8pub trait Endpoint {
9 type Output;
10
11 /// HTTP method, e.g. "GET", "POST".
12 fn method(&self) -> &'static str;
13
14 /// Path relative to the base URL, e.g. "/api/roms".
15 fn path(&self) -> String;
16
17 /// Query parameters as key/value pairs.
18 fn query(&self) -> Vec<(String, String)> {
19 Vec::new()
20 }
21
22 /// Optional JSON request body.
23 fn body(&self) -> Option<Value> {
24 None
25 }
26}