cognite/dto/data_modeling/instances/extensions/
common.rs

1use serde::{Deserialize, Serialize};
2use serde_with::skip_serializing_none;
3
4use crate::models::instances::InstanceId;
5
6#[skip_serializing_none]
7#[derive(Serialize, Deserialize, Clone, Debug, Default)]
8#[serde(rename_all = "camelCase")]
9/// Cognite sourceable.
10pub struct CogniteSourceable {
11    /// Identifier from the source system.
12    pub source_id: Option<String>,
13    /// Context of the source id. For systems where the sourceId is globally unique, the sourceContext is expected to not be set.
14    pub source_context: Option<String>,
15    /// Direct relation to a source system.
16    pub source: Option<InstanceId>,
17    /// When the instance was created in source system (if available).
18    pub source_created_time: Option<i64>,
19    /// When the instance was last updated in the source system (if available)
20    pub source_updated_time: Option<i64>,
21    /// User identifier from the source system on who created the source data. This identifier is
22    /// not guaranteed to match the user identifiers in CDF.
23    pub source_created_user: Option<String>,
24    /// User identifier from the source system on who last updated the source data.
25    /// This identifier is not guaranteed to match the user identifiers in CDF.
26    pub source_updated_user: Option<String>,
27}
28
29#[skip_serializing_none]
30#[derive(Serialize, Deserialize, Clone, Debug, Default)]
31#[serde(rename_all = "camelCase")]
32/// Cognite describable.
33pub struct CogniteDescribable {
34    /// Name of the instance.
35    pub name: Option<String>,
36    /// Description of the instance.
37    pub description: Option<String>,
38    /// Text based labels for generic use, limited to 1000.
39    pub tags: Option<Vec<String>>,
40    /// Alternative names for the node.
41    pub aliases: Option<Vec<String>>,
42}
43
44impl CogniteDescribable {
45    /// Create a new describable instance.
46    pub fn new() -> Self {
47        Self {
48            ..Default::default()
49        }
50    }
51}
52
53#[skip_serializing_none]
54#[derive(Serialize, Deserialize, Clone, Debug, Default)]
55#[serde(rename_all = "camelCase")]
56/// Cognite auditable.
57pub struct CogniteAuditable {
58    /// When the instance was last updated.
59    pub last_updated_time: i64,
60    /// When the instance was created.
61    pub created_time: i64,
62    /// When the instance was deleted.
63    pub deleted_time: Option<i64>,
64}