authentik_rust/models/
event.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/// Event : Event Serializer
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct Event {
16    #[serde(rename = "pk")]
17    pub pk: uuid::Uuid,
18    #[serde(rename = "user", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
19    pub user: Option<Option<serde_json::Value>>,
20    #[serde(rename = "action")]
21    pub action: models::EventActions,
22    #[serde(rename = "app")]
23    pub app: String,
24    #[serde(rename = "context", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
25    pub context: Option<Option<serde_json::Value>>,
26    #[serde(rename = "client_ip", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
27    pub client_ip: Option<Option<String>>,
28    #[serde(rename = "created")]
29    pub created: String,
30    #[serde(rename = "expires", skip_serializing_if = "Option::is_none")]
31    pub expires: Option<String>,
32    #[serde(rename = "brand", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
33    pub brand: Option<Option<serde_json::Value>>,
34}
35
36impl Event {
37    /// Event Serializer
38    pub fn new(pk: uuid::Uuid, action: models::EventActions, app: String, created: String) -> Event {
39        Event {
40            pk,
41            user: None,
42            action,
43            app,
44            context: None,
45            client_ip: None,
46            created,
47            expires: None,
48            brand: None,
49        }
50    }
51}
52