Skip to main content

nominal_api/conjure/objects/authorization/
get_user_orgs_request.rs

1/// We use the claims in the id + access token to determine which orgs the user belongs to.
2#[derive(
3    Debug,
4    Clone,
5    conjure_object::serde::Serialize,
6    conjure_object::serde::Deserialize,
7    PartialEq,
8    Eq,
9    PartialOrd,
10    Ord,
11    Hash
12)]
13#[serde(crate = "conjure_object::serde")]
14#[conjure_object::private::staged_builder::staged_builder]
15#[builder(crate = conjure_object::private::staged_builder, update, inline)]
16pub struct GetUserOrgsRequest {
17    #[builder(into)]
18    #[serde(rename = "idToken")]
19    id_token: String,
20    #[builder(default, into)]
21    #[serde(rename = "accessToken", skip_serializing_if = "Option::is_none", default)]
22    access_token: Option<String>,
23}
24impl GetUserOrgsRequest {
25    /// Constructs a new instance of the type.
26    #[inline]
27    pub fn new(id_token: impl Into<String>) -> Self {
28        Self::builder().id_token(id_token).build()
29    }
30    #[inline]
31    pub fn id_token(&self) -> &str {
32        &*self.id_token
33    }
34    #[inline]
35    pub fn access_token(&self) -> Option<&str> {
36        self.access_token.as_ref().map(|o| &**o)
37    }
38}