#![allow(deprecated)]
/*
* server
*
* ## Real-time data The only real-time path to get tracing data is to ingest via OpenTelemetry (`POST /api/public/otel/v1/traces`) and retrieve via Observations API v2 (`GET /api/public/v2/observations`) and Metrics API v2 (`GET /api/public/v2/metrics`). Other public API write and read endpoints can delay data by about 10 minutes. Direct OpenTelemetry exporters must send the `x-langfuse-ingestion-version: 4` header; current Python and JS SDKs already do. See the [Public API docs](https://langfuse.com/docs/api-and-data-platform/features/public-api) and [real-time ingestion](https://langfuse.com/integrations/native/opentelemetry.md#real-time-ingestion). ## Authentication Authenticate with the API using [Basic Auth](https://en.wikipedia.org/wiki/Basic_access_authentication), get API keys in the project settings: - username: Langfuse Public Key - password: Langfuse Secret Key ## Exports - OpenAPI spec: https://cloud.langfuse.com/generated/api/openapi.yml - Self-hosted deployments: interactive API reference at `/api/docs` and OpenAPI spec at `/api/openapi.yaml`
*
* The version of the OpenAPI document:
*
* Generated by: https://openapi-generator.tech
*/
use super::{configuration, ContentType, Error};
use crate::{apis::ResponseContent, models};
use serde::{de::Error as _, Deserialize, Serialize};
use timvw_rust_runtime;
/// struct for typed errors of method [`unstable_topics_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UnstableTopicsGetError {
Status400(serde_json::Value),
Status401(serde_json::Value),
Status403(serde_json::Value),
Status404(serde_json::Value),
Status405(serde_json::Value),
Status429(models::UnstablePublicApiError),
Status500(models::UnstablePublicApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`unstable_topics_get_facet`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UnstableTopicsGetFacetError {
Status400(serde_json::Value),
Status401(serde_json::Value),
Status403(serde_json::Value),
Status404(serde_json::Value),
Status405(serde_json::Value),
Status429(models::UnstablePublicApiError),
Status500(models::UnstablePublicApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`unstable_topics_get_rule`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UnstableTopicsGetRuleError {
Status400(serde_json::Value),
Status401(serde_json::Value),
Status403(serde_json::Value),
Status404(serde_json::Value),
Status405(serde_json::Value),
Status429(models::UnstablePublicApiError),
Status500(models::UnstablePublicApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`unstable_topics_list`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UnstableTopicsListError {
Status400(serde_json::Value),
Status401(serde_json::Value),
Status403(serde_json::Value),
Status404(serde_json::Value),
Status405(serde_json::Value),
Status429(models::UnstablePublicApiError),
Status500(models::UnstablePublicApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`unstable_topics_list_assignments`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UnstableTopicsListAssignmentsError {
Status400(serde_json::Value),
Status401(serde_json::Value),
Status403(serde_json::Value),
Status404(serde_json::Value),
Status405(serde_json::Value),
Status429(models::UnstablePublicApiError),
Status500(models::UnstablePublicApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`unstable_topics_list_facets`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UnstableTopicsListFacetsError {
Status400(serde_json::Value),
Status401(serde_json::Value),
Status403(serde_json::Value),
Status404(serde_json::Value),
Status405(serde_json::Value),
Status429(models::UnstablePublicApiError),
Status500(models::UnstablePublicApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`unstable_topics_list_rules`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UnstableTopicsListRulesError {
Status400(serde_json::Value),
Status401(serde_json::Value),
Status403(serde_json::Value),
Status404(serde_json::Value),
Status405(serde_json::Value),
Status429(models::UnstablePublicApiError),
Status500(models::UnstablePublicApiError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`unstable_topics_list_summaries`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UnstableTopicsListSummariesError {
Status400(serde_json::Value),
Status401(serde_json::Value),
Status403(serde_json::Value),
Status404(serde_json::Value),
Status405(serde_json::Value),
Status429(models::UnstablePublicApiError),
Status500(models::UnstablePublicApiError),
UnknownValue(serde_json::Value),
}
/// Unstable: Topics is in closed beta. The shape may change without notice. Get one topic of a facet's current map by its stable id. Retired topics are not found.
#[bon::builder]
pub async fn unstable_topics_get(
configuration: &configuration::Configuration,
topic_id: &str,
from_timestamp: Option<chrono::DateTime<chrono::FixedOffset>>,
to_timestamp: Option<chrono::DateTime<chrono::FixedOffset>>,
) -> Result<models::UnstableTopicWithStatus, Error<UnstableTopicsGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_topic_id = topic_id;
let p_query_from_timestamp = from_timestamp;
let p_query_to_timestamp = to_timestamp;
let uri_str = format!(
"{}/api/public/unstable/topics/{topicId}",
configuration.base_path,
topicId = crate::apis::urlencode(p_path_topic_id)
);
let mut req_builder = configuration
.client
.request(timvw_rust_runtime::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_from_timestamp {
req_builder = req_builder.query(&[("fromTimestamp", ¶m_value.to_rfc3339())]);
}
if let Some(ref param_value) = p_query_to_timestamp {
req_builder = req_builder.query(&[("toTimestamp", ¶m_value.to_rfc3339())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder =
req_builder.header(timvw_rust_runtime::header::USER_AGENT, user_agent.clone());
}
if let Some(ref auth_conf) = configuration.basic_auth {
req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UnstableTopicWithStatus`"))),
ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UnstableTopicWithStatus`")))),
}
} else {
let headers = resp.headers().clone();
let content = resp.text().await?;
let entity: Option<UnstableTopicsGetError> = match status.as_u16() {
400 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsGetError::Status400),
401 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsGetError::Status401),
403 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsGetError::Status403),
404 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsGetError::Status404),
405 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsGetError::Status405),
429 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsGetError::Status429),
500 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsGetError::Status500),
_ => None,
}
.or_else(|| {
serde_json::from_str(&content)
.ok()
.map(UnstableTopicsGetError::UnknownValue)
});
Err(Error::ResponseError(Box::new(ResponseContent {
status,
content,
entity,
headers,
})))
}
}
/// Unstable: Topics is in closed beta. The shape may change without notice. Get one Topics facet by id, including inactive facets.
#[bon::builder]
pub async fn unstable_topics_get_facet(
configuration: &configuration::Configuration,
facet_id: &str,
) -> Result<models::UnstableTopicFacet, Error<UnstableTopicsGetFacetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_facet_id = facet_id;
let uri_str = format!(
"{}/api/public/unstable/topic-facets/{facetId}",
configuration.base_path,
facetId = crate::apis::urlencode(p_path_facet_id)
);
let mut req_builder = configuration
.client
.request(timvw_rust_runtime::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder =
req_builder.header(timvw_rust_runtime::header::USER_AGENT, user_agent.clone());
}
if let Some(ref auth_conf) = configuration.basic_auth {
req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UnstableTopicFacet`"))),
ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UnstableTopicFacet`")))),
}
} else {
let headers = resp.headers().clone();
let content = resp.text().await?;
let entity: Option<UnstableTopicsGetFacetError> = match status.as_u16() {
400 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsGetFacetError::Status400),
401 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsGetFacetError::Status401),
403 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsGetFacetError::Status403),
404 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsGetFacetError::Status404),
405 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsGetFacetError::Status405),
429 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsGetFacetError::Status429),
500 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsGetFacetError::Status500),
_ => None,
}
.or_else(|| {
serde_json::from_str(&content)
.ok()
.map(UnstableTopicsGetFacetError::UnknownValue)
});
Err(Error::ResponseError(Box::new(ResponseContent {
status,
content,
entity,
headers,
})))
}
}
/// Unstable: Topics is in closed beta. The shape may change without notice. Get one Topics rule by id.
#[bon::builder]
pub async fn unstable_topics_get_rule(
configuration: &configuration::Configuration,
rule_id: &str,
) -> Result<models::UnstableTopicRule, Error<UnstableTopicsGetRuleError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_rule_id = rule_id;
let uri_str = format!(
"{}/api/public/unstable/topic-rules/{ruleId}",
configuration.base_path,
ruleId = crate::apis::urlencode(p_path_rule_id)
);
let mut req_builder = configuration
.client
.request(timvw_rust_runtime::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder =
req_builder.header(timvw_rust_runtime::header::USER_AGENT, user_agent.clone());
}
if let Some(ref auth_conf) = configuration.basic_auth {
req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UnstableTopicRule`"))),
ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UnstableTopicRule`")))),
}
} else {
let headers = resp.headers().clone();
let content = resp.text().await?;
let entity: Option<UnstableTopicsGetRuleError> = match status.as_u16() {
400 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsGetRuleError::Status400),
401 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsGetRuleError::Status401),
403 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsGetRuleError::Status403),
404 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsGetRuleError::Status404),
405 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsGetRuleError::Status405),
429 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsGetRuleError::Status429),
500 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsGetRuleError::Status500),
_ => None,
}
.or_else(|| {
serde_json::from_str(&content)
.ok()
.map(UnstableTopicsGetRuleError::UnknownValue)
});
Err(Error::ResponseError(Box::new(ResponseContent {
status,
content,
entity,
headers,
})))
}
}
/// Unstable: Topics is in closed beta. The shape may change without notice. List the topics of each active facet's live map, with the number of traces currently assigned to each topic in the window. Retired topics are not listed. `facets` holds per-facet trace counts by topic status. The window applies to the trace start time. It defaults to the last 7 days and can span at most 93 days. `filter` is a JSON array of filter conditions combined with AND. String matching is case-insensitive. Columns: `facetId` (stringOptions), `facetName` (string, stringOptions), `ruleId` (stringOptions), `id` (stringOptions), `name` (string, stringOptions). Facet and rule conditions also restrict `facets`.
#[bon::builder]
pub async fn unstable_topics_list(
configuration: &configuration::Configuration,
from_timestamp: Option<chrono::DateTime<chrono::FixedOffset>>,
to_timestamp: Option<chrono::DateTime<chrono::FixedOffset>>,
filter: Option<&str>,
order_by: Option<models::UnstableTopicsOrderBy>,
page: Option<i64>,
limit: Option<i64>,
) -> Result<models::UnstableTopicList, Error<UnstableTopicsListError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_from_timestamp = from_timestamp;
let p_query_to_timestamp = to_timestamp;
let p_query_filter = filter;
let p_query_order_by = order_by;
let p_query_page = page;
let p_query_limit = limit;
let uri_str = format!("{}/api/public/unstable/topics", configuration.base_path);
let mut req_builder = configuration
.client
.request(timvw_rust_runtime::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_from_timestamp {
req_builder = req_builder.query(&[("fromTimestamp", ¶m_value.to_rfc3339())]);
}
if let Some(ref param_value) = p_query_to_timestamp {
req_builder = req_builder.query(&[("toTimestamp", ¶m_value.to_rfc3339())]);
}
if let Some(ref param_value) = p_query_filter {
req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_order_by {
req_builder = req_builder.query(&[("orderBy", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_page {
req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_limit {
req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder =
req_builder.header(timvw_rust_runtime::header::USER_AGENT, user_agent.clone());
}
if let Some(ref auth_conf) = configuration.basic_auth {
req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UnstableTopicList`"))),
ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UnstableTopicList`")))),
}
} else {
let headers = resp.headers().clone();
let content = resp.text().await?;
let entity: Option<UnstableTopicsListError> = match status.as_u16() {
400 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListError::Status400),
401 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListError::Status401),
403 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListError::Status403),
404 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListError::Status404),
405 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListError::Status405),
429 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListError::Status429),
500 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListError::Status500),
_ => None,
}
.or_else(|| {
serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListError::UnknownValue)
});
Err(Error::ResponseError(Box::new(ResponseContent {
status,
content,
entity,
headers,
})))
}
}
/// Unstable: Topics is in closed beta. The shape may change without notice. List the current topic per trace, facet and rule on each rule's live map: `assigned` with its topic, or `outlier` when no topic fits. Summarized traces that are not assigned yet are not listed; find them through `GET /topic-summaries` with `assignmentStatus`. The window applies to the trace start time. It defaults to the last 7 days and can span at most 30 days, starting no earlier than the plan's data access window. Without `fromTimestamp` and `toTimestamp`, a `traceId` `any of` filter reads the listed traces at their own start time within the last 93 days. Rows are ordered by trace start time. Each request scans a bounded number of candidate rows. A page shorter than `limit` (even an empty one) with a `meta.cursor` does not indicate completion; continue with the cursor until it is null. Only active facets (attached to a Topics rule, or all facets if the project has no rule) are read. Traces Topics never processed are not listed. `filter` is a JSON array of filter conditions combined with AND, with at most 100 `traceId` values. Columns: `traceId`, `facetId`, `facetName`, `ruleId`, `environment`, `topicId`, `topicName` (stringOptions), `status` (stringOptions, `any of` only: `assigned`, `outlier`), `timestamp` (datetime). An unknown `topicName` matches nothing under `any of` and is ignored under `none of`. Common questions: - Topics of specific traces: `traceId` `any of` the trace ids. - Traces in a topic: `topicId` or `topicName`.
#[bon::builder]
pub async fn unstable_topics_list_assignments(
configuration: &configuration::Configuration,
from_timestamp: Option<chrono::DateTime<chrono::FixedOffset>>,
to_timestamp: Option<chrono::DateTime<chrono::FixedOffset>>,
filter: Option<&str>,
order_by: Option<models::UnstableTopicResultsOrderBy>,
limit: Option<i64>,
cursor: Option<&str>,
) -> Result<models::UnstableTopicAssignmentList, Error<UnstableTopicsListAssignmentsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_from_timestamp = from_timestamp;
let p_query_to_timestamp = to_timestamp;
let p_query_filter = filter;
let p_query_order_by = order_by;
let p_query_limit = limit;
let p_query_cursor = cursor;
let uri_str = format!(
"{}/api/public/unstable/topic-assignments",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(timvw_rust_runtime::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_from_timestamp {
req_builder = req_builder.query(&[("fromTimestamp", ¶m_value.to_rfc3339())]);
}
if let Some(ref param_value) = p_query_to_timestamp {
req_builder = req_builder.query(&[("toTimestamp", ¶m_value.to_rfc3339())]);
}
if let Some(ref param_value) = p_query_filter {
req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_order_by {
req_builder = req_builder.query(&[("orderBy", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_limit {
req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_cursor {
req_builder = req_builder.query(&[("cursor", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder =
req_builder.header(timvw_rust_runtime::header::USER_AGENT, user_agent.clone());
}
if let Some(ref auth_conf) = configuration.basic_auth {
req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UnstableTopicAssignmentList`"))),
ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UnstableTopicAssignmentList`")))),
}
} else {
let headers = resp.headers().clone();
let content = resp.text().await?;
let entity: Option<UnstableTopicsListAssignmentsError> = match status.as_u16() {
400 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListAssignmentsError::Status400),
401 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListAssignmentsError::Status401),
403 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListAssignmentsError::Status403),
404 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListAssignmentsError::Status404),
405 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListAssignmentsError::Status405),
429 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListAssignmentsError::Status429),
500 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListAssignmentsError::Status500),
_ => None,
}
.or_else(|| {
serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListAssignmentsError::UnknownValue)
});
Err(Error::ResponseError(Box::new(ResponseContent {
status,
content,
entity,
headers,
})))
}
}
/// Unstable: Topics is in closed beta. The shape may change without notice. List the project's Topics facets. Only active facets (run by a Topics rule, or all facets if the project has no rule) are returned unless `filter` contains an `active` condition. `filter` is a JSON array of filter conditions combined with AND. String matching is case-insensitive. Columns: `id` (stringOptions), `name` (string, stringOptions), `description` (string), `isBuiltIn` (boolean), `active` (boolean).
#[bon::builder]
pub async fn unstable_topics_list_facets(
configuration: &configuration::Configuration,
filter: Option<&str>,
page: Option<i64>,
limit: Option<i64>,
) -> Result<models::UnstableTopicFacetList, Error<UnstableTopicsListFacetsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_filter = filter;
let p_query_page = page;
let p_query_limit = limit;
let uri_str = format!(
"{}/api/public/unstable/topic-facets",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(timvw_rust_runtime::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_filter {
req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_page {
req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_limit {
req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder =
req_builder.header(timvw_rust_runtime::header::USER_AGENT, user_agent.clone());
}
if let Some(ref auth_conf) = configuration.basic_auth {
req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UnstableTopicFacetList`"))),
ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UnstableTopicFacetList`")))),
}
} else {
let headers = resp.headers().clone();
let content = resp.text().await?;
let entity: Option<UnstableTopicsListFacetsError> = match status.as_u16() {
400 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListFacetsError::Status400),
401 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListFacetsError::Status401),
403 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListFacetsError::Status403),
404 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListFacetsError::Status404),
405 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListFacetsError::Status405),
429 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListFacetsError::Status429),
500 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListFacetsError::Status500),
_ => None,
}
.or_else(|| {
serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListFacetsError::UnknownValue)
});
Err(Error::ResponseError(Box::new(ResponseContent {
status,
content,
entity,
headers,
})))
}
}
/// Unstable: Topics is in closed beta. The shape may change without notice. List the project's Topics rules. A rule selects traces with an observation filter and a sampling rate, runs the facets in `facetIds` and keeps its own live topic map. `filter` is a JSON array of filter conditions combined with AND. String matching is case-insensitive. Columns: `id` (stringOptions), `name` (string, stringOptions).
#[bon::builder]
pub async fn unstable_topics_list_rules(
configuration: &configuration::Configuration,
filter: Option<&str>,
page: Option<i64>,
limit: Option<i64>,
) -> Result<models::UnstableTopicRuleList, Error<UnstableTopicsListRulesError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_filter = filter;
let p_query_page = page;
let p_query_limit = limit;
let uri_str = format!(
"{}/api/public/unstable/topic-rules",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(timvw_rust_runtime::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_filter {
req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_page {
req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_limit {
req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder =
req_builder.header(timvw_rust_runtime::header::USER_AGENT, user_agent.clone());
}
if let Some(ref auth_conf) = configuration.basic_auth {
req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UnstableTopicRuleList`"))),
ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UnstableTopicRuleList`")))),
}
} else {
let headers = resp.headers().clone();
let content = resp.text().await?;
let entity: Option<UnstableTopicsListRulesError> = match status.as_u16() {
400 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListRulesError::Status400),
401 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListRulesError::Status401),
403 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListRulesError::Status403),
404 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListRulesError::Status404),
405 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListRulesError::Status405),
429 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListRulesError::Status429),
500 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListRulesError::Status500),
_ => None,
}
.or_else(|| {
serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListRulesError::UnknownValue)
});
Err(Error::ResponseError(Box::new(ResponseContent {
status,
content,
entity,
headers,
})))
}
}
/// Unstable: Topics is in closed beta. The shape may change without notice. List the current Topics summary per trace and facet: what the trace is about from the facet's perspective. Summaries are shared by all rules. A trace that was re-summarized lists only its latest summary. The window applies to the trace start time. It defaults to the last 7 days and can span at most 30 days, starting no earlier than the plan's data access window. Without `fromTimestamp` and `toTimestamp`, a `traceId` `any of` filter reads the listed traces at their own start time within the last 93 days. Rows are ordered by trace start time. Each request scans a bounded number of candidate rows. A page shorter than `limit` (even an empty one) with a `meta.cursor` does not indicate completion; continue with the cursor until it is null. Only active facets (attached to a Topics rule, or all facets if the project has no rule) are read. Traces Topics never processed are not listed. `filter` is a JSON array of filter conditions combined with AND, with at most 100 `traceId` values. Columns: `traceId`, `facetId`, `facetName`, `ruleId`, `environment` (stringOptions), `timestamp`, `processedAt` (datetime), `state`, `topicId`, `topicName` (stringOptions), `assignmentStatus` (stringOptions, `any of` only). An unknown `topicName` matches nothing under `any of` and is ignored under `none of`. `state` values: `complete` (summarized), `not_applicable` (the facet does not apply to the trace), `insufficient_input` (too little input to summarize). `assignmentStatus` values: `assigned`, `outlier` (no topic fits), `awaiting_map` (summarized, not yet assigned). Common questions: - Summaries of specific traces: `traceId` `any of` the trace ids. - Summaries of a topic's traces: `topicId` or `topicName`. - Traces without a topic yet: `assignmentStatus` `any of` `[\"awaiting_map\", \"outlier\"]`.
#[bon::builder]
pub async fn unstable_topics_list_summaries(
configuration: &configuration::Configuration,
from_timestamp: Option<chrono::DateTime<chrono::FixedOffset>>,
to_timestamp: Option<chrono::DateTime<chrono::FixedOffset>>,
filter: Option<&str>,
truncate_summaries: Option<bool>,
order_by: Option<models::UnstableTopicResultsOrderBy>,
limit: Option<i64>,
cursor: Option<&str>,
) -> Result<models::UnstableTopicSummaryList, Error<UnstableTopicsListSummariesError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_from_timestamp = from_timestamp;
let p_query_to_timestamp = to_timestamp;
let p_query_filter = filter;
let p_query_truncate_summaries = truncate_summaries;
let p_query_order_by = order_by;
let p_query_limit = limit;
let p_query_cursor = cursor;
let uri_str = format!(
"{}/api/public/unstable/topic-summaries",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(timvw_rust_runtime::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_from_timestamp {
req_builder = req_builder.query(&[("fromTimestamp", ¶m_value.to_rfc3339())]);
}
if let Some(ref param_value) = p_query_to_timestamp {
req_builder = req_builder.query(&[("toTimestamp", ¶m_value.to_rfc3339())]);
}
if let Some(ref param_value) = p_query_filter {
req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_truncate_summaries {
req_builder = req_builder.query(&[("truncateSummaries", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_order_by {
req_builder = req_builder.query(&[("orderBy", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_limit {
req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_cursor {
req_builder = req_builder.query(&[("cursor", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder =
req_builder.header(timvw_rust_runtime::header::USER_AGENT, user_agent.clone());
}
if let Some(ref auth_conf) = configuration.basic_auth {
req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UnstableTopicSummaryList`"))),
ContentType::Unsupported(unknown_type) => Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::UnstableTopicSummaryList`")))),
}
} else {
let headers = resp.headers().clone();
let content = resp.text().await?;
let entity: Option<UnstableTopicsListSummariesError> = match status.as_u16() {
400 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListSummariesError::Status400),
401 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListSummariesError::Status401),
403 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListSummariesError::Status403),
404 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListSummariesError::Status404),
405 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListSummariesError::Status405),
429 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListSummariesError::Status429),
500 => serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListSummariesError::Status500),
_ => None,
}
.or_else(|| {
serde_json::from_str(&content)
.ok()
.map(UnstableTopicsListSummariesError::UnknownValue)
});
Err(Error::ResponseError(Box::new(ResponseContent {
status,
content,
entity,
headers,
})))
}
}