Skip to main content

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