Skip to main content

netbox_openapi/models/
image_attachment.rs

1/*
2 * NetBox REST API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 4.6.8 (4.6)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// ImageAttachment : Extends the built-in ModelSerializer to enforce calling full_clean() on a copy of the associated instance during validation. (DRF does not do this by default; see <https://github.com/encode/django-rest-framework/issues/3144>)
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct ImageAttachment {
15    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
16    pub id: Option<i32>,
17    #[serde(rename = "url", skip_serializing_if = "Option::is_none")]
18    pub url: Option<String>,
19    #[serde(rename = "display", skip_serializing_if = "Option::is_none")]
20    pub display: Option<String>,
21    #[serde(rename = "object_type")]
22    pub object_type: String,
23    #[serde(rename = "object_id")]
24    pub object_id: i64,
25    #[serde(
26        rename = "parent",
27        default,
28        with = "::serde_with::rust::double_option",
29        skip_serializing_if = "Option::is_none"
30    )]
31    pub parent: Option<Option<serde_json::Value>>,
32    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
33    pub name: Option<String>,
34    #[serde(rename = "image")]
35    pub image: String,
36    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
37    pub description: Option<String>,
38    #[serde(rename = "image_height", skip_serializing_if = "Option::is_none")]
39    pub image_height: Option<i32>,
40    #[serde(rename = "image_width", skip_serializing_if = "Option::is_none")]
41    pub image_width: Option<i32>,
42    #[serde(rename = "image_size", skip_serializing_if = "Option::is_none")]
43    pub image_size: Option<i32>,
44    #[serde(
45        rename = "created",
46        default,
47        with = "::serde_with::rust::double_option",
48        skip_serializing_if = "Option::is_none"
49    )]
50    pub created: Option<Option<String>>,
51    #[serde(
52        rename = "last_updated",
53        default,
54        with = "::serde_with::rust::double_option",
55        skip_serializing_if = "Option::is_none"
56    )]
57    pub last_updated: Option<Option<String>>,
58}
59
60impl ImageAttachment {
61    /// Extends the built-in ModelSerializer to enforce calling full_clean() on a copy of the associated instance during validation. (DRF does not do this by default; see <https://github.com/encode/django-rest-framework/issues/3144>)
62    pub fn new(object_type: String, object_id: i64, image: String) -> ImageAttachment {
63        ImageAttachment {
64            id: None,
65            url: None,
66            display: None,
67            object_type,
68            object_id,
69            parent: None,
70            name: None,
71            image,
72            description: None,
73            image_height: None,
74            image_width: None,
75            image_size: None,
76            created: None,
77            last_updated: None,
78        }
79    }
80}