Cppgram  1.0.0
Easy and modern C++14 Telegram Bot API wrapper
voice.hpp
1 #ifndef CPPGRAM_VOICE_HPP
2 #define CPPGRAM_VOICE_HPP
3 
4 #include <experimental/optional>
5 #include <string>
6 
7 #include <json/json.h>
8 
9 namespace cppgram
10 {
11 namespace types
12 {
18 class Voice
19 {
22  public:
24  std::string file_id;
25 
27  uint_fast32_t duration;
28 
30  std::experimental::optional<std::string> mime_type;
31 
33  std::experimental::optional<uint_fast32_t> file_size;
34 
35  Voice( Json::Value &json_voice )
36  : file_id( json_voice["file_id"].asString() )
37  , duration( json_voice["duration"].asUInt() )
38  {
39  if ( !json_voice["mime_type"].isNull() )
40  {
41  mime_type.emplace( json_voice["mime_type"].asString() );
42  }
43 
44  if ( !json_voice["file_size"].isNull() )
45  {
46  file_size.emplace( json_voice["file_size"].asUInt() );
47  }
48  };
49 };
50 }
51 }
52 
53 #endif
uint_fast32_t duration
Definition: voice.hpp:27
Definition: voice.hpp:18
std::experimental::optional< uint_fast32_t > file_size
Definition: voice.hpp:33
std::experimental::optional< std::string > mime_type
Definition: voice.hpp:30
std::string file_id
Definition: voice.hpp:24
main namespace for Cppgram