Skip to content

Commit 81197ab

Browse files
committedDec 27, 2023
DiscordCoreAPI Release v2.0.5
* Updated the moveThroughMessagePages function to fix an issue with iterating over pages. * Updated a few of the functions to accommodate for the changes made to the depended-upon library Jsonifier.
1 parent 5bab805 commit 81197ab

14 files changed

+131
-102
lines changed
 

‎Include/discordcoreapi/CoRoutine.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ namespace discord_core_api {
5050

5151
/// @brief An error type for co_routines.
5252
struct co_routine_error : public dca_exception {
53-
inline co_routine_error(jsonifier::string_view message, std::source_location location = std::source_location::current()) : dca_exception{ message, location } {};
53+
inline co_routine_error(const jsonifier::string_view& message, std::source_location location = std::source_location::current()) : dca_exception{ message, location } {};
5454
};
5555

5656
template<typename value_type> class result_holder {

‎Include/discordcoreapi/JsonSpecializations.hpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,21 @@ namespace discord_core_api {
6565
namespace jsonifier_internal {
6666

6767
template<typename value_type>
68-
concept snowflake_t = std::same_as<discord_core_api::snowflake, jsonifier::concepts::unwrap<value_type>>;
68+
concept snowflake_t = std::same_as<discord_core_api::snowflake, jsonifier::concepts::unwrap_t<value_type>>;
6969

7070
template<snowflake_t value_type_new> struct serialize_impl<value_type_new> {
7171
template<snowflake_t value_type, jsonifier::concepts::buffer_like iterator_type>
72-
inline static void op(value_type&& value, iterator_type&& iter, uint64_t& index) {
72+
inline static void impl(value_type&& value, iterator_type&& iter, uint64_t& index) {
7373
jsonifier::string newString{ static_cast<jsonifier::string>(value) };
74-
serialize::op(newString, iter, index);
74+
serialize::impl(newString, iter, index);
7575
}
7676
};
7777

7878
template<snowflake_t value_type_new> struct parse_impl<value_type_new> {
79-
template<snowflake_t value_type, jsonifier::concepts::is_fwd_iterator iterator> inline static void op(value_type&& value, iterator&& iter) {
79+
template<snowflake_t value_type, jsonifier::concepts::is_fwd_iterator iterator> inline static void impl(value_type&& value, iterator&& iter) {
8080
jsonifier::raw_json_data newString{};
81-
parse::op(newString, iter);
82-
if (newString.getType() == jsonifier_internal::json_type::String) {
81+
parse::impl(newString, iter);
82+
if (newString.getType() == jsonifier::json_type::String) {
8383
value = newString.operator jsonifier::string();
8484
} else {
8585
value = newString.operator uint64_t();
@@ -88,20 +88,20 @@ namespace jsonifier_internal {
8888
};
8989

9090
template<typename value_type>
91-
concept time_stamp_t = std::same_as<discord_core_api::time_stamp, jsonifier::concepts::unwrap<value_type>>;
91+
concept time_stamp_t = std::same_as<discord_core_api::time_stamp, jsonifier::concepts::unwrap_t<value_type>>;
9292

9393
template<time_stamp_t value_type_new> struct serialize_impl<value_type_new> {
9494
template<time_stamp_t value_type, jsonifier::concepts::buffer_like iterator_type>
95-
inline static void op(value_type&& value, iterator_type&& iter, uint64_t& index) {
95+
inline static void impl(value_type&& value, iterator_type&& iter, uint64_t& index) {
9696
jsonifier::string newString{ static_cast<jsonifier::string>(value) };
97-
serialize::op(newString, iter, index);
97+
serialize::impl(newString, iter, index);
9898
}
9999
};
100100

101101
template<time_stamp_t value_type_new> struct parse_impl<value_type_new> {
102-
template<time_stamp_t value_type, jsonifier::concepts::is_fwd_iterator iterator> inline static void op(value_type&& value, iterator&& iter) {
102+
template<time_stamp_t value_type, jsonifier::concepts::is_fwd_iterator iterator> inline static void impl(value_type&& value, iterator&& iter) {
103103
jsonifier::string newString{};
104-
parse::op(newString, iter);
104+
parse::impl(newString, iter);
105105
value = static_cast<jsonifier::string>(newString);
106106
};
107107
};
@@ -622,7 +622,7 @@ namespace jsonifier {
622622

623623
template<> struct core<discord_core_api::file> {
624624
using value_type = discord_core_api::file;
625-
static constexpr auto parseValue = createScalarValue(&value_type::data);
625+
static constexpr auto parseValue = createValue(&value_type::data);
626626
};
627627

628628
template<> struct core<discord_core_api::allowed_mentions_data> {

‎Include/discordcoreapi/Utilities/Etf.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ namespace discord_core_api {
100100
/// @brief Constructs an etf_parse_error instance with a message and source location.
101101
/// @param message the error message.
102102
/// @param location the source location where the error occurred.
103-
inline explicit etf_parse_error(jsonifier::string_view message, std::source_location location = std::source_location::current())
103+
inline explicit etf_parse_error(const jsonifier::string_view& message, std::source_location location = std::source_location::current())
104104
: dca_exception{ message, location } {};
105105
};
106106

@@ -446,7 +446,7 @@ namespace discord_core_api {
446446
/// @brief Constructor for etf_serialize_error.
447447
/// @param message the error message.
448448
/// @param location source location where the error occurred.
449-
inline etf_serialize_error(jsonifier::string_view message, std::source_location location = std::source_location::current()) : dca_exception{ message, location } {};
449+
inline etf_serialize_error(const jsonifier::string_view& message, std::source_location location = std::source_location::current()) : dca_exception{ message, location } {};
450450
};
451451

452452
/// @brief Enumeration for different json value types.

‎Include/discordcoreapi/Utilities/HttpsClient.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ namespace discord_core_api {
9999
class https_error : public dca_exception {
100100
public:
101101
https_response_code errorCode{};
102-
inline https_error(jsonifier::string_view message, std::source_location location = std::source_location::current()) : dca_exception{ message, location } {};
102+
inline https_error(const jsonifier::string_view& message, std::source_location location = std::source_location::current()) : dca_exception{ message, location } {};
103103
};
104104

105105
struct DiscordCoreAPI_Dll https_response_data {
@@ -252,7 +252,7 @@ namespace discord_core_api {
252252
https_client(jsonifier::string_view botTokenNew);
253253

254254
template<typename value_type, typename string_type> void getParseErrors(jsonifier::jsonifier_core<false>& parser, value_type& value, string_type& stringNew) {
255-
parser.parseJson(value, stringNew);
255+
parser.parseJson<true>(value, parser.minify(parser.prettify(stringNew)));
256256
if (auto result = parser.getErrors(); result.size() > 0) {
257257
for (auto& valueNew: result) {
258258
message_printer::printError<print_message_type::websocket>(valueNew.reportError());

‎Source/ChannelEntities.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ namespace jsonifier {
6363

6464
template<> struct core<discord_core_api::modify_guild_channel_positions_data> {
6565
using value_type = discord_core_api::modify_guild_channel_positions_data;
66-
static constexpr auto parseValue = createScalarValue(&value_type::modifyChannelData);
66+
static constexpr auto parseValue = createValue(&value_type::modifyChannelData);
6767
};
6868

6969
template<> struct core<discord_core_api::modify_channel_data> {

0 commit comments

Comments
 (0)
Please sign in to comment.