Skip to content

Commit

Permalink
Explore annotating required response fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Hinton committed Feb 9, 2024
1 parent 6882a20 commit 4aae352
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 26 deletions.
31 changes: 18 additions & 13 deletions crates/bitwarden-api-api/src/models/base_secret_response_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,40 @@
pub struct BaseSecretResponseModel {
#[serde(rename = "object", skip_serializing_if = "Option::is_none")]
pub object: Option<String>,
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
pub id: Option<uuid::Uuid>,
#[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")]
pub organization_id: Option<uuid::Uuid>,
#[serde(rename = "id")]
pub id: uuid::Uuid,
#[serde(rename = "organizationId")]
pub organization_id: uuid::Uuid,
#[serde(rename = "key", skip_serializing_if = "Option::is_none")]
pub key: Option<String>,
#[serde(rename = "value", skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
#[serde(rename = "note", skip_serializing_if = "Option::is_none")]
pub note: Option<String>,
#[serde(rename = "creationDate", skip_serializing_if = "Option::is_none")]
pub creation_date: Option<String>,
#[serde(rename = "revisionDate", skip_serializing_if = "Option::is_none")]
pub revision_date: Option<String>,
#[serde(rename = "creationDate")]
pub creation_date: String,
#[serde(rename = "revisionDate")]
pub revision_date: String,
#[serde(rename = "projects", skip_serializing_if = "Option::is_none")]
pub projects: Option<Vec<crate::models::SecretResponseInnerProject>>,
}

impl BaseSecretResponseModel {
pub fn new() -> BaseSecretResponseModel {
pub fn new(
id: uuid::Uuid,
organization_id: uuid::Uuid,
creation_date: String,
revision_date: String,
) -> BaseSecretResponseModel {
BaseSecretResponseModel {
object: None,
id: None,
organization_id: None,
id,
organization_id,
key: None,
value: None,
note: None,
creation_date: None,
revision_date: None,
creation_date,
revision_date,
projects: None,
}
}
Expand Down
31 changes: 18 additions & 13 deletions crates/bitwarden-api-api/src/models/secret_response_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@
pub struct SecretResponseModel {
#[serde(rename = "object", skip_serializing_if = "Option::is_none")]
pub object: Option<String>,
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
pub id: Option<uuid::Uuid>,
#[serde(rename = "organizationId", skip_serializing_if = "Option::is_none")]
pub organization_id: Option<uuid::Uuid>,
#[serde(rename = "id")]
pub id: uuid::Uuid,
#[serde(rename = "organizationId")]
pub organization_id: uuid::Uuid,
#[serde(rename = "key", skip_serializing_if = "Option::is_none")]
pub key: Option<String>,
#[serde(rename = "value", skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
#[serde(rename = "note", skip_serializing_if = "Option::is_none")]
pub note: Option<String>,
#[serde(rename = "creationDate", skip_serializing_if = "Option::is_none")]
pub creation_date: Option<String>,
#[serde(rename = "revisionDate", skip_serializing_if = "Option::is_none")]
pub revision_date: Option<String>,
#[serde(rename = "creationDate")]
pub creation_date: String,
#[serde(rename = "revisionDate")]
pub revision_date: String,
#[serde(rename = "projects", skip_serializing_if = "Option::is_none")]
pub projects: Option<Vec<crate::models::SecretResponseInnerProject>>,
#[serde(rename = "read", skip_serializing_if = "Option::is_none")]
Expand All @@ -35,16 +35,21 @@ pub struct SecretResponseModel {
}

impl SecretResponseModel {
pub fn new() -> SecretResponseModel {
pub fn new(
id: uuid::Uuid,
organization_id: uuid::Uuid,
creation_date: String,
revision_date: String,
) -> SecretResponseModel {
SecretResponseModel {
object: None,
id: None,
organization_id: None,
id,
organization_id,
key: None,
value: None,
note: None,
creation_date: None,
revision_date: None,
creation_date,
revision_date,
projects: None,
read: None,
write: None,
Expand Down

0 comments on commit 4aae352

Please sign in to comment.