Skip to content

Update bindings to use the reqwest-trait template #343

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions bitwarden_license/bitwarden-sm/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ impl From<ValidationErrors> for SecretsManagerError {
}
}

impl<T> From<ApiApisError<T>> for SecretsManagerError {
fn from(e: bitwarden_api_api::apis::Error<T>) -> Self {
impl From<ApiApisError> for SecretsManagerError {
fn from(e: bitwarden_api_api::apis::Error) -> Self {
SecretsManagerError::ApiError(e.into())
}
}
11 changes: 5 additions & 6 deletions bitwarden_license/bitwarden-sm/src/projects/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,11 @@ pub(crate) async fn create_project(
});

let config = client.internal.get_api_configurations().await;
let res = bitwarden_api_api::apis::projects_api::organizations_organization_id_projects_post(
&config.api,
input.organization_id,
project,
)
.await?;
let res = config
.api_client()
.projects_api()
.organizations_organization_id_projects_post(input.organization_id, project)
.await?;

ProjectResponse::process_response(res, &mut key_store.context())
}
Expand Down
8 changes: 5 additions & 3 deletions bitwarden_license/bitwarden-sm/src/projects/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ pub(crate) async fn delete_projects(
input: ProjectsDeleteRequest,
) -> Result<ProjectsDeleteResponse, SecretsManagerError> {
let config = client.internal.get_api_configurations().await;
let res =
bitwarden_api_api::apis::projects_api::projects_delete_post(&config.api, Some(input.ids))
.await?;
let res = config
.api_client()
.projects_api()
.projects_delete_post(Some(input.ids))
.await?;

ProjectsDeleteResponse::process_response(res)
}
Expand Down
6 changes: 5 additions & 1 deletion bitwarden_license/bitwarden-sm/src/projects/get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ pub(crate) async fn get_project(
) -> Result<ProjectResponse, SecretsManagerError> {
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 res = config
.api_client()
.projects_api()
.projects_id_get(input.id)
.await?;

let key_store = client.internal.get_key_store();

Expand Down
10 changes: 5 additions & 5 deletions bitwarden_license/bitwarden-sm/src/projects/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ pub(crate) async fn list_projects(
input: &ProjectsListRequest,
) -> Result<ProjectsResponse, SecretsManagerError> {
let config = client.internal.get_api_configurations().await;
let res = bitwarden_api_api::apis::projects_api::organizations_organization_id_projects_get(
&config.api,
input.organization_id,
)
.await?;
let res = config
.api_client()
.projects_api()
.organizations_organization_id_projects_get(input.organization_id)
.await?;

let key_store = client.internal.get_key_store();

Expand Down
8 changes: 5 additions & 3 deletions bitwarden_license/bitwarden-sm/src/projects/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ pub(crate) async fn update_project(
});

let config = client.internal.get_api_configurations().await;
let res =
bitwarden_api_api::apis::projects_api::projects_id_put(&config.api, input.id, project)
.await?;
let res = config
.api_client()
.projects_api()
.projects_id_put(input.id, project)
.await?;

ProjectResponse::process_response(res, &mut key_store.context())
}
Expand Down
11 changes: 5 additions & 6 deletions bitwarden_license/bitwarden-sm/src/secrets/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,11 @@ pub(crate) async fn create_secret(
};

let config = client.internal.get_api_configurations().await;
let res = bitwarden_api_api::apis::secrets_api::organizations_organization_id_secrets_post(
&config.api,
input.organization_id,
secret,
)
.await?;
let res = config
.api_client()
.secrets_api()
.organizations_organization_id_secrets_post(input.organization_id, secret)
.await?;

SecretResponse::process_response(res, &mut key_store.context())
}
Expand Down
8 changes: 5 additions & 3 deletions bitwarden_license/bitwarden-sm/src/secrets/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ pub(crate) async fn delete_secrets(
input: SecretsDeleteRequest,
) -> Result<SecretsDeleteResponse, SecretsManagerError> {
let config = client.internal.get_api_configurations().await;
let res =
bitwarden_api_api::apis::secrets_api::secrets_delete_post(&config.api, Some(input.ids))
.await?;
let res = config
.api_client()
.secrets_api()
.secrets_delete_post(Some(input.ids))
.await?;

SecretsDeleteResponse::process_response(res)
}
Expand Down
6 changes: 5 additions & 1 deletion bitwarden_license/bitwarden-sm/src/secrets/get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ pub(crate) async fn get_secret(
input: &SecretGetRequest,
) -> Result<SecretResponse, SecretsManagerError> {
let config = client.internal.get_api_configurations().await;
let res = bitwarden_api_api::apis::secrets_api::secrets_id_get(&config.api, input.id).await?;
let res = config
.api_client()
.secrets_api()
.secrets_id_get(input.id)
.await?;

let key_store = client.internal.get_key_store();

Expand Down
7 changes: 5 additions & 2 deletions bitwarden_license/bitwarden-sm/src/secrets/get_by_ids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ pub(crate) async fn get_secrets_by_ids(

let config = client.internal.get_api_configurations().await;

let res =
bitwarden_api_api::apis::secrets_api::secrets_get_by_ids_post(&config.api, request).await?;
let res = config
.api_client()
.secrets_api()
.secrets_get_by_ids_post(request)
.await?;

let key_store = client.internal.get_key_store();

Expand Down
20 changes: 10 additions & 10 deletions bitwarden_license/bitwarden-sm/src/secrets/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ pub(crate) async fn list_secrets(
input: &SecretIdentifiersRequest,
) -> Result<SecretIdentifiersResponse, SecretsManagerError> {
let config = client.internal.get_api_configurations().await;
let res = bitwarden_api_api::apis::secrets_api::organizations_organization_id_secrets_get(
&config.api,
input.organization_id,
)
.await?;
let res = config
.api_client()
.secrets_api()
.organizations_organization_id_secrets_get(input.organization_id)
.await?;

let key_store = client.internal.get_key_store();

Expand All @@ -50,11 +50,11 @@ pub(crate) async fn list_secrets_by_project(
input: &SecretIdentifiersByProjectRequest,
) -> Result<SecretIdentifiersResponse, SecretsManagerError> {
let config = client.internal.get_api_configurations().await;
let res = bitwarden_api_api::apis::secrets_api::projects_project_id_secrets_get(
&config.api,
input.project_id,
)
.await?;
let res = config
.api_client()
.secrets_api()
.projects_project_id_secrets_get(input.project_id)
.await?;

let key_store = client.internal.get_key_store();

Expand Down
11 changes: 5 additions & 6 deletions bitwarden_license/bitwarden-sm/src/secrets/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@ pub(crate) async fn sync_secrets(
let config = client.internal.get_api_configurations().await;
let last_synced_date = input.last_synced_date.map(|date| date.to_rfc3339());

let res = bitwarden_api_api::apis::secrets_api::organizations_organization_id_secrets_sync_get(
&config.api,
input.organization_id,
last_synced_date,
)
.await?;
let res = config
.api_client()
.secrets_api()
.organizations_organization_id_secrets_sync_get(input.organization_id, last_synced_date)
.await?;

let key_store = client.internal.get_key_store();

Expand Down
7 changes: 5 additions & 2 deletions bitwarden_license/bitwarden-sm/src/secrets/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,11 @@ pub(crate) async fn update_secret(
};

let config = client.internal.get_api_configurations().await;
let res =
bitwarden_api_api::apis::secrets_api::secrets_id_put(&config.api, input.id, secret).await?;
let res = config
.api_client()
.secrets_api()
.secrets_id_put(input.id, secret)
.await?;

SecretResponse::process_response(res, &mut key_store.context())
}
Expand Down
4 changes: 4 additions & 0 deletions crates/bitwarden-api-api/.openapi-generator-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@
docs/*.md
.travis.yml
git_push.sh
.gitignore

# We handle dependency updates with renovate, so we don't want to overwrite Cargo.toml
Cargo.toml
2 changes: 0 additions & 2 deletions crates/bitwarden-api-api/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.gitignore
Cargo.toml
README.md
src/apis/access_policies_api.rs
src/apis/account_billing_v_next_api.rs
Expand Down
2 changes: 1 addition & 1 deletion crates/bitwarden-api-api/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.13.0
7.14.0
4 changes: 2 additions & 2 deletions crates/bitwarden-api-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ client.

- API version: latest
- Package version: 1.0.0
- Generator version: 7.13.0
- Generator version: 7.14.0
- Build package: `org.openapitools.codegen.languages.RustClientCodegen`

## Installation
Expand All @@ -25,7 +25,7 @@ bitwarden-api-api = { path = "./bitwarden-api-api" }

## Documentation for API Endpoints

All URIs are relative to _http://localhost_
All URIs are relative to *https://api.bitwarden.com*

| Class | Method | HTTP request | Description |
| ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
Expand Down
Loading