Cppgram  1.0.0
Easy and modern C++14 Telegram Bot API wrapper
sticker.hpp
1 #ifndef CPPGRAM_STICKER_HPP
2 #define CPPGRAM_STICKER_HPP
3 
4 #include <experimental/optional>
5 #include <string>
6 
7 #include <json/json.h>
8 
9 #include "photo_size.hpp"
10 
11 namespace cppgram
12 {
13 namespace types
14 {
21 class Sticker
22 {
25  public:
27  std::string file_id;
28 
30  uint_fast32_t width,
31 
33  height;
34 
36  std::experimental::optional<PhotoSize> thumb;
37 
39  std::experimental::optional<std::string> emoj;
40 
42  std::experimental::optional<uint_fast32_t> file_size;
43 
44  Sticker( Json::Value &json_sticker )
45  : file_id( json_sticker["file_id"].asString() )
46  , width( json_sticker["width"].asUInt() )
47  , height( json_sticker["height"].asUInt() )
48  {
49  if ( !json_sticker["thumb"].isNull() )
50  {
51  thumb.emplace( PhotoSize( json_sticker["thumb"] ) );
52  }
53 
54  if ( !json_sticker["emoj"].isNull() )
55  {
56  emoj.emplace( json_sticker["emoj"].asString() );
57  }
58 
59  if ( !json_sticker["file_size"].isNull() )
60  {
61  file_size.emplace( json_sticker["file_size"].asUInt() );
62  }
63  }
64 };
65 }
66 }
67 
68 #endif
std::string file_id
Unique identifier for this file.
Definition: sticker.hpp:27
std::experimental::optional< std::string > emoj
Optional. Emoj associated with the sticker
Definition: sticker.hpp:39
A photo or thumbnail.
Definition: photo_size.hpp:20
A sticker.
Definition: sticker.hpp:21
std::experimental::optional< uint_fast32_t > file_size
Optional. File size
Definition: sticker.hpp:42
std::experimental::optional< PhotoSize > thumb
Optional. Sticker thumbnail in .webbp or .jpg format
Definition: sticker.hpp:36
uint_fast32_t height
Sticker height.
Definition: sticker.hpp:30
uint_fast32_t width
Sticker width.
Definition: sticker.hpp:30
main namespace for Cppgram