bitwarden_api_api/models/
send_request_model.rs

1/*
2 * Bitwarden Internal API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: latest
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use serde::{Deserialize, Serialize};
12
13use crate::models;
14
15/// SendRequestModel : A send request issued by a Bitwarden client
16#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
17pub struct SendRequestModel {
18    #[serde(
19        rename = "type",
20        alias = "R#type",
21        skip_serializing_if = "Option::is_none"
22    )]
23    pub r#type: Option<models::SendType>,
24    #[serde(
25        rename = "authType",
26        alias = "AuthType",
27        skip_serializing_if = "Option::is_none"
28    )]
29    pub auth_type: Option<models::AuthType>,
30    /// Estimated length of the file accompanying the send. null when
31    /// Bit.Api.Tools.Models.Request.SendRequestModel.Type is Bit.Core.Tools.Enums.SendType.Text.
32    #[serde(
33        rename = "fileLength",
34        alias = "FileLength",
35        skip_serializing_if = "Option::is_none"
36    )]
37    pub file_length: Option<i64>,
38    /// Label for the send.
39    #[serde(
40        rename = "name",
41        alias = "Name",
42        skip_serializing_if = "Option::is_none"
43    )]
44    pub name: Option<String>,
45    /// Notes for the send. This is only visible to the owner of the send.
46    #[serde(
47        rename = "notes",
48        alias = "Notes",
49        skip_serializing_if = "Option::is_none"
50    )]
51    pub notes: Option<String>,
52    /// A base64-encoded byte array containing the Send's encryption key. This key is also provided
53    /// to send recipients in the Send's URL.
54    #[serde(rename = "key", alias = "Key")]
55    pub key: String,
56    /// The maximum number of times a send can be accessed before it expires. When this value is
57    /// null, there is no limit.
58    #[serde(
59        rename = "maxAccessCount",
60        alias = "MaxAccessCount",
61        skip_serializing_if = "Option::is_none"
62    )]
63    pub max_access_count: Option<i32>,
64    /// The date after which a send cannot be accessed. When this value is null, there is no
65    /// expiration date.
66    #[serde(
67        rename = "expirationDate",
68        alias = "ExpirationDate",
69        skip_serializing_if = "Option::is_none"
70    )]
71    pub expiration_date: Option<String>,
72    /// The date after which a send may be automatically deleted from the server. When this is
73    /// null, the send may be deleted after it has exceeded the global send timeout limit.
74    #[serde(rename = "deletionDate", alias = "DeletionDate")]
75    pub deletion_date: String,
76    #[serde(
77        rename = "file",
78        alias = "File",
79        skip_serializing_if = "Option::is_none"
80    )]
81    pub file: Option<Box<models::SendFileModel>>,
82    #[serde(
83        rename = "text",
84        alias = "Text",
85        skip_serializing_if = "Option::is_none"
86    )]
87    pub text: Option<Box<models::SendTextModel>>,
88    /// Base64-encoded byte array of a password hash that grants access to the send. Mutually
89    /// exclusive with Bit.Api.Tools.Models.Request.SendRequestModel.Emails.
90    #[serde(
91        rename = "password",
92        alias = "Password",
93        skip_serializing_if = "Option::is_none"
94    )]
95    pub password: Option<String>,
96    /// Comma-separated list of emails that may access the send using OTP authentication. Mutually
97    /// exclusive with Bit.Api.Tools.Models.Request.SendRequestModel.Password.
98    #[serde(
99        rename = "emails",
100        alias = "Emails",
101        skip_serializing_if = "Option::is_none"
102    )]
103    pub emails: Option<String>,
104    /// When true, send access is disabled. Defaults to false.
105    #[serde(rename = "disabled", alias = "Disabled")]
106    pub disabled: bool,
107    /// When true send access hides the user's email address and displays a confirmation message
108    /// instead. Defaults to false.
109    #[serde(
110        rename = "hideEmail",
111        alias = "HideEmail",
112        skip_serializing_if = "Option::is_none"
113    )]
114    pub hide_email: Option<bool>,
115}
116
117impl SendRequestModel {
118    /// A send request issued by a Bitwarden client
119    pub fn new(key: String, deletion_date: String, disabled: bool) -> SendRequestModel {
120        SendRequestModel {
121            r#type: None,
122            auth_type: None,
123            file_length: None,
124            name: None,
125            notes: None,
126            key,
127            max_access_count: None,
128            expiration_date: None,
129            deletion_date,
130            file: None,
131            text: None,
132            password: None,
133            emails: None,
134            disabled,
135            hide_email: None,
136        }
137    }
138}