@@ -31,34 +31,88 @@ const CATEGORY_ID_KEY: &str = "category_id";
3131pub struct ExtraFields {
3232 /// Reference to the latest document.
3333 #[ serde( rename = "ref" , skip_serializing_if = "Option::is_none" ) ]
34- pub ( super ) doc_ref : Option < DocumentRef > ,
34+ doc_ref : Option < DocumentRef > ,
3535 /// Reference to the document template.
3636 #[ serde( skip_serializing_if = "Option::is_none" ) ]
37- pub ( super ) template : Option < DocumentRef > ,
37+ template : Option < DocumentRef > ,
3838 /// Reference to the document reply.
3939 #[ serde( skip_serializing_if = "Option::is_none" ) ]
40- pub ( super ) reply : Option < DocumentRef > ,
40+ reply : Option < DocumentRef > ,
4141 /// Reference to the document section.
4242 #[ serde( skip_serializing_if = "Option::is_none" ) ]
43- pub ( super ) section : Option < String > ,
43+ section : Option < String > ,
4444 /// Reference to the document collaborators. Collaborator type is TBD.
4545 #[ serde( default = "Vec::new" , skip_serializing_if = "Vec::is_empty" ) ]
46- pub ( super ) collabs : Vec < String > ,
46+ collabs : Vec < String > ,
4747 /// Unique identifier for the brand that is running the voting.
4848 #[ serde( skip_serializing_if = "Option::is_none" ) ]
49- pub ( super ) brand_id : Option < UuidV4 > ,
49+ brand_id : Option < UuidV4 > ,
5050 /// Unique identifier for the campaign of voting.
5151 #[ serde( skip_serializing_if = "Option::is_none" ) ]
52- pub ( super ) campaign_id : Option < UuidV4 > ,
52+ campaign_id : Option < UuidV4 > ,
5353 /// Unique identifier for the election.
5454 #[ serde( skip_serializing_if = "Option::is_none" ) ]
55- pub ( super ) election_id : Option < UuidV4 > ,
55+ election_id : Option < UuidV4 > ,
5656 /// Unique identifier for the voting category as a collection of proposals.
5757 #[ serde( skip_serializing_if = "Option::is_none" ) ]
58- pub ( super ) category_id : Option < UuidV4 > ,
58+ category_id : Option < UuidV4 > ,
5959}
6060
6161impl ExtraFields {
62+ /// Return `ref` field.
63+ #[ must_use]
64+ pub fn doc_ref ( & self ) -> Option < DocumentRef > {
65+ self . doc_ref
66+ }
67+
68+ /// Return `template` field.
69+ #[ must_use]
70+ pub fn template ( & self ) -> Option < DocumentRef > {
71+ self . template
72+ }
73+
74+ /// Return `reply` field.
75+ #[ must_use]
76+ pub fn reply ( & self ) -> Option < DocumentRef > {
77+ self . reply
78+ }
79+
80+ /// Return `section` field.
81+ #[ must_use]
82+ pub fn section ( & self ) -> Option < & String > {
83+ self . section . as_ref ( )
84+ }
85+
86+ /// Return `collabs` field.
87+ #[ must_use]
88+ pub fn collabs ( & self ) -> & Vec < String > {
89+ & self . collabs
90+ }
91+
92+ /// Return `brand_id` field.
93+ #[ must_use]
94+ pub fn brand_id ( & self ) -> Option < UuidV4 > {
95+ self . brand_id
96+ }
97+
98+ /// Return `campaign_id` field.
99+ #[ must_use]
100+ pub fn campaign_id ( & self ) -> Option < UuidV4 > {
101+ self . campaign_id
102+ }
103+
104+ /// Return `election_id` field.
105+ #[ must_use]
106+ pub fn election_id ( & self ) -> Option < UuidV4 > {
107+ self . election_id
108+ }
109+
110+ /// Return `category_id` field.
111+ #[ must_use]
112+ pub fn category_id ( & self ) -> Option < UuidV4 > {
113+ self . category_id
114+ }
115+
62116 /// Fill the COSE header `ExtraFields` data into the header builder.
63117 pub ( super ) fn fill_cose_header_fields (
64118 & self , mut builder : coset:: HeaderBuilder ,
0 commit comments