// WARNING: This file is automatically generated. Any changes will be lost. #include "twitch-eventsub-ws/chrono.hpp" // IWYU pragma: keep #include "twitch-eventsub-ws/detail/errors.hpp" #include "twitch-eventsub-ws/detail/variant.hpp" // IWYU pragma: keep #include "twitch-eventsub-ws/payloads/session-welcome.hpp" #include namespace chatterino::eventsub::lib::payload::session_welcome { boost::json::result_for::type tag_invoke( boost::json::try_value_to_tag /* tag */, const boost::json::value &jvRoot) { if (!jvRoot.is_object()) { EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject); } const auto &outerRoot = jvRoot.get_object(); const auto *jvInnerRoot = outerRoot.if_contains("session"); if (jvInnerRoot == nullptr) { EVENTSUB_BAIL_HERE(error::Kind::InnerRootMissing); } if (!jvInnerRoot->is_object()) { EVENTSUB_BAIL_HERE(error::Kind::ExpectedObject); } const auto &root = jvInnerRoot->get_object(); const auto *jvid = root.if_contains("id"); if (jvid == nullptr) { EVENTSUB_BAIL_HERE(error::Kind::FieldMissing); } auto id = boost::json::try_value_to(*jvid); if (id.has_error()) { return id.error(); } return Payload{ .id = std::move(id.value()), }; } } // namespace chatterino::eventsub::lib::payload::session_welcome