Skip to main content

windmill_api/apis/
integration_api.rs

1/*
2 * Windmill API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.823.1
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18/// struct for typed errors of method [`get_hub_integration_meta`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum GetHubIntegrationMetaError {
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`list_hub_integrations`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum ListHubIntegrationsError {
29    UnknownValue(serde_json::Value),
30}
31
32
33pub async fn get_hub_integration_meta(configuration: &configuration::Configuration, app: &str) -> Result<models::GetHubIntegrationMeta200Response, Error<GetHubIntegrationMetaError>> {
34    let local_var_configuration = configuration;
35
36    let local_var_client = &local_var_configuration.client;
37
38    let local_var_uri_str = format!("{}/integrations/hub/{app}/meta", local_var_configuration.base_path, app=crate::apis::urlencode(app));
39    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
40
41    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
42        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
43    }
44    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
45        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
46    };
47
48    let local_var_req = local_var_req_builder.build()?;
49    let local_var_resp = local_var_client.execute(local_var_req).await?;
50
51    let local_var_status = local_var_resp.status();
52    let local_var_content = local_var_resp.text().await?;
53
54    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
55        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
56    } else {
57        let local_var_entity: Option<GetHubIntegrationMetaError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
58        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
59        Err(Error::ResponseError(local_var_error))
60    }
61}
62
63pub async fn list_hub_integrations(configuration: &configuration::Configuration, kind: Option<&str>) -> Result<Vec<models::ListHubIntegrations200ResponseInner>, Error<ListHubIntegrationsError>> {
64    let local_var_configuration = configuration;
65
66    let local_var_client = &local_var_configuration.client;
67
68    let local_var_uri_str = format!("{}/integrations/hub/list", local_var_configuration.base_path);
69    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
70
71    if let Some(ref local_var_str) = kind {
72        local_var_req_builder = local_var_req_builder.query(&[("kind", &local_var_str.to_string())]);
73    }
74    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
75        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
76    }
77    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
78        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
79    };
80
81    let local_var_req = local_var_req_builder.build()?;
82    let local_var_resp = local_var_client.execute(local_var_req).await?;
83
84    let local_var_status = local_var_resp.status();
85    let local_var_content = local_var_resp.text().await?;
86
87    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
88        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
89    } else {
90        let local_var_entity: Option<ListHubIntegrationsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
91        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
92        Err(Error::ResponseError(local_var_error))
93    }
94}
95