authentik_rust/models/
invitation.rs

1/*
2 * authentik
3 *
4 * Making authentication simple.
5 *
6 * The version of the OpenAPI document: 2024.2.1
7 * Contact: hello@goauthentik.io
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12
13/// Invitation : Invitation Serializer
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct Invitation {
16    #[serde(rename = "pk")]
17    pub pk: uuid::Uuid,
18    #[serde(rename = "name")]
19    pub name: String,
20    #[serde(rename = "expires", skip_serializing_if = "Option::is_none")]
21    pub expires: Option<String>,
22    #[serde(rename = "fixed_data", skip_serializing_if = "Option::is_none")]
23    pub fixed_data: Option<std::collections::HashMap<String, serde_json::Value>>,
24    #[serde(rename = "created_by")]
25    pub created_by: Box<models::GroupMember>,
26    /// When enabled, the invitation will be deleted after usage.
27    #[serde(rename = "single_use", skip_serializing_if = "Option::is_none")]
28    pub single_use: Option<bool>,
29    /// When set, only the configured flow can use this invitation.
30    #[serde(rename = "flow", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
31    pub flow: Option<Option<uuid::Uuid>>,
32    #[serde(rename = "flow_obj")]
33    pub flow_obj: Box<models::Flow>,
34}
35
36impl Invitation {
37    /// Invitation Serializer
38    pub fn new(pk: uuid::Uuid, name: String, created_by: models::GroupMember, flow_obj: models::Flow) -> Invitation {
39        Invitation {
40            pk,
41            name,
42            expires: None,
43            fixed_data: None,
44            created_by: Box::new(created_by),
45            single_use: None,
46            flow: None,
47            flow_obj: Box::new(flow_obj),
48        }
49    }
50}
51