mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 20:50:06 +00:00
Add GitHub types for Release API
This commit is contained in:
parent
abd8602a16
commit
6412c77a9d
3 changed files with 78 additions and 1 deletions
|
|
@ -126,10 +126,12 @@ set(SRC_SETTINGS source/scwx/qt/settings/general_settings.cpp
|
||||||
source/scwx/qt/settings/settings_variable.cpp
|
source/scwx/qt/settings/settings_variable.cpp
|
||||||
source/scwx/qt/settings/settings_variable_base.cpp)
|
source/scwx/qt/settings/settings_variable_base.cpp)
|
||||||
set(HDR_TYPES source/scwx/qt/types/font_types.hpp
|
set(HDR_TYPES source/scwx/qt/types/font_types.hpp
|
||||||
|
source/scwx/qt/types/github_types.hpp
|
||||||
source/scwx/qt/types/qt_types.hpp
|
source/scwx/qt/types/qt_types.hpp
|
||||||
source/scwx/qt/types/radar_product_record.hpp
|
source/scwx/qt/types/radar_product_record.hpp
|
||||||
source/scwx/qt/types/text_event_key.hpp)
|
source/scwx/qt/types/text_event_key.hpp)
|
||||||
set(SRC_TYPES source/scwx/qt/types/radar_product_record.cpp
|
set(SRC_TYPES source/scwx/qt/types/github_types.cpp
|
||||||
|
source/scwx/qt/types/radar_product_record.cpp
|
||||||
source/scwx/qt/types/text_event_key.cpp)
|
source/scwx/qt/types/text_event_key.cpp)
|
||||||
set(HDR_UI source/scwx/qt/ui/about_dialog.hpp
|
set(HDR_UI source/scwx/qt/ui/about_dialog.hpp
|
||||||
source/scwx/qt/ui/alert_dialog.hpp
|
source/scwx/qt/ui/alert_dialog.hpp
|
||||||
|
|
|
||||||
39
scwx-qt/source/scwx/qt/types/github_types.cpp
Normal file
39
scwx-qt/source/scwx/qt/types/github_types.cpp
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
#include <scwx/qt/types/github_types.hpp>
|
||||||
|
|
||||||
|
#include <boost/json/value_to.hpp>
|
||||||
|
|
||||||
|
namespace scwx
|
||||||
|
{
|
||||||
|
namespace qt
|
||||||
|
{
|
||||||
|
namespace types
|
||||||
|
{
|
||||||
|
namespace gh
|
||||||
|
{
|
||||||
|
|
||||||
|
Release tag_invoke(boost::json::value_to_tag<Release>,
|
||||||
|
const boost::json::value& jv)
|
||||||
|
{
|
||||||
|
auto jo = jv.as_object();
|
||||||
|
|
||||||
|
Release release {};
|
||||||
|
|
||||||
|
// Required parameters
|
||||||
|
release.name_ = jo.at("name").as_string();
|
||||||
|
release.htmlUrl_ = jo.at("html_url").as_string();
|
||||||
|
release.draft_ = jo.at("draft").as_bool();
|
||||||
|
release.prerelease_ = jo.at("prerelease").as_bool();
|
||||||
|
|
||||||
|
// Optional parameters
|
||||||
|
if (jo.contains("body"))
|
||||||
|
{
|
||||||
|
release.body_ = jo.at("body").as_string();
|
||||||
|
}
|
||||||
|
|
||||||
|
return release;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace gh
|
||||||
|
} // namespace types
|
||||||
|
} // namespace qt
|
||||||
|
} // namespace scwx
|
||||||
36
scwx-qt/source/scwx/qt/types/github_types.hpp
Normal file
36
scwx-qt/source/scwx/qt/types/github_types.hpp
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <boost/json/value.hpp>
|
||||||
|
|
||||||
|
namespace scwx
|
||||||
|
{
|
||||||
|
namespace qt
|
||||||
|
{
|
||||||
|
namespace types
|
||||||
|
{
|
||||||
|
namespace gh
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief GitHub Release object
|
||||||
|
*
|
||||||
|
* <https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28>
|
||||||
|
*/
|
||||||
|
struct Release
|
||||||
|
{
|
||||||
|
std::string name_ {};
|
||||||
|
std::string htmlUrl_ {};
|
||||||
|
std::string body_ {};
|
||||||
|
bool draft_ {};
|
||||||
|
bool prerelease_ {};
|
||||||
|
};
|
||||||
|
|
||||||
|
Release tag_invoke(boost::json::value_to_tag<Release>,
|
||||||
|
const boost::json::value& jv);
|
||||||
|
|
||||||
|
} // namespace gh
|
||||||
|
} // namespace types
|
||||||
|
} // namespace qt
|
||||||
|
} // namespace scwx
|
||||||
Loading…
Add table
Add a link
Reference in a new issue