|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This phpFile is auto-generated. |
|
5
|
|
|
*/ |
|
6
|
|
|
|
|
7
|
|
|
declare(strict_types=1); |
|
8
|
|
|
|
|
9
|
|
|
namespace PHPTdGram\Schema; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Contains information about one session in a Telegram application used by the current user. Sessions should be shown to the user in the returned order. |
|
13
|
|
|
*/ |
|
14
|
|
|
class Session extends TdObject |
|
15
|
|
|
{ |
|
16
|
|
|
public const TYPE_NAME = 'session'; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Session identifier. |
|
20
|
|
|
*/ |
|
21
|
|
|
protected string $id; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* True, if this session is the current session. |
|
25
|
|
|
*/ |
|
26
|
|
|
protected bool $isCurrent; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* True, if a password is needed to complete authorization of the session. |
|
30
|
|
|
*/ |
|
31
|
|
|
protected bool $isPasswordPending; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* Telegram API identifier, as provided by the application. |
|
35
|
|
|
*/ |
|
36
|
|
|
protected int $apiId; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Name of the application, as provided by the application. |
|
40
|
|
|
*/ |
|
41
|
|
|
protected string $applicationName; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* The version of the application, as provided by the application. |
|
45
|
|
|
*/ |
|
46
|
|
|
protected string $applicationVersion; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* True, if the application is an official application or uses the api_id of an official application. |
|
50
|
|
|
*/ |
|
51
|
|
|
protected bool $isOfficialApplication; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* Model of the device the application has been run or is running on, as provided by the application. |
|
55
|
|
|
*/ |
|
56
|
|
|
protected string $deviceModel; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* Operating system the application has been run or is running on, as provided by the application. |
|
60
|
|
|
*/ |
|
61
|
|
|
protected string $platform; |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* Version of the operating system the application has been run or is running on, as provided by the application. |
|
65
|
|
|
*/ |
|
66
|
|
|
protected string $systemVersion; |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* Point in time (Unix timestamp) when the user has logged in. |
|
70
|
|
|
*/ |
|
71
|
|
|
protected int $logInDate; |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* Point in time (Unix timestamp) when the session was last used. |
|
75
|
|
|
*/ |
|
76
|
|
|
protected int $lastActiveDate; |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* IP address from which the session was created, in human-readable format. |
|
80
|
|
|
*/ |
|
81
|
|
|
protected string $ip; |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* A two-letter country code for the country from which the session was created, based on the IP address. |
|
85
|
|
|
*/ |
|
86
|
|
|
protected string $country; |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* Region code from which the session was created, based on the IP address. |
|
90
|
|
|
*/ |
|
91
|
|
|
protected string $region; |
|
92
|
|
|
|
|
93
|
|
|
public function __construct( |
|
94
|
|
|
string $id, |
|
95
|
|
|
bool $isCurrent, |
|
96
|
|
|
bool $isPasswordPending, |
|
97
|
|
|
int $apiId, |
|
98
|
|
|
string $applicationName, |
|
99
|
|
|
string $applicationVersion, |
|
100
|
|
|
bool $isOfficialApplication, |
|
101
|
|
|
string $deviceModel, |
|
102
|
|
|
string $platform, |
|
103
|
|
|
string $systemVersion, |
|
104
|
|
|
int $logInDate, |
|
105
|
|
|
int $lastActiveDate, |
|
106
|
|
|
string $ip, |
|
107
|
|
|
string $country, |
|
108
|
|
|
string $region |
|
109
|
|
|
) { |
|
110
|
|
|
$this->id = $id; |
|
111
|
|
|
$this->isCurrent = $isCurrent; |
|
112
|
|
|
$this->isPasswordPending = $isPasswordPending; |
|
113
|
|
|
$this->apiId = $apiId; |
|
114
|
|
|
$this->applicationName = $applicationName; |
|
115
|
|
|
$this->applicationVersion = $applicationVersion; |
|
116
|
|
|
$this->isOfficialApplication = $isOfficialApplication; |
|
117
|
|
|
$this->deviceModel = $deviceModel; |
|
118
|
|
|
$this->platform = $platform; |
|
119
|
|
|
$this->systemVersion = $systemVersion; |
|
120
|
|
|
$this->logInDate = $logInDate; |
|
121
|
|
|
$this->lastActiveDate = $lastActiveDate; |
|
122
|
|
|
$this->ip = $ip; |
|
123
|
|
|
$this->country = $country; |
|
124
|
|
|
$this->region = $region; |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
public static function fromArray(array $array): Session |
|
128
|
|
|
{ |
|
129
|
|
|
return new static( |
|
130
|
|
|
$array['id'], |
|
131
|
|
|
$array['is_current'], |
|
132
|
|
|
$array['is_password_pending'], |
|
133
|
|
|
$array['api_id'], |
|
134
|
|
|
$array['application_name'], |
|
135
|
|
|
$array['application_version'], |
|
136
|
|
|
$array['is_official_application'], |
|
137
|
|
|
$array['device_model'], |
|
138
|
|
|
$array['platform'], |
|
139
|
|
|
$array['system_version'], |
|
140
|
|
|
$array['log_in_date'], |
|
141
|
|
|
$array['last_active_date'], |
|
142
|
|
|
$array['ip'], |
|
143
|
|
|
$array['country'], |
|
144
|
|
|
$array['region'], |
|
145
|
|
|
); |
|
146
|
|
|
} |
|
147
|
|
|
|
|
148
|
|
|
public function typeSerialize(): array |
|
149
|
|
|
{ |
|
150
|
|
|
return [ |
|
151
|
|
|
'@type' => static::TYPE_NAME, |
|
152
|
|
|
'id' => $this->id, |
|
153
|
|
|
'is_current' => $this->isCurrent, |
|
154
|
|
|
'is_password_pending' => $this->isPasswordPending, |
|
155
|
|
|
'api_id' => $this->apiId, |
|
156
|
|
|
'application_name' => $this->applicationName, |
|
157
|
|
|
'application_version' => $this->applicationVersion, |
|
158
|
|
|
'is_official_application' => $this->isOfficialApplication, |
|
159
|
|
|
'device_model' => $this->deviceModel, |
|
160
|
|
|
'platform' => $this->platform, |
|
161
|
|
|
'system_version' => $this->systemVersion, |
|
162
|
|
|
'log_in_date' => $this->logInDate, |
|
163
|
|
|
'last_active_date' => $this->lastActiveDate, |
|
164
|
|
|
'ip' => $this->ip, |
|
165
|
|
|
'country' => $this->country, |
|
166
|
|
|
'region' => $this->region, |
|
167
|
|
|
]; |
|
168
|
|
|
} |
|
169
|
|
|
|
|
170
|
|
|
public function getId(): string |
|
171
|
|
|
{ |
|
172
|
|
|
return $this->id; |
|
173
|
|
|
} |
|
174
|
|
|
|
|
175
|
|
|
public function getIsCurrent(): bool |
|
176
|
|
|
{ |
|
177
|
|
|
return $this->isCurrent; |
|
178
|
|
|
} |
|
179
|
|
|
|
|
180
|
|
|
public function getIsPasswordPending(): bool |
|
181
|
|
|
{ |
|
182
|
|
|
return $this->isPasswordPending; |
|
183
|
|
|
} |
|
184
|
|
|
|
|
185
|
|
|
public function getApiId(): int |
|
186
|
|
|
{ |
|
187
|
|
|
return $this->apiId; |
|
188
|
|
|
} |
|
189
|
|
|
|
|
190
|
|
|
public function getApplicationName(): string |
|
191
|
|
|
{ |
|
192
|
|
|
return $this->applicationName; |
|
193
|
|
|
} |
|
194
|
|
|
|
|
195
|
|
|
public function getApplicationVersion(): string |
|
196
|
|
|
{ |
|
197
|
|
|
return $this->applicationVersion; |
|
198
|
|
|
} |
|
199
|
|
|
|
|
200
|
|
|
public function getIsOfficialApplication(): bool |
|
201
|
|
|
{ |
|
202
|
|
|
return $this->isOfficialApplication; |
|
203
|
|
|
} |
|
204
|
|
|
|
|
205
|
|
|
public function getDeviceModel(): string |
|
206
|
|
|
{ |
|
207
|
|
|
return $this->deviceModel; |
|
208
|
|
|
} |
|
209
|
|
|
|
|
210
|
|
|
public function getPlatform(): string |
|
211
|
|
|
{ |
|
212
|
|
|
return $this->platform; |
|
213
|
|
|
} |
|
214
|
|
|
|
|
215
|
|
|
public function getSystemVersion(): string |
|
216
|
|
|
{ |
|
217
|
|
|
return $this->systemVersion; |
|
218
|
|
|
} |
|
219
|
|
|
|
|
220
|
|
|
public function getLogInDate(): int |
|
221
|
|
|
{ |
|
222
|
|
|
return $this->logInDate; |
|
223
|
|
|
} |
|
224
|
|
|
|
|
225
|
|
|
public function getLastActiveDate(): int |
|
226
|
|
|
{ |
|
227
|
|
|
return $this->lastActiveDate; |
|
228
|
|
|
} |
|
229
|
|
|
|
|
230
|
|
|
public function getIp(): string |
|
231
|
|
|
{ |
|
232
|
|
|
return $this->ip; |
|
233
|
|
|
} |
|
234
|
|
|
|
|
235
|
|
|
public function getCountry(): string |
|
236
|
|
|
{ |
|
237
|
|
|
return $this->country; |
|
238
|
|
|
} |
|
239
|
|
|
|
|
240
|
|
|
public function getRegion(): string |
|
241
|
|
|
{ |
|
242
|
|
|
return $this->region; |
|
243
|
|
|
} |
|
244
|
|
|
} |
|
245
|
|
|
|