Skip to main content

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. The server
73    /// enforces a maximum of 31 days from creation. A background job deletes sends once this date
74    /// has passed.
75    #[serde(rename = "deletionDate", alias = "DeletionDate")]
76    pub deletion_date: String,
77    #[serde(
78        rename = "file",
79        alias = "File",
80        skip_serializing_if = "Option::is_none"
81    )]
82    pub file: Option<Box<models::SendFileModel>>,
83    #[serde(
84        rename = "text",
85        alias = "Text",
86        skip_serializing_if = "Option::is_none"
87    )]
88    pub text: Option<Box<models::SendTextModel>>,
89    /// String containing secret Send data
90    #[serde(
91        rename = "data",
92        alias = "Data",
93        skip_serializing_if = "Option::is_none"
94    )]
95    pub data: Option<String>,
96    /// Base64-encoded byte array of a password hash that grants access to the send. Mutually
97    /// exclusive with Bit.Api.Tools.Models.Request.SendRequestModel.Emails.
98    #[serde(
99        rename = "password",
100        alias = "Password",
101        skip_serializing_if = "Option::is_none"
102    )]
103    pub password: Option<String>,
104    /// Comma-separated list of emails that may access the send using OTP authentication. Mutually
105    /// exclusive with Bit.Api.Tools.Models.Request.SendRequestModel.Password.
106    #[serde(
107        rename = "emails",
108        alias = "Emails",
109        skip_serializing_if = "Option::is_none"
110    )]
111    pub emails: Option<String>,
112    /// When true, send access is disabled. Defaults to false.
113    #[serde(rename = "disabled", alias = "Disabled")]
114    pub disabled: bool,
115    /// When true send access hides the user's email address and displays a confirmation message
116    /// instead. Defaults to false.
117    #[serde(
118        rename = "hideEmail",
119        alias = "HideEmail",
120        skip_serializing_if = "Option::is_none"
121    )]
122    pub hide_email: Option<bool>,
123}
124
125impl SendRequestModel {
126    /// A send request issued by a Bitwarden client
127    pub fn new(key: String, deletion_date: String, disabled: bool) -> SendRequestModel {
128        SendRequestModel {
129            r#type: None,
130            auth_type: None,
131            file_length: None,
132            name: None,
133            notes: None,
134            key,
135            max_access_count: None,
136            expiration_date: None,
137            deletion_date,
138            file: None,
139            text: None,
140            data: None,
141            password: None,
142            emails: None,
143            disabled,
144            hide_email: None,
145        }
146    }
147}