netbox_openapi/models/
token.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/// Token : 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 Token {
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_url", skip_serializing_if = "Option::is_none")]
20    pub display_url: Option<String>,
21    #[serde(rename = "display", skip_serializing_if = "Option::is_none")]
22    pub display: Option<String>,
23    #[serde(rename = "user")]
24    pub user: Box<crate::models::BriefUser>,
25    #[serde(rename = "created", skip_serializing_if = "Option::is_none")]
26    pub created: Option<String>,
27    #[serde(
28        rename = "expires",
29        default,
30        with = "::serde_with::rust::double_option",
31        skip_serializing_if = "Option::is_none"
32    )]
33    pub expires: Option<Option<String>>,
34    #[serde(
35        rename = "last_used",
36        default,
37        with = "::serde_with::rust::double_option",
38        skip_serializing_if = "Option::is_none"
39    )]
40    pub last_used: Option<Option<String>>,
41    /// Permit create/update/delete operations using this key
42    #[serde(rename = "write_enabled", skip_serializing_if = "Option::is_none")]
43    pub write_enabled: Option<bool>,
44    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
45    pub description: Option<String>,
46}
47
48impl Token {
49    /// 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>)
50    pub fn new(user: crate::models::BriefUser) -> Token {
51        Token {
52            id: None,
53            url: None,
54            display_url: None,
55            display: None,
56            user: Box::new(user),
57            created: None,
58            expires: None,
59            last_used: None,
60            write_enabled: None,
61            description: None,
62        }
63    }
64}