Skip to main content

nominal_api/conjure/objects/scout/catalog/
dataset_file.rs

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    conjure_object::private::DeriveWith
7)]
8#[serde(crate = "conjure_object::serde")]
9#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
10#[conjure_object::private::staged_builder::staged_builder]
11#[builder(crate = conjure_object::private::staged_builder, update, inline)]
12pub struct DatasetFile {
13    #[serde(rename = "id")]
14    id: super::super::super::datasource::DatasetFileId,
15    #[serde(rename = "datasetRid")]
16    dataset_rid: super::super::super::api::rids::DatasetRid,
17    #[builder(into)]
18    #[serde(rename = "name")]
19    name: String,
20    #[builder(custom(type = super::Handle, convert = Box::new))]
21    #[serde(rename = "handle")]
22    handle: Box<super::Handle>,
23    #[builder(
24        default,
25        custom(
26            type = impl
27            Into<Option<super::Bounds>>,
28            convert = |v|v.into().map(Box::new)
29        )
30    )]
31    #[serde(rename = "bounds", skip_serializing_if = "Option::is_none", default)]
32    bounds: Option<Box<super::Bounds>>,
33    #[serde(rename = "uploadedAt")]
34    uploaded_at: conjure_object::DateTime<conjure_object::Utc>,
35    #[builder(default, into)]
36    #[serde(rename = "ingestedAt", skip_serializing_if = "Option::is_none", default)]
37    ingested_at: Option<conjure_object::DateTime<conjure_object::Utc>>,
38    #[builder(
39        custom(type = super::super::super::api::IngestStatusV2, convert = Box::new)
40    )]
41    #[serde(rename = "ingestStatus")]
42    ingest_status: Box<super::super::super::api::IngestStatusV2>,
43    #[builder(
44        default,
45        custom(
46            type = impl
47            Into<Option<super::TimestampMetadata>>,
48            convert = |v|v.into().map(Box::new)
49        )
50    )]
51    #[serde(
52        rename = "timestampMetadata",
53        skip_serializing_if = "Option::is_none",
54        default
55    )]
56    timestamp_metadata: Option<Box<super::TimestampMetadata>>,
57    #[builder(
58        default,
59        custom(
60            type = impl
61            Into<Option<super::IngestTagMetadata>>,
62            convert = |v|v.into().map(Box::new)
63        )
64    )]
65    #[serde(
66        rename = "ingestTagMetadata",
67        skip_serializing_if = "Option::is_none",
68        default
69    )]
70    ingest_tag_metadata: Option<Box<super::IngestTagMetadata>>,
71    #[builder(default, into)]
72    #[serde(
73        rename = "originFilePaths",
74        skip_serializing_if = "Option::is_none",
75        default
76    )]
77    origin_file_paths: Option<Vec<String>>,
78    #[builder(default, into)]
79    #[serde(rename = "ingestJobRid", skip_serializing_if = "Option::is_none", default)]
80    ingest_job_rid: Option<super::super::super::ingest::api::IngestJobRid>,
81    #[builder(default, into)]
82    #[serde(rename = "deletedAt", skip_serializing_if = "Option::is_none", default)]
83    deleted_at: Option<conjure_object::DateTime<conjure_object::Utc>>,
84    #[builder(
85        default,
86        custom(
87            type = impl
88            Into<Option<super::DatasetFileMetadata>>,
89            convert = |v|v.into().map(Box::new)
90        )
91    )]
92    #[serde(rename = "metadata", skip_serializing_if = "Option::is_none", default)]
93    metadata: Option<Box<super::DatasetFileMetadata>>,
94}
95impl DatasetFile {
96    #[inline]
97    pub fn id(&self) -> super::super::super::datasource::DatasetFileId {
98        self.id
99    }
100    #[inline]
101    pub fn dataset_rid(&self) -> &super::super::super::api::rids::DatasetRid {
102        &self.dataset_rid
103    }
104    #[inline]
105    pub fn name(&self) -> &str {
106        &*self.name
107    }
108    #[inline]
109    pub fn handle(&self) -> &super::Handle {
110        &*self.handle
111    }
112    #[inline]
113    pub fn bounds(&self) -> Option<&super::Bounds> {
114        self.bounds.as_ref().map(|o| &**o)
115    }
116    /// Timestamp that the file was received and stored, but not processed or made available to consumers.
117    #[inline]
118    pub fn uploaded_at(&self) -> conjure_object::DateTime<conjure_object::Utc> {
119        self.uploaded_at
120    }
121    /// Timestamp that the file is ingested at and made available for processing. If the file has failed to be
122    /// ingested for any reason or is still being processed, then this value will be empty.
123    #[inline]
124    pub fn ingested_at(&self) -> Option<conjure_object::DateTime<conjure_object::Utc>> {
125        self.ingested_at.as_ref().map(|o| *o)
126    }
127    #[inline]
128    pub fn ingest_status(&self) -> &super::super::super::api::IngestStatusV2 {
129        &*self.ingest_status
130    }
131    #[inline]
132    pub fn timestamp_metadata(&self) -> Option<&super::TimestampMetadata> {
133        self.timestamp_metadata.as_ref().map(|o| &**o)
134    }
135    #[inline]
136    pub fn ingest_tag_metadata(&self) -> Option<&super::IngestTagMetadata> {
137        self.ingest_tag_metadata.as_ref().map(|o| &**o)
138    }
139    #[inline]
140    pub fn origin_file_paths(&self) -> Option<&[String]> {
141        self.origin_file_paths.as_ref().map(|o| &**o)
142    }
143    #[inline]
144    pub fn ingest_job_rid(
145        &self,
146    ) -> Option<&super::super::super::ingest::api::IngestJobRid> {
147        self.ingest_job_rid.as_ref().map(|o| &*o)
148    }
149    /// Timestamp that the file is deleted at, only present if the file has been deleted.
150    #[inline]
151    pub fn deleted_at(&self) -> Option<conjure_object::DateTime<conjure_object::Utc>> {
152        self.deleted_at.as_ref().map(|o| *o)
153    }
154    /// File-type-specific metadata. For video files, contains timestamp manifest and segment metadata.
155    #[inline]
156    pub fn metadata(&self) -> Option<&super::DatasetFileMetadata> {
157        self.metadata.as_ref().map(|o| &**o)
158    }
159}