windmill_api/apis/
integration_api.rs1use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum ListHubIntegrationsError {
22 UnknownValue(serde_json::Value),
23}
24
25
26pub async fn list_hub_integrations(configuration: &configuration::Configuration, kind: Option<&str>) -> Result<Vec<models::ListHubIntegrations200ResponseInner>, Error<ListHubIntegrationsError>> {
27 let local_var_configuration = configuration;
28
29 let local_var_client = &local_var_configuration.client;
30
31 let local_var_uri_str = format!("{}/integrations/hub/list", local_var_configuration.base_path);
32 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
33
34 if let Some(ref local_var_str) = kind {
35 local_var_req_builder = local_var_req_builder.query(&[("kind", &local_var_str.to_string())]);
36 }
37 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
38 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
39 }
40 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
41 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
42 };
43
44 let local_var_req = local_var_req_builder.build()?;
45 let local_var_resp = local_var_client.execute(local_var_req).await?;
46
47 let local_var_status = local_var_resp.status();
48 let local_var_content = local_var_resp.text().await?;
49
50 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
51 crate::from_str_patched(&local_var_content).map_err(Error::from)
52 } else {
53 let local_var_entity: Option<ListHubIntegrationsError> = crate::from_str_patched(&local_var_content).ok();
54 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
55 Err(Error::ResponseError(local_var_error))
56 }
57}
58