bitwarden_sm/projects/
get.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use bitwarden_core::{client::Client, Error};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use uuid::Uuid;

use super::ProjectResponse;

#[derive(Serialize, Deserialize, Debug, JsonSchema)]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct ProjectGetRequest {
    /// ID of the project to retrieve
    pub id: Uuid,
}

pub(crate) async fn get_project(
    client: &Client,
    input: &ProjectGetRequest,
) -> Result<ProjectResponse, Error> {
    let config = client.internal.get_api_configurations().await;

    let res = bitwarden_api_api::apis::projects_api::projects_id_get(&config.api, input.id).await?;

    let enc = client.internal.get_encryption_settings()?;

    ProjectResponse::process_response(res, &enc)
}