Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SM-865] Part 2 Use new get secrets by IDs endpoint #150

Merged
merged 29 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c8867aa
Add auto generated Api bindings
Thomas-Avery Jul 27, 2023
ee974ab
Expose new endpoint methods in SDK
Thomas-Avery Jul 31, 2023
cddcd3f
Use in bws CLI
Thomas-Avery Jul 31, 2023
d8d0f74
Expose new command in JSON schemas
Thomas-Avery Jul 31, 2023
f6b9f93
restructure and rename response
Thomas-Avery Jul 31, 2023
67abc9b
Expose getByIds in napi
Thomas-Avery Jul 31, 2023
a119254
Merge branch 'master' into sm/sm-865-bulk-secret-fetching
Thomas-Avery Aug 1, 2023
49926ec
fix cargo check
Thomas-Avery Aug 1, 2023
ea9c3cd
Merge branch 'master' into sm/sm-865-bulk-secret-fetching
Thomas-Avery Aug 1, 2023
16b4a50
Merge branch 'master' into sm/sm-865-bulk-secret-fetching
Thomas-Avery Aug 1, 2023
0c55b40
Add openapi auto generation
Thomas-Avery Aug 2, 2023
b20dfe1
Merge branch 'sm/sm-865-api-bindings' into sm/sm-865-bulk-secret-fetc…
Thomas-Avery Aug 2, 2023
b759749
Regenerated open api doc
Thomas-Avery Aug 2, 2023
6e762d1
Merge branch 'sm/sm-865-api-bindings' into sm/sm-865-bulk-secret-fetc…
Thomas-Avery Aug 2, 2023
143cd6e
revert back to original binding.js
Thomas-Avery Aug 2, 2023
cd40891
remove .clone()
Thomas-Avery Aug 2, 2023
09e8b6f
Add to changelog
Thomas-Avery Aug 2, 2023
0a64d87
Merge branch 'master' into sm/sm-865-api-bindings
Thomas-Avery Aug 7, 2023
3643e85
Merge branch 'master' into sm/sm-865-api-bindings
Thomas-Avery Aug 8, 2023
86c6c81
Merge branch 'sm/sm-865-api-bindings' into sm/sm-865-bulk-secret-fetc…
Thomas-Avery Aug 8, 2023
0088b74
Merge branch 'master' into sm/sm-865-api-bindings
Thomas-Avery Aug 16, 2023
02ff72e
Merge branch 'sm/sm-865-api-bindings' into sm/sm-865-bulk-secret-fetc…
Thomas-Avery Aug 16, 2023
6a03bca
Merge branch 'master' into sm/sm-865-api-bindings
Thomas-Avery Aug 24, 2023
8561810
Merge branch 'sm/sm-865-api-bindings' into sm/sm-865-bulk-secret-fetc…
Thomas-Avery Aug 24, 2023
a345cbd
run cargo fmt
Thomas-Avery Aug 24, 2023
4874866
Merge branch 'sm/sm-865-api-bindings' into sm/sm-865-bulk-secret-fetc…
Thomas-Avery Aug 24, 2023
44bbdd6
Merge branch 'master' into sm/sm-865-api-bindings
Thomas-Avery Aug 28, 2023
4eb5a58
Merge branch 'sm/sm-865-api-bindings' into sm/sm-865-bulk-secret-fetc…
Thomas-Avery Aug 28, 2023
53e7b62
Merge branch 'master' into sm/sm-865-bulk-secret-fetching
Thomas-Avery Aug 28, 2023
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
12 changes: 12 additions & 0 deletions crates/bitwarden-api-api/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ src/apis/installations_api.rs
src/apis/licenses_api.rs
src/apis/misc_api.rs
src/apis/mod.rs
src/apis/organization_auth_requests_api.rs
src/apis/organization_connections_api.rs
src/apis/organization_domain_api.rs
src/apis/organization_export_api.rs
Expand Down Expand Up @@ -53,6 +54,7 @@ src/models/access_token_create_request_model.rs
src/models/access_token_creation_response_model.rs
src/models/access_token_response_model.rs
src/models/access_token_response_model_list_response_model.rs
src/models/admin_auth_request_update_request_model.rs
src/models/api_key_response_model.rs
src/models/attachment_request_model.rs
src/models/attachment_response_model.rs
Expand All @@ -65,6 +67,8 @@ src/models/auth_request_update_request_model.rs
src/models/authentication_extensions_client_outputs.rs
src/models/authenticator_attestation_raw_response.rs
src/models/base_access_policy_response_model.rs
src/models/base_secret_response_model.rs
src/models/base_secret_response_model_list_response_model.rs
src/models/billing_history_response_model.rs
src/models/billing_invoice.rs
src/models/billing_payment_response_model.rs
Expand All @@ -75,8 +79,10 @@ src/models/billing_subscription_item.rs
src/models/billing_subscription_upcoming_invoice.rs
src/models/billing_transaction.rs
src/models/bit_pay_invoice_request_model.rs
src/models/bitwarden_product_type.rs
src/models/bulk_delete_response_model.rs
src/models/bulk_delete_response_model_list_response_model.rs
src/models/bulk_deny_admin_auth_request_request_model.rs
src/models/cipher_attachment_model.rs
src/models/cipher_bulk_delete_request_model.rs
src/models/cipher_bulk_move_request_model.rs
Expand Down Expand Up @@ -115,6 +121,7 @@ src/models/collection_response_model_list_response_model.rs
src/models/collection_with_id_request_model.rs
src/models/config_response_model.rs
src/models/delete_recover_request_model.rs
src/models/device_keys_request_model.rs
src/models/device_request_model.rs
src/models/device_response_model.rs
src/models/device_response_model_list_response_model.rs
Expand Down Expand Up @@ -147,6 +154,7 @@ src/models/folder_request_model.rs
src/models/folder_response_model.rs
src/models/folder_response_model_list_response_model.rs
src/models/folder_with_id_request_model.rs
src/models/get_secrets_request_model.rs
src/models/global_domains.rs
src/models/global_equivalent_domains_type.rs
src/models/granted_access_policy_request.rs
Expand Down Expand Up @@ -176,6 +184,7 @@ src/models/keys_request_model.rs
src/models/keys_response_model.rs
src/models/license_type.rs
src/models/master_password_policy_response_model.rs
src/models/member_decryption_type.rs
src/models/mod.rs
src/models/open_id_connect_redirect_behavior.rs
src/models/organization_api_key_information.rs
Expand Down Expand Up @@ -237,6 +246,8 @@ src/models/password_request_model.rs
src/models/payment_method_type.rs
src/models/payment_request_model.rs
src/models/payment_response_model.rs
src/models/pending_organization_auth_request_response_model.rs
src/models/pending_organization_auth_request_response_model_list_response_model.rs
src/models/permissions.rs
src/models/plan_response_model.rs
src/models/plan_response_model_list_response_model.rs
Expand Down Expand Up @@ -305,6 +316,7 @@ src/models/secret_update_request_model.rs
src/models/secret_verification_request_model.rs
src/models/secret_with_projects_inner_project.rs
src/models/secret_with_projects_list_response_model.rs
src/models/secrets_manager_subscription_update_request_model.rs
src/models/secrets_with_projects_inner_secret.rs
src/models/secure_note_type.rs
src/models/selection_read_only_request_model.rs
Expand Down
31 changes: 23 additions & 8 deletions crates/bitwarden-api-api/README.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions crates/bitwarden-api-api/src/apis/auth_requests_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ pub async fn auth_requests_get(

pub async fn auth_requests_id_get(
configuration: &configuration::Configuration,
id: &str,
id: uuid::Uuid,
) -> Result<crate::models::AuthRequestResponseModel, Error<AuthRequestsIdGetError>> {
let local_var_configuration = configuration;

Expand Down Expand Up @@ -133,7 +133,7 @@ pub async fn auth_requests_id_get(

pub async fn auth_requests_id_put(
configuration: &configuration::Configuration,
id: &str,
id: uuid::Uuid,
auth_request_update_request_model: Option<crate::models::AuthRequestUpdateRequestModel>,
) -> Result<crate::models::AuthRequestResponseModel, Error<AuthRequestsIdPutError>> {
let local_var_configuration = configuration;
Expand Down Expand Up @@ -179,7 +179,7 @@ pub async fn auth_requests_id_put(

pub async fn auth_requests_id_response_get(
configuration: &configuration::Configuration,
id: &str,
id: uuid::Uuid,
code: Option<&str>,
) -> Result<crate::models::AuthRequestResponseModel, Error<AuthRequestsIdResponseGetError>> {
let local_var_configuration = configuration;
Expand Down
157 changes: 157 additions & 0 deletions crates/bitwarden-api-api/src/apis/devices_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ use reqwest;
use super::{configuration, Error};
use crate::apis::ResponseContent;

/// struct for typed errors of method [`devices_exist_by_types_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DevicesExistByTypesPostError {
UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`devices_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
Expand Down Expand Up @@ -90,6 +97,20 @@ pub enum DevicesIdentifierIdentifierTokenPutError {
UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`devices_identifier_keys_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DevicesIdentifierKeysPostError {
UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`devices_identifier_keys_put`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DevicesIdentifierKeysPutError {
UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`devices_knowndevice_email_identifier_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
Expand All @@ -111,6 +132,50 @@ pub enum DevicesPostError {
UnknownValue(serde_json::Value),
}

pub async fn devices_exist_by_types_post(
configuration: &configuration::Configuration,
device_type: Option<Vec<crate::models::DeviceType>>,
) -> Result<bool, Error<DevicesExistByTypesPostError>> {
let local_var_configuration = configuration;

let local_var_client = &local_var_configuration.client;

let local_var_uri_str = format!(
"{}/devices/exist-by-types",
local_var_configuration.base_path
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&device_type);

let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;

let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;

if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<DevicesExistByTypesPostError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}

pub async fn devices_get(
configuration: &configuration::Configuration,
) -> Result<crate::models::DeviceResponseModelListResponseModel, Error<DevicesGetError>> {
Expand Down Expand Up @@ -598,6 +663,98 @@ pub async fn devices_identifier_identifier_token_put(
}
}

pub async fn devices_identifier_keys_post(
configuration: &configuration::Configuration,
identifier: &str,
device_keys_request_model: Option<crate::models::DeviceKeysRequestModel>,
) -> Result<crate::models::DeviceResponseModel, Error<DevicesIdentifierKeysPostError>> {
let local_var_configuration = configuration;

let local_var_client = &local_var_configuration.client;

let local_var_uri_str = format!(
"{}/devices/{identifier}/keys",
local_var_configuration.base_path,
identifier = crate::apis::urlencode(identifier.to_string())
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&device_keys_request_model);

let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;

let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;

if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<DevicesIdentifierKeysPostError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}

pub async fn devices_identifier_keys_put(
configuration: &configuration::Configuration,
identifier: &str,
device_keys_request_model: Option<crate::models::DeviceKeysRequestModel>,
) -> Result<crate::models::DeviceResponseModel, Error<DevicesIdentifierKeysPutError>> {
let local_var_configuration = configuration;

let local_var_client = &local_var_configuration.client;

let local_var_uri_str = format!(
"{}/devices/{identifier}/keys",
local_var_configuration.base_path,
identifier = crate::apis::urlencode(identifier.to_string())
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());

if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&device_keys_request_model);

let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;

let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;

if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<DevicesIdentifierKeysPutError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}

pub async fn devices_knowndevice_email_identifier_get(
configuration: &configuration::Configuration,
email: &str,
Expand Down
4 changes: 3 additions & 1 deletion crates/bitwarden-api-api/src/apis/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::{error, fmt};
use std::error;
use std::fmt;

#[derive(Debug, Clone)]
pub struct ResponseContent<T> {
Expand Down Expand Up @@ -78,6 +79,7 @@ pub mod info_api;
pub mod installations_api;
pub mod licenses_api;
pub mod misc_api;
pub mod organization_auth_requests_api;
pub mod organization_connections_api;
pub mod organization_domain_api;
pub mod organization_export_api;
Expand Down
Loading