| 6 |
| * Copyright Nikolai Kudashov, 2016. |
| 7 | */ |
| 8 |
| 9 | #ifndef APISCHEME_H |
| 10 | #define APISCHEME_H |
| 11 |
| 12 | #include <vector> |
| 13 | #include <memory> |
| 14 | #include <bits/unique_ptr.h> |
| 15 | #include "TLObject.h" |
| 16 |
| 17 | class ByteArray; |
| 18 | class NativeByteBuffer; |
| 19 |
| 20 | class Bool : public TLObject { |
| 21 |
| 22 | public: |
| 23 | static Bool *TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, bool &error); |
| 24 | }; |
| 25 |
| 26 | class TL_boolTrue : public Bool { |
| 27 |
| 28 | public: |
| 29 | static const uint32_t constructor = 0x997275b5; |
| 30 |
| 31 | void serializeToStream(NativeByteBuffer *stream); |
| 32 | }; |
| 33 |
| 34 | class TL_boolFalse : public Bool { |
| 35 |
| 36 | public: |
| 37 | static const uint32_t constructor = 0xbc799737; |
| 38 |
| 39 | void serializeToStream(NativeByteBuffer *stream); |
| 40 | }; |
| 41 |
| 42 | class TL_dcOption : public TLObject { |
| 43 |
| 44 | public: |
| 45 | static const uint32_t constructor = 0x5d8c6cc; |
| 46 |
| 47 | int32_t flags; |
| 48 | bool ipv6; |
| 49 | bool media_only; |
| 50 | bool tcpo_only; |
| 51 | bool cdn; |
| 52 | bool isStatic; |
| 53 | int32_t id; |
| 54 | std::string ip_address; |
| 55 | int32_t port; |
| 56 |
| 57 | static TL_dcOption *TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, bool &error); |
| 58 | void readParams(NativeByteBuffer *stream, bool &error); |
| 59 | void serializeToStream(NativeByteBuffer *stream); |
| 60 | }; |
| 61 |
| 62 | class TL_cdnPublicKey : public TLObject { |
| 63 |
| 64 | public: |
| 65 | static const uint32_t constructor = 0xc982eaba; |
| 66 |
| 67 | int32_t dc_id; |
| 68 | std::string public_key; |
| 69 |
| 70 | static TL_cdnPublicKey *TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, bool &error); |
| 71 | void readParams(NativeByteBuffer *stream, bool &error); |
| 72 | void serializeToStream(NativeByteBuffer *stream); |
| 73 | }; |
| 74 |
| 75 | class TL_cdnConfig : public TLObject { |
| 76 |
| 77 | public: |
| 78 | static const uint32_t constructor = 0x5725e40a; |
| 79 |
| 80 | std::vector<std::unique_ptr<TL_cdnPublicKey>> public_keys; |
| 81 |
| 82 | static TL_cdnConfig *TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, bool &error); |
| 83 | void readParams(NativeByteBuffer *stream, bool &error); |
| 84 | void serializeToStream(NativeByteBuffer *stream); |
| 85 | }; |
| 86 |
| 87 | class TL_help_getCdnConfig : public TLObject { |
| 88 |
| 89 | public: |
| 90 | static const uint32_t constructor = 0x52029342; |
| 91 |
| 92 | bool isNeedLayer(); |
| 93 | TLObject *deserializeResponse(NativeByteBuffer *stream, uint32_t constructor, bool &error); |
| 94 | void serializeToStream(NativeByteBuffer *stream); |
| 95 | }; |
| 96 |
| 97 | class TL_disabledFeature : public TLObject { |
| 98 |
| 99 | public: |
| 100 | static const uint32_t constructor = 0xae636f24; |
| 101 |
| 102 | std::string feature; |
| 103 | std::string description; |
| 104 |
| 105 | static TL_disabledFeature *TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, bool &error); |
| 106 | void readParams(NativeByteBuffer *stream, bool &error); |
| 107 | void serializeToStream(NativeByteBuffer *stream); |
| 108 | }; |
| 109 |
| 110 | class TL_config : public TLObject { |
| 111 |
| 112 | public: |
| 113 | static const uint32_t constructor = 0x9c840964; |
| 114 |
| 115 | int32_t flags; |
| 116 | int32_t date; |
| 117 | int32_t expires; |
| 118 | bool test_mode; |
| 119 | int32_t this_dc; |
| 120 | std::vector<std::unique_ptr<TL_dcOption>> dc_options; |
| 121 | int32_t chat_size_max; |
| 122 | int32_t megagroup_size_max; |
| 123 | int32_t forwarded_count_max; |
| 124 | int32_t online_update_period_ms; |
| 125 | int32_t offline_blur_timeout_ms; |
| 126 | int32_t offline_idle_timeout_ms; |
| 127 | int32_t online_cloud_timeout_ms; |
| 128 | int32_t notify_cloud_delay_ms; |
| 129 | int32_t notify_default_delay_ms; |
| 130 | int32_t chat_big_size; |
| 131 | int32_t push_chat_period_ms; |
| 132 | int32_t push_chat_limit; |
| 133 | int32_t saved_gifs_limit; |
| 134 | int32_t edit_time_limit; |
| 135 | int32_t rating_e_decay; |
| 136 | int32_t stickers_recent_limit; |
| 137 | int32_t stickers_faved_limit; |
| 138 | int32_t channels_read_media_period; |
| 139 | int32_t tmp_sessions; |
| 140 | int32_t pinned_dialogs_count_max; |
| 141 | int32_t call_receive_timeout_ms; |
| 142 | int32_t call_ring_timeout_ms; |
| 143 | int32_t call_connect_timeout_ms; |
| 144 | int32_t call_packet_timeout_ms; |
| 145 | std::string me_url_prefix; |
| 146 | std::string suggested_lang_code; |
| 147 | int32_t lang_pack_version; |
| 148 | std::vector<std::unique_ptr<TL_disabledFeature>> disabled_features; |
| 149 |
| 150 | static TL_config *TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, bool &error); |
| 151 | void readParams(NativeByteBuffer *stream, bool &error); |
| 152 | void serializeToStream(NativeByteBuffer *stream); |
| 153 | }; |
| 154 |
| 155 | class TL_help_getConfig : public TLObject { |
| 156 |
| 157 | public: |
| 158 | static const uint32_t constructor = 0xc4f9186b; |
| 159 |
| 160 | bool isNeedLayer(); |
| 161 | TLObject *deserializeResponse(NativeByteBuffer *stream, uint32_t constructor, bool &error); |
| 162 | void serializeToStream(NativeByteBuffer *stream); |
| 163 | }; |
| 164 |
| 165 | class TL_account_registerDevice : public TLObject { |
| 166 |
| 167 | public: |
| 168 | static const uint32_t constructor = 0x637ea878; |
| 169 |
| 170 | int32_t token_type; |
| 171 | std::string token; |
| 172 |
| 173 | bool isNeedLayer(); |
| 174 | TLObject *deserializeResponse(NativeByteBuffer *stream, uint32_t constructor, bool &error); |
| 175 | void serializeToStream(NativeByteBuffer *stream); |
| 176 | }; |
| 177 |
| 178 | class UserStatus : public TLObject { |
| 179 |
| 180 | public: |
| 181 | int32_t expires; |
| 182 |
| 183 | static UserStatus *TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, bool &error); |
| 184 | }; |
| 185 |
| 186 | class TL_userStatusOffline : public UserStatus { |
| 187 |
| 188 | public: |
| 189 | static const uint32_t constructor = 0x8c703f; |
| 190 |
| 191 | void readParams(NativeByteBuffer *stream, bool &error); |
| 192 | void serializeToStream(NativeByteBuffer *stream); |
| 193 | }; |
| 194 |
| 195 | class TL_userStatusLastWeek : public UserStatus { |
| 196 |
| 197 | public: |
| 198 | static const uint32_t constructor = 0x7bf09fc; |
| 199 |
| 200 | void serializeToStream(NativeByteBuffer *stream); |
| 201 | }; |
| 202 |
| 203 | class TL_userStatusEmpty : public UserStatus { |
| 204 |
| 205 | public: |
| 206 | static const uint32_t constructor = 0x9d05049; |
| 207 |
| 208 | void serializeToStream(NativeByteBuffer *stream); |
| 209 | }; |
| 210 |
| 211 | class TL_userStatusLastMonth : public UserStatus { |
| 212 |
| 213 | public: |
| 214 | static const uint32_t constructor = 0x77ebc742; |
| 215 |
| 216 | void serializeToStream(NativeByteBuffer *stream); |
| 217 | }; |
| 218 |
| 219 | class TL_userStatusOnline : public UserStatus { |
| 220 |
| 221 | public: |
| 222 | static const uint32_t constructor = 0xedb93949; |
| 223 |
| 224 | void readParams(NativeByteBuffer *stream, bool &error); |
| 225 | void serializeToStream(NativeByteBuffer *stream); |
| 226 | }; |
| 227 |
| 228 | class TL_userStatusRecently : public UserStatus { |
| 229 |
| 230 | public: |
| 231 | static const uint32_t constructor = 0xe26f42f1; |
| 232 |
| 233 | void serializeToStream(NativeByteBuffer *stream); |
| 234 | }; |
| 235 |
| 236 | class FileLocation : public TLObject { |
| 237 |
| 238 | public: |
| 239 | int32_t dc_id; |
| 240 | int64_t volume_id; |
| 241 | int32_t local_id; |
| 242 | int64_t secret; |
| 243 | std::unique_ptr<ByteArray> key; |
| 244 | std::unique_ptr<ByteArray> iv; |
| 245 |
| 246 | static FileLocation *TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, bool &error); |
| 247 | }; |
| 248 |
| 249 | class TL_fileLocation : public FileLocation { |
| 250 |
| 251 | public: |
| 252 | static const uint32_t constructor = 0x53d69076; |
| 253 |
| 254 | void readParams(NativeByteBuffer *stream, bool &error); |
| 255 | void serializeToStream(NativeByteBuffer *stream); |
| 256 | }; |
| 257 |
| 258 | class TL_fileEncryptedLocation : public FileLocation { |
| 259 |
| 260 | public: |
| 261 | static const uint32_t constructor = 0x55555554; |
| 262 |
| 263 | void readParams(NativeByteBuffer *stream, bool &error); |
| 264 | void serializeToStream(NativeByteBuffer *stream); |
| 265 | }; |
| 266 |
| 267 | class TL_fileLocationUnavailable : public FileLocation { |
| 268 |
| 269 | public: |
| 270 | static const uint32_t constructor = 0x7c596b46; |
| 271 |
| 272 | void readParams(NativeByteBuffer *stream, bool &error); |
| 273 | void serializeToStream(NativeByteBuffer *stream); |
| 274 | }; |
| 275 |
| 276 | class UserProfilePhoto : public TLObject { |
| 277 |
| 278 | public: |
| 279 | int64_t photo_id; |
| 280 | std::unique_ptr<FileLocation> photo_small; |
| 281 | std::unique_ptr<FileLocation> photo_big; |
| 282 |
| 283 | static UserProfilePhoto *TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, bool &error); |
| 284 | }; |
| 285 |
| 286 | class TL_userProfilePhotoEmpty : public UserProfilePhoto { |
| 287 |
| 288 | public: |
| 289 | static const uint32_t constructor = 0x4f11bae1; |
| 290 |
| 291 | void serializeToStream(NativeByteBuffer *stream); |
| 292 | }; |
| 293 |
| 294 | class TL_userProfilePhoto : public UserProfilePhoto { |
| 295 |
| 296 | public: |
| 297 | static const uint32_t constructor = 0xd559d8c8; |
| 298 |
| 299 | void readParams(NativeByteBuffer *stream, bool &error); |
| 300 | void serializeToStream(NativeByteBuffer *stream); |
| 301 | }; |
| 302 |
| 303 | class User : public TLObject { |
| 304 |
| 305 | public: |
| 306 | int32_t id; |
| 307 | std::string first_name; |
| 308 | std::string last_name; |
| 309 | std::string username; |
| 310 | int64_t access_hash; |
| 311 | std::string phone; |
| 312 | std::unique_ptr<UserProfilePhoto> photo; |
| 313 | std::unique_ptr<UserStatus> status; |
| 314 | int32_t flags; |
| 315 | int32_t bot_info_version; |
| 316 | std::string restriction_reason; |
| 317 | std::string bot_inline_placeholder; |
| 318 | std::string lang_code; |
| 319 |
| 320 | static User *TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, bool &error); |
| 321 | }; |
| 322 |
| 323 | class TL_userEmpty : public User { |
| 324 |
| 325 | public: |
| 326 | static const uint32_t constructor = 0x200250ba; |
| 327 |
| 328 | void readParams(NativeByteBuffer *stream, bool &error); |
| 329 | void serializeToStream(NativeByteBuffer *stream); |
| 330 | }; |
| 331 |
| 332 | class TL_user : public User { |
| 333 |
| 334 | public: |
| 335 | static const uint32_t constructor = 0x2e13f4c3; |
| 336 |
| 337 | void readParams(NativeByteBuffer *stream, bool &error); |
| 338 | void serializeToStream(NativeByteBuffer *stream); |
| 339 | }; |
| 340 |
| 341 | class TL_auth_authorization : public TLObject { |
| 342 |
| 343 | public: |
| 344 | static const uint32_t constructor = 0xcd050916; |
| 345 |
| 346 | int32_t flags; |
| 347 | int32_t tmp_sessions; |
| 348 | std::unique_ptr<User> user; |
| 349 |
| 350 | static TL_auth_authorization *TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, bool &error); |
| 351 | void readParams(NativeByteBuffer *stream, bool &error); |
| 352 | }; |
| 353 |
| 354 | class TL_auth_exportedAuthorization : public TLObject { |
| 355 |
| 356 | public: |
| 357 | static const uint32_t constructor = 0xdf969c2d; |
| 358 |
| 359 | int32_t id; |
| 360 | std::unique_ptr<ByteArray> bytes; |
| 361 |
| 362 | static TL_auth_exportedAuthorization *TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, bool &error); |
| 363 | void readParams(NativeByteBuffer *stream, bool &error); |
| 364 | }; |
| 365 |
| 366 | class TL_auth_exportAuthorization : public TLObject { |
| 367 |
| 368 | public: |
| 369 | static const uint32_t constructor = 0xe5bfffcd; |
| 370 |
| 371 | int32_t dc_id; |
| 372 |
| 373 | bool isNeedLayer(); |
| 374 | TLObject *deserializeResponse(NativeByteBuffer *stream, uint32_t constructor, bool &error); |
| 375 | void serializeToStream(NativeByteBuffer *stream); |
| 376 | }; |
| 377 |
| 378 | class TL_auth_importAuthorization : public TLObject { |
| 379 |
| 380 | public: |
| 381 | static const uint32_t constructor = 0xe3ef9613; |
| 382 |
| 383 | int32_t id; |
| 384 | std::unique_ptr<ByteArray> bytes; |
| 385 |
| 386 | bool isNeedLayer(); |
| 387 | TLObject *deserializeResponse(NativeByteBuffer *stream, uint32_t constructor, bool &error); |
| 388 | void serializeToStream(NativeByteBuffer *stream); |
| 389 | }; |
| 390 |
| 391 | class auth_SentCode : public TLObject { |
| 392 |
| 393 | public: |
| 394 | bool phone_registered; |
| 395 | std::string phone_code_hash; |
| 396 | int32_t send_call_timeout; |
| 397 | bool is_password; |
| 398 |
| 399 | static auth_SentCode *TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, bool &error); |
| 400 | }; |
| 401 |
| 402 | class TL_auth_sentAppCode : public auth_SentCode { |
| 403 |
| 404 | public: |
| 405 | static const uint32_t constructor = 0xe325edcf; |
| 406 |
| 407 | void readParams(NativeByteBuffer *stream, bool &error); |
| 408 | void serializeToStream(NativeByteBuffer *stream); |
| 409 | }; |
| 410 |
| 411 | class TL_auth_sentCode : public auth_SentCode { |
| 412 |
| 413 | public: |
| 414 | static const uint32_t constructor = 0xefed51d9; |
| 415 |
| 416 | void readParams(NativeByteBuffer *stream, bool &error); |
| 417 | void serializeToStream(NativeByteBuffer *stream); |
| 418 | }; |
| 419 |
| 420 | class TL_auth_sendCode : public TLObject { |
| 421 |
| 422 | public: |
| 423 | static const uint32_t constructor = 0x768d5f4d; |
| 424 |
| 425 | std::string phone_number; |
| 426 | int32_t sms_type; |
| 427 | int32_t api_id; |
| 428 | std::string api_hash; |
| 429 | std::string lang_code; |
| 430 |
| 431 | TLObject *deserializeResponse(NativeByteBuffer *stream, uint32_t constructor, bool &error); |
| 432 | void serializeToStream(NativeByteBuffer *stream); |
| 433 | }; |
| 434 |
| 435 | class TL_updatesTooLong : public TLObject { |
| 436 |
| 437 | public: |
| 438 | static const uint32_t constructor = 0xe317af7e; |
| 439 |
| 440 | void serializeToStream(NativeByteBuffer *stream); |
| 441 | }; |
| 442 |
| 443 | class storage_FileType : public TLObject { |
| 444 |
| 445 | public: |
| 446 |
| 447 | static storage_FileType *TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, bool &error); |
| 448 | }; |
| 449 |
| 450 | class TL_storage_fileUnknown : public storage_FileType { |
| 451 |
| 452 | public: |
| 453 | static const uint32_t constructor = 0xaa963b05; |
| 454 |
| 455 | void serializeToStream(NativeByteBuffer *stream); |
| 456 | }; |
| 457 |
| 458 | class TL_storage_fileMp4 : public storage_FileType { |
| 459 |
| 460 | public: |
| 461 | static const uint32_t constructor = 0xb3cea0e4; |
| 462 |
| 463 | void serializeToStream(NativeByteBuffer *stream); |
| 464 | }; |
| 465 |
| 466 | class TL_storage_fileWebp : public storage_FileType { |
| 467 |
| 468 | public: |
| 469 | static const uint32_t constructor = 0x1081464c; |
| 470 |
| 471 | void serializeToStream(NativeByteBuffer *stream); |
| 472 | }; |
| 473 |
| 474 | class TL_storage_filePng : public storage_FileType { |
| 475 |
| 476 | public: |
| 477 | static const uint32_t constructor = 0xa4f63c0; |
| 478 |
| 479 | void serializeToStream(NativeByteBuffer *stream); |
| 480 | }; |
| 481 |
| 482 | class TL_storage_fileGif : public storage_FileType { |
| 483 |
| 484 | public: |
| 485 | static const uint32_t constructor = 0xcae1aadf; |
| 486 |
| 487 | void serializeToStream(NativeByteBuffer *stream); |
| 488 | }; |
| 489 |
| 490 | class TL_storage_filePdf : public storage_FileType { |
| 491 |
| 492 | public: |
| 493 | static const uint32_t constructor = 0xae1e508d; |
| 494 |
| 495 | void serializeToStream(NativeByteBuffer *stream); |
| 496 | }; |
| 497 |
| 498 | class TL_storage_fileMp3 : public storage_FileType { |
| 499 |
| 500 | public: |
| 501 | static const uint32_t constructor = 0x528a0677; |
| 502 |
| 503 | void serializeToStream(NativeByteBuffer *stream); |
| 504 | }; |
| 505 |
| 506 | class TL_storage_fileJpeg : public storage_FileType { |
| 507 |
| 508 | public: |
| 509 | static const uint32_t constructor = 0x7efe0e; |
| 510 |
| 511 | void serializeToStream(NativeByteBuffer *stream); |
| 512 | }; |
| 513 |
| 514 | class TL_storage_fileMov : public storage_FileType { |
| 515 |
| 516 | public: |
| 517 | static const uint32_t constructor = 0x4b09ebbc; |
| 518 |
| 519 | void serializeToStream(NativeByteBuffer *stream); |
| 520 | }; |
| 521 |
| 522 | class TL_storage_filePartial : public storage_FileType { |
| 523 |
| 524 | public: |
| 525 | static const uint32_t constructor = 0x40bc6f52; |
| 526 |
| 527 | void serializeToStream(NativeByteBuffer *stream); |
| 528 | }; |
| 529 |
| 530 | class InputFileLocation : public TLObject { |
| 531 |
| 532 | public: |
| 533 | int64_t id; |
| 534 | int64_t access_hash; |
| 535 | int32_t version; |
| 536 | int64_t volume_id; |
| 537 | int32_t local_id; |
| 538 | int64_t secret; |
| 539 |
| 540 | static InputFileLocation *TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, bool &error); |
| 541 | }; |
| 542 |
| 543 | class TL_inputDocumentFileLocation : public InputFileLocation { |
| 544 |
| 545 | public: |
| 546 | static const uint32_t constructor = 0x430f0724; |
| 547 |
| 548 | void readParams(NativeByteBuffer *stream, bool &error); |
| 549 | void serializeToStream(NativeByteBuffer *stream); |
| 550 | }; |
| 551 |
| 552 | class TL_inputFileLocation : public InputFileLocation { |
| 553 |
| 554 | public: |
| 555 | static const uint32_t constructor = 0x14637196; |
| 556 |
| 557 | void readParams(NativeByteBuffer *stream, bool &error); |
| 558 | void serializeToStream(NativeByteBuffer *stream); |
| 559 | }; |
| 560 |
| 561 | class TL_inputEncryptedFileLocation : public InputFileLocation { |
| 562 |
| 563 | public: |
| 564 | static const uint32_t constructor = 0xf5235d55; |
| 565 |
| 566 | void readParams(NativeByteBuffer *stream, bool &error); |
| 567 | void serializeToStream(NativeByteBuffer *stream); |
| 568 | }; |
| 569 |
| 570 | class TL_upload_saveFilePart : public TLObject { |
| 571 |
| 572 | public: |
| 573 | static const uint32_t constructor = 0xb304a621; |
| 574 |
| 575 | int64_t file_id; |
| 576 | int32_t file_part; |
| 577 | std::unique_ptr<ByteArray> bytes; |
| 578 |
| 579 | bool isNeedLayer(); |
| 580 | TLObject *deserializeResponse(NativeByteBuffer *stream, uint32_t constructor, bool &error); |
| 581 | void serializeToStream(NativeByteBuffer *stream); |
| 582 | }; |
| 583 |
| 584 | class TL_upload_file : public TLObject { |
| 585 |
| 586 | public: |
| 587 | static const uint32_t constructor = 0x96a18d5; |
| 588 |
| 589 | std::unique_ptr<storage_FileType> type; |
| 590 | int32_t mtime; |
| 591 | NativeByteBuffer *bytes = nullptr; |
| 592 |
| 593 | ~TL_upload_file(); |
| 594 | static TL_upload_file *TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, bool &error); |
| 595 | void readParams(NativeByteBuffer *stream, bool &error); |
| 596 | }; |
| 597 |
| 598 | class TL_upload_getFile : public TLObject { |
| 599 |
| 600 | public: |
| 601 | static const uint32_t constructor = 0xe3a6cfb5; |
| 602 |
| 603 | InputFileLocation *location; |
| 604 | int32_t offset; |
| 605 | int32_t limit; |
| 606 |
| 607 | bool isNeedLayer(); |
| 608 | TLObject *deserializeResponse(NativeByteBuffer *stream, uint32_t constructor, bool &error); |
| 609 | void serializeToStream(NativeByteBuffer *stream); |
| 610 | }; |
| 611 |
| 612 | #endif |
| 613 |