Skip to main content

nautobot_openapi/models/
note.rs

1/*
2 * API Documentation
3 *
4 * Source of truth and network automation platform
5 *
6 * The version of the OpenAPI document: 3.1.0 (3.1)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// Note : This base serializer implements common fields and logic for all ModelSerializers.  Namely, it:  - defines the `display` field which exposes a human friendly value for the given object. - ensures that `id` field is always present on the serializer as well. - ensures that `created` and `last_updated` fields are always present if applicable to this model and serializer. - ensures that `object_type` field is always present on the serializer which represents the content-type of this   serializer's associated model (e.g. \"dcim.device\"). This is required as the OpenAPI schema, using the   PolymorphicProxySerializer class defined below, relies upon this field as a way to identify to the client   which of several possible serializers are in use for a given attribute. - supports `?depth` query parameter. It is passed in as `nested_depth` to the `build_nested_field()` function   to enable the dynamic generation of nested serializers.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct Note {
15    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
16    pub id: Option<uuid::Uuid>,
17    #[serde(rename = "object_type", skip_serializing_if = "Option::is_none")]
18    pub object_type: Option<String>,
19    /// Human friendly display value
20    #[serde(rename = "display", skip_serializing_if = "Option::is_none")]
21    pub display: Option<String>,
22    #[serde(rename = "url", skip_serializing_if = "Option::is_none")]
23    pub url: Option<String>,
24    #[serde(rename = "natural_slug", skip_serializing_if = "Option::is_none")]
25    pub natural_slug: Option<String>,
26    #[serde(rename = "assigned_object_type")]
27    pub assigned_object_type: String,
28    #[serde(
29        rename = "assigned_object",
30        default,
31        with = "::serde_with::rust::double_option",
32        skip_serializing_if = "Option::is_none"
33    )]
34    pub assigned_object: Option<Option<Box<crate::models::NoteAssignedObject>>>,
35    #[serde(rename = "assigned_object_id")]
36    pub assigned_object_id: uuid::Uuid,
37    #[serde(rename = "user_name", skip_serializing_if = "Option::is_none")]
38    pub user_name: Option<String>,
39    #[serde(rename = "note")]
40    pub note: String,
41    #[serde(
42        rename = "user",
43        default,
44        with = "::serde_with::rust::double_option",
45        skip_serializing_if = "Option::is_none"
46    )]
47    pub user: Option<Option<Box<crate::models::ApprovalWorkflowUser>>>,
48    #[serde(
49        rename = "created",
50        default,
51        with = "::serde_with::rust::double_option",
52        skip_serializing_if = "Option::is_none"
53    )]
54    pub created: Option<Option<String>>,
55    #[serde(
56        rename = "last_updated",
57        default,
58        with = "::serde_with::rust::double_option",
59        skip_serializing_if = "Option::is_none"
60    )]
61    pub last_updated: Option<Option<String>>,
62}
63
64impl Note {
65    /// This base serializer implements common fields and logic for all ModelSerializers.  Namely, it:  - defines the `display` field which exposes a human friendly value for the given object. - ensures that `id` field is always present on the serializer as well. - ensures that `created` and `last_updated` fields are always present if applicable to this model and serializer. - ensures that `object_type` field is always present on the serializer which represents the content-type of this   serializer's associated model (e.g. \"dcim.device\"). This is required as the OpenAPI schema, using the   PolymorphicProxySerializer class defined below, relies upon this field as a way to identify to the client   which of several possible serializers are in use for a given attribute. - supports `?depth` query parameter. It is passed in as `nested_depth` to the `build_nested_field()` function   to enable the dynamic generation of nested serializers.
66    pub fn new(assigned_object_type: String, assigned_object_id: uuid::Uuid, note: String) -> Note {
67        Note {
68            id: None,
69            object_type: None,
70            display: None,
71            url: None,
72            natural_slug: None,
73            assigned_object_type,
74            assigned_object: None,
75            assigned_object_id,
76            user_name: None,
77            note,
78            user: None,
79            created: None,
80            last_updated: None,
81        }
82    }
83}