windmill_api/apis/
documentation_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.592.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 [`query_documentation`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum QueryDocumentationError {
22    Status403(String),
23    UnknownValue(serde_json::Value),
24}
25
26
27pub async fn query_documentation(configuration: &configuration::Configuration, query_documentation_request: models::QueryDocumentationRequest) -> Result<serde_json::Value, Error<QueryDocumentationError>> {
28    let local_var_configuration = configuration;
29
30    let local_var_client = &local_var_configuration.client;
31
32    let local_var_uri_str = format!("{}/inkeep", local_var_configuration.base_path);
33    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
34
35    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
36        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
37    }
38    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
39        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
40    };
41    local_var_req_builder = local_var_req_builder.json(&query_documentation_request);
42
43    let local_var_req = local_var_req_builder.build()?;
44    let local_var_resp = local_var_client.execute(local_var_req).await?;
45
46    let local_var_status = local_var_resp.status();
47    let local_var_content = local_var_resp.text().await?;
48
49    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
50        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
51    } else {
52        let local_var_entity: Option<QueryDocumentationError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
53        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
54        Err(Error::ResponseError(local_var_error))
55    }
56}
57