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.4.2-Docker-3.4.1 (4.4)
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(
43        rename = "created",
44        default,
45        with = "::serde_with::rust::double_option",
46        skip_serializing_if = "Option::is_none"
47    )]
48    pub created: Option<Option<String>>,
49    #[serde(
50        rename = "last_updated",
51        default,
52        with = "::serde_with::rust::double_option",
53        skip_serializing_if = "Option::is_none"
54    )]
55    pub last_updated: Option<Option<String>>,
56}
57
58impl ImageAttachment {
59    /// 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>)
60    pub fn new(object_type: String, object_id: i64, image: String) -> ImageAttachment {
61        ImageAttachment {
62            id: None,
63            url: None,
64            display: None,
65            object_type,
66            object_id,
67            parent: None,
68            name: None,
69            image,
70            description: None,
71            image_height: None,
72            image_width: None,
73            created: None,
74            last_updated: None,
75        }
76    }
77}