uarp-sdk 0.5.7

Async Rust client for the UARP (Snaga) Universal Agent Runtime Platform API
Documentation
// Code generated by @uarp/codegen from spec/openapi.json. DO NOT EDIT.
//!
//! Tenant-scoped usage analytics

#![allow(unused_imports, clippy::too_many_arguments)]

use reqwest::Method;
use serde::{Deserialize, Serialize};

use crate::client::{Client, Request, NO_BODY, NO_QUERY};
use crate::error::Result;
use crate::generated::models;
use crate::multipart::{field_text, FilePart};
use crate::util::encode_path;

/// Query and header parameters for `tenantAnalyticsAgents`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct TenantAnalyticsAgentsParams {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub days: Option<i64>,
}

/// Tenant-scoped usage analytics
#[derive(Debug, Clone)]
pub struct AnalyticsApi {
    pub(crate) client: Client,
}

impl Client {
    /// Tenant-scoped usage analytics
    pub fn analytics(&self) -> AnalyticsApi {
        AnalyticsApi { client: self.clone() }
    }
}

impl AnalyticsApi {
    /// Tenant-scoped agent analytics
    ///
    /// `GET /api/v1/analytics/agents`
    ///
    /// Required scopes: `read:analytics`.
    pub async fn tenant_analytics_agents(&self, params: &TenantAnalyticsAgentsParams) -> Result<models::AgentAnalyticsSummary> {
        self.client
            .request_json(Request {
                method: Method::GET,
                path: "/api/v1/analytics/agents".to_string(),
                query: Some(params),
                body: NO_BODY,
                headers: Vec::new(),
                idempotent: false,
            })
            .await
    }
}