reactive_graph/client/instances/flows/args/
search.rs

1use crate::client::types::entities::args::parse_entity_ty;
2use clap::Args;
3use reactive_graph_client::client::instances::flows::variables::search::variables::SearchFlowInstancesVariables;
4use reactive_graph_graph::EntityTypeId;
5use reactive_graph_graph::NamespacedTypeGetter;
6use uuid::Uuid;
7
8/// CLI argument for searching entity instances.
9#[derive(Args, Debug, Clone)]
10pub(crate) struct SearchFlowInstancesArgs {
11    /// The fully qualified namespace of the entity type.
12    #[clap(long, name = "entity_type", value_parser = parse_entity_ty)]
13    pub entity_ty: Option<EntityTypeId>,
14
15    /// The id of the entity instance.
16    #[clap(short, long)]
17    pub id: Option<Uuid>,
18
19    /// The label of the entity instance.
20    #[clap(short, long)]
21    pub label: Option<String>,
22}
23
24// impl SearchFlowInstancesArgs {}
25//
26impl From<&SearchFlowInstancesArgs> for SearchFlowInstancesVariables {
27    fn from(args: &SearchFlowInstancesArgs) -> Self {
28        SearchFlowInstancesVariables {
29            _type: args.entity_ty.clone().map(|relation_ty| relation_ty.namespace().to_string()),
30            id: args.id.map(From::from),
31            label: args.label.clone(),
32        }
33        // let ty: Option<reactive_graph_graph::EntityTypeId> = search.ty.clone().into();
34        // SearchFlowInstancesVariables::builder()
35        //     .ty(ty.map(From::from))
36        //     .id(search.id.map(From::from))
37        //     .label(search.label.clone())
38        //     .build()
39    }
40}