| 1047 | } |
| 1048 | |
| 1049 | int ParseRarity(const MTPStarGiftAttributeRarity &rarity) { |
| 1050 | return rarity.match([&](const MTPDstarGiftAttributeRarity &data) { |
| 1051 | return std::max(data.vpermille().v, 0); |
| 1052 | }, [&](const MTPDstarGiftAttributeRarityUncommon &) { |
| 1053 | return int(Data::UniqueGiftRarity::Uncommon); |
| 1054 | }, [&](const MTPDstarGiftAttributeRarityRare &) { |
| 1055 | return int(Data::UniqueGiftRarity::Rare); |
| 1056 | }, [&](const MTPDstarGiftAttributeRarityEpic &) { |
| 1057 | return int(Data::UniqueGiftRarity::Epic); |
| 1058 | }, [&](const MTPDstarGiftAttributeRarityLegendary &) { |
| 1059 | return int(Data::UniqueGiftRarity::Legendary); |
| 1060 | }); |
| 1061 | } |
| 1062 | |
| 1063 | Data::UniqueGiftModel FromTL( |
| 1064 | not_null<Main::Session*> session, |