netbox_openapi/models/
patched_user_request.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/// PatchedUserRequest : 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 PatchedUserRequest {
15    /// Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.
16    #[serde(rename = "username", skip_serializing_if = "Option::is_none")]
17    pub username: Option<String>,
18    #[serde(rename = "password", skip_serializing_if = "Option::is_none")]
19    pub password: Option<String>,
20    #[serde(rename = "first_name", skip_serializing_if = "Option::is_none")]
21    pub first_name: Option<String>,
22    #[serde(rename = "last_name", skip_serializing_if = "Option::is_none")]
23    pub last_name: Option<String>,
24    #[serde(rename = "email", skip_serializing_if = "Option::is_none")]
25    pub email: Option<String>,
26    /// Designates whether the user can log into this admin site.
27    #[serde(rename = "is_staff", skip_serializing_if = "Option::is_none")]
28    pub is_staff: Option<bool>,
29    /// Designates whether this user should be treated as active. Unselect this instead of deleting accounts.
30    #[serde(rename = "is_active", skip_serializing_if = "Option::is_none")]
31    pub is_active: Option<bool>,
32    #[serde(rename = "date_joined", skip_serializing_if = "Option::is_none")]
33    pub date_joined: Option<String>,
34    #[serde(
35        rename = "last_login",
36        default,
37        with = "::serde_with::rust::double_option",
38        skip_serializing_if = "Option::is_none"
39    )]
40    pub last_login: Option<Option<String>>,
41    #[serde(rename = "groups", skip_serializing_if = "Option::is_none")]
42    pub groups: Option<Vec<i32>>,
43    #[serde(rename = "permissions", skip_serializing_if = "Option::is_none")]
44    pub permissions: Option<Vec<i32>>,
45}
46
47impl PatchedUserRequest {
48    /// 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>)
49    pub fn new() -> PatchedUserRequest {
50        PatchedUserRequest {
51            username: None,
52            password: None,
53            first_name: None,
54            last_name: None,
55            email: None,
56            is_staff: None,
57            is_active: None,
58            date_joined: None,
59            last_login: None,
60            groups: None,
61            permissions: None,
62        }
63    }
64}