conductor/models/
secret.rs1use serde::{Deserialize, Serialize};
5
6#[derive(Debug, Clone, Default, Serialize, Deserialize)]
8#[serde(rename_all = "camelCase")]
9pub struct MetadataTag {
10 pub key: String,
12
13 #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
15 pub tag_type: Option<String>,
16
17 #[serde(skip_serializing_if = "Option::is_none")]
19 pub value: Option<String>,
20}
21
22impl MetadataTag {
23 pub fn new(key: impl Into<String>) -> Self {
25 Self {
26 key: key.into(),
27 tag_type: None,
28 value: None,
29 }
30 }
31
32 pub fn with_value(key: impl Into<String>, value: impl Into<String>) -> Self {
34 Self {
35 key: key.into(),
36 tag_type: None,
37 value: Some(value.into()),
38 }
39 }
40
41 #[must_use]
43 pub fn with_type(mut self, tag_type: impl Into<String>) -> Self {
44 self.tag_type = Some(tag_type.into());
45 self
46 }
47}