Skip to main content

nautobot_openapi/models/
image_attachment_request.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/// ImageAttachmentRequest : 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 ImageAttachmentRequest {
15    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
16    pub id: Option<uuid::Uuid>,
17    #[serde(rename = "content_type")]
18    pub content_type: String,
19    #[serde(rename = "object_id")]
20    pub object_id: uuid::Uuid,
21    #[serde(rename = "image")]
22    pub image: std::path::PathBuf,
23    #[serde(rename = "image_height")]
24    pub image_height: i32,
25    #[serde(rename = "image_width")]
26    pub image_width: i32,
27    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
28    pub name: Option<String>,
29}
30
31impl ImageAttachmentRequest {
32    /// 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>)
33    pub fn new(
34        content_type: String,
35        object_id: uuid::Uuid,
36        image: std::path::PathBuf,
37        image_height: i32,
38        image_width: i32,
39    ) -> ImageAttachmentRequest {
40        ImageAttachmentRequest {
41            id: None,
42            content_type,
43            object_id,
44            image,
45            image_height,
46            image_width,
47            name: None,
48        }
49    }
50}