Skip to main content

bitwarden_api_api/models/
sso_jit_provision_finish_trusted_device_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/// SsoJitProvisionFinishTrustedDeviceRequestModel : Combines the bodies of `POST accounts/keys`,
16/// `PUT organizations/{orgId}/users/{userId}/reset-password-enrollment` and `PUT
17/// devices/{identifier}/keys` for a trusted device encryption SSO JIT user.
18#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
19pub struct SsoJitProvisionFinishTrustedDeviceRequestModel {
20    #[serde(rename = "keys", alias = "Keys")]
21    pub keys: Box<models::KeysRequestModel>,
22    #[serde(rename = "organizationId", alias = "OrganizationId")]
23    pub organization_id: uuid::Uuid,
24    /// The user key encapsulated by the organization's public key. Required when
25    /// Bit.Api.Auth.Models.Request.SsoJitProvisionFinish.
26    /// SsoJitProvisionFinishTrustedDeviceRequestModel.AcceptOrganizationInvite is true; ignored
27    /// otherwise. For now, this is tied to
28    /// Bit.Api.Auth.Models.Request.SsoJitProvisionFinish.
29    /// SsoJitProvisionFinishTrustedDeviceRequestModel.AcceptOrganizationInvite.
30    #[serde(
31        rename = "accountRecoveryKey",
32        alias = "AccountRecoveryKey",
33        skip_serializing_if = "Option::is_none"
34    )]
35    pub account_recovery_key: Option<String>,
36    #[serde(
37        rename = "deviceKeys",
38        alias = "DeviceKeys",
39        skip_serializing_if = "Option::is_none"
40    )]
41    pub device_keys: Option<Box<models::DeviceKeysRequestModel>>,
42    /// True moves the pending organization membership to Accepted and enrolls in account recovery.
43    /// False leaves it Invited (open-invite links). The C# `required` modifier makes
44    /// System.Text.Json reject a body without it. For now, account recovery enrollment is tied to
45    /// this flag.
46    #[serde(
47        rename = "acceptOrganizationInvite",
48        alias = "AcceptOrganizationInvite"
49    )]
50    pub accept_organization_invite: bool,
51}
52
53impl SsoJitProvisionFinishTrustedDeviceRequestModel {
54    /// Combines the bodies of `POST accounts/keys`, `PUT
55    /// organizations/{orgId}/users/{userId}/reset-password-enrollment` and `PUT
56    /// devices/{identifier}/keys` for a trusted device encryption SSO JIT user.
57    pub fn new(
58        keys: models::KeysRequestModel,
59        organization_id: uuid::Uuid,
60        accept_organization_invite: bool,
61    ) -> SsoJitProvisionFinishTrustedDeviceRequestModel {
62        SsoJitProvisionFinishTrustedDeviceRequestModel {
63            keys: Box::new(keys),
64            organization_id,
65            account_recovery_key: None,
66            device_keys: None,
67            accept_organization_invite,
68        }
69    }
70}