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
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053

use crate::types::*;
use crate::errors::*;
use uuid::Uuid;




use std::fmt::Debug;
use serde::de::{Deserialize, Deserializer};



/// TRAIT | Represents a part of the text which must be formatted differently
pub trait TDTextEntityType: Debug + RObject {}

/// Represents a part of the text which must be formatted differently
#[derive(Debug, Clone, Serialize)]
#[serde(untagged)]
pub enum TextEntityType {
  #[doc(hidden)] _Default(()),
  /// A bold text
  Bold(TextEntityTypeBold),
  /// A bot command, beginning with "/". This shouldn't be highlighted if there are no bots in the chat
  BotCommand(TextEntityTypeBotCommand),
  /// A cashtag text, beginning with "$" and consisting of capital english letters (i.e. "$USD")
  Cashtag(TextEntityTypeCashtag),
  /// Text that must be formatted as if inside a code HTML tag
  Code(TextEntityTypeCode),
  /// An email address
  EmailAddress(TextEntityTypeEmailAddress),
  /// A hashtag text, beginning with "#"
  Hashtag(TextEntityTypeHashtag),
  /// An italic text
  Italic(TextEntityTypeItalic),
  /// A mention of a user by their username
  Mention(TextEntityTypeMention),
  /// A text shows instead of a raw mention of the user (e.g., when the user has no username)
  MentionName(TextEntityTypeMentionName),
  /// A phone number
  PhoneNumber(TextEntityTypePhoneNumber),
  /// Text that must be formatted as if inside a pre HTML tag
  Pre(TextEntityTypePre),
  /// Text that must be formatted as if inside pre, and code HTML tags
  PreCode(TextEntityTypePreCode),
  /// A text description shown instead of a raw URL
  TextUrl(TextEntityTypeTextUrl),
  /// An HTTP URL
  Url(TextEntityTypeUrl),

}

impl Default for TextEntityType {
  fn default() -> Self { TextEntityType::_Default(()) }
}

impl<'de> Deserialize<'de> for TextEntityType {
  fn deserialize<D>(deserializer: D) -> Result<TextEntityType, D::Error> where D: Deserializer<'de> {
    use serde::de::Error;
    rtd_enum_deserialize!(
      TextEntityType,
      (textEntityTypeBold, Bold);
      (textEntityTypeBotCommand, BotCommand);
      (textEntityTypeCashtag, Cashtag);
      (textEntityTypeCode, Code);
      (textEntityTypeEmailAddress, EmailAddress);
      (textEntityTypeHashtag, Hashtag);
      (textEntityTypeItalic, Italic);
      (textEntityTypeMention, Mention);
      (textEntityTypeMentionName, MentionName);
      (textEntityTypePhoneNumber, PhoneNumber);
      (textEntityTypePre, Pre);
      (textEntityTypePreCode, PreCode);
      (textEntityTypeTextUrl, TextUrl);
      (textEntityTypeUrl, Url);

    )(deserializer)
  }
}

impl RObject for TextEntityType {
  #[doc(hidden)] fn td_name(&self) -> &'static str {
    match self {
      TextEntityType::Bold(t) => t.td_name(),
      TextEntityType::BotCommand(t) => t.td_name(),
      TextEntityType::Cashtag(t) => t.td_name(),
      TextEntityType::Code(t) => t.td_name(),
      TextEntityType::EmailAddress(t) => t.td_name(),
      TextEntityType::Hashtag(t) => t.td_name(),
      TextEntityType::Italic(t) => t.td_name(),
      TextEntityType::Mention(t) => t.td_name(),
      TextEntityType::MentionName(t) => t.td_name(),
      TextEntityType::PhoneNumber(t) => t.td_name(),
      TextEntityType::Pre(t) => t.td_name(),
      TextEntityType::PreCode(t) => t.td_name(),
      TextEntityType::TextUrl(t) => t.td_name(),
      TextEntityType::Url(t) => t.td_name(),

      _ => "-1",
    }
  }
  #[doc(hidden)] fn extra(&self) -> Option<String> {
    match self {
      TextEntityType::Bold(t) => t.extra(),
      TextEntityType::BotCommand(t) => t.extra(),
      TextEntityType::Cashtag(t) => t.extra(),
      TextEntityType::Code(t) => t.extra(),
      TextEntityType::EmailAddress(t) => t.extra(),
      TextEntityType::Hashtag(t) => t.extra(),
      TextEntityType::Italic(t) => t.extra(),
      TextEntityType::Mention(t) => t.extra(),
      TextEntityType::MentionName(t) => t.extra(),
      TextEntityType::PhoneNumber(t) => t.extra(),
      TextEntityType::Pre(t) => t.extra(),
      TextEntityType::PreCode(t) => t.extra(),
      TextEntityType::TextUrl(t) => t.extra(),
      TextEntityType::Url(t) => t.extra(),

      _ => None,
    }
  }
  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}

impl TextEntityType {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
  #[doc(hidden)] pub fn _is_default(&self) -> bool { if let TextEntityType::_Default(_) = self { true } else { false } }

  pub fn is_bold(&self) -> bool { if let TextEntityType::Bold(_) = self { true } else { false } }
  pub fn is_bot_command(&self) -> bool { if let TextEntityType::BotCommand(_) = self { true } else { false } }
  pub fn is_cashtag(&self) -> bool { if let TextEntityType::Cashtag(_) = self { true } else { false } }
  pub fn is_code(&self) -> bool { if let TextEntityType::Code(_) = self { true } else { false } }
  pub fn is_email_address(&self) -> bool { if let TextEntityType::EmailAddress(_) = self { true } else { false } }
  pub fn is_hashtag(&self) -> bool { if let TextEntityType::Hashtag(_) = self { true } else { false } }
  pub fn is_italic(&self) -> bool { if let TextEntityType::Italic(_) = self { true } else { false } }
  pub fn is_mention(&self) -> bool { if let TextEntityType::Mention(_) = self { true } else { false } }
  pub fn is_mention_name(&self) -> bool { if let TextEntityType::MentionName(_) = self { true } else { false } }
  pub fn is_phone_number(&self) -> bool { if let TextEntityType::PhoneNumber(_) = self { true } else { false } }
  pub fn is_pre(&self) -> bool { if let TextEntityType::Pre(_) = self { true } else { false } }
  pub fn is_pre_code(&self) -> bool { if let TextEntityType::PreCode(_) = self { true } else { false } }
  pub fn is_text_url(&self) -> bool { if let TextEntityType::TextUrl(_) = self { true } else { false } }
  pub fn is_url(&self) -> bool { if let TextEntityType::Url(_) = self { true } else { false } }

  pub fn on_bold<F: FnOnce(&TextEntityTypeBold)>(&self, fnc: F) -> &Self { if let TextEntityType::Bold(t) = self { fnc(t) }; self }
  pub fn on_bot_command<F: FnOnce(&TextEntityTypeBotCommand)>(&self, fnc: F) -> &Self { if let TextEntityType::BotCommand(t) = self { fnc(t) }; self }
  pub fn on_cashtag<F: FnOnce(&TextEntityTypeCashtag)>(&self, fnc: F) -> &Self { if let TextEntityType::Cashtag(t) = self { fnc(t) }; self }
  pub fn on_code<F: FnOnce(&TextEntityTypeCode)>(&self, fnc: F) -> &Self { if let TextEntityType::Code(t) = self { fnc(t) }; self }
  pub fn on_email_address<F: FnOnce(&TextEntityTypeEmailAddress)>(&self, fnc: F) -> &Self { if let TextEntityType::EmailAddress(t) = self { fnc(t) }; self }
  pub fn on_hashtag<F: FnOnce(&TextEntityTypeHashtag)>(&self, fnc: F) -> &Self { if let TextEntityType::Hashtag(t) = self { fnc(t) }; self }
  pub fn on_italic<F: FnOnce(&TextEntityTypeItalic)>(&self, fnc: F) -> &Self { if let TextEntityType::Italic(t) = self { fnc(t) }; self }
  pub fn on_mention<F: FnOnce(&TextEntityTypeMention)>(&self, fnc: F) -> &Self { if let TextEntityType::Mention(t) = self { fnc(t) }; self }
  pub fn on_mention_name<F: FnOnce(&TextEntityTypeMentionName)>(&self, fnc: F) -> &Self { if let TextEntityType::MentionName(t) = self { fnc(t) }; self }
  pub fn on_phone_number<F: FnOnce(&TextEntityTypePhoneNumber)>(&self, fnc: F) -> &Self { if let TextEntityType::PhoneNumber(t) = self { fnc(t) }; self }
  pub fn on_pre<F: FnOnce(&TextEntityTypePre)>(&self, fnc: F) -> &Self { if let TextEntityType::Pre(t) = self { fnc(t) }; self }
  pub fn on_pre_code<F: FnOnce(&TextEntityTypePreCode)>(&self, fnc: F) -> &Self { if let TextEntityType::PreCode(t) = self { fnc(t) }; self }
  pub fn on_text_url<F: FnOnce(&TextEntityTypeTextUrl)>(&self, fnc: F) -> &Self { if let TextEntityType::TextUrl(t) = self { fnc(t) }; self }
  pub fn on_url<F: FnOnce(&TextEntityTypeUrl)>(&self, fnc: F) -> &Self { if let TextEntityType::Url(t) = self { fnc(t) }; self }

  pub fn as_bold(&self) -> Option<&TextEntityTypeBold> { if let TextEntityType::Bold(t) = self { return Some(t) } None }
  pub fn as_bot_command(&self) -> Option<&TextEntityTypeBotCommand> { if let TextEntityType::BotCommand(t) = self { return Some(t) } None }
  pub fn as_cashtag(&self) -> Option<&TextEntityTypeCashtag> { if let TextEntityType::Cashtag(t) = self { return Some(t) } None }
  pub fn as_code(&self) -> Option<&TextEntityTypeCode> { if let TextEntityType::Code(t) = self { return Some(t) } None }
  pub fn as_email_address(&self) -> Option<&TextEntityTypeEmailAddress> { if let TextEntityType::EmailAddress(t) = self { return Some(t) } None }
  pub fn as_hashtag(&self) -> Option<&TextEntityTypeHashtag> { if let TextEntityType::Hashtag(t) = self { return Some(t) } None }
  pub fn as_italic(&self) -> Option<&TextEntityTypeItalic> { if let TextEntityType::Italic(t) = self { return Some(t) } None }
  pub fn as_mention(&self) -> Option<&TextEntityTypeMention> { if let TextEntityType::Mention(t) = self { return Some(t) } None }
  pub fn as_mention_name(&self) -> Option<&TextEntityTypeMentionName> { if let TextEntityType::MentionName(t) = self { return Some(t) } None }
  pub fn as_phone_number(&self) -> Option<&TextEntityTypePhoneNumber> { if let TextEntityType::PhoneNumber(t) = self { return Some(t) } None }
  pub fn as_pre(&self) -> Option<&TextEntityTypePre> { if let TextEntityType::Pre(t) = self { return Some(t) } None }
  pub fn as_pre_code(&self) -> Option<&TextEntityTypePreCode> { if let TextEntityType::PreCode(t) = self { return Some(t) } None }
  pub fn as_text_url(&self) -> Option<&TextEntityTypeTextUrl> { if let TextEntityType::TextUrl(t) = self { return Some(t) } None }
  pub fn as_url(&self) -> Option<&TextEntityTypeUrl> { if let TextEntityType::Url(t) = self { return Some(t) } None }



  pub fn bold<T: AsRef<TextEntityTypeBold>>(t: T) -> Self { TextEntityType::Bold(t.as_ref().clone()) }

  pub fn bot_command<T: AsRef<TextEntityTypeBotCommand>>(t: T) -> Self { TextEntityType::BotCommand(t.as_ref().clone()) }

  pub fn cashtag<T: AsRef<TextEntityTypeCashtag>>(t: T) -> Self { TextEntityType::Cashtag(t.as_ref().clone()) }

  pub fn code<T: AsRef<TextEntityTypeCode>>(t: T) -> Self { TextEntityType::Code(t.as_ref().clone()) }

  pub fn email_address<T: AsRef<TextEntityTypeEmailAddress>>(t: T) -> Self { TextEntityType::EmailAddress(t.as_ref().clone()) }

  pub fn hashtag<T: AsRef<TextEntityTypeHashtag>>(t: T) -> Self { TextEntityType::Hashtag(t.as_ref().clone()) }

  pub fn italic<T: AsRef<TextEntityTypeItalic>>(t: T) -> Self { TextEntityType::Italic(t.as_ref().clone()) }

  pub fn mention<T: AsRef<TextEntityTypeMention>>(t: T) -> Self { TextEntityType::Mention(t.as_ref().clone()) }

  pub fn mention_name<T: AsRef<TextEntityTypeMentionName>>(t: T) -> Self { TextEntityType::MentionName(t.as_ref().clone()) }

  pub fn phone_number<T: AsRef<TextEntityTypePhoneNumber>>(t: T) -> Self { TextEntityType::PhoneNumber(t.as_ref().clone()) }

  pub fn pre<T: AsRef<TextEntityTypePre>>(t: T) -> Self { TextEntityType::Pre(t.as_ref().clone()) }

  pub fn pre_code<T: AsRef<TextEntityTypePreCode>>(t: T) -> Self { TextEntityType::PreCode(t.as_ref().clone()) }

  pub fn text_url<T: AsRef<TextEntityTypeTextUrl>>(t: T) -> Self { TextEntityType::TextUrl(t.as_ref().clone()) }

  pub fn url<T: AsRef<TextEntityTypeUrl>>(t: T) -> Self { TextEntityType::Url(t.as_ref().clone()) }

}

impl AsRef<TextEntityType> for TextEntityType {
  fn as_ref(&self) -> &TextEntityType { self }
}







/// A bold text
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct TextEntityTypeBold {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
  
}

impl RObject for TextEntityTypeBold {
  #[doc(hidden)] fn td_name(&self) -> &'static str { "textEntityTypeBold" }
  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}


impl TDTextEntityType for TextEntityTypeBold {}



impl TextEntityTypeBold {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
  pub fn builder() -> RTDTextEntityTypeBoldBuilder {
    let mut inner = TextEntityTypeBold::default();
    inner.td_name = "textEntityTypeBold".to_string();
    inner.extra = Some(Uuid::new_v4().to_string());
    RTDTextEntityTypeBoldBuilder { inner }
  }

}

#[doc(hidden)]
pub struct RTDTextEntityTypeBoldBuilder {
  inner: TextEntityTypeBold
}

impl RTDTextEntityTypeBoldBuilder {
  pub fn build(&self) -> TextEntityTypeBold { self.inner.clone() }

}

impl AsRef<TextEntityTypeBold> for TextEntityTypeBold {
  fn as_ref(&self) -> &TextEntityTypeBold { self }
}

impl AsRef<TextEntityTypeBold> for RTDTextEntityTypeBoldBuilder {
  fn as_ref(&self) -> &TextEntityTypeBold { &self.inner }
}







/// A bot command, beginning with "/". This shouldn't be highlighted if there are no bots in the chat
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct TextEntityTypeBotCommand {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
  
}

impl RObject for TextEntityTypeBotCommand {
  #[doc(hidden)] fn td_name(&self) -> &'static str { "textEntityTypeBotCommand" }
  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}


impl TDTextEntityType for TextEntityTypeBotCommand {}



impl TextEntityTypeBotCommand {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
  pub fn builder() -> RTDTextEntityTypeBotCommandBuilder {
    let mut inner = TextEntityTypeBotCommand::default();
    inner.td_name = "textEntityTypeBotCommand".to_string();
    inner.extra = Some(Uuid::new_v4().to_string());
    RTDTextEntityTypeBotCommandBuilder { inner }
  }

}

#[doc(hidden)]
pub struct RTDTextEntityTypeBotCommandBuilder {
  inner: TextEntityTypeBotCommand
}

impl RTDTextEntityTypeBotCommandBuilder {
  pub fn build(&self) -> TextEntityTypeBotCommand { self.inner.clone() }

}

impl AsRef<TextEntityTypeBotCommand> for TextEntityTypeBotCommand {
  fn as_ref(&self) -> &TextEntityTypeBotCommand { self }
}

impl AsRef<TextEntityTypeBotCommand> for RTDTextEntityTypeBotCommandBuilder {
  fn as_ref(&self) -> &TextEntityTypeBotCommand { &self.inner }
}







/// A cashtag text, beginning with "$" and consisting of capital english letters (i.e. "$USD")
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct TextEntityTypeCashtag {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
  
}

impl RObject for TextEntityTypeCashtag {
  #[doc(hidden)] fn td_name(&self) -> &'static str { "textEntityTypeCashtag" }
  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}


impl TDTextEntityType for TextEntityTypeCashtag {}



impl TextEntityTypeCashtag {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
  pub fn builder() -> RTDTextEntityTypeCashtagBuilder {
    let mut inner = TextEntityTypeCashtag::default();
    inner.td_name = "textEntityTypeCashtag".to_string();
    inner.extra = Some(Uuid::new_v4().to_string());
    RTDTextEntityTypeCashtagBuilder { inner }
  }

}

#[doc(hidden)]
pub struct RTDTextEntityTypeCashtagBuilder {
  inner: TextEntityTypeCashtag
}

impl RTDTextEntityTypeCashtagBuilder {
  pub fn build(&self) -> TextEntityTypeCashtag { self.inner.clone() }

}

impl AsRef<TextEntityTypeCashtag> for TextEntityTypeCashtag {
  fn as_ref(&self) -> &TextEntityTypeCashtag { self }
}

impl AsRef<TextEntityTypeCashtag> for RTDTextEntityTypeCashtagBuilder {
  fn as_ref(&self) -> &TextEntityTypeCashtag { &self.inner }
}







/// Text that must be formatted as if inside a code HTML tag
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct TextEntityTypeCode {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
  
}

impl RObject for TextEntityTypeCode {
  #[doc(hidden)] fn td_name(&self) -> &'static str { "textEntityTypeCode" }
  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}


impl TDTextEntityType for TextEntityTypeCode {}



impl TextEntityTypeCode {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
  pub fn builder() -> RTDTextEntityTypeCodeBuilder {
    let mut inner = TextEntityTypeCode::default();
    inner.td_name = "textEntityTypeCode".to_string();
    inner.extra = Some(Uuid::new_v4().to_string());
    RTDTextEntityTypeCodeBuilder { inner }
  }

}

#[doc(hidden)]
pub struct RTDTextEntityTypeCodeBuilder {
  inner: TextEntityTypeCode
}

impl RTDTextEntityTypeCodeBuilder {
  pub fn build(&self) -> TextEntityTypeCode { self.inner.clone() }

}

impl AsRef<TextEntityTypeCode> for TextEntityTypeCode {
  fn as_ref(&self) -> &TextEntityTypeCode { self }
}

impl AsRef<TextEntityTypeCode> for RTDTextEntityTypeCodeBuilder {
  fn as_ref(&self) -> &TextEntityTypeCode { &self.inner }
}







/// An email address
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct TextEntityTypeEmailAddress {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
  
}

impl RObject for TextEntityTypeEmailAddress {
  #[doc(hidden)] fn td_name(&self) -> &'static str { "textEntityTypeEmailAddress" }
  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}


impl TDTextEntityType for TextEntityTypeEmailAddress {}



impl TextEntityTypeEmailAddress {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
  pub fn builder() -> RTDTextEntityTypeEmailAddressBuilder {
    let mut inner = TextEntityTypeEmailAddress::default();
    inner.td_name = "textEntityTypeEmailAddress".to_string();
    inner.extra = Some(Uuid::new_v4().to_string());
    RTDTextEntityTypeEmailAddressBuilder { inner }
  }

}

#[doc(hidden)]
pub struct RTDTextEntityTypeEmailAddressBuilder {
  inner: TextEntityTypeEmailAddress
}

impl RTDTextEntityTypeEmailAddressBuilder {
  pub fn build(&self) -> TextEntityTypeEmailAddress { self.inner.clone() }

}

impl AsRef<TextEntityTypeEmailAddress> for TextEntityTypeEmailAddress {
  fn as_ref(&self) -> &TextEntityTypeEmailAddress { self }
}

impl AsRef<TextEntityTypeEmailAddress> for RTDTextEntityTypeEmailAddressBuilder {
  fn as_ref(&self) -> &TextEntityTypeEmailAddress { &self.inner }
}







/// A hashtag text, beginning with "#"
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct TextEntityTypeHashtag {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
  
}

impl RObject for TextEntityTypeHashtag {
  #[doc(hidden)] fn td_name(&self) -> &'static str { "textEntityTypeHashtag" }
  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}


impl TDTextEntityType for TextEntityTypeHashtag {}



impl TextEntityTypeHashtag {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
  pub fn builder() -> RTDTextEntityTypeHashtagBuilder {
    let mut inner = TextEntityTypeHashtag::default();
    inner.td_name = "textEntityTypeHashtag".to_string();
    inner.extra = Some(Uuid::new_v4().to_string());
    RTDTextEntityTypeHashtagBuilder { inner }
  }

}

#[doc(hidden)]
pub struct RTDTextEntityTypeHashtagBuilder {
  inner: TextEntityTypeHashtag
}

impl RTDTextEntityTypeHashtagBuilder {
  pub fn build(&self) -> TextEntityTypeHashtag { self.inner.clone() }

}

impl AsRef<TextEntityTypeHashtag> for TextEntityTypeHashtag {
  fn as_ref(&self) -> &TextEntityTypeHashtag { self }
}

impl AsRef<TextEntityTypeHashtag> for RTDTextEntityTypeHashtagBuilder {
  fn as_ref(&self) -> &TextEntityTypeHashtag { &self.inner }
}







/// An italic text
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct TextEntityTypeItalic {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
  
}

impl RObject for TextEntityTypeItalic {
  #[doc(hidden)] fn td_name(&self) -> &'static str { "textEntityTypeItalic" }
  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}


impl TDTextEntityType for TextEntityTypeItalic {}



impl TextEntityTypeItalic {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
  pub fn builder() -> RTDTextEntityTypeItalicBuilder {
    let mut inner = TextEntityTypeItalic::default();
    inner.td_name = "textEntityTypeItalic".to_string();
    inner.extra = Some(Uuid::new_v4().to_string());
    RTDTextEntityTypeItalicBuilder { inner }
  }

}

#[doc(hidden)]
pub struct RTDTextEntityTypeItalicBuilder {
  inner: TextEntityTypeItalic
}

impl RTDTextEntityTypeItalicBuilder {
  pub fn build(&self) -> TextEntityTypeItalic { self.inner.clone() }

}

impl AsRef<TextEntityTypeItalic> for TextEntityTypeItalic {
  fn as_ref(&self) -> &TextEntityTypeItalic { self }
}

impl AsRef<TextEntityTypeItalic> for RTDTextEntityTypeItalicBuilder {
  fn as_ref(&self) -> &TextEntityTypeItalic { &self.inner }
}







/// A mention of a user by their username
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct TextEntityTypeMention {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
  
}

impl RObject for TextEntityTypeMention {
  #[doc(hidden)] fn td_name(&self) -> &'static str { "textEntityTypeMention" }
  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}


impl TDTextEntityType for TextEntityTypeMention {}



impl TextEntityTypeMention {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
  pub fn builder() -> RTDTextEntityTypeMentionBuilder {
    let mut inner = TextEntityTypeMention::default();
    inner.td_name = "textEntityTypeMention".to_string();
    inner.extra = Some(Uuid::new_v4().to_string());
    RTDTextEntityTypeMentionBuilder { inner }
  }

}

#[doc(hidden)]
pub struct RTDTextEntityTypeMentionBuilder {
  inner: TextEntityTypeMention
}

impl RTDTextEntityTypeMentionBuilder {
  pub fn build(&self) -> TextEntityTypeMention { self.inner.clone() }

}

impl AsRef<TextEntityTypeMention> for TextEntityTypeMention {
  fn as_ref(&self) -> &TextEntityTypeMention { self }
}

impl AsRef<TextEntityTypeMention> for RTDTextEntityTypeMentionBuilder {
  fn as_ref(&self) -> &TextEntityTypeMention { &self.inner }
}







/// A text shows instead of a raw mention of the user (e.g., when the user has no username)
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct TextEntityTypeMentionName {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
  /// Identifier of the mentioned user
  user_id: i64,
  
}

impl RObject for TextEntityTypeMentionName {
  #[doc(hidden)] fn td_name(&self) -> &'static str { "textEntityTypeMentionName" }
  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}


impl TDTextEntityType for TextEntityTypeMentionName {}



impl TextEntityTypeMentionName {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
  pub fn builder() -> RTDTextEntityTypeMentionNameBuilder {
    let mut inner = TextEntityTypeMentionName::default();
    inner.td_name = "textEntityTypeMentionName".to_string();
    inner.extra = Some(Uuid::new_v4().to_string());
    RTDTextEntityTypeMentionNameBuilder { inner }
  }

  pub fn user_id(&self) -> i64 { self.user_id }

}

#[doc(hidden)]
pub struct RTDTextEntityTypeMentionNameBuilder {
  inner: TextEntityTypeMentionName
}

impl RTDTextEntityTypeMentionNameBuilder {
  pub fn build(&self) -> TextEntityTypeMentionName { self.inner.clone() }

   
  pub fn user_id(&mut self, user_id: i64) -> &mut Self {
    self.inner.user_id = user_id;
    self
  }

}

impl AsRef<TextEntityTypeMentionName> for TextEntityTypeMentionName {
  fn as_ref(&self) -> &TextEntityTypeMentionName { self }
}

impl AsRef<TextEntityTypeMentionName> for RTDTextEntityTypeMentionNameBuilder {
  fn as_ref(&self) -> &TextEntityTypeMentionName { &self.inner }
}







/// A phone number
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct TextEntityTypePhoneNumber {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
  
}

impl RObject for TextEntityTypePhoneNumber {
  #[doc(hidden)] fn td_name(&self) -> &'static str { "textEntityTypePhoneNumber" }
  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}


impl TDTextEntityType for TextEntityTypePhoneNumber {}



impl TextEntityTypePhoneNumber {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
  pub fn builder() -> RTDTextEntityTypePhoneNumberBuilder {
    let mut inner = TextEntityTypePhoneNumber::default();
    inner.td_name = "textEntityTypePhoneNumber".to_string();
    inner.extra = Some(Uuid::new_v4().to_string());
    RTDTextEntityTypePhoneNumberBuilder { inner }
  }

}

#[doc(hidden)]
pub struct RTDTextEntityTypePhoneNumberBuilder {
  inner: TextEntityTypePhoneNumber
}

impl RTDTextEntityTypePhoneNumberBuilder {
  pub fn build(&self) -> TextEntityTypePhoneNumber { self.inner.clone() }

}

impl AsRef<TextEntityTypePhoneNumber> for TextEntityTypePhoneNumber {
  fn as_ref(&self) -> &TextEntityTypePhoneNumber { self }
}

impl AsRef<TextEntityTypePhoneNumber> for RTDTextEntityTypePhoneNumberBuilder {
  fn as_ref(&self) -> &TextEntityTypePhoneNumber { &self.inner }
}







/// Text that must be formatted as if inside a pre HTML tag
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct TextEntityTypePre {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
  
}

impl RObject for TextEntityTypePre {
  #[doc(hidden)] fn td_name(&self) -> &'static str { "textEntityTypePre" }
  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}


impl TDTextEntityType for TextEntityTypePre {}



impl TextEntityTypePre {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
  pub fn builder() -> RTDTextEntityTypePreBuilder {
    let mut inner = TextEntityTypePre::default();
    inner.td_name = "textEntityTypePre".to_string();
    inner.extra = Some(Uuid::new_v4().to_string());
    RTDTextEntityTypePreBuilder { inner }
  }

}

#[doc(hidden)]
pub struct RTDTextEntityTypePreBuilder {
  inner: TextEntityTypePre
}

impl RTDTextEntityTypePreBuilder {
  pub fn build(&self) -> TextEntityTypePre { self.inner.clone() }

}

impl AsRef<TextEntityTypePre> for TextEntityTypePre {
  fn as_ref(&self) -> &TextEntityTypePre { self }
}

impl AsRef<TextEntityTypePre> for RTDTextEntityTypePreBuilder {
  fn as_ref(&self) -> &TextEntityTypePre { &self.inner }
}







/// Text that must be formatted as if inside pre, and code HTML tags
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct TextEntityTypePreCode {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
  /// Programming language of the code; as defined by the sender
  language: String,
  
}

impl RObject for TextEntityTypePreCode {
  #[doc(hidden)] fn td_name(&self) -> &'static str { "textEntityTypePreCode" }
  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}


impl TDTextEntityType for TextEntityTypePreCode {}



impl TextEntityTypePreCode {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
  pub fn builder() -> RTDTextEntityTypePreCodeBuilder {
    let mut inner = TextEntityTypePreCode::default();
    inner.td_name = "textEntityTypePreCode".to_string();
    inner.extra = Some(Uuid::new_v4().to_string());
    RTDTextEntityTypePreCodeBuilder { inner }
  }

  pub fn language(&self) -> &String { &self.language }

}

#[doc(hidden)]
pub struct RTDTextEntityTypePreCodeBuilder {
  inner: TextEntityTypePreCode
}

impl RTDTextEntityTypePreCodeBuilder {
  pub fn build(&self) -> TextEntityTypePreCode { self.inner.clone() }

   
  pub fn language<T: AsRef<str>>(&mut self, language: T) -> &mut Self {
    self.inner.language = language.as_ref().to_string();
    self
  }

}

impl AsRef<TextEntityTypePreCode> for TextEntityTypePreCode {
  fn as_ref(&self) -> &TextEntityTypePreCode { self }
}

impl AsRef<TextEntityTypePreCode> for RTDTextEntityTypePreCodeBuilder {
  fn as_ref(&self) -> &TextEntityTypePreCode { &self.inner }
}







/// A text description shown instead of a raw URL
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct TextEntityTypeTextUrl {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
  /// HTTP or tg:// URL to be opened when the link is clicked
  url: String,
  
}

impl RObject for TextEntityTypeTextUrl {
  #[doc(hidden)] fn td_name(&self) -> &'static str { "textEntityTypeTextUrl" }
  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}


impl TDTextEntityType for TextEntityTypeTextUrl {}



impl TextEntityTypeTextUrl {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
  pub fn builder() -> RTDTextEntityTypeTextUrlBuilder {
    let mut inner = TextEntityTypeTextUrl::default();
    inner.td_name = "textEntityTypeTextUrl".to_string();
    inner.extra = Some(Uuid::new_v4().to_string());
    RTDTextEntityTypeTextUrlBuilder { inner }
  }

  pub fn url(&self) -> &String { &self.url }

}

#[doc(hidden)]
pub struct RTDTextEntityTypeTextUrlBuilder {
  inner: TextEntityTypeTextUrl
}

impl RTDTextEntityTypeTextUrlBuilder {
  pub fn build(&self) -> TextEntityTypeTextUrl { self.inner.clone() }

   
  pub fn url<T: AsRef<str>>(&mut self, url: T) -> &mut Self {
    self.inner.url = url.as_ref().to_string();
    self
  }

}

impl AsRef<TextEntityTypeTextUrl> for TextEntityTypeTextUrl {
  fn as_ref(&self) -> &TextEntityTypeTextUrl { self }
}

impl AsRef<TextEntityTypeTextUrl> for RTDTextEntityTypeTextUrlBuilder {
  fn as_ref(&self) -> &TextEntityTypeTextUrl { &self.inner }
}







/// An HTTP URL
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct TextEntityTypeUrl {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
  
}

impl RObject for TextEntityTypeUrl {
  #[doc(hidden)] fn td_name(&self) -> &'static str { "textEntityTypeUrl" }
  #[doc(hidden)] fn extra(&self) -> Option<String> { self.extra.clone() }
  fn to_json(&self) -> RTDResult<String> { Ok(serde_json::to_string(self)?) }
}


impl TDTextEntityType for TextEntityTypeUrl {}



impl TextEntityTypeUrl {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> { Ok(serde_json::from_str(json.as_ref())?) }
  pub fn builder() -> RTDTextEntityTypeUrlBuilder {
    let mut inner = TextEntityTypeUrl::default();
    inner.td_name = "textEntityTypeUrl".to_string();
    inner.extra = Some(Uuid::new_v4().to_string());
    RTDTextEntityTypeUrlBuilder { inner }
  }

}

#[doc(hidden)]
pub struct RTDTextEntityTypeUrlBuilder {
  inner: TextEntityTypeUrl
}

impl RTDTextEntityTypeUrlBuilder {
  pub fn build(&self) -> TextEntityTypeUrl { self.inner.clone() }

}

impl AsRef<TextEntityTypeUrl> for TextEntityTypeUrl {
  fn as_ref(&self) -> &TextEntityTypeUrl { self }
}

impl AsRef<TextEntityTypeUrl> for RTDTextEntityTypeUrlBuilder {
  fn as_ref(&self) -> &TextEntityTypeUrl { &self.inner }
}