/*
* API Documentation
*
* Source of truth and network automation platform
*
* The version of the OpenAPI document: 3.1.0 (3.1)
*
* Generated by: https://openapi-generator.tech
*/
/// 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.
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct Note {
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
pub id: Option<uuid::Uuid>,
#[serde(rename = "object_type", skip_serializing_if = "Option::is_none")]
pub object_type: Option<String>,
/// Human friendly display value
#[serde(rename = "display", skip_serializing_if = "Option::is_none")]
pub display: Option<String>,
#[serde(rename = "url", skip_serializing_if = "Option::is_none")]
pub url: Option<String>,
#[serde(rename = "natural_slug", skip_serializing_if = "Option::is_none")]
pub natural_slug: Option<String>,
#[serde(rename = "assigned_object_type")]
pub assigned_object_type: String,
#[serde(
rename = "assigned_object",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub assigned_object: Option<Option<Box<crate::models::NoteAssignedObject>>>,
#[serde(rename = "assigned_object_id")]
pub assigned_object_id: uuid::Uuid,
#[serde(rename = "user_name", skip_serializing_if = "Option::is_none")]
pub user_name: Option<String>,
#[serde(rename = "note")]
pub note: String,
#[serde(
rename = "user",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub user: Option<Option<Box<crate::models::ApprovalWorkflowUser>>>,
#[serde(
rename = "created",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub created: Option<Option<String>>,
#[serde(
rename = "last_updated",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub last_updated: Option<Option<String>>,
}
impl 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.
pub fn new(assigned_object_type: String, assigned_object_id: uuid::Uuid, note: String) -> Note {
Note {
id: None,
object_type: None,
display: None,
url: None,
natural_slug: None,
assigned_object_type,
assigned_object: None,
assigned_object_id,
user_name: None,
note,
user: None,
created: None,
last_updated: None,
}
}
}