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-874: Fix Python Integration #229

Merged
merged 24 commits into from
Nov 27, 2023
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
007bae3
SM-874: Update BitwardenClient in login.py
coltonhurst Aug 29, 2023
c384428
Merge branch 'master' into sm/sm-874
coltonhurst Sep 11, 2023
bfa8d94
sm/sm-874: Fix Python SDK integration
coltonhurst Sep 12, 2023
7628b8a
Merge branch 'master' into sm/sm-874
coltonhurst Sep 12, 2023
1833336
SM-874: Add project_ids param to SecretsClient update function in bit…
coltonhurst Sep 13, 2023
82f0fe1
Merge branch 'master' into sm/sm-874
coltonhurst Sep 14, 2023
8c6b527
SM-874: Add a ProjectsClient and address PR comments
coltonhurst Sep 15, 2023
279253e
Merge branch 'master' into sm/sm-874
coltonhurst Sep 15, 2023
4212204
SM-874: Rename login.py and remove unused functions in bitwarden_clie…
coltonhurst Sep 19, 2023
7559397
Merge branch 'master' into sm/sm-874
coltonhurst Sep 19, 2023
87e4c22
Merge branch 'master' into sm/sm-874
coltonhurst Sep 26, 2023
b10fd14
Merge branch 'master' into sm/sm-874
coltonhurst Oct 17, 2023
8f0885e
SM-874: Handle error cases on secret deletes
coltonhurst Oct 18, 2023
578f41c
SM-874: Fix linting issue
coltonhurst Oct 18, 2023
aca61bf
SM-874: Handle error cases on project deletes
coltonhurst Oct 18, 2023
b489e6d
Merge branch 'master' into sm/sm-874
coltonhurst Oct 19, 2023
171d8a3
SM-874: Revert error.rs, projects/delete.rs, and secrets/delete.rs
coltonhurst Oct 23, 2023
14af6a7
Merge branch 'master' into sm/sm-874
coltonhurst Oct 23, 2023
2d421cb
Merge branch 'master' into sm/sm-874
coltonhurst Nov 16, 2023
f80c4dd
SM-874: Move failure check to run_command function
coltonhurst Nov 16, 2023
c992350
Remove return value from access_token_login
coltonhurst Nov 16, 2023
39c2982
Merge branch 'master' into sm/sm-874
coltonhurst Nov 17, 2023
e8a445b
SM-874: In example.py, secrets.get should pass the id, not an array o…
coltonhurst Nov 17, 2023
08f92db
Merge branch 'master' into sm/sm-874
coltonhurst Nov 20, 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
40 changes: 28 additions & 12 deletions crates/bitwarden/src/secrets_manager/projects/delete.rs
dani-garcia marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,28 @@ impl ProjectsDeleteResponse {
pub(crate) fn process_response(
response: BulkDeleteResponseModelListResponseModel,
) -> Result<ProjectsDeleteResponse> {
Ok(ProjectsDeleteResponse {
data: response
.data
.unwrap_or_default()
.into_iter()
.map(ProjectDeleteResponse::process_response)
.collect::<Result<_, _>>()?,
})
let mut successes = Vec::new();
let mut failures = Vec::new();

for item in response.data.unwrap_or_default() {
match ProjectDeleteResponse::process_response(item) {
Ok(data) => {
successes.push(data);
}
Err(Error::ApiError(error)) => {
failures.extend_from_slice(&error);
}
Err(_) => {
unreachable!();
}
}
}

if failures.is_empty() {
Ok(ProjectsDeleteResponse { data: successes })
} else {
Err(Error::ApiError(failures))
}
}
}

Expand All @@ -61,9 +75,11 @@ impl ProjectDeleteResponse {
pub(crate) fn process_response(
response: BulkDeleteResponseModel,
) -> Result<ProjectDeleteResponse> {
Ok(ProjectDeleteResponse {
id: response.id.ok_or(Error::MissingFields)?,
error: response.error,
})
let id = response.id.ok_or(Error::MissingFields)?;

match response.error {
Some(error) => Err(Error::ApiError(vec![(id, error)])),
None => Ok(ProjectDeleteResponse { id, error: None }),
}
}
}