@@ -6,11 +6,14 @@ use serde::{Deserialize, Deserializer, Serialize};
66use serde_with:: skip_serializing_none;
77use std:: fmt:: { self , Formatter } ;
88
9- /// Assets related to the object, including title and url .
9+ /// Assets related to the object, including title, url, and tags .
1010#[ non_exhaustive]
1111#[ skip_serializing_none]
1212#[ derive( Clone , Debug , PartialEq , Serialize ) ]
1313pub struct MetricAssetAttributes {
14+ /// List of tag keys used in the asset.
15+ #[ serde( rename = "tags" ) ]
16+ pub tags : Option < Vec < String > > ,
1417 /// Title of the asset.
1518 #[ serde( rename = "title" ) ]
1619 pub title : Option < String > ,
@@ -27,13 +30,19 @@ pub struct MetricAssetAttributes {
2730impl MetricAssetAttributes {
2831 pub fn new ( ) -> MetricAssetAttributes {
2932 MetricAssetAttributes {
33+ tags : None ,
3034 title : None ,
3135 url : None ,
3236 additional_properties : std:: collections:: BTreeMap :: new ( ) ,
3337 _unparsed : false ,
3438 }
3539 }
3640
41+ pub fn tags ( mut self , value : Vec < String > ) -> Self {
42+ self . tags = Some ( value) ;
43+ self
44+ }
45+
3746 pub fn title ( mut self , value : String ) -> Self {
3847 self . title = Some ( value) ;
3948 self
@@ -76,6 +85,7 @@ impl<'de> Deserialize<'de> for MetricAssetAttributes {
7685 where
7786 M : MapAccess < ' a > ,
7887 {
88+ let mut tags: Option < Vec < String > > = None ;
7989 let mut title: Option < String > = None ;
8090 let mut url: Option < String > = None ;
8191 let mut additional_properties: std:: collections:: BTreeMap <
@@ -86,6 +96,12 @@ impl<'de> Deserialize<'de> for MetricAssetAttributes {
8696
8797 while let Some ( ( k, v) ) = map. next_entry :: < String , serde_json:: Value > ( ) ? {
8898 match k. as_str ( ) {
99+ "tags" => {
100+ if v. is_null ( ) {
101+ continue ;
102+ }
103+ tags = Some ( serde_json:: from_value ( v) . map_err ( M :: Error :: custom) ?) ;
104+ }
89105 "title" => {
90106 if v. is_null ( ) {
91107 continue ;
@@ -107,6 +123,7 @@ impl<'de> Deserialize<'de> for MetricAssetAttributes {
107123 }
108124
109125 let content = MetricAssetAttributes {
126+ tags,
110127 title,
111128 url,
112129 additional_properties,
0 commit comments