Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions crates/bitwarden-api-api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[package]
name = "bitwarden-api-api"
description = "Api bindings for the Bitwarden API."
categories = ["api-bindings"]

version.workspace = true
Expand All @@ -13,14 +12,10 @@ license-file.workspace = true
keywords.workspace = true

[dependencies]
reqwest = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
serde_repr = { workspace = true }
serde_with = { version = ">=3.8, <4", default-features = false, features = [
"base64",
"std",
"macros",
] }
url = ">=2.5, <3"
uuid = { workspace = true }
serde = { version = "^1.0", features = ["derive"] }
serde_with = { version = "^3.8", default-features = false, features = ["base64", "std", "macros"] }
serde_json = "^1.0"
serde_repr = "^0.1"
url = "^2.5"
uuid = { version = "^1.8", features = ["serde", "v4"] }
reqwest = { version = "^0.12", default-features = false, features = ["json", "multipart", "http2"] }
1 change: 1 addition & 0 deletions crates/bitwarden-api-api/src/apis/accounts_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ pub async fn accounts_api_key(
}
}

/// This operation is defined on: [`https://github.com/bitwarden/server/blob/22420f595f2f50dd2fc0061743841285258aed22/src/Api/Auth/Controllers/AccountsController.cs#L435`]
pub async fn accounts_delete(
configuration: &configuration::Configuration,
secret_verification_request_model: Option<models::SecretVerificationRequestModel>,
Expand Down
1 change: 1 addition & 0 deletions crates/bitwarden-api-api/src/apis/auth_requests_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ pub async fn auth_requests_get_response(
}
}

/// This operation is defined on: [`https://github.com/bitwarden/server/blob/22420f595f2f50dd2fc0061743841285258aed22/src/Api/Auth/Controllers/AuthRequestsController.cs#L83`]
pub async fn auth_requests_post(
configuration: &configuration::Configuration,
auth_request_create_request_model: Option<models::AuthRequestCreateRequestModel>,
Expand Down
1 change: 1 addition & 0 deletions crates/bitwarden-api-api/src/apis/ciphers_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,7 @@ pub async fn ciphers_delete_many_admin(
}
}

/// This operation is defined on: [`https://github.com/bitwarden/server/blob/22420f595f2f50dd2fc0061743841285258aed22/src/Api/Vault/Controllers/CiphersController.cs#L129`]
pub async fn ciphers_get(
configuration: &configuration::Configuration,
id: uuid::Uuid,
Expand Down
1 change: 1 addition & 0 deletions crates/bitwarden-api-api/src/apis/devices_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ pub async fn devices_get_device_keys(
}
}

/// This operation is defined on: [`https://github.com/bitwarden/server/blob/22420f595f2f50dd2fc0061743841285258aed22/src/Api/Controllers/DevicesController.cs#L93`]
pub async fn devices_post(
configuration: &configuration::Configuration,
device_request_model: Option<models::DeviceRequestModel>,
Expand Down
2 changes: 2 additions & 0 deletions crates/bitwarden-api-api/src/apis/folders_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ pub async fn folders_delete_all(
}
}

/// This operation is defined on: [`https://github.com/bitwarden/server/blob/22420f595f2f50dd2fc0061743841285258aed22/src/Api/Vault/Controllers/FoldersController.cs#L49`]
pub async fn folders_get(
configuration: &configuration::Configuration,
id: &str,
Expand Down Expand Up @@ -236,6 +237,7 @@ pub async fn folders_get_all(
}
}

/// This operation is defined on: [`https://github.com/bitwarden/server/blob/22420f595f2f50dd2fc0061743841285258aed22/src/Api/Vault/Controllers/FoldersController.cs#L58`]
pub async fn folders_post(
configuration: &configuration::Configuration,
folder_request_model: Option<models::FolderRequestModel>,
Expand Down
1 change: 1 addition & 0 deletions crates/bitwarden-api-api/src/apis/installations_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ pub async fn installations_get(
}
}

/// This operation is defined on: [`https://github.com/bitwarden/server/blob/22420f595f2f50dd2fc0061743841285258aed22/src/Api/Platform/Installations/Controllers/InstallationsController.cs#L46`]
pub async fn installations_post(
configuration: &configuration::Configuration,
installation_request_model: Option<models::InstallationRequestModel>,
Expand Down
1 change: 1 addition & 0 deletions crates/bitwarden-api-api/src/apis/organizations_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,7 @@ pub async fn organizations_leave(
}
}

/// This operation is defined on: [`https://github.com/bitwarden/server/blob/22420f595f2f50dd2fc0061743841285258aed22/src/Api/AdminConsole/Controllers/OrganizationsController.cs#L198`]
pub async fn organizations_post(
configuration: &configuration::Configuration,
organization_create_request_model: Option<models::OrganizationCreateRequestModel>,
Expand Down
1 change: 1 addition & 0 deletions crates/bitwarden-api-api/src/apis/plans_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub enum PlansGetError {
UnknownValue(serde_json::Value),
}

/// This operation is defined on: [`https://github.com/bitwarden/server/blob/22420f595f2f50dd2fc0061743841285258aed22/src/Api/Controllers/PlansController.cs#L16`]
pub async fn plans_get(
configuration: &configuration::Configuration,
) -> Result<models::PlanResponseModelListResponseModel, Error<PlansGetError>> {
Expand Down
141 changes: 141 additions & 0 deletions crates/bitwarden-api-api/src/apis/provider_billing_v_next_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1053,3 +1053,144 @@ pub async fn provider_billing_v_next_update_payment_method(
}))
}
}

/// This operation is defined on: [`https://github.com/bitwarden/server/blob/22420f595f2f50dd2fc0061743841285258aed22/src/Api/Billing/Controllers/VNext/ProviderBillingVNextController.cs#L114`]
pub async fn providers_provider_id_billing_vnext_warnings_get(
configuration: &configuration::Configuration,
provider_id: &str,
id: Option<uuid::Uuid>,
name: Option<&str>,
business_name: Option<&str>,
business_address1: Option<&str>,
business_address2: Option<&str>,
business_address3: Option<&str>,
business_country: Option<&str>,
business_tax_number: Option<&str>,
billing_email: Option<&str>,
billing_phone: Option<&str>,
status: Option<models::ProviderStatusType>,
use_events: Option<bool>,
r#type: Option<models::ProviderType>,
enabled: Option<bool>,
creation_date: Option<String>,
revision_date: Option<String>,
gateway: Option<models::GatewayType>,
gateway_customer_id: Option<&str>,
gateway_subscription_id: Option<&str>,
discount_id: Option<&str>,
) -> Result<(), Error<ProvidersProviderIdBillingVnextWarningsGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_provider_id = provider_id;
let p_id = id;
let p_name = name;
let p_business_name = business_name;
let p_business_address1 = business_address1;
let p_business_address2 = business_address2;
let p_business_address3 = business_address3;
let p_business_country = business_country;
let p_business_tax_number = business_tax_number;
let p_billing_email = billing_email;
let p_billing_phone = billing_phone;
let p_status = status;
let p_use_events = use_events;
let p_type = r#type;
let p_enabled = enabled;
let p_creation_date = creation_date;
let p_revision_date = revision_date;
let p_gateway = gateway;
let p_gateway_customer_id = gateway_customer_id;
let p_gateway_subscription_id = gateway_subscription_id;
let p_discount_id = discount_id;

let uri_str = format!(
"{}/providers/{providerId}/billing/vnext/warnings",
configuration.base_path,
providerId = crate::apis::urlencode(p_provider_id)
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);

if let Some(ref param_value) = p_id {
req_builder = req_builder.query(&[("id", &param_value.to_string())]);
}
if let Some(ref param_value) = p_name {
req_builder = req_builder.query(&[("name", &param_value.to_string())]);
}
if let Some(ref param_value) = p_business_name {
req_builder = req_builder.query(&[("businessName", &param_value.to_string())]);
}
if let Some(ref param_value) = p_business_address1 {
req_builder = req_builder.query(&[("businessAddress1", &param_value.to_string())]);
}
if let Some(ref param_value) = p_business_address2 {
req_builder = req_builder.query(&[("businessAddress2", &param_value.to_string())]);
}
if let Some(ref param_value) = p_business_address3 {
req_builder = req_builder.query(&[("businessAddress3", &param_value.to_string())]);
}
if let Some(ref param_value) = p_business_country {
req_builder = req_builder.query(&[("businessCountry", &param_value.to_string())]);
}
if let Some(ref param_value) = p_business_tax_number {
req_builder = req_builder.query(&[("businessTaxNumber", &param_value.to_string())]);
}
if let Some(ref param_value) = p_billing_email {
req_builder = req_builder.query(&[("billingEmail", &param_value.to_string())]);
}
if let Some(ref param_value) = p_billing_phone {
req_builder = req_builder.query(&[("billingPhone", &param_value.to_string())]);
}
if let Some(ref param_value) = p_status {
req_builder = req_builder.query(&[("status", &param_value.to_string())]);
}
if let Some(ref param_value) = p_use_events {
req_builder = req_builder.query(&[("useEvents", &param_value.to_string())]);
}
if let Some(ref param_value) = p_type {
req_builder = req_builder.query(&[("type", &param_value.to_string())]);
}
if let Some(ref param_value) = p_enabled {
req_builder = req_builder.query(&[("enabled", &param_value.to_string())]);
}
if let Some(ref param_value) = p_creation_date {
req_builder = req_builder.query(&[("creationDate", &param_value.to_string())]);
}
if let Some(ref param_value) = p_revision_date {
req_builder = req_builder.query(&[("revisionDate", &param_value.to_string())]);
}
if let Some(ref param_value) = p_gateway {
req_builder = req_builder.query(&[("gateway", &param_value.to_string())]);
}
if let Some(ref param_value) = p_gateway_customer_id {
req_builder = req_builder.query(&[("gatewayCustomerId", &param_value.to_string())]);
}
if let Some(ref param_value) = p_gateway_subscription_id {
req_builder = req_builder.query(&[("gatewaySubscriptionId", &param_value.to_string())]);
}
if let Some(ref param_value) = p_discount_id {
req_builder = req_builder.query(&[("discountId", &param_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};

let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;

let status = resp.status();

if !status.is_client_error() && !status.is_server_error() {
Ok(())
} else {
let content = resp.text().await?;
let entity: Option<ProvidersProviderIdBillingVnextWarningsGetError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
1 change: 1 addition & 0 deletions crates/bitwarden-api-api/src/apis/sends_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ pub async fn sends_get_send_file_download_data(
}
}

/// This operation is defined on: [`https://github.com/bitwarden/server/blob/22420f595f2f50dd2fc0061743841285258aed22/src/Api/Tools/Controllers/SendsController.cs#L205`]
pub async fn sends_post(
configuration: &configuration::Configuration,
send_request_model: Option<models::SendRequestModel>,
Expand Down
1 change: 1 addition & 0 deletions crates/bitwarden-api-api/src/apis/sync_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub enum SyncGetError {
UnknownValue(serde_json::Value),
}

/// This operation is defined on: [`https://github.com/bitwarden/server/blob/22420f595f2f50dd2fc0061743841285258aed22/src/Api/Vault/Controllers/SyncController.cs#L80`]
pub async fn sync_get(
configuration: &configuration::Configuration,
exclude_domains: Option<bool>,
Expand Down
19 changes: 7 additions & 12 deletions crates/bitwarden-api-identity/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[package]
name = "bitwarden-api-identity"
description = "Api bindings for the Bitwarden Identity API."
categories = ["api-bindings"]

version.workspace = true
Expand All @@ -13,14 +12,10 @@ license-file.workspace = true
keywords.workspace = true

[dependencies]
reqwest = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
serde_repr = { workspace = true }
serde_with = { version = ">=3.8, <4", default-features = false, features = [
"base64",
"std",
"macros",
] }
url = ">=2.5, <3"
uuid = { workspace = true }
serde = { version = "^1.0", features = ["derive"] }
serde_with = { version = "^3.8", default-features = false, features = ["base64", "std", "macros"] }
serde_json = "^1.0"
serde_repr = "^0.1"
url = "^2.5"
uuid = { version = "^1.8", features = ["serde", "v4"] }
reqwest = { version = "^0.12", default-features = false, features = ["json", "multipart", "http2"] }
2 changes: 1 addition & 1 deletion crates/bitwarden-vault/src/cipher/card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use super::cipher::CipherKind;
use crate::{cipher::cipher::CopyableCipherFields, Cipher, VaultParseError};

#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we shouldn't remove the deny_unknown_fields

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we always want deny_unknown_fields to keep things in sync

What are we trying to keep in sync - is it that we don't get additional data from the server that we don't expect?

To me that makes sense if we need to make sure that the server isn't giving us additional data that we aren't expecting. But with this change, we are no longer using the server response for these fields, and are instead extracting it ourselves from the data field on the client-side - with that change, these values simply become windowed views into the datafield, and I don't think we are gaining value from rejecting unknown fields anymore.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I synced with @gbubemismith offline on this, and right now we agreed that there's no need to keep deny_unknown_fields

#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
#[cfg_attr(feature = "wasm", derive(Tsify), tsify(into_wasm_abi, from_wasm_abi))]
pub struct Card {
Expand Down
Loading
Loading