use super::TestRun;
use crate::framework::endpoint::{HerokuEndpoint, Method};
pub struct TestRunUpdate<'a> {
pub run_id: &'a str,
pub params: TestRunUpdateParams<'a>,
}
#[cfg(feature = "builder")]
impl<'a> TestRunUpdate<'a> {
pub fn new(run_id: &'a str, message: Option<&'a str>, status: &'a str) -> TestRunUpdate<'a> {
TestRunUpdate {
run_id,
params: TestRunUpdateParams { message, status },
}
}
}
#[derive(Serialize, Clone, Debug)]
pub struct TestRunUpdateParams<'a> {
pub message: Option<&'a str>,
pub status: &'a str,
}
impl<'a> HerokuEndpoint<TestRun, (), TestRunUpdateParams<'a>> for TestRunUpdate<'a> {
fn method(&self) -> Method {
Method::Post
}
fn path(&self) -> String {
format!("test-runs/{}", self.run_id)
}
fn body(&self) -> Option<TestRunUpdateParams<'a>> {
Some(self.params.clone())
}
}