cognite/dto/core/time_series/
synthetic.rs1use serde::{Deserialize, Serialize};
2use serde_with::skip_serializing_none;
3
4use crate::time_series::TimestampOrRelative;
5
6#[skip_serializing_none]
7#[derive(Serialize, Deserialize, Debug, Default, Clone)]
8#[serde(rename_all = "camelCase")]
9pub struct SyntheticTimeSeriesQuery {
11 pub expression: String,
14 pub start: Option<TimestampOrRelative>,
16 pub end: Option<TimestampOrRelative>,
18 pub limit: Option<i32>,
20}
21
22#[skip_serializing_none]
23#[derive(Serialize, Deserialize, Debug, Clone)]
24#[serde(rename_all = "camelCase")]
25pub struct SyntheticDataValue {
27 pub timestamp: i64,
29 pub value: f64,
31}
32
33#[skip_serializing_none]
34#[derive(Serialize, Deserialize, Debug, Clone)]
35#[serde(rename_all = "camelCase")]
36pub struct SyntheticDataError {
38 pub timestamp: i64,
40 pub error: String,
42}
43
44#[skip_serializing_none]
45#[derive(Serialize, Deserialize, Debug, Clone)]
46#[serde(untagged)]
47pub enum SyntheticDataPoint {
49 Value(SyntheticDataValue),
51 Error(SyntheticDataError),
53}
54
55#[skip_serializing_none]
56#[derive(Serialize, Deserialize, Debug, Clone)]
57#[serde(rename_all = "camelCase")]
58pub struct SyntheticQueryResponse {
60 pub is_string: Option<bool>,
62 pub datapoints: Vec<SyntheticDataPoint>,
64}