Cppgram  1.0.0
Easy and modern C++14 Telegram Bot API wrapper
animation.hpp
1 #ifndef CPPGRAM_ANIMATION_HPP
2 #define CPPGRAM_ANIMATION_HPP
3 
4 #include "photo_size.hpp"
5 
6 namespace cppgram
7 {
8 namespace types
9 {
13 class Animation
14 {
15  public:
17  std::string file_id;
18 
20  std::experimental::optional<PhotoSize> thumb;
21 
23  std::experimental::optional<std::string> file_name,
24 
26  mime_type;
27 
29  std::experimental::optional<uint_fast32_t> file_size;
30 
31  Animation( Json::Value &json_animation )
32  : file_id( json_animation["file_id"].asString() )
33  {
34  if ( !json_animation["thumb"].isNull() )
35  {
36  thumb.emplace( PhotoSize( json_animation["thumb"] ) );
37  }
38  if ( !json_animation["file_name"].isNull() )
39  {
40  file_name.emplace( json_animation["file_name"].asString() );
41  }
42  if ( !json_animation["mime_type"].isNull() )
43  {
44  mime_type.emplace( json_animation["mime_type"].asString() );
45  }
46  if ( !json_animation["file_size"].isNull() )
47  {
48  file_size.emplace( json_animation["file_size"].asUInt() );
49  }
50  }
51 };
52 }
53 }
54 
55 #endif
This object represents an animation file to be displayed in the message containing a game...
Definition: animation.hpp:13
std::experimental::optional< std::string > mime_type
Definition: animation.hpp:23
std::experimental::optional< PhotoSize > thumb
Optional. Animation thumbnail as defined by sender.
Definition: animation.hpp:20
A photo or thumbnail.
Definition: photo_size.hpp:20
std::experimental::optional< uint_fast32_t > file_size
Optional. File size.
Definition: animation.hpp:29
std::experimental::optional< std::string > file_name
Optional. Original animation filename as defined by sender.
Definition: animation.hpp:23
main namespace for Cppgram
std::string file_id
Unique file identifier.
Definition: animation.hpp:17