Rewrite to chatty but functional API.

This commit is contained in:
2025-06-14 22:16:13 +02:00
parent d1832bc794
commit db6f55bc47
20 changed files with 423 additions and 175 deletions

View File

@@ -0,0 +1,34 @@
use std::fmt::Display;
use async_trait::async_trait;
use gamenight_api_client_rs::{apis::default_api::join_post, models::GamenightId};
use uuid::Uuid;
use super::{Flow, FlowOutcome, FlowResult, GamenightState};
#[derive(Clone)]
pub struct Join {
gamenight_id: Uuid
}
impl Join {
pub fn new(gamenight_id: Uuid) -> Self {
Self {
gamenight_id
}
}
}
#[async_trait]
impl<'a> Flow<'a> for Join {
async fn run(&self, state: &'a mut GamenightState) -> FlowResult<'a> {
let _ = join_post(&state.configuration, Some(GamenightId{gamenight_id: self.gamenight_id.to_string()})).await?;
Ok((FlowOutcome::Successful, state))
}
}
impl Display for Join {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "Join")
}
}