Skip to main content

romm_cli/endpoints/
mod.rs

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