bitwarden_vault/
domain.rs

1use bitwarden_core::require;
2use serde::{Deserialize, Serialize};
3
4use crate::VaultParseError;
5
6#[derive(Serialize, Deserialize, Debug)]
7pub struct GlobalDomains {
8    pub r#type: i32,
9    pub domains: Vec<String>,
10    pub excluded: bool,
11}
12
13impl TryFrom<bitwarden_api_api::models::GlobalDomains> for GlobalDomains {
14    type Error = VaultParseError;
15
16    fn try_from(
17        global_domains: bitwarden_api_api::models::GlobalDomains,
18    ) -> Result<Self, Self::Error> {
19        Ok(Self {
20            r#type: require!(global_domains.r#type),
21            domains: require!(global_domains.domains),
22            excluded: require!(global_domains.excluded),
23        })
24    }
25}