refactor(eventsub): enforce static error categories (#5903)
This commit is contained in:
+1
-1
@@ -21,7 +21,7 @@
|
||||
- Bugfix: Fixed the reply button showing for inline whispers and announcements. (#5863)
|
||||
- Bugfix: Fixed suspicious user treatment update messages not being searchable. (#5865)
|
||||
- Bugfix: Ensure miniaudio backend exits even if it doesn't exit cleanly. (#5896)
|
||||
- Dev: Add initial experimental EventSub support. (#5837, #5895, #5897, #5904, #5910)
|
||||
- Dev: Add initial experimental EventSub support. (#5837, #5895, #5897, #5904, #5910, #5903)
|
||||
- Dev: Highlight checks now use non-capturing groups for the boundaries. (#5784)
|
||||
- Dev: Removed unused PubSub whisper code. (#5898)
|
||||
- Dev: Updated Conan dependencies. (#5776)
|
||||
|
||||
@@ -17,7 +17,7 @@ def _generate_implementation(header_path: str, items: list[Struct | Enum]) -> st
|
||||
doc = f"""// WARNING: This file is automatically generated. Any changes will be lost.
|
||||
#include "{header_path}"
|
||||
#include "twitch-eventsub-ws/chrono.hpp" // IWYU pragma: keep
|
||||
#include "twitch-eventsub-ws/errors.hpp"
|
||||
#include "twitch-eventsub-ws/detail/errors.hpp"
|
||||
#include <boost/json.hpp>
|
||||
|
||||
"""
|
||||
|
||||
@@ -3,8 +3,7 @@ boost::json::result_for<{{enum.full_name}}, boost::json::value>::type tag_invoke
|
||||
{
|
||||
if (!jvRoot.is_string())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeString{"{{enum.full_name}} must be a string"};
|
||||
return boost::system::error_code{129, errorMustBeString};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedString);
|
||||
}
|
||||
std::string_view eString(jvRoot.get_string());
|
||||
|
||||
@@ -16,6 +15,5 @@ boost::json::result_for<{{enum.full_name}}, boost::json::value>::type tag_invoke
|
||||
}
|
||||
{%- endfor %}
|
||||
|
||||
static const error::ApplicationErrorCategory errorEnumNameDidNotExist{"{{enum.full_name}} did not have a constant that matched this string"};
|
||||
return boost::system::error_code{129, errorEnumNameDidNotExist};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::UnknownEnumValue);
|
||||
}
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
static const error::ApplicationErrorCategory error_missing_field_{{field.name}}{"Missing required key {{field.json_name}}"};
|
||||
return boost::system::error_code{129, error_missing_field_{{field.name}}};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
|
||||
@@ -4,28 +4,24 @@ boost::json::result_for<{{struct.full_name}}, boost::json::value>::type tag_invo
|
||||
{% if struct.inner_root %}
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{"{{struct.full_name}} must be an object"};
|
||||
return boost::system::error_code{129, errorMustBeObject};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
}
|
||||
const auto &outerRoot = jvRoot.get_object();
|
||||
|
||||
const auto *jvInnerRoot = outerRoot.if_contains("{{struct.inner_root}}");
|
||||
if (jvInnerRoot == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMissing{"{{struct.full_name}}'s key {{struct.inner_root}} is missing"};
|
||||
return boost::system::error_code{129, errorMissing};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::InnerRootMissing);
|
||||
}
|
||||
if (!jvInnerRoot->is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{"{{struct.full_name}}'s {{struct.inner_root}} must be an object"};
|
||||
return boost::system::error_code{129, errorMustBeObject};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
}
|
||||
const auto &root = jvInnerRoot->get_object();
|
||||
{% else %}
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{"{{struct.full_name}} must be an object"};
|
||||
return boost::system::error_code{129, errorMustBeObject};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
}
|
||||
const auto &root = jvRoot.get_object();
|
||||
{% endif %}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "twitch-eventsub-ws/errors.hpp"
|
||||
|
||||
#define EVENTSUB_BAIL_HERE(kind) \
|
||||
{ \
|
||||
static constexpr boost::source_location loc = BOOST_CURRENT_LOCATION; \
|
||||
return ::chatterino::eventsub::lib::error::makeCode(kind, &loc); \
|
||||
}
|
||||
@@ -6,32 +6,35 @@
|
||||
|
||||
namespace chatterino::eventsub::lib::error {
|
||||
|
||||
// NOLINTNEXTLINE(performance-enum-size)
|
||||
enum class Kind : int {
|
||||
FieldMissing = 1,
|
||||
ExpectedObject,
|
||||
ExpectedString,
|
||||
UnknownEnumValue,
|
||||
InnerRootMissing,
|
||||
NoMessageHandler
|
||||
};
|
||||
|
||||
class ApplicationErrorCategory final : public boost::system::error_category
|
||||
{
|
||||
const std::string innerMessage;
|
||||
|
||||
public:
|
||||
ApplicationErrorCategory(const char *_innerMessage)
|
||||
: innerMessage(_innerMessage)
|
||||
{
|
||||
}
|
||||
|
||||
explicit ApplicationErrorCategory(std::string _innerMessage)
|
||||
: innerMessage(std::move(_innerMessage))
|
||||
{
|
||||
}
|
||||
consteval ApplicationErrorCategory() = default;
|
||||
|
||||
const char *name() const noexcept override
|
||||
{
|
||||
return "Application JSON error";
|
||||
}
|
||||
std::string message(int /*ev*/) const override
|
||||
{
|
||||
return this->innerMessage;
|
||||
return "JSON deserialization error";
|
||||
}
|
||||
|
||||
std::string message(int ev) const override;
|
||||
};
|
||||
|
||||
const ApplicationErrorCategory EXPECTED_OBJECT{"Expected object"};
|
||||
const ApplicationErrorCategory MISSING_KEY{"Missing key"};
|
||||
inline constexpr ApplicationErrorCategory CATEGORY;
|
||||
|
||||
inline boost::system::error_code makeCode(Kind kind,
|
||||
const boost::source_location *loc)
|
||||
{
|
||||
return {static_cast<int>(kind), CATEGORY, loc};
|
||||
}
|
||||
|
||||
} // namespace chatterino::eventsub::lib::error
|
||||
|
||||
@@ -24,6 +24,7 @@ set(SOURCE_FILES
|
||||
|
||||
json.cpp
|
||||
string.cpp
|
||||
errors.cpp
|
||||
|
||||
# Subscription types (only additional functions)
|
||||
payloads/channel-ban-v1.cpp
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
#include "twitch-eventsub-ws/errors.hpp"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
namespace chatterino::eventsub::lib::error {
|
||||
|
||||
std::string ApplicationErrorCategory::message(int ev) const
|
||||
{
|
||||
using namespace std::string_literals;
|
||||
|
||||
static_assert(sizeof(int) == sizeof(Kind));
|
||||
auto kind = static_cast<Kind>(ev);
|
||||
|
||||
switch (kind)
|
||||
{
|
||||
case Kind::FieldMissing:
|
||||
return "Missing required key"s;
|
||||
case Kind::ExpectedObject:
|
||||
return "Expected an object"s;
|
||||
case Kind::ExpectedString:
|
||||
return "Expected a string"s;
|
||||
case Kind::UnknownEnumValue:
|
||||
return "Unknown enum value"s;
|
||||
case Kind::InnerRootMissing:
|
||||
return "Missing inner root"s;
|
||||
case Kind::NoMessageHandler:
|
||||
return "No message handler found"s;
|
||||
}
|
||||
|
||||
assert(false);
|
||||
return "Unknown error"s;
|
||||
}
|
||||
|
||||
} // namespace chatterino::eventsub::lib::error
|
||||
@@ -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/messages/metadata.hpp"
|
||||
|
||||
#include <boost/json.hpp>
|
||||
@@ -12,18 +12,14 @@ boost::json::result_for<Metadata, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Metadata 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 *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);
|
||||
@@ -36,10 +32,7 @@ boost::json::result_for<Metadata, boost::json::value>::type tag_invoke(
|
||||
const auto *jvmessageType = root.if_contains("message_type");
|
||||
if (jvmessageType == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_messageType{
|
||||
"Missing required key message_type"};
|
||||
return boost::system::error_code{129, error_missing_field_messageType};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto messageType = boost::json::try_value_to<std::string>(*jvmessageType);
|
||||
@@ -52,11 +45,7 @@ boost::json::result_for<Metadata, boost::json::value>::type tag_invoke(
|
||||
const auto *jvmessageTimestamp = root.if_contains("message_timestamp");
|
||||
if (jvmessageTimestamp == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_messageTimestamp{
|
||||
"Missing required key message_timestamp"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_messageTimestamp};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto messageTimestamp =
|
||||
|
||||
@@ -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-ban-v1.hpp"
|
||||
|
||||
#include <boost/json.hpp>
|
||||
@@ -12,20 +12,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 =
|
||||
@@ -40,11 +34,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 =
|
||||
@@ -59,11 +49,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 =
|
||||
@@ -77,11 +63,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
const auto *jvmoderatorUserID = root.if_contains("moderator_user_id");
|
||||
if (jvmoderatorUserID == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_moderatorUserID{
|
||||
"Missing required key moderator_user_id"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_moderatorUserID};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto moderatorUserID =
|
||||
@@ -95,11 +77,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
const auto *jvmoderatorUserLogin = root.if_contains("moderator_user_login");
|
||||
if (jvmoderatorUserLogin == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_moderatorUserLogin{
|
||||
"Missing required key moderator_user_login"};
|
||||
return boost::system::error_code{
|
||||
129, error_missing_field_moderatorUserLogin};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto moderatorUserLogin =
|
||||
@@ -113,11 +91,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
const auto *jvmoderatorUserName = root.if_contains("moderator_user_name");
|
||||
if (jvmoderatorUserName == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_moderatorUserName{
|
||||
"Missing required key moderator_user_name"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_moderatorUserName};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto moderatorUserName =
|
||||
@@ -131,9 +105,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
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);
|
||||
@@ -146,9 +118,7 @@ boost::json::result_for<Event, 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);
|
||||
@@ -161,9 +131,7 @@ boost::json::result_for<Event, 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);
|
||||
@@ -176,9 +144,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
const auto *jvreason = root.if_contains("reason");
|
||||
if (jvreason == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_reason{
|
||||
"Missing required key reason"};
|
||||
return boost::system::error_code{129, error_missing_field_reason};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto reason = boost::json::try_value_to<std::string>(*jvreason);
|
||||
@@ -191,10 +157,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
const auto *jvisPermanent = root.if_contains("is_permanent");
|
||||
if (jvisPermanent == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_isPermanent{
|
||||
"Missing required key is_permanent"};
|
||||
return boost::system::error_code{129, error_missing_field_isPermanent};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto isPermanent = boost::json::try_value_to<bool>(*jvisPermanent);
|
||||
@@ -207,9 +170,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
const auto *jvbannedAt = root.if_contains("banned_at");
|
||||
if (jvbannedAt == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_bannedAt{"Missing required key banned_at"};
|
||||
return boost::system::error_code{129, error_missing_field_bannedAt};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto bannedAt =
|
||||
@@ -258,19 +219,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 =
|
||||
@@ -284,9 +240,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);
|
||||
|
||||
@@ -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-message-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);
|
||||
@@ -369,18 +329,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);
|
||||
@@ -393,9 +349,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);
|
||||
@@ -415,18 +369,14 @@ boost::json::result_for<Cheer, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Cheer 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 *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);
|
||||
@@ -446,20 +396,14 @@ boost::json::result_for<Reply, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Reply 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 *jvparentMessageID = root.if_contains("parent_message_id");
|
||||
if (jvparentMessageID == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_parentMessageID{
|
||||
"Missing required key parent_message_id"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_parentMessageID};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto parentMessageID =
|
||||
@@ -473,10 +417,7 @@ boost::json::result_for<Reply, boost::json::value>::type tag_invoke(
|
||||
const auto *jvparentUserID = root.if_contains("parent_user_id");
|
||||
if (jvparentUserID == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_parentUserID{
|
||||
"Missing required key parent_user_id"};
|
||||
return boost::system::error_code{129, error_missing_field_parentUserID};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto parentUserID = boost::json::try_value_to<std::string>(*jvparentUserID);
|
||||
@@ -489,11 +430,7 @@ boost::json::result_for<Reply, boost::json::value>::type tag_invoke(
|
||||
const auto *jvparentUserLogin = root.if_contains("parent_user_login");
|
||||
if (jvparentUserLogin == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_parentUserLogin{
|
||||
"Missing required key parent_user_login"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_parentUserLogin};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto parentUserLogin =
|
||||
@@ -507,11 +444,7 @@ boost::json::result_for<Reply, boost::json::value>::type tag_invoke(
|
||||
const auto *jvparentUserName = root.if_contains("parent_user_name");
|
||||
if (jvparentUserName == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_parentUserName{
|
||||
"Missing required key parent_user_name"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_parentUserName};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto parentUserName =
|
||||
@@ -525,11 +458,7 @@ boost::json::result_for<Reply, boost::json::value>::type tag_invoke(
|
||||
const auto *jvparentMessageBody = root.if_contains("parent_message_body");
|
||||
if (jvparentMessageBody == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_parentMessageBody{
|
||||
"Missing required key parent_message_body"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_parentMessageBody};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto parentMessageBody =
|
||||
@@ -543,11 +472,7 @@ boost::json::result_for<Reply, boost::json::value>::type tag_invoke(
|
||||
const auto *jvthreadMessageID = root.if_contains("thread_message_id");
|
||||
if (jvthreadMessageID == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_threadMessageID{
|
||||
"Missing required key thread_message_id"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_threadMessageID};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto threadMessageID =
|
||||
@@ -561,10 +486,7 @@ boost::json::result_for<Reply, boost::json::value>::type tag_invoke(
|
||||
const auto *jvthreadUserID = root.if_contains("thread_user_id");
|
||||
if (jvthreadUserID == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_threadUserID{
|
||||
"Missing required key thread_user_id"};
|
||||
return boost::system::error_code{129, error_missing_field_threadUserID};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto threadUserID = boost::json::try_value_to<std::string>(*jvthreadUserID);
|
||||
@@ -577,11 +499,7 @@ boost::json::result_for<Reply, boost::json::value>::type tag_invoke(
|
||||
const auto *jvthreadUserLogin = root.if_contains("thread_user_login");
|
||||
if (jvthreadUserLogin == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_threadUserLogin{
|
||||
"Missing required key thread_user_login"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_threadUserLogin};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto threadUserLogin =
|
||||
@@ -595,11 +513,7 @@ boost::json::result_for<Reply, boost::json::value>::type tag_invoke(
|
||||
const auto *jvthreadUserName = root.if_contains("thread_user_name");
|
||||
if (jvthreadUserName == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_threadUserName{
|
||||
"Missing required key thread_user_name"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_threadUserName};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto threadUserName =
|
||||
@@ -628,20 +542,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 =
|
||||
@@ -656,11 +564,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 =
|
||||
@@ -675,11 +579,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 =
|
||||
@@ -693,11 +593,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 =
|
||||
@@ -711,11 +607,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 =
|
||||
@@ -729,11 +621,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 =
|
||||
@@ -747,9 +635,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);
|
||||
@@ -762,9 +648,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);
|
||||
@@ -776,9 +660,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);
|
||||
@@ -791,10 +673,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
const auto *jvmessageType = root.if_contains("message_type");
|
||||
if (jvmessageType == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_messageType{
|
||||
"Missing required key message_type"};
|
||||
return boost::system::error_code{129, error_missing_field_messageType};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto messageType = boost::json::try_value_to<std::string>(*jvmessageType);
|
||||
@@ -807,9 +686,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);
|
||||
@@ -886,19 +763,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 =
|
||||
@@ -912,9 +784,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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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-moderate-v2.hpp"
|
||||
|
||||
#include <boost/json.hpp>
|
||||
@@ -12,9 +12,7 @@ boost::json::result_for<Action, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_string())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeString{
|
||||
"Action must be a string"};
|
||||
return boost::system::error_code{129, errorMustBeString};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedString);
|
||||
}
|
||||
std::string_view eString(jvRoot.get_string());
|
||||
|
||||
@@ -156,9 +154,7 @@ boost::json::result_for<Action, boost::json::value>::type tag_invoke(
|
||||
return Action::SharedChatDelete;
|
||||
}
|
||||
|
||||
static const error::ApplicationErrorCategory errorEnumNameDidNotExist{
|
||||
"Action did not have a constant that matched this string"};
|
||||
return boost::system::error_code{129, errorEnumNameDidNotExist};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::UnknownEnumValue);
|
||||
}
|
||||
|
||||
boost::json::result_for<Followers, boost::json::value>::type tag_invoke(
|
||||
@@ -166,9 +162,7 @@ boost::json::result_for<Followers, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Followers must be an object"};
|
||||
return boost::system::error_code{129, errorMustBeObject};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
}
|
||||
const auto &root = jvRoot.get_object();
|
||||
|
||||
@@ -176,11 +170,7 @@ boost::json::result_for<Followers, boost::json::value>::type tag_invoke(
|
||||
root.if_contains("follow_duration_minutes");
|
||||
if (jvfollowDurationMinutes == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_followDurationMinutes{
|
||||
"Missing required key follow_duration_minutes"};
|
||||
return boost::system::error_code{
|
||||
129, error_missing_field_followDurationMinutes};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto followDurationMinutes =
|
||||
@@ -201,20 +191,14 @@ boost::json::result_for<Slow, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Slow 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 *jvwaitTimeSeconds = root.if_contains("wait_time_seconds");
|
||||
if (jvwaitTimeSeconds == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_waitTimeSeconds{
|
||||
"Missing required key wait_time_seconds"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_waitTimeSeconds};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto waitTimeSeconds = boost::json::try_value_to<int>(*jvwaitTimeSeconds);
|
||||
@@ -234,18 +218,14 @@ boost::json::result_for<Vip, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Vip 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<String>(*jvuserID);
|
||||
@@ -258,9 +238,7 @@ boost::json::result_for<Vip, 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<String>(*jvuserLogin);
|
||||
@@ -273,9 +251,7 @@ boost::json::result_for<Vip, 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<String>(*jvuserName);
|
||||
@@ -297,18 +273,14 @@ boost::json::result_for<Unvip, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Unvip 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<String>(*jvuserID);
|
||||
@@ -321,9 +293,7 @@ boost::json::result_for<Unvip, 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<String>(*jvuserLogin);
|
||||
@@ -336,9 +306,7 @@ boost::json::result_for<Unvip, 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<String>(*jvuserName);
|
||||
@@ -360,18 +328,14 @@ boost::json::result_for<Mod, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Mod 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);
|
||||
@@ -384,9 +348,7 @@ boost::json::result_for<Mod, 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);
|
||||
@@ -399,9 +361,7 @@ boost::json::result_for<Mod, 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);
|
||||
@@ -423,18 +383,14 @@ boost::json::result_for<Unmod, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Unmod 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);
|
||||
@@ -447,9 +403,7 @@ boost::json::result_for<Unmod, 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);
|
||||
@@ -462,9 +416,7 @@ boost::json::result_for<Unmod, 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);
|
||||
@@ -486,18 +438,14 @@ boost::json::result_for<Ban, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Ban 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);
|
||||
@@ -510,9 +458,7 @@ boost::json::result_for<Ban, 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);
|
||||
@@ -525,9 +471,7 @@ boost::json::result_for<Ban, 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);
|
||||
@@ -540,9 +484,7 @@ boost::json::result_for<Ban, boost::json::value>::type tag_invoke(
|
||||
const auto *jvreason = root.if_contains("reason");
|
||||
if (jvreason == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_reason{
|
||||
"Missing required key reason"};
|
||||
return boost::system::error_code{129, error_missing_field_reason};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto reason = boost::json::try_value_to<std::string>(*jvreason);
|
||||
@@ -565,18 +507,14 @@ boost::json::result_for<Unban, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Unban 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);
|
||||
@@ -589,9 +527,7 @@ boost::json::result_for<Unban, 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);
|
||||
@@ -604,9 +540,7 @@ boost::json::result_for<Unban, 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);
|
||||
@@ -628,18 +562,14 @@ boost::json::result_for<Timeout, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Timeout 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);
|
||||
@@ -652,9 +582,7 @@ boost::json::result_for<Timeout, 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);
|
||||
@@ -667,9 +595,7 @@ boost::json::result_for<Timeout, 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);
|
||||
@@ -682,9 +608,7 @@ boost::json::result_for<Timeout, boost::json::value>::type tag_invoke(
|
||||
const auto *jvreason = root.if_contains("reason");
|
||||
if (jvreason == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_reason{
|
||||
"Missing required key reason"};
|
||||
return boost::system::error_code{129, error_missing_field_reason};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto reason = boost::json::try_value_to<std::string>(*jvreason);
|
||||
@@ -697,9 +621,7 @@ boost::json::result_for<Timeout, boost::json::value>::type tag_invoke(
|
||||
const auto *jvexpiresAt = root.if_contains("expires_at");
|
||||
if (jvexpiresAt == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_expiresAt{"Missing required key expires_at"};
|
||||
return boost::system::error_code{129, error_missing_field_expiresAt};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto expiresAt = boost::json::try_value_to<std::string>(*jvexpiresAt);
|
||||
@@ -723,18 +645,14 @@ boost::json::result_for<Untimeout, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Untimeout 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);
|
||||
@@ -747,9 +665,7 @@ boost::json::result_for<Untimeout, 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);
|
||||
@@ -762,9 +678,7 @@ boost::json::result_for<Untimeout, 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);
|
||||
@@ -786,18 +700,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);
|
||||
@@ -810,9 +720,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);
|
||||
@@ -825,9 +733,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);
|
||||
@@ -840,10 +746,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);
|
||||
@@ -866,18 +769,14 @@ 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();
|
||||
|
||||
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);
|
||||
@@ -890,9 +789,7 @@ boost::json::result_for<Unraid, 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);
|
||||
@@ -905,9 +802,7 @@ boost::json::result_for<Unraid, 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);
|
||||
@@ -929,18 +824,14 @@ boost::json::result_for<Delete, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Delete 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);
|
||||
@@ -953,9 +844,7 @@ boost::json::result_for<Delete, 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);
|
||||
@@ -968,9 +857,7 @@ boost::json::result_for<Delete, 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);
|
||||
@@ -983,9 +870,7 @@ boost::json::result_for<Delete, 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);
|
||||
@@ -998,10 +883,7 @@ boost::json::result_for<Delete, boost::json::value>::type tag_invoke(
|
||||
const auto *jvmessageBody = root.if_contains("message_body");
|
||||
if (jvmessageBody == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_messageBody{
|
||||
"Missing required key message_body"};
|
||||
return boost::system::error_code{129, error_missing_field_messageBody};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto messageBody = boost::json::try_value_to<std::string>(*jvmessageBody);
|
||||
@@ -1026,18 +908,14 @@ boost::json::result_for<AutomodTerms, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"AutomodTerms 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 *jvaction = root.if_contains("action");
|
||||
if (jvaction == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_action{
|
||||
"Missing required key action"};
|
||||
return boost::system::error_code{129, error_missing_field_action};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto action = boost::json::try_value_to<std::string>(*jvaction);
|
||||
@@ -1050,9 +928,7 @@ boost::json::result_for<AutomodTerms, boost::json::value>::type tag_invoke(
|
||||
const auto *jvlist = root.if_contains("list");
|
||||
if (jvlist == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_list{
|
||||
"Missing required key list"};
|
||||
return boost::system::error_code{129, error_missing_field_list};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto list = boost::json::try_value_to<std::string>(*jvlist);
|
||||
@@ -1065,9 +941,7 @@ boost::json::result_for<AutomodTerms, boost::json::value>::type tag_invoke(
|
||||
const auto *jvterms = root.if_contains("terms");
|
||||
if (jvterms == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_terms{
|
||||
"Missing required key terms"};
|
||||
return boost::system::error_code{129, error_missing_field_terms};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
const auto terms =
|
||||
boost::json::try_value_to<std::vector<std::string>>(*jvterms);
|
||||
@@ -1079,10 +953,7 @@ boost::json::result_for<AutomodTerms, boost::json::value>::type tag_invoke(
|
||||
const auto *jvfromAutomod = root.if_contains("from_automod");
|
||||
if (jvfromAutomod == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_fromAutomod{
|
||||
"Missing required key from_automod"};
|
||||
return boost::system::error_code{129, error_missing_field_fromAutomod};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto fromAutomod = boost::json::try_value_to<bool>(*jvfromAutomod);
|
||||
@@ -1106,18 +977,14 @@ boost::json::result_for<UnbanRequest, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"UnbanRequest 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 *jvisApproved = root.if_contains("is_approved");
|
||||
if (jvisApproved == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_isApproved{"Missing required key is_approved"};
|
||||
return boost::system::error_code{129, error_missing_field_isApproved};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto isApproved = boost::json::try_value_to<bool>(*jvisApproved);
|
||||
@@ -1130,9 +997,7 @@ boost::json::result_for<UnbanRequest, boost::json::value>::type tag_invoke(
|
||||
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);
|
||||
@@ -1145,9 +1010,7 @@ boost::json::result_for<UnbanRequest, 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);
|
||||
@@ -1160,9 +1023,7 @@ boost::json::result_for<UnbanRequest, 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);
|
||||
@@ -1175,11 +1036,7 @@ boost::json::result_for<UnbanRequest, boost::json::value>::type tag_invoke(
|
||||
const auto *jvmoderatorMessage = root.if_contains("moderator_message");
|
||||
if (jvmoderatorMessage == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_moderatorMessage{
|
||||
"Missing required key moderator_message"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_moderatorMessage};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto moderatorMessage =
|
||||
@@ -1204,18 +1061,14 @@ boost::json::result_for<Warn, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Warn 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);
|
||||
@@ -1228,9 +1081,7 @@ boost::json::result_for<Warn, 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);
|
||||
@@ -1243,9 +1094,7 @@ boost::json::result_for<Warn, 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);
|
||||
@@ -1258,9 +1107,7 @@ boost::json::result_for<Warn, boost::json::value>::type tag_invoke(
|
||||
const auto *jvreason = root.if_contains("reason");
|
||||
if (jvreason == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_reason{
|
||||
"Missing required key reason"};
|
||||
return boost::system::error_code{129, error_missing_field_reason};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto reason = boost::json::try_value_to<std::string>(*jvreason);
|
||||
@@ -1273,11 +1120,7 @@ boost::json::result_for<Warn, boost::json::value>::type tag_invoke(
|
||||
const auto *jvchatRulesCited = root.if_contains("chat_rules_cited");
|
||||
if (jvchatRulesCited == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_chatRulesCited{
|
||||
"Missing required key chat_rules_cited"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_chatRulesCited};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
const auto chatRulesCited =
|
||||
boost::json::try_value_to<std::vector<std::string>>(*jvchatRulesCited);
|
||||
@@ -1300,20 +1143,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 =
|
||||
@@ -1328,11 +1165,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 =
|
||||
@@ -1347,11 +1180,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 =
|
||||
@@ -1417,11 +1246,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
const auto *jvmoderatorUserID = root.if_contains("moderator_user_id");
|
||||
if (jvmoderatorUserID == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_moderatorUserID{
|
||||
"Missing required key moderator_user_id"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_moderatorUserID};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto moderatorUserID =
|
||||
@@ -1435,11 +1260,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
const auto *jvmoderatorUserLogin = root.if_contains("moderator_user_login");
|
||||
if (jvmoderatorUserLogin == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_moderatorUserLogin{
|
||||
"Missing required key moderator_user_login"};
|
||||
return boost::system::error_code{
|
||||
129, error_missing_field_moderatorUserLogin};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto moderatorUserLogin =
|
||||
@@ -1453,11 +1274,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
const auto *jvmoderatorUserName = root.if_contains("moderator_user_name");
|
||||
if (jvmoderatorUserName == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_moderatorUserName{
|
||||
"Missing required key moderator_user_name"};
|
||||
return boost::system::error_code{129,
|
||||
error_missing_field_moderatorUserName};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto moderatorUserName =
|
||||
@@ -1471,9 +1288,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
const auto *jvaction = root.if_contains("action");
|
||||
if (jvaction == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_action{
|
||||
"Missing required key action"};
|
||||
return boost::system::error_code{129, error_missing_field_action};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto action = boost::json::try_value_to<Action>(*jvaction);
|
||||
@@ -1790,19 +1605,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 =
|
||||
@@ -1816,9 +1626,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);
|
||||
|
||||
@@ -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-update-v1.hpp"
|
||||
|
||||
#include <boost/json.hpp>
|
||||
@@ -12,20 +12,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 =
|
||||
@@ -40,11 +34,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 =
|
||||
@@ -59,11 +49,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 =
|
||||
@@ -77,9 +63,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
const auto *jvtitle = root.if_contains("title");
|
||||
if (jvtitle == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_title{
|
||||
"Missing required key title"};
|
||||
return boost::system::error_code{129, error_missing_field_title};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto title = boost::json::try_value_to<std::string>(*jvtitle);
|
||||
@@ -92,9 +76,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
const auto *jvlanguage = root.if_contains("language");
|
||||
if (jvlanguage == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_language{"Missing required key language"};
|
||||
return boost::system::error_code{129, error_missing_field_language};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto language = boost::json::try_value_to<std::string>(*jvlanguage);
|
||||
@@ -107,9 +89,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
const auto *jvcategoryID = root.if_contains("category_id");
|
||||
if (jvcategoryID == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_categoryID{"Missing required key category_id"};
|
||||
return boost::system::error_code{129, error_missing_field_categoryID};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto categoryID = boost::json::try_value_to<std::string>(*jvcategoryID);
|
||||
@@ -122,10 +102,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
const auto *jvcategoryName = root.if_contains("category_name");
|
||||
if (jvcategoryName == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_categoryName{
|
||||
"Missing required key category_name"};
|
||||
return boost::system::error_code{129, error_missing_field_categoryName};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto categoryName = boost::json::try_value_to<std::string>(*jvcategoryName);
|
||||
@@ -138,9 +115,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
const auto *jvisMature = root.if_contains("is_mature");
|
||||
if (jvisMature == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_isMature{"Missing required key is_mature"};
|
||||
return boost::system::error_code{129, error_missing_field_isMature};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto isMature = boost::json::try_value_to<bool>(*jvisMature);
|
||||
@@ -167,19 +142,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 =
|
||||
@@ -193,9 +163,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);
|
||||
|
||||
@@ -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/session-welcome.hpp"
|
||||
|
||||
#include <boost/json.hpp>
|
||||
@@ -12,33 +12,25 @@ 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 &outerRoot = jvRoot.get_object();
|
||||
|
||||
const auto *jvInnerRoot = outerRoot.if_contains("session");
|
||||
if (jvInnerRoot == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMissing{
|
||||
"Payload's key session is missing"};
|
||||
return boost::system::error_code{129, errorMissing};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::InnerRootMissing);
|
||||
}
|
||||
if (!jvInnerRoot->is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Payload's session must be an object"};
|
||||
return boost::system::error_code{129, errorMustBeObject};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
}
|
||||
const auto &root = jvInnerRoot->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);
|
||||
|
||||
@@ -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/stream-offline-v1.hpp"
|
||||
|
||||
#include <boost/json.hpp>
|
||||
@@ -12,20 +12,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 =
|
||||
@@ -40,11 +34,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 =
|
||||
@@ -59,11 +49,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 =
|
||||
@@ -86,19 +72,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 =
|
||||
@@ -112,9 +93,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);
|
||||
|
||||
@@ -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/stream-online-v1.hpp"
|
||||
|
||||
#include <boost/json.hpp>
|
||||
@@ -12,18 +12,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 *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);
|
||||
@@ -36,11 +32,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
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 =
|
||||
@@ -55,11 +47,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 =
|
||||
@@ -74,11 +62,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 =
|
||||
@@ -92,9 +76,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
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);
|
||||
@@ -107,9 +89,7 @@ boost::json::result_for<Event, boost::json::value>::type tag_invoke(
|
||||
const auto *jvstartedAt = root.if_contains("started_at");
|
||||
if (jvstartedAt == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_startedAt{"Missing required key started_at"};
|
||||
return boost::system::error_code{129, error_missing_field_startedAt};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto startedAt = boost::json::try_value_to<std::string>(*jvstartedAt);
|
||||
@@ -134,19 +114,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 =
|
||||
@@ -160,9 +135,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);
|
||||
|
||||
@@ -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/subscription.hpp"
|
||||
|
||||
#include <boost/json.hpp>
|
||||
@@ -12,18 +12,14 @@ boost::json::result_for<Transport, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Transport 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 *jvmethod = root.if_contains("method");
|
||||
if (jvmethod == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_method{
|
||||
"Missing required key method"};
|
||||
return boost::system::error_code{129, error_missing_field_method};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto method = boost::json::try_value_to<std::string>(*jvmethod);
|
||||
@@ -36,9 +32,7 @@ boost::json::result_for<Transport, boost::json::value>::type tag_invoke(
|
||||
const auto *jvsessionID = root.if_contains("session_id");
|
||||
if (jvsessionID == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_sessionID{"Missing required key session_id"};
|
||||
return boost::system::error_code{129, error_missing_field_sessionID};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto sessionID = boost::json::try_value_to<std::string>(*jvsessionID);
|
||||
@@ -60,18 +54,14 @@ boost::json::result_for<Subscription, boost::json::value>::type tag_invoke(
|
||||
{
|
||||
if (!jvRoot.is_object())
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorMustBeObject{
|
||||
"Subscription 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);
|
||||
@@ -84,9 +74,7 @@ boost::json::result_for<Subscription, boost::json::value>::type tag_invoke(
|
||||
const auto *jvstatus = root.if_contains("status");
|
||||
if (jvstatus == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_status{
|
||||
"Missing required key status"};
|
||||
return boost::system::error_code{129, error_missing_field_status};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto status = boost::json::try_value_to<std::string>(*jvstatus);
|
||||
@@ -99,9 +87,7 @@ boost::json::result_for<Subscription, boost::json::value>::type tag_invoke(
|
||||
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);
|
||||
@@ -114,9 +100,7 @@ boost::json::result_for<Subscription, boost::json::value>::type tag_invoke(
|
||||
const auto *jvversion = root.if_contains("version");
|
||||
if (jvversion == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_version{"Missing required key version"};
|
||||
return boost::system::error_code{129, error_missing_field_version};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto version = boost::json::try_value_to<std::string>(*jvversion);
|
||||
@@ -129,9 +113,7 @@ boost::json::result_for<Subscription, boost::json::value>::type tag_invoke(
|
||||
const auto *jvtransport = root.if_contains("transport");
|
||||
if (jvtransport == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_transport{"Missing required key transport"};
|
||||
return boost::system::error_code{129, error_missing_field_transport};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto transport = boost::json::try_value_to<Transport>(*jvtransport);
|
||||
@@ -144,9 +126,7 @@ boost::json::result_for<Subscription, boost::json::value>::type tag_invoke(
|
||||
const auto *jvcreatedAt = root.if_contains("created_at");
|
||||
if (jvcreatedAt == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
error_missing_field_createdAt{"Missing required key created_at"};
|
||||
return boost::system::error_code{129, error_missing_field_createdAt};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto createdAt = boost::json::try_value_to<std::string>(*jvcreatedAt);
|
||||
@@ -159,9 +139,7 @@ boost::json::result_for<Subscription, boost::json::value>::type tag_invoke(
|
||||
const auto *jvcost = root.if_contains("cost");
|
||||
if (jvcost == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory error_missing_field_cost{
|
||||
"Missing required key cost"};
|
||||
return boost::system::error_code{129, error_missing_field_cost};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
auto cost = boost::json::try_value_to<int>(*jvcost);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "twitch-eventsub-ws/session.hpp"
|
||||
|
||||
#include "twitch-eventsub-ws/errors.hpp"
|
||||
#include "twitch-eventsub-ws/detail/errors.hpp"
|
||||
#include "twitch-eventsub-ws/listener.hpp"
|
||||
#include "twitch-eventsub-ws/messages/metadata.hpp"
|
||||
#include "twitch-eventsub-ws/payloads/channel-ban-v1.hpp"
|
||||
@@ -46,7 +46,8 @@ namespace {
|
||||
// Report a failure
|
||||
void fail(beast::error_code ec, char const *what)
|
||||
{
|
||||
std::cerr << what << ": " << ec.message() << "\n";
|
||||
std::cerr << what << ": " << ec.message() << " (" << ec.location()
|
||||
<< ")\n";
|
||||
}
|
||||
|
||||
template <class T>
|
||||
@@ -219,18 +220,13 @@ boost::system::error_code handleMessage(std::unique_ptr<Listener> &listener,
|
||||
const auto *jvObject = jv.if_object();
|
||||
if (jvObject == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory errorRootMustBeObject{
|
||||
"Payload root must be an object"};
|
||||
return boost::system::error_code{129, errorRootMustBeObject};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject);
|
||||
}
|
||||
|
||||
const auto *metadataV = jvObject->if_contains("metadata");
|
||||
if (metadataV == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
errorRootMustContainMetadata{
|
||||
"Payload root must contain a metadata field"};
|
||||
return boost::system::error_code{129, errorRootMustContainMetadata};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
auto metadataResult =
|
||||
boost::json::try_value_to<messages::Metadata>(*metadataV);
|
||||
@@ -246,22 +242,13 @@ boost::system::error_code handleMessage(std::unique_ptr<Listener> &listener,
|
||||
|
||||
if (handler == MESSAGE_HANDLERS.end())
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "No message handler found for message type: ";
|
||||
ss << metadata.messageType;
|
||||
error::ApplicationErrorCategory errorNoMessageHandlerForMessageType{
|
||||
ss.str()};
|
||||
return boost::system::error_code{129,
|
||||
errorNoMessageHandlerForMessageType};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::NoMessageHandler);
|
||||
}
|
||||
|
||||
const auto *payloadV = jvObject->if_contains("payload");
|
||||
if (payloadV == nullptr)
|
||||
{
|
||||
static const error::ApplicationErrorCategory
|
||||
errorRootMustContainPayload{
|
||||
"Payload root must contain a payload field"};
|
||||
return boost::system::error_code{129, errorRootMustContainPayload};
|
||||
EVENTSUB_BAIL_HERE(error::Kind::FieldMissing);
|
||||
}
|
||||
|
||||
handler->second(metadata, *payloadV, listener, NOTIFICATION_HANDLERS);
|
||||
|
||||
Reference in New Issue
Block a user