use crate::types::Platform;
use super::Endpoint;
use serde_json::Value;
#[derive(Debug, Default, Clone)]
pub struct ListPlatforms;
impl Endpoint for ListPlatforms {
type Output = Vec<Platform>;
fn method(&self) -> &'static str {
"GET"
}
fn path(&self) -> String {
"/api/platforms".into()
}
}
#[derive(Debug, Clone)]
pub struct GetPlatform {
pub id: u64,
}
impl Endpoint for GetPlatform {
type Output = Platform;
fn method(&self) -> &'static str {
"GET"
}
fn path(&self) -> String {
format!("/api/platforms/{}", self.id)
}
}
#[derive(Debug, Default, Clone)]
pub struct ListSupportedPlatforms;
impl Endpoint for ListSupportedPlatforms {
type Output = Value;
fn method(&self) -> &'static str {
"GET"
}
fn path(&self) -> String {
"/api/platforms/supported".into()
}
}
#[derive(Debug, Clone)]
pub struct PutPlatform {
pub id: u64,
pub body: Value,
}
impl Endpoint for PutPlatform {
type Output = Value;
fn method(&self) -> &'static str {
"PUT"
}
fn path(&self) -> String {
format!("/api/platforms/{}", self.id)
}
fn body(&self) -> Option<Value> {
Some(self.body.clone())
}
}
#[derive(Debug, Clone)]
pub struct DeletePlatform {
pub id: u64,
}
impl Endpoint for DeletePlatform {
type Output = Value;
fn method(&self) -> &'static str {
"DELETE"
}
fn path(&self) -> String {
format!("/api/platforms/{}", self.id)
}
}