bitwarden-api-api 3.0.0

Api bindings for the Bitwarden API.
Documentation
/*
 * Bitwarden Internal API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: latest
 *
 * Generated by: https://openapi-generator.tech
 */

use serde::{Deserialize, Serialize};

use crate::models;

/// SendWithIdRequestModel : A send request issued by a Bitwarden client
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct SendWithIdRequestModel {
    #[serde(
        rename = "type",
        alias = "R#type",
        skip_serializing_if = "Option::is_none"
    )]
    pub r#type: Option<models::SendType>,
    #[serde(
        rename = "authType",
        alias = "AuthType",
        skip_serializing_if = "Option::is_none"
    )]
    pub auth_type: Option<models::AuthType>,
    /// Estimated length of the file accompanying the send. null when
    /// Bit.Api.Tools.Models.Request.SendRequestModel.Type is Bit.Core.Tools.Enums.SendType.Text.
    #[serde(
        rename = "fileLength",
        alias = "FileLength",
        skip_serializing_if = "Option::is_none"
    )]
    pub file_length: Option<i64>,
    /// Label for the send.
    #[serde(
        rename = "name",
        alias = "Name",
        skip_serializing_if = "Option::is_none"
    )]
    pub name: Option<String>,
    /// Notes for the send. This is only visible to the owner of the send.
    #[serde(
        rename = "notes",
        alias = "Notes",
        skip_serializing_if = "Option::is_none"
    )]
    pub notes: Option<String>,
    /// A base64-encoded byte array containing the Send's encryption key. This key is also provided
    /// to send recipients in the Send's URL.
    #[serde(rename = "key", alias = "Key")]
    pub key: String,
    /// The maximum number of times a send can be accessed before it expires. When this value is
    /// null, there is no limit.
    #[serde(
        rename = "maxAccessCount",
        alias = "MaxAccessCount",
        skip_serializing_if = "Option::is_none"
    )]
    pub max_access_count: Option<i32>,
    /// The date after which a send cannot be accessed. When this value is null, there is no
    /// expiration date.
    #[serde(
        rename = "expirationDate",
        alias = "ExpirationDate",
        skip_serializing_if = "Option::is_none"
    )]
    pub expiration_date: Option<String>,
    /// The date after which a send may be automatically deleted from the server. The server
    /// enforces a maximum of 31 days from creation. A background job deletes sends once this date
    /// has passed.
    #[serde(rename = "deletionDate", alias = "DeletionDate")]
    pub deletion_date: String,
    #[serde(
        rename = "file",
        alias = "File",
        skip_serializing_if = "Option::is_none"
    )]
    pub file: Option<Box<models::SendFileModel>>,
    #[serde(
        rename = "text",
        alias = "Text",
        skip_serializing_if = "Option::is_none"
    )]
    pub text: Option<Box<models::SendTextModel>>,
    /// Base64-encoded byte array of a password hash that grants access to the send. Mutually
    /// exclusive with Bit.Api.Tools.Models.Request.SendRequestModel.Emails.
    #[serde(
        rename = "password",
        alias = "Password",
        skip_serializing_if = "Option::is_none"
    )]
    pub password: Option<String>,
    /// Comma-separated list of emails that may access the send using OTP authentication. Mutually
    /// exclusive with Bit.Api.Tools.Models.Request.SendRequestModel.Password.
    #[serde(
        rename = "emails",
        alias = "Emails",
        skip_serializing_if = "Option::is_none"
    )]
    pub emails: Option<String>,
    /// When true, send access is disabled. Defaults to false.
    #[serde(rename = "disabled", alias = "Disabled")]
    pub disabled: bool,
    /// When true send access hides the user's email address and displays a confirmation message
    /// instead. Defaults to false.
    #[serde(
        rename = "hideEmail",
        alias = "HideEmail",
        skip_serializing_if = "Option::is_none"
    )]
    pub hide_email: Option<bool>,
    /// Identifies the send. When this is null, the client is requesting a new send.
    #[serde(rename = "id", alias = "Id")]
    pub id: uuid::Uuid,
}

impl SendWithIdRequestModel {
    /// A send request issued by a Bitwarden client
    pub fn new(
        key: String,
        deletion_date: String,
        disabled: bool,
        id: uuid::Uuid,
    ) -> SendWithIdRequestModel {
        SendWithIdRequestModel {
            r#type: None,
            auth_type: None,
            file_length: None,
            name: None,
            notes: None,
            key,
            max_access_count: None,
            expiration_date: None,
            deletion_date,
            file: None,
            text: None,
            password: None,
            emails: None,
            disabled,
            hide_email: None,
            id,
        }
    }
}