sl4f_lib/component/
types.rs1use serde::{Deserialize, Serialize};
6
7pub enum ComponentMethod {
8 Launch,
9 List,
10 Search,
11}
12
13impl std::str::FromStr for ComponentMethod {
14 type Err = anyhow::Error;
15 fn from_str(method: &str) -> Result<Self, Self::Err> {
16 match method {
17 "Launch" => Ok(ComponentMethod::Launch),
18 "List" => Ok(ComponentMethod::List),
19 "Search" => Ok(ComponentMethod::Search),
20 _ => return Err(format_err!("Invalid Component Facade method: {}", method)),
21 }
22 }
23}
24
25#[derive(Deserialize, Debug)]
26pub struct ComponentSearchRequest {
27 pub name: Option<String>,
28}
29
30#[derive(Serialize, Deserialize, Debug)]
31pub enum ComponentSearchResult {
32 Success,
33 NotFound,
34}
35
36#[derive(Deserialize, Debug)]
37pub struct ComponentLaunchRequest {
38 pub url: Option<String>,
39 pub arguments: Option<Vec<String>>,
40 pub wait_until_stop: bool,
41}
42
43#[derive(Serialize, Deserialize, Debug)]
44pub enum ComponentLaunchResponse {
45 Success,
46 Fail(i64),
47}