diff --git a/src/types/passport_element_error.rs b/src/types/passport_element_error.rs index 33325173..fd78ea3f 100644 --- a/src/types/passport_element_error.rs +++ b/src/types/passport_element_error.rs @@ -87,6 +87,41 @@ pub struct PassportElementErrorDataField { pub data_hash: String, } +impl PassportElementErrorDataField { + pub fn new( + r#type: PassportElementErrorDataFieldType, + field_name: S1, + data_hash: S2, + ) -> Self + where + S1: Into, + S2: Into, + { + Self { r#type, field_name: field_name.into(), data_hash: data_hash.into() } + } + + pub fn r#type(mut self, val: PassportElementErrorDataFieldType) -> Self { + self.r#type = val; + self + } + + pub fn field_name(mut self, val: S) -> Self + where + S: Into, + { + self.field_name = val.into(); + self + } + + pub fn data_hash(mut self, val: S) -> Self + where + S: Into, + { + self.data_hash = val.into(); + self + } +} + /// Represents an issue with the front side of a document. /// /// The error is considered resolved when the file with the front side of the @@ -104,6 +139,28 @@ pub struct PassportElementErrorFrontSide { pub file_hash: String, } +impl PassportElementErrorFrontSide { + pub fn new(r#type: PassportElementErrorFrontSideType, file_hash: S) -> Self + where + S: Into, + { + Self { r#type, file_hash: file_hash.into() } + } + + pub fn r#type(mut self, val: PassportElementErrorFrontSideType) -> Self { + self.r#type = val; + self + } + + pub fn file_hash(mut self, val: S) -> Self + where + S: Into, + { + self.file_hash = val.into(); + self + } +} + /// Represents an issue with the reverse side of a document. /// /// The error is considered resolved when the file with reverse side of the