1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
* NetBox REST API
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 4.6.2 (4.6)
*
* Generated by: https://openapi-generator.tech
*/
/// UserRequest : 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>)
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct UserRequest {
/// Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.
#[serde(rename = "username")]
pub username: String,
#[serde(rename = "password")]
pub password: String,
#[serde(rename = "first_name", skip_serializing_if = "Option::is_none")]
pub first_name: Option<String>,
#[serde(rename = "last_name", skip_serializing_if = "Option::is_none")]
pub last_name: Option<String>,
#[serde(rename = "email", skip_serializing_if = "Option::is_none")]
pub email: Option<String>,
/// Designates whether this user should be treated as active. Unselect this instead of deleting accounts.
#[serde(rename = "is_active", skip_serializing_if = "Option::is_none")]
pub is_active: Option<bool>,
#[serde(rename = "date_joined", skip_serializing_if = "Option::is_none")]
pub date_joined: Option<String>,
#[serde(
rename = "last_login",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub last_login: Option<Option<String>>,
#[serde(rename = "groups", skip_serializing_if = "Option::is_none")]
pub groups: Option<Vec<i32>>,
#[serde(rename = "permissions", skip_serializing_if = "Option::is_none")]
pub permissions: Option<Vec<i32>>,
}
impl UserRequest {
/// 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>)
pub fn new(username: String, password: String) -> UserRequest {
UserRequest {
username,
password,
first_name: None,
last_name: None,
email: None,
is_active: None,
date_joined: None,
last_login: None,
groups: None,
permissions: None,
}
}
}