Skip to main content

romm_cli/endpoints/
platforms.rs

1use crate::types::Platform;
2
3use super::Endpoint;
4
5/// List all platforms.
6#[derive(Debug, Default, Clone)]
7pub struct ListPlatforms;
8
9impl Endpoint for ListPlatforms {
10    type Output = Vec<Platform>;
11
12    fn method(&self) -> &'static str {
13        "GET"
14    }
15
16    fn path(&self) -> String {
17        "/api/platforms".into()
18    }
19}
20
21/// Retrieve a platform by ID.
22#[derive(Debug, Clone)]
23pub struct GetPlatform {
24    pub id: u64,
25}
26
27impl Endpoint for GetPlatform {
28    type Output = Platform;
29
30    fn method(&self) -> &'static str {
31        "GET"
32    }
33
34    fn path(&self) -> String {
35        format!("/api/platforms/{}", self.id)
36    }
37}