@@ -32,34 +32,88 @@ const CATEGORY_ID_KEY: &str = "category_id";
3232pub struct ExtraFields {
3333 /// Reference to the latest document.
3434 #[ serde( rename = "ref" , skip_serializing_if = "Option::is_none" ) ]
35- pub ( super ) doc_ref : Option < DocumentRef > ,
35+ doc_ref : Option < DocumentRef > ,
3636 /// Reference to the document template.
3737 #[ serde( skip_serializing_if = "Option::is_none" ) ]
38- pub ( super ) template : Option < DocumentRef > ,
38+ template : Option < DocumentRef > ,
3939 /// Reference to the document reply.
4040 #[ serde( skip_serializing_if = "Option::is_none" ) ]
41- pub ( super ) reply : Option < DocumentRef > ,
41+ reply : Option < DocumentRef > ,
4242 /// Reference to the document section.
4343 #[ serde( skip_serializing_if = "Option::is_none" ) ]
44- pub ( super ) section : Option < String > ,
44+ section : Option < String > ,
4545 /// Reference to the document collaborators. Collaborator type is TBD.
4646 #[ serde( default = "Vec::new" , skip_serializing_if = "Vec::is_empty" ) ]
47- pub ( super ) collabs : Vec < String > ,
47+ collabs : Vec < String > ,
4848 /// Unique identifier for the brand that is running the voting.
4949 #[ serde( skip_serializing_if = "Option::is_none" ) ]
50- pub ( super ) brand_id : Option < UuidV4 > ,
50+ brand_id : Option < UuidV4 > ,
5151 /// Unique identifier for the campaign of voting.
5252 #[ serde( skip_serializing_if = "Option::is_none" ) ]
53- pub ( super ) campaign_id : Option < UuidV4 > ,
53+ campaign_id : Option < UuidV4 > ,
5454 /// Unique identifier for the election.
5555 #[ serde( skip_serializing_if = "Option::is_none" ) ]
56- pub ( super ) election_id : Option < UuidV4 > ,
56+ election_id : Option < UuidV4 > ,
5757 /// Unique identifier for the voting category as a collection of proposals.
5858 #[ serde( skip_serializing_if = "Option::is_none" ) ]
59- pub ( super ) category_id : Option < UuidV4 > ,
59+ category_id : Option < UuidV4 > ,
6060}
6161
6262impl ExtraFields {
63+ /// Return `ref` field.
64+ #[ must_use]
65+ pub fn doc_ref ( & self ) -> Option < DocumentRef > {
66+ self . doc_ref
67+ }
68+
69+ /// Return `template` field.
70+ #[ must_use]
71+ pub fn template ( & self ) -> Option < DocumentRef > {
72+ self . template
73+ }
74+
75+ /// Return `reply` field.
76+ #[ must_use]
77+ pub fn reply ( & self ) -> Option < DocumentRef > {
78+ self . reply
79+ }
80+
81+ /// Return `section` field.
82+ #[ must_use]
83+ pub fn section ( & self ) -> Option < & String > {
84+ self . section . as_ref ( )
85+ }
86+
87+ /// Return `collabs` field.
88+ #[ must_use]
89+ pub fn collabs ( & self ) -> & Vec < String > {
90+ & self . collabs
91+ }
92+
93+ /// Return `brand_id` field.
94+ #[ must_use]
95+ pub fn brand_id ( & self ) -> Option < UuidV4 > {
96+ self . brand_id
97+ }
98+
99+ /// Return `campaign_id` field.
100+ #[ must_use]
101+ pub fn campaign_id ( & self ) -> Option < UuidV4 > {
102+ self . campaign_id
103+ }
104+
105+ /// Return `election_id` field.
106+ #[ must_use]
107+ pub fn election_id ( & self ) -> Option < UuidV4 > {
108+ self . election_id
109+ }
110+
111+ /// Return `category_id` field.
112+ #[ must_use]
113+ pub fn category_id ( & self ) -> Option < UuidV4 > {
114+ self . category_id
115+ }
116+
63117 /// Fill the COSE header `ExtraFields` data into the header builder.
64118 pub ( super ) fn fill_cose_header_fields (
65119 & self , mut builder : coset:: HeaderBuilder ,
0 commit comments