Skip to main content

nominal_api/conjure/objects/scout/savedviews/api/
create_saved_view_request.rs

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    conjure_object::private::DeriveWith
7)]
8#[serde(crate = "conjure_object::serde")]
9#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
10#[conjure_object::private::staged_builder::staged_builder]
11#[builder(crate = conjure_object::private::staged_builder, update, inline)]
12pub struct CreateSavedViewRequest {
13    #[builder(into)]
14    #[serde(rename = "title")]
15    title: String,
16    #[builder(
17        default,
18        custom(
19            type = impl
20            Into<Option<super::super::super::api::Symbol>>,
21            convert = |v|v.into().map(Box::new)
22        )
23    )]
24    #[serde(rename = "symbol", skip_serializing_if = "Option::is_none", default)]
25    symbol: Option<Box<super::super::super::api::Symbol>>,
26    #[builder(
27        default,
28        custom(
29            type = impl
30            Into<Option<super::super::super::api::Color>>,
31            convert = |v|v.into().map(Box::new)
32        )
33    )]
34    #[serde(rename = "color", skip_serializing_if = "Option::is_none", default)]
35    color: Option<Box<super::super::super::api::Color>>,
36    #[builder(custom(type = super::SearchState, convert = Box::new))]
37    #[serde(rename = "searchState")]
38    search_state: Box<super::SearchState>,
39    #[builder(custom(type = super::DisplayState, convert = Box::new))]
40    #[serde(rename = "displayState")]
41    display_state: Box<super::DisplayState>,
42    #[builder(default, into)]
43    #[serde(rename = "workspaceRid", skip_serializing_if = "Option::is_none", default)]
44    workspace_rid: Option<super::super::super::super::api::rids::WorkspaceRid>,
45}
46impl CreateSavedViewRequest {
47    /// Constructs a new instance of the type.
48    #[inline]
49    pub fn new(
50        title: impl Into<String>,
51        search_state: super::SearchState,
52        display_state: super::DisplayState,
53    ) -> Self {
54        Self::builder()
55            .title(title)
56            .search_state(search_state)
57            .display_state(display_state)
58            .build()
59    }
60    #[inline]
61    pub fn title(&self) -> &str {
62        &*self.title
63    }
64    #[inline]
65    pub fn symbol(&self) -> Option<&super::super::super::api::Symbol> {
66        self.symbol.as_ref().map(|o| &**o)
67    }
68    #[inline]
69    pub fn color(&self) -> Option<&super::super::super::api::Color> {
70        self.color.as_ref().map(|o| &**o)
71    }
72    #[inline]
73    pub fn search_state(&self) -> &super::SearchState {
74        &*self.search_state
75    }
76    #[inline]
77    pub fn display_state(&self) -> &super::DisplayState {
78        &*self.display_state
79    }
80    #[inline]
81    pub fn workspace_rid(
82        &self,
83    ) -> Option<&super::super::super::super::api::rids::WorkspaceRid> {
84        self.workspace_rid.as_ref().map(|o| &*o)
85    }
86}