refactor(eventsub): enforce static error categories (#5903)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// WARNING: This file is automatically generated. Any changes will be lost.
|
||||
#include "twitch-eventsub-ws/chrono.hpp" // IWYU pragma: keep
|
||||
#include "twitch-eventsub-ws/errors.hpp"
|
||||
#include "twitch-eventsub-ws/detail/errors.hpp"
|
||||
#include "twitch-eventsub-ws/payloads/channel-chat-notification-v1.hpp"
|
||||
|
||||
#include <boost/json.hpp>
|
||||
@@ -12,18 +12,14 @@ boost::json::result_for<Badge, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Badge must be an object"};
|
||||
return boost::system::error_code{129, errorMustBeObject};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
}
|
||||
const auto &root = jvRoot.get_object();
|
||||
|
||||
const auto *jvsetID = root.if_contains("set_id");
|
||||
if (jvsetID == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_setID{
|
||||
"Missing required key set_id"};
|
||||
return boost::system::error_code{129, error_missing_field_setID};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto setID = boost::json::try_value_to<std::string>(*jvsetID);
|
||||
@@ -36,9 +32,7 @@ boost::json::result_for<Badge, boost::json::value>::type tag_invoke(
|
||||
const auto *jvid = root.if_contains("id");
|
||||
if (jvid == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_id{
|
||||
"Missing required key id"};
|
||||
return boost::system::error_code{129, error_missing_field_id};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto id = boost::json::try_value_to<std::string>(*jvid);
|
||||
@@ -51,9 +45,7 @@ boost::json::result_for<Badge, boost::json::value>::type tag_invoke(
|
||||
const auto *jvinfo = root.if_contains("info");
|
||||
if (jvinfo == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_info{
|
||||
"Missing required key info"};
|
||||
return boost::system::error_code{129, error_missing_field_info};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto info = boost::json::try_value_to<std::string>(*jvinfo);
|
||||
@@ -75,18 +67,14 @@ boost::json::result_for<Cheermote, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Cheermote must be an object"};
|
||||
return boost::system::error_code{129, errorMustBeObject};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
}
|
||||
const auto &root = jvRoot.get_object();
|
||||
|
||||
const auto *jvprefix = root.if_contains("prefix");
|
||||
if (jvprefix == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_prefix{
|
||||
"Missing required key prefix"};
|
||||
return boost::system::error_code{129, error_missing_field_prefix};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto prefix = boost::json::try_value_to<std::string>(*jvprefix);
|
||||
@@ -99,9 +87,7 @@ boost::json::result_for<Cheermote, boost::json::value>::type tag_invoke(
|
||||
const auto *jvbits = root.if_contains("bits");
|
||||
if (jvbits == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_bits{
|
||||
"Missing required key bits"};
|
||||
return boost::system::error_code{129, error_missing_field_bits};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto bits = boost::json::try_value_to<int>(*jvbits);
|
||||
@@ -114,9 +100,7 @@ boost::json::result_for<Cheermote, boost::json::value>::type tag_invoke(
|
||||
const auto *jvtier = root.if_contains("tier");
|
||||
if (jvtier == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_tier{
|
||||
"Missing required key tier"};
|
||||
return boost::system::error_code{129, error_missing_field_tier};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto tier = boost::json::try_value_to<int>(*jvtier);
|
||||
@@ -138,18 +122,14 @@ boost::json::result_for<Emote, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Emote must be an object"};
|
||||
return boost::system::error_code{129, errorMustBeObject};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
}
|
||||
const auto &root = jvRoot.get_object();
|
||||
|
||||
const auto *jvid = root.if_contains("id");
|
||||
if (jvid == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_id{
|
||||
"Missing required key id"};
|
||||
return boost::system::error_code{129, error_missing_field_id};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto id = boost::json::try_value_to<std::string>(*jvid);
|
||||
@@ -162,9 +142,7 @@ boost::json::result_for<Emote, boost::json::value>::type tag_invoke(
|
||||
const auto *jvemoteSetID = root.if_contains("emote_set_id");
|
||||
if (jvemoteSetID == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_emoteSetID{"Missing required key emote_set_id"};
|
||||
return boost::system::error_code{129, error_missing_field_emoteSetID};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto emoteSetID = boost::json::try_value_to<std::string>(*jvemoteSetID);
|
||||
@@ -177,9 +155,7 @@ boost::json::result_for<Emote, boost::json::value>::type tag_invoke(
|
||||
const auto *jvownerID = root.if_contains("owner_id");
|
||||
if (jvownerID == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_ownerID{"Missing required key owner_id"};
|
||||
return boost::system::error_code{129, error_missing_field_ownerID};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto ownerID = boost::json::try_value_to<std::string>(*jvownerID);
|
||||
@@ -192,9 +168,7 @@ boost::json::result_for<Emote, boost::json::value>::type tag_invoke(
|
||||
const auto *jvformat = root.if_contains("format");
|
||||
if (jvformat == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_format{
|
||||
"Missing required key format"};
|
||||
return boost::system::error_code{129, error_missing_field_format};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
const auto format =
|
||||
boost::json::try_value_to<std::vector<std::string>>(*jvformat);
|
||||
@@ -216,18 +190,14 @@ boost::json::result_for<Mention, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Mention must be an object"};
|
||||
return boost::system::error_code{129, errorMustBeObject};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
}
|
||||
const auto &root = jvRoot.get_object();
|
||||
|
||||
const auto *jvuserID = root.if_contains("user_id");
|
||||
if (jvuserID == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_userID{
|
||||
"Missing required key user_id"};
|
||||
return boost::system::error_code{129, error_missing_field_userID};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto userID = boost::json::try_value_to<std::string>(*jvuserID);
|
||||
@@ -240,9 +210,7 @@ boost::json::result_for<Mention, boost::json::value>::type tag_invoke(
|
||||
const auto *jvuserName = root.if_contains("user_name");
|
||||
if (jvuserName == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_userName{"Missing required key user_name"};
|
||||
return boost::system::error_code{129, error_missing_field_userName};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto userName = boost::json::try_value_to<std::string>(*jvuserName);
|
||||
@@ -255,9 +223,7 @@ boost::json::result_for<Mention, boost::json::value>::type tag_invoke(
|
||||
const auto *jvuserLogin = root.if_contains("user_login");
|
||||
if (jvuserLogin == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_userLogin{"Missing required key user_login"};
|
||||
return boost::system::error_code{129, error_missing_field_userLogin};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto userLogin = boost::json::try_value_to<std::string>(*jvuserLogin);
|
||||
@@ -280,18 +246,14 @@ boost::json::result_for<MessageFragment, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"MessageFragment must be an object"};
|
||||
return boost::system::error_code{129, errorMustBeObject};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
}
|
||||
const auto &root = jvRoot.get_object();
|
||||
|
||||
const auto *jvtype = root.if_contains("type");
|
||||
if (jvtype == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_type{
|
||||
"Missing required key type"};
|
||||
return boost::system::error_code{129, error_missing_field_type};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto type = boost::json::try_value_to<std::string>(*jvtype);
|
||||
@@ -304,9 +266,7 @@ boost::json::result_for<MessageFragment, boost::json::value>::type tag_invoke(
|
||||
const auto *jvtext = root.if_contains("text");
|
||||
if (jvtext == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_text{
|
||||
"Missing required key text"};
|
||||
return boost::system::error_code{129, error_missing_field_text};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto text = boost::json::try_value_to<std::string>(*jvtext);
|
||||
@@ -370,18 +330,14 @@ boost::json::result_for<Subcription, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Subcription must be an object"};
|
||||
return boost::system::error_code{129, errorMustBeObject};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
}
|
||||
const auto &root = jvRoot.get_object();
|
||||
|
||||
const auto *jvsubTier = root.if_contains("sub_tier");
|
||||
if (jvsubTier == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_subTier{"Missing required key sub_tier"};
|
||||
return boost::system::error_code{129, error_missing_field_subTier};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto subTier = boost::json::try_value_to<std::string>(*jvsubTier);
|
||||
@@ -394,9 +350,7 @@ boost::json::result_for<Subcription, boost::json::value>::type tag_invoke(
|
||||
const auto *jvisPrime = root.if_contains("is_prime");
|
||||
if (jvisPrime == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_isPrime{"Missing required key is_prime"};
|
||||
return boost::system::error_code{129, error_missing_field_isPrime};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto isPrime = boost::json::try_value_to<bool>(*jvisPrime);
|
||||
@@ -409,11 +363,7 @@ boost::json::result_for<Subcription, boost::json::value>::type tag_invoke(
|
||||
const auto *jvdurationMonths = root.if_contains("duration_months");
|
||||
if (jvdurationMonths == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_durationMonths{
|
||||
"Missing required key duration_months"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_durationMonths};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto durationMonths = boost::json::try_value_to<int>(*jvdurationMonths);
|
||||
@@ -436,20 +386,14 @@ boost::json::result_for<Resubscription, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Resubscription must be an object"};
|
||||
return boost::system::error_code{129, errorMustBeObject};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
}
|
||||
const auto &root = jvRoot.get_object();
|
||||
|
||||
const auto *jvcumulativeMonths = root.if_contains("cumulative_months");
|
||||
if (jvcumulativeMonths == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_cumulativeMonths{
|
||||
"Missing required key cumulative_months"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_cumulativeMonths};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto cumulativeMonths = boost::json::try_value_to<int>(*jvcumulativeMonths);
|
||||
@@ -462,11 +406,7 @@ boost::json::result_for<Resubscription, boost::json::value>::type tag_invoke(
|
||||
const auto *jvdurationMonths = root.if_contains("duration_months");
|
||||
if (jvdurationMonths == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_durationMonths{
|
||||
"Missing required key duration_months"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_durationMonths};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto durationMonths = boost::json::try_value_to<int>(*jvdurationMonths);
|
||||
@@ -492,9 +432,7 @@ boost::json::result_for<Resubscription, boost::json::value>::type tag_invoke(
|
||||
const auto *jvsubTier = root.if_contains("sub_tier");
|
||||
if (jvsubTier == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_subTier{"Missing required key sub_tier"};
|
||||
return boost::system::error_code{129, error_missing_field_subTier};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto subTier = boost::json::try_value_to<std::string>(*jvsubTier);
|
||||
@@ -507,9 +445,7 @@ boost::json::result_for<Resubscription, boost::json::value>::type tag_invoke(
|
||||
const auto *jvisPrime = root.if_contains("is_prime");
|
||||
if (jvisPrime == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_isPrime{"Missing required key is_prime"};
|
||||
return boost::system::error_code{129, error_missing_field_isPrime};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto isPrime = boost::json::try_value_to<bool>(*jvisPrime);
|
||||
@@ -522,9 +458,7 @@ boost::json::result_for<Resubscription, boost::json::value>::type tag_invoke(
|
||||
const auto *jvisGift = root.if_contains("is_gift");
|
||||
if (jvisGift == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_isGift{
|
||||
"Missing required key is_gift"};
|
||||
return boost::system::error_code{129, error_missing_field_isGift};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto isGift = boost::json::try_value_to<bool>(*jvisGift);
|
||||
@@ -537,11 +471,7 @@ boost::json::result_for<Resubscription, boost::json::value>::type tag_invoke(
|
||||
const auto *jvgifterIsAnonymous = root.if_contains("gifter_is_anonymous");
|
||||
if (jvgifterIsAnonymous == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_gifterIsAnonymous{
|
||||
"Missing required key gifter_is_anonymous"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_gifterIsAnonymous};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto gifterIsAnonymous =
|
||||
@@ -614,20 +544,14 @@ boost::json::result_for<GiftSubscription, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"GiftSubscription must be an object"};
|
||||
return boost::system::error_code{129, errorMustBeObject};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
}
|
||||
const auto &root = jvRoot.get_object();
|
||||
|
||||
const auto *jvdurationMonths = root.if_contains("duration_months");
|
||||
if (jvdurationMonths == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_durationMonths{
|
||||
"Missing required key duration_months"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_durationMonths};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto durationMonths = boost::json::try_value_to<int>(*jvdurationMonths);
|
||||
@@ -667,11 +591,7 @@ boost::json::result_for<GiftSubscription, boost::json::value>::type tag_invoke(
|
||||
const auto *jvrecipientUserID = root.if_contains("recipient_user_id");
|
||||
if (jvrecipientUserID == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_recipientUserID{
|
||||
"Missing required key recipient_user_id"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_recipientUserID};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto recipientUserID =
|
||||
@@ -685,11 +605,7 @@ boost::json::result_for<GiftSubscription, boost::json::value>::type tag_invoke(
|
||||
const auto *jvrecipientUserName = root.if_contains("recipient_user_name");
|
||||
if (jvrecipientUserName == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_recipientUserName{
|
||||
"Missing required key recipient_user_name"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_recipientUserName};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto recipientUserName =
|
||||
@@ -703,11 +619,7 @@ boost::json::result_for<GiftSubscription, boost::json::value>::type tag_invoke(
|
||||
const auto *jvrecipientUserLogin = root.if_contains("recipient_user_login");
|
||||
if (jvrecipientUserLogin == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_recipientUserLogin{
|
||||
"Missing required key recipient_user_login"};
|
||||
return boost::system::error_code{
|
||||
129, error_missing_field_recipientUserLogin};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto recipientUserLogin =
|
||||
@@ -721,9 +633,7 @@ boost::json::result_for<GiftSubscription, boost::json::value>::type tag_invoke(
|
||||
const auto *jvsubTier = root.if_contains("sub_tier");
|
||||
if (jvsubTier == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_subTier{"Missing required key sub_tier"};
|
||||
return boost::system::error_code{129, error_missing_field_subTier};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto subTier = boost::json::try_value_to<std::string>(*jvsubTier);
|
||||
@@ -765,18 +675,14 @@ boost::json::result_for<CommunityGiftSubscription, boost::json::value>::type
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"CommunityGiftSubscription must be an object"};
|
||||
return boost::system::error_code{129, errorMustBeObject};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
}
|
||||
const auto &root = jvRoot.get_object();
|
||||
|
||||
const auto *jvid = root.if_contains("id");
|
||||
if (jvid == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_id{
|
||||
"Missing required key id"};
|
||||
return boost::system::error_code{129, error_missing_field_id};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto id = boost::json::try_value_to<std::string>(*jvid);
|
||||
@@ -789,9 +695,7 @@ boost::json::result_for<CommunityGiftSubscription, boost::json::value>::type
|
||||
const auto *jvtotal = root.if_contains("total");
|
||||
if (jvtotal == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_total{
|
||||
"Missing required key total"};
|
||||
return boost::system::error_code{129, error_missing_field_total};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto total = boost::json::try_value_to<int>(*jvtotal);
|
||||
@@ -804,9 +708,7 @@ boost::json::result_for<CommunityGiftSubscription, boost::json::value>::type
|
||||
const auto *jvsubTier = root.if_contains("sub_tier");
|
||||
if (jvsubTier == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_subTier{"Missing required key sub_tier"};
|
||||
return boost::system::error_code{129, error_missing_field_subTier};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto subTier = boost::json::try_value_to<std::string>(*jvsubTier);
|
||||
@@ -844,20 +746,14 @@ boost::json::result_for<GiftPaidUpgrade, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"GiftPaidUpgrade must be an object"};
|
||||
return boost::system::error_code{129, errorMustBeObject};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
}
|
||||
const auto &root = jvRoot.get_object();
|
||||
|
||||
const auto *jvgifterIsAnonymous = root.if_contains("gifter_is_anonymous");
|
||||
if (jvgifterIsAnonymous == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_gifterIsAnonymous{
|
||||
"Missing required key gifter_is_anonymous"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_gifterIsAnonymous};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto gifterIsAnonymous =
|
||||
@@ -924,18 +820,14 @@ boost::json::result_for<PrimePaidUpgrade, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"PrimePaidUpgrade must be an object"};
|
||||
return boost::system::error_code{129, errorMustBeObject};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
}
|
||||
const auto &root = jvRoot.get_object();
|
||||
|
||||
const auto *jvsubTier = root.if_contains("sub_tier");
|
||||
if (jvsubTier == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_subTier{"Missing required key sub_tier"};
|
||||
return boost::system::error_code{129, error_missing_field_subTier};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto subTier = boost::json::try_value_to<std::string>(*jvsubTier);
|
||||
@@ -955,18 +847,14 @@ boost::json::result_for<Raid, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Raid must be an object"};
|
||||
return boost::system::error_code{129, errorMustBeObject};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
}
|
||||
const auto &root = jvRoot.get_object();
|
||||
|
||||
const auto *jvuserID = root.if_contains("user_id");
|
||||
if (jvuserID == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_userID{
|
||||
"Missing required key user_id"};
|
||||
return boost::system::error_code{129, error_missing_field_userID};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto userID = boost::json::try_value_to<std::string>(*jvuserID);
|
||||
@@ -979,9 +867,7 @@ boost::json::result_for<Raid, boost::json::value>::type tag_invoke(
|
||||
const auto *jvuserName = root.if_contains("user_name");
|
||||
if (jvuserName == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_userName{"Missing required key user_name"};
|
||||
return boost::system::error_code{129, error_missing_field_userName};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto userName = boost::json::try_value_to<std::string>(*jvuserName);
|
||||
@@ -994,9 +880,7 @@ boost::json::result_for<Raid, boost::json::value>::type tag_invoke(
|
||||
const auto *jvuserLogin = root.if_contains("user_login");
|
||||
if (jvuserLogin == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_userLogin{"Missing required key user_login"};
|
||||
return boost::system::error_code{129, error_missing_field_userLogin};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto userLogin = boost::json::try_value_to<std::string>(*jvuserLogin);
|
||||
@@ -1009,10 +893,7 @@ boost::json::result_for<Raid, boost::json::value>::type tag_invoke(
|
||||
const auto *jvviewerCount = root.if_contains("viewer_count");
|
||||
if (jvviewerCount == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_viewerCount{
|
||||
"Missing required key viewer_count"};
|
||||
return boost::system::error_code{129, error_missing_field_viewerCount};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto viewerCount = boost::json::try_value_to<int>(*jvviewerCount);
|
||||
@@ -1025,11 +906,7 @@ boost::json::result_for<Raid, boost::json::value>::type tag_invoke(
|
||||
const auto *jvprofileImageURL = root.if_contains("profile_image_url");
|
||||
if (jvprofileImageURL == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_profileImageURL{
|
||||
"Missing required key profile_image_url"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_profileImageURL};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto profileImageURL =
|
||||
@@ -1054,9 +931,7 @@ boost::json::result_for<Unraid, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Unraid must be an object"};
|
||||
return boost::system::error_code{129, errorMustBeObject};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
}
|
||||
const auto &root = jvRoot.get_object();
|
||||
|
||||
@@ -1069,20 +944,14 @@ boost::json::result_for<PayItForward, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"PayItForward must be an object"};
|
||||
return boost::system::error_code{129, errorMustBeObject};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
}
|
||||
const auto &root = jvRoot.get_object();
|
||||
|
||||
const auto *jvgifterIsAnonymous = root.if_contains("gifter_is_anonymous");
|
||||
if (jvgifterIsAnonymous == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_gifterIsAnonymous{
|
||||
"Missing required key gifter_is_anonymous"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_gifterIsAnonymous};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto gifterIsAnonymous =
|
||||
@@ -1149,18 +1018,14 @@ boost::json::result_for<Announcement, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Announcement must be an object"};
|
||||
return boost::system::error_code{129, errorMustBeObject};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
}
|
||||
const auto &root = jvRoot.get_object();
|
||||
|
||||
const auto *jvcolor = root.if_contains("color");
|
||||
if (jvcolor == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_color{
|
||||
"Missing required key color"};
|
||||
return boost::system::error_code{129, error_missing_field_color};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto color = boost::json::try_value_to<std::string>(*jvcolor);
|
||||
@@ -1181,18 +1046,14 @@ boost::json::result_for<CharityDonationAmount, boost::json::value>::type
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"CharityDonationAmount must be an object"};
|
||||
return boost::system::error_code{129, errorMustBeObject};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
}
|
||||
const auto &root = jvRoot.get_object();
|
||||
|
||||
const auto *jvvalue = root.if_contains("value");
|
||||
if (jvvalue == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_value{
|
||||
"Missing required key value"};
|
||||
return boost::system::error_code{129, error_missing_field_value};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto value = boost::json::try_value_to<int>(*jvvalue);
|
||||
@@ -1205,11 +1066,7 @@ boost::json::result_for<CharityDonationAmount, boost::json::value>::type
|
||||
const auto *jvdecimalPlaces = root.if_contains("decimal_places");
|
||||
if (jvdecimalPlaces == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_decimalPlaces{
|
||||
"Missing required key decimal_places"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_decimalPlaces};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto decimalPlaces = boost::json::try_value_to<int>(*jvdecimalPlaces);
|
||||
@@ -1222,9 +1079,7 @@ boost::json::result_for<CharityDonationAmount, boost::json::value>::type
|
||||
const auto *jvcurrency = root.if_contains("currency");
|
||||
if (jvcurrency == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_currency{"Missing required key currency"};
|
||||
return boost::system::error_code{129, error_missing_field_currency};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto currency = boost::json::try_value_to<std::string>(*jvcurrency);
|
||||
@@ -1247,19 +1102,14 @@ boost::json::result_for<CharityDonation, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"CharityDonation must be an object"};
|
||||
return boost::system::error_code{129, errorMustBeObject};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
}
|
||||
const auto &root = jvRoot.get_object();
|
||||
|
||||
const auto *jvcharityName = root.if_contains("charity_name");
|
||||
if (jvcharityName == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_charityName{
|
||||
"Missing required key charity_name"};
|
||||
return boost::system::error_code{129, error_missing_field_charityName};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto charityName = boost::json::try_value_to<std::string>(*jvcharityName);
|
||||
@@ -1272,9 +1122,7 @@ boost::json::result_for<CharityDonation, boost::json::value>::type tag_invoke(
|
||||
const auto *jvamount = root.if_contains("amount");
|
||||
if (jvamount == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_amount{
|
||||
"Missing required key amount"};
|
||||
return boost::system::error_code{129, error_missing_field_amount};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto amount = boost::json::try_value_to<CharityDonationAmount>(*jvamount);
|
||||
@@ -1296,18 +1144,14 @@ boost::json::result_for<BitsBadgeTier, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"BitsBadgeTier must be an object"};
|
||||
return boost::system::error_code{129, errorMustBeObject};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
}
|
||||
const auto &root = jvRoot.get_object();
|
||||
|
||||
const auto *jvtier = root.if_contains("tier");
|
||||
if (jvtier == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_tier{
|
||||
"Missing required key tier"};
|
||||
return boost::system::error_code{129, error_missing_field_tier};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto tier = boost::json::try_value_to<int>(*jvtier);
|
||||
@@ -1327,18 +1171,14 @@ boost::json::result_for<Message, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Message must be an object"};
|
||||
return boost::system::error_code{129, errorMustBeObject};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
}
|
||||
const auto &root = jvRoot.get_object();
|
||||
|
||||
const auto *jvtext = root.if_contains("text");
|
||||
if (jvtext == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_text{
|
||||
"Missing required key text"};
|
||||
return boost::system::error_code{129, error_missing_field_text};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto text = boost::json::try_value_to<std::string>(*jvtext);
|
||||
@@ -1351,9 +1191,7 @@ boost::json::result_for<Message, boost::json::value>::type tag_invoke(
|
||||
const auto *jvfragments = root.if_contains("fragments");
|
||||
if (jvfragments == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_fragments{"Missing required key fragments"};
|
||||
return boost::system::error_code{129, error_missing_field_fragments};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
const auto fragments =
|
||||
boost::json::try_value_to<std::vector<MessageFragment>>(*jvfragments);
|
||||
@@ -1373,20 +1211,14 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Event must be an object"};
|
||||
return boost::system::error_code{129, errorMustBeObject};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
}
|
||||
const auto &root = jvRoot.get_object();
|
||||
|
||||
const auto *jvbroadcasterUserID = root.if_contains("broadcaster_user_id");
|
||||
if (jvbroadcasterUserID == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_broadcasterUserID{
|
||||
"Missing required key broadcaster_user_id"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_broadcasterUserID};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto broadcasterUserID =
|
||||
@@ -1401,11 +1233,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
root.if_contains("broadcaster_user_login");
|
||||
if (jvbroadcasterUserLogin == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_broadcasterUserLogin{
|
||||
"Missing required key broadcaster_user_login"};
|
||||
return boost::system::error_code{
|
||||
129, error_missing_field_broadcasterUserLogin};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto broadcasterUserLogin =
|
||||
@@ -1420,11 +1248,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
root.if_contains("broadcaster_user_name");
|
||||
if (jvbroadcasterUserName == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_broadcasterUserName{
|
||||
"Missing required key broadcaster_user_name"};
|
||||
return boost::system::error_code{
|
||||
129, error_missing_field_broadcasterUserName};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto broadcasterUserName =
|
||||
@@ -1438,11 +1262,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
const auto *jvchatterUserID = root.if_contains("chatter_user_id");
|
||||
if (jvchatterUserID == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_chatterUserID{
|
||||
"Missing required key chatter_user_id"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_chatterUserID};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto chatterUserID =
|
||||
@@ -1456,11 +1276,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
const auto *jvchatterUserLogin = root.if_contains("chatter_user_login");
|
||||
if (jvchatterUserLogin == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_chatterUserLogin{
|
||||
"Missing required key chatter_user_login"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_chatterUserLogin};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto chatterUserLogin =
|
||||
@@ -1474,11 +1290,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
const auto *jvchatterUserName = root.if_contains("chatter_user_name");
|
||||
if (jvchatterUserName == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_chatterUserName{
|
||||
"Missing required key chatter_user_name"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_chatterUserName};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto chatterUserName =
|
||||
@@ -1492,11 +1304,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
const auto *jvchatterIsAnonymous = root.if_contains("chatter_is_anonymous");
|
||||
if (jvchatterIsAnonymous == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_chatterIsAnonymous{
|
||||
"Missing required key chatter_is_anonymous"};
|
||||
return boost::system::error_code{
|
||||
129, error_missing_field_chatterIsAnonymous};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto chatterIsAnonymous =
|
||||
@@ -1510,9 +1318,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
const auto *jvcolor = root.if_contains("color");
|
||||
if (jvcolor == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_color{
|
||||
"Missing required key color"};
|
||||
return boost::system::error_code{129, error_missing_field_color};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto color = boost::json::try_value_to<std::string>(*jvcolor);
|
||||
@@ -1525,9 +1331,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
const auto *jvbadges = root.if_contains("badges");
|
||||
if (jvbadges == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_badges{
|
||||
"Missing required key badges"};
|
||||
return boost::system::error_code{129, error_missing_field_badges};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
const auto badges =
|
||||
boost::json::try_value_to<std::vector<Badge>>(*jvbadges);
|
||||
@@ -1539,11 +1343,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
const auto *jvsystemMessage = root.if_contains("system_message");
|
||||
if (jvsystemMessage == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_systemMessage{
|
||||
"Missing required key system_message"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_systemMessage};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto systemMessage =
|
||||
@@ -1557,9 +1357,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
const auto *jvmessageID = root.if_contains("message_id");
|
||||
if (jvmessageID == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_messageID{"Missing required key message_id"};
|
||||
return boost::system::error_code{129, error_missing_field_messageID};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto messageID = boost::json::try_value_to<std::string>(*jvmessageID);
|
||||
@@ -1572,9 +1370,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
const auto *jvmessage = root.if_contains("message");
|
||||
if (jvmessage == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_message{"Missing required key message"};
|
||||
return boost::system::error_code{129, error_missing_field_message};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto message = boost::json::try_value_to<Message>(*jvmessage);
|
||||
@@ -1587,9 +1383,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
const auto *jvnoticeType = root.if_contains("notice_type");
|
||||
if (jvnoticeType == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_noticeType{"Missing required key notice_type"};
|
||||
return boost::system::error_code{129, error_missing_field_noticeType};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto noticeType = boost::json::try_value_to<std::string>(*jvnoticeType);
|
||||
@@ -1797,19 +1591,14 @@ boost::json::result_for<Payload, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Payload must be an object"};
|
||||
return boost::system::error_code{129, errorMustBeObject};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
}
|
||||
const auto &root = jvRoot.get_object();
|
||||
|
||||
const auto *jvsubscription = root.if_contains("subscription");
|
||||
if (jvsubscription == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_subscription{
|
||||
"Missing required key subscription"};
|
||||
return boost::system::error_code{129, error_missing_field_subscription};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto subscription =
|
||||
@@ -1823,9 +1612,7 @@ boost::json::result_for<Payload, boost::json::value>::type tag_invoke(
|
||||
const auto *jvevent = root.if_contains("event");
|
||||
if (jvevent == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_event{
|
||||
"Missing required key event"};
|
||||
return boost::system::error_code{129, error_missing_field_event};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto event = boost::json::try_value_to<Event>(*jvevent);
|
||||
|
||||
Reference in New Issue
Block a user