windmill-api 1.765.0

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
Documentation
/*
 * Windmill API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.765.0
 * Contact: contact@windmill.dev
 * Generated by: https://openapi-generator.tech
 */


use reqwest;
use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};


/// struct for typed errors of method [`list_data_metrics`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListDataMetricsError {
    UnknownValue(serde_json::Value),
}


/// Call this before writing any aggregate query over a DuckLake table. A declared measure is the canonical definition of that number, and reproducing it yourself will silently disagree with it (a `revenue` measure typically excludes refunds or test rows). Filter by `table` for one table's declarations, or by `path_prefix` (e.g. `f/analytics`) for everything declared under a folder; omit both to browse the whole catalog. Results are keyset-paged: a full page may mean more remain, so continue with the `cursor_*` params rather than assuming a measure does not exist. Use each returned `expr` verbatim, and when a measure has a `filter` write it as `expr FILTER (WHERE filter)` so measures with different predicates can share one GROUP BY. If a number you need has no declared measure, write your own aggregate as usual. Results are limited to declarations whose producing script the caller can read. 
pub async fn list_data_metrics(configuration: &configuration::Configuration, workspace: &str, table: Option<&str>, path_prefix: Option<&str>, per_page: Option<i32>, cursor_table: Option<&str>, cursor_kind: Option<&str>, cursor_name: Option<&str>, cursor_script: Option<&str>) -> Result<models::ListDataMetrics200Response, Error<ListDataMetricsError>> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!("{}/w/{workspace}/data_metrics/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

    if let Some(ref local_var_str) = table {
        local_var_req_builder = local_var_req_builder.query(&[("table", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = path_prefix {
        local_var_req_builder = local_var_req_builder.query(&[("path_prefix", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = per_page {
        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = cursor_table {
        local_var_req_builder = local_var_req_builder.query(&[("cursor_table", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = cursor_kind {
        local_var_req_builder = local_var_req_builder.query(&[("cursor_kind", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = cursor_name {
        local_var_req_builder = local_var_req_builder.query(&[("cursor_name", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = cursor_script {
        local_var_req_builder = local_var_req_builder.query(&[("cursor_script", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<ListDataMetricsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
        Err(Error::ResponseError(local_var_error))
    }
}