nile_client_rs/models/
instance_event.rs

1/*
2 * Nile API
3 *
4 * Making SaaS chill.
5 *
6 * The version of the OpenAPI document: 0.1.0-fdd7cd5
7 * Contact: support@thenile.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
12pub struct InstanceEvent {
13    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
14    pub id: Option<i32>,
15    #[serde(rename = "event_type", skip_serializing_if = "Option::is_none")]
16    pub event_type: Option<EventType>,
17    #[serde(rename = "before", skip_serializing_if = "Option::is_none")]
18    pub before: Option<Box<crate::models::Instance>>,
19    #[serde(rename = "after", skip_serializing_if = "Option::is_none")]
20    pub after: Option<Box<crate::models::Instance>>,
21    /// The id of the organization that the instance of this event belongs to
22    #[serde(rename = "org", skip_serializing_if = "Option::is_none")]
23    pub org: Option<String>,
24    #[serde(rename = "timestamp")]
25    pub timestamp: String,
26}
27
28impl InstanceEvent {
29    pub fn new(timestamp: String) -> InstanceEvent {
30        InstanceEvent {
31            id: None,
32            event_type: None,
33            before: None,
34            after: None,
35            org: None,
36            timestamp,
37        }
38    }
39}
40
41///
42#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
43pub enum EventType {
44    #[serde(rename = "CREATE")]
45    Create,
46    #[serde(rename = "UPDATE")]
47    Update,
48    #[serde(rename = "DELETE")]
49    Delete,
50}
51
52impl Default for EventType {
53    fn default() -> EventType {
54        Self::Create
55    }
56}
57
58use serde::{Deserialize, Serialize};