/
data.py
186 lines (164 loc) · 6.22 KB
/
data.py
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
182
183
184
185
186
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2024
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser Public License for more details.
#
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
# pylint: disable=missing-module-docstring
from typing import Optional
from telegram._telegramobject import TelegramObject
from telegram._utils.types import JSONDict
class PersonalDetails(TelegramObject):
"""
This object represents personal details.
Args:
first_name (:obj:`str`): First Name.
middle_name (:obj:`str`): Optional. First Name.
last_name (:obj:`str`): Last Name.
birth_date (:obj:`str`): Date of birth in DD.MM.YYYY format.
gender (:obj:`str`): Gender, male or female.
country_code (:obj:`str`): Citizenship (ISO 3166-1 alpha-2 country code).
residence_country_code (:obj:`str`): Country of residence (ISO 3166-1 alpha-2 country
code).
first_name_native (:obj:`str`): First Name in the language of the user's country of
residence.
middle_name_native (:obj:`str`): Optional. Middle Name in the language of the user's
country of residence.
last_name_native (:obj:`str`): Last Name in the language of the user's country of
residence.
Attributes:
first_name (:obj:`str`): First Name.
middle_name (:obj:`str`): Optional. First Name.
last_name (:obj:`str`): Last Name.
birth_date (:obj:`str`): Date of birth in DD.MM.YYYY format.
gender (:obj:`str`): Gender, male or female.
country_code (:obj:`str`): Citizenship (ISO 3166-1 alpha-2 country code).
residence_country_code (:obj:`str`): Country of residence (ISO 3166-1 alpha-2 country
code).
first_name_native (:obj:`str`): First Name in the language of the user's country of
residence.
middle_name_native (:obj:`str`): Optional. Middle Name in the language of the user's
country of residence.
last_name_native (:obj:`str`): Last Name in the language of the user's country of
residence.
"""
__slots__ = (
"birth_date",
"country_code",
"first_name",
"first_name_native",
"gender",
"last_name",
"last_name_native",
"middle_name",
"middle_name_native",
"residence_country_code",
)
def __init__(
self,
first_name: str,
last_name: str,
birth_date: str,
gender: str,
country_code: str,
residence_country_code: str,
first_name_native: Optional[str] = None,
last_name_native: Optional[str] = None,
middle_name: Optional[str] = None,
middle_name_native: Optional[str] = None,
*,
api_kwargs: Optional[JSONDict] = None,
):
super().__init__(api_kwargs=api_kwargs)
# Required
self.first_name: str = first_name
self.last_name: str = last_name
self.middle_name: Optional[str] = middle_name
self.birth_date: str = birth_date
self.gender: str = gender
self.country_code: str = country_code
self.residence_country_code: str = residence_country_code
self.first_name_native: Optional[str] = first_name_native
self.last_name_native: Optional[str] = last_name_native
self.middle_name_native: Optional[str] = middle_name_native
self._freeze()
class ResidentialAddress(TelegramObject):
"""
This object represents a residential address.
Args:
street_line1 (:obj:`str`): First line for the address.
street_line2 (:obj:`str`): Optional. Second line for the address.
city (:obj:`str`): City.
state (:obj:`str`): Optional. State.
country_code (:obj:`str`): ISO 3166-1 alpha-2 country code.
post_code (:obj:`str`): Address post code.
Attributes:
street_line1 (:obj:`str`): First line for the address.
street_line2 (:obj:`str`): Optional. Second line for the address.
city (:obj:`str`): City.
state (:obj:`str`): Optional. State.
country_code (:obj:`str`): ISO 3166-1 alpha-2 country code.
post_code (:obj:`str`): Address post code.
"""
__slots__ = (
"city",
"country_code",
"post_code",
"state",
"street_line1",
"street_line2",
)
def __init__(
self,
street_line1: str,
street_line2: str,
city: str,
state: str,
country_code: str,
post_code: str,
*,
api_kwargs: Optional[JSONDict] = None,
):
super().__init__(api_kwargs=api_kwargs)
# Required
self.street_line1: str = street_line1
self.street_line2: str = street_line2
self.city: str = city
self.state: str = state
self.country_code: str = country_code
self.post_code: str = post_code
self._freeze()
class IdDocumentData(TelegramObject):
"""
This object represents the data of an identity document.
Args:
document_no (:obj:`str`): Document number.
expiry_date (:obj:`str`): Optional. Date of expiry, in DD.MM.YYYY format.
Attributes:
document_no (:obj:`str`): Document number.
expiry_date (:obj:`str`): Optional. Date of expiry, in DD.MM.YYYY format.
"""
__slots__ = ("document_no", "expiry_date")
def __init__(
self,
document_no: str,
expiry_date: str,
*,
api_kwargs: Optional[JSONDict] = None,
):
super().__init__(api_kwargs=api_kwargs)
self.document_no: str = document_no
self.expiry_date: str = expiry_date
self._freeze()