Skip to main content

windmill_api/apis/
raw_app_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.631.2
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 [`list_raw_apps`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum ListRawAppsError {
22    UnknownValue(serde_json::Value),
23}
24
25
26pub async fn list_raw_apps(configuration: &configuration::Configuration, workspace: &str, page: Option<i32>, per_page: Option<i32>, order_desc: Option<bool>, created_by: Option<&str>, path_start: Option<&str>, path_exact: Option<&str>, starred_only: Option<bool>) -> Result<Vec<models::ListableRawApp>, Error<ListRawAppsError>> {
27    let local_var_configuration = configuration;
28
29    let local_var_client = &local_var_configuration.client;
30
31    let local_var_uri_str = format!("{}/w/{workspace}/raw_apps/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
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) = page {
35        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
36    }
37    if let Some(ref local_var_str) = per_page {
38        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
39    }
40    if let Some(ref local_var_str) = order_desc {
41        local_var_req_builder = local_var_req_builder.query(&[("order_desc", &local_var_str.to_string())]);
42    }
43    if let Some(ref local_var_str) = created_by {
44        local_var_req_builder = local_var_req_builder.query(&[("created_by", &local_var_str.to_string())]);
45    }
46    if let Some(ref local_var_str) = path_start {
47        local_var_req_builder = local_var_req_builder.query(&[("path_start", &local_var_str.to_string())]);
48    }
49    if let Some(ref local_var_str) = path_exact {
50        local_var_req_builder = local_var_req_builder.query(&[("path_exact", &local_var_str.to_string())]);
51    }
52    if let Some(ref local_var_str) = starred_only {
53        local_var_req_builder = local_var_req_builder.query(&[("starred_only", &local_var_str.to_string())]);
54    }
55    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
56        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
57    }
58    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
59        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
60    };
61
62    let local_var_req = local_var_req_builder.build()?;
63    let local_var_resp = local_var_client.execute(local_var_req).await?;
64
65    let local_var_status = local_var_resp.status();
66    let local_var_content = local_var_resp.text().await?;
67
68    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
69        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
70    } else {
71        let local_var_entity: Option<ListRawAppsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
72        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
73        Err(Error::ResponseError(local_var_error))
74    }
75}
76