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    #[serde(
90        rename = "data",
91        alias = "Data",
92        skip_serializing_if = "Option::is_none"
93    )]
94    pub data: Option<Box<models::SendDataModel>>,
95    /// Base64-encoded byte array of a password hash that grants access to the send. Mutually
96    /// exclusive with Bit.Api.Tools.Models.Request.SendRequestModel.Emails.
97    #[serde(
98        rename = "password",
99        alias = "Password",
100        skip_serializing_if = "Option::is_none"
101    )]
102    pub password: Option<String>,
103    /// Comma-separated list of emails that may access the send using OTP authentication. Mutually
104    /// exclusive with Bit.Api.Tools.Models.Request.SendRequestModel.Password.
105    #[serde(
106        rename = "emails",
107        alias = "Emails",
108        skip_serializing_if = "Option::is_none"
109    )]
110    pub emails: Option<String>,
111    /// When true, send access is disabled. Defaults to false.
112    #[serde(rename = "disabled", alias = "Disabled")]
113    pub disabled: bool,
114    /// When true send access hides the user's email address and displays a confirmation message
115    /// instead. Defaults to false.
116    #[serde(
117        rename = "hideEmail",
118        alias = "HideEmail",
119        skip_serializing_if = "Option::is_none"
120    )]
121    pub hide_email: Option<bool>,
122}
123
124impl SendRequestModel {
125    /// A send request issued by a Bitwarden client
126    pub fn new(key: String, deletion_date: String, disabled: bool) -> SendRequestModel {
127        SendRequestModel {
128            r#type: None,
129            auth_type: None,
130            file_length: None,
131            name: None,
132            notes: None,
133            key,
134            max_access_count: None,
135            expiration_date: None,
136            deletion_date,
137            file: None,
138            text: None,
139            data: None,
140            password: None,
141            emails: None,
142            disabled,
143            hide_email: None,
144        }
145    }
146}