Skip to content

Commit d198ccc

Browse files
Alex Holmbergclaude
authored andcommitted
fix(api): wrap get_optional responses in GenericResponse
The API wraps all responses in { "data": ... } but check_provider_connection and get_cluster were not unwrapping this, causing parse errors when the provider IS connected. This explains why the agent couldn't detect connected providers. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 14f3e82 commit d198ccc

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/platform/api/client.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,10 @@ impl PlatformApiClient {
584584
provider.as_str(),
585585
project_id
586586
);
587-
self.get_optional(&path).await
587+
// API wraps responses in { "data": ... }, so we need GenericResponse
588+
let response: Option<GenericResponse<CloudCredentialStatus>> =
589+
self.get_optional(&path).await?;
590+
Ok(response.map(|r| r.data))
588591
}
589592

590593
/// List all cloud credentials for a project
@@ -777,8 +780,11 @@ impl PlatformApiClient {
777780
///
778781
/// Endpoint: GET /api/clusters/:clusterId
779782
pub async fn get_cluster(&self, cluster_id: &str) -> Result<Option<ClusterEntity>> {
780-
self.get_optional(&format!("/api/clusters/{}", cluster_id))
781-
.await
783+
// API wraps responses in { "data": ... }, so we need GenericResponse
784+
let response: Option<GenericResponse<ClusterEntity>> = self
785+
.get_optional(&format!("/api/clusters/{}", cluster_id))
786+
.await?;
787+
Ok(response.map(|r| r.data))
782788
}
783789

784790
// =========================================================================

0 commit comments

Comments
 (0)