mirror of
https://github.com/UltraCoderRU/telebotxx.git
synced 2026-01-28 04:05:13 +00:00
JSON-parsing functions moved to namespace telebotxx.
This commit is contained in:
parent
1c2c8384bc
commit
1e43989b77
1 changed files with 64 additions and 62 deletions
|
|
@ -13,8 +13,8 @@
|
|||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
using namespace telebotxx;
|
||||
|
||||
namespace telebotxx
|
||||
{
|
||||
const rapidjson::Value& parseResponse(const rapidjson::Document& doc)
|
||||
{
|
||||
using namespace rapidjson;
|
||||
|
|
@ -31,8 +31,7 @@ const rapidjson::Value& parseResponse(const rapidjson::Document& doc)
|
|||
if (!doc.HasMember("result") || !doc["result"].IsObject())
|
||||
throw ParseError("Field 'result' not found or has invalid type");
|
||||
return doc["result"];
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
if (!doc.HasMember("error_code") || !doc["error_code"].IsInt())
|
||||
throw ParseError("Field 'error_code' not found or has invalid type");
|
||||
|
|
@ -76,6 +75,9 @@ User parseUser(const rapidjson::Value& obj)
|
|||
|
||||
return User(id, firstName, lastName, username);
|
||||
}
|
||||
}
|
||||
|
||||
using namespace telebotxx;
|
||||
|
||||
class BotApi::Impl
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue