1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
use crate::model::TelegramPassportElement;
use serde::{Deserialize, Serialize};

/// struct for holding data needed to call
/// [`set_passport_data_errors`]
///
/// [`set_passport_data_errors`]:
/// ../../api/trait.API.html#method.set_passport_data_errors
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
pub struct SetPassportDataErrors {
    /// User identifier
    pub user_id: i64,
    /// A vec describing the errors
    pub errors: Vec<PassportElementError>,
}

/// This object represents an error in the Telegram Passport element which was
/// submitted that should be resolved by the user
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
#[serde(tag = "source")]
pub enum PassportElementError {
    #[serde(rename = "data")]
    DataField(PassportElementErrorDataField),
    #[serde(rename = "front_side")]
    FrontSide(PassportElementErrorFrontSide),
    #[serde(rename = "reverse_side")]
    ReverseSide(PassportElementErrorReverseSide),
    #[serde(rename = "selfie")]
    Selfie(PassportElementErrorSelfie),
    #[serde(rename = "file")]
    File(PassportElementErrorFile),
    #[serde(rename = "files")]
    Files(PassportElementErrorFiles),
    #[serde(rename = "translation_file")]
    TranslationFile(PassportElementErrorTranslationFile),
    #[serde(rename = "translation_files")]
    TranslationFiles(PassportElementErrorTranslationFiles),
    #[serde(rename = "unspecified")]
    Unspecified(PassportElementErrorUnspecified),
}

/// Represents an issue in one of the data fields that was provided by the user.
/// The error is considered resolved when the field's value changes.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
pub struct PassportElementErrorDataField {
    /// The section of the user's Telegram Passport which has the error,
    /// one of “personal_details”, “passport”, “driver_license”,
    /// “identity_card”, “internal_passport”, “address”
    #[serde(rename = "type")]
    pub section_type: TelegramPassportElement,
    /// Name of the data field which has the error
    pub field_name: String,
    /// Base64-encoded data hash
    pub data_hash: String,
    /// Error message
    pub message: String,
}

/// Represents an issue with the front side of a document.
/// The error is considered resolved when the file with the front side of the
/// document changes.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
pub struct PassportElementErrorFrontSide {
    /// The section of the user's Telegram Passport which has the issue,
    /// one of “passport”, “driver_license”, “identity_card”,
    /// “internal_passport”
    #[serde(rename = "type")]
    pub section_type: TelegramPassportElement,
    /// Base64-encoded hash of the file with the front side of the document
    pub file_hash: String,
    /// Error message
    pub message: String,
}

/// Represents an issue with the reverse side of a document.
/// The error is considered resolved when the file with reverse side of the
/// document changes.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
pub struct PassportElementErrorReverseSide {
    /// The section of the user's Telegram Passport which has the issue,
    /// one of “driver_license”, “identity_card”
    #[serde(rename = "type")]
    pub section_type: TelegramPassportElement,
    /// Base64-encoded hash of the file with the reverse side of the document
    pub file_hash: String,
    /// Error message
    pub message: String,
}

/// Represents an issue with the selfie with a document.
/// The error is considered resolved when the file with the selfie changes.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
pub struct PassportElementErrorSelfie {
    /// The section of the user's Telegram Passport which has the issue,
    /// one of “passport”, “driver_license”, “identity_card”,
    /// “internal_passport”
    #[serde(rename = "type")]
    pub section_type: TelegramPassportElement,
    /// Base64-encoded hash of the file with the selfie
    pub file_hash: String,
    /// Error message
    pub message: String,
}

/// Represents an issue with a document scan.
/// The error is considered resolved when the file with the document scan
/// changes.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
pub struct PassportElementErrorFile {
    /// The section of the user's Telegram Passport which has the issue
    /// one of “utility_bill”, “bank_statement”, “rental_agreement”,
    /// “passport_registration”, “temporary_registration”
    #[serde(rename = "type")]
    pub section_type: TelegramPassportElement,
    /// Base64-encoded file hash
    pub file_hash: String,
    /// Error message
    pub message: String,
}

/// Represents an issue with a list of scans.
/// The error is considered resolved when the list of files containing the scans
/// changes.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
pub struct PassportElementErrorFiles {
    /// The section of the user's Telegram Passport which has the issue,
    /// one of “utility_bill”, “bank_statement”, “rental_agreement”,
    /// “passport_registration”, “temporary_registration”
    #[serde(rename = "type")]
    pub section_type: TelegramPassportElement,
    /// List of base64-encoded file hashes
    pub file_hashes: Vec<String>,
    /// Error message
    pub message: String,
}

/// Represents an issue with one of the files that constitute the translation of
/// a document. The error is considered resolved when the file changes.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
pub struct PassportElementErrorTranslationFile {
    /// Type of element of the user's Telegram Passport which has the issue,
    /// one of “passport”, “driver_license”, “identity_card”,
    /// “internal_passport”, “utility_bill”, “bank_statement”,
    /// “rental_agreement”, “passport_registration”, “temporary_registration”
    #[serde(rename = "type")]
    pub section_type: TelegramPassportElement,
    /// Base64-encoded file hash
    pub file_hash: String,
    /// Error message
    pub message: String,
}

/// Represents an issue with the translated version of a document.
/// The error is considered resolved when a file with the document translation
/// change.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
pub struct PassportElementErrorTranslationFiles {
    /// Type of element of the user's Telegram Passport which has the issue,
    /// one of “passport”, “driver_license”, “identity_card”,
    /// “internal_passport”, “utility_bill”, “bank_statement”,
    /// “rental_agreement”, “passport_registration”, “temporary_registration”
    #[serde(rename = "type")]
    pub section_type: TelegramPassportElement,
    /// List of base64-encoded file hashes
    pub file_hashes: Vec<String>,
    /// Error message
    pub message: String,
}

/// Represents an issue in an unspecified place.
/// The error is considered resolved when new data is added.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
pub struct PassportElementErrorUnspecified {
    /// Type of element of the user's Telegram Passport which has the issue
    #[serde(rename = "type")]
    pub section_type: TelegramPassportElement,
    /// Base64-encoded element hash
    pub element_hash: String,
    /// Error message
    pub message: String,
}