From 3b1d996e3cd626a4987d8a0e6b87f26274213bd8 Mon Sep 17 00:00:00 2001 From: Carter Green Date: Fri, 13 Mar 2026 11:43:22 -0500 Subject: [PATCH 1/2] ADD: Add progress to BatchJob response --- CHANGELOG.md | 5 +++++ include/databento/batch.hpp | 3 +++ include/databento/detail/json_helpers.hpp | 3 +++ src/batch.cpp | 1 + src/detail/json_helpers.cpp | 16 ++++++++++++++++ src/historical.cpp | 1 + tests/src/batch_tests.cpp | 6 ++++-- 7 files changed, 33 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa1cd0e..7e8c919 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.51.0 - TBD + +### Enhancements +- Added support for `progress` field in `BatchJob` response + ## 0.50.0 - 2026-03-03 ### Enhancements diff --git a/include/databento/batch.hpp b/include/databento/batch.hpp index d505e3c..fe331af 100644 --- a/include/databento/batch.hpp +++ b/include/databento/batch.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include #include #include #include @@ -49,6 +50,8 @@ struct BatchJob { // Empty if it hasn't finished processing. The expiration is set based on when // the job finishes processing, not when it was requested. std::string ts_expiration; + // Progress percentage (0-100). `nullopt` for jobs that were just submitted. + std::optional progress; }; // Description of a batch file. diff --git a/include/databento/detail/json_helpers.hpp b/include/databento/detail/json_helpers.hpp index 1a088f8..88f14cf 100644 --- a/include/databento/detail/json_helpers.hpp +++ b/include/databento/detail/json_helpers.hpp @@ -93,5 +93,8 @@ std::vector ParseAt(std::string_view endpoint, const nlohmann::json template <> date::year_month_day ParseAt(std::string_view endpoint, const nlohmann::json& json, std::string_view key); +template <> +std::optional ParseAt(std::string_view endpoint, + const nlohmann::json& json, std::string_view key); } // namespace databento::detail diff --git a/src/batch.cpp b/src/batch.cpp index 5939c02..75c529b 100644 --- a/src/batch.cpp +++ b/src/batch.cpp @@ -47,6 +47,7 @@ std::ostream& operator<<(std::ostream& stream, const BatchJob& batch_job) { .AddField("ts_process_start", batch_job.ts_process_start) .AddField("ts_process_done", batch_job.ts_process_done) .AddField("ts_expiration", batch_job.ts_expiration) + .AddField("progress", batch_job.progress) .Finish(); } diff --git a/src/detail/json_helpers.cpp b/src/detail/json_helpers.cpp index dbe40db..0be80ea 100644 --- a/src/detail/json_helpers.cpp +++ b/src/detail/json_helpers.cpp @@ -138,4 +138,20 @@ date::year_month_day ParseAt(std::string_view endpoint, const nlohmann::json& js } return start; } +template <> +std::optional ParseAt(std::string_view endpoint, + const nlohmann::json& json, std::string_view key) { + if (!json.contains(key)) { + return {}; + } + const auto& val_json = json.at(key); + if (val_json.is_null()) { + return {}; + } + if (!val_json.is_number_unsigned()) { + throw JsonResponseError::TypeMismatch( + endpoint, std::string{key} + " unsigned number", val_json); + } + return val_json.get(); +} } // namespace databento::detail diff --git a/src/historical.cpp b/src/historical.cpp index ecf2589..399ae2c 100644 --- a/src/historical.cpp +++ b/src/historical.cpp @@ -104,6 +104,7 @@ databento::BatchJob Parse(const std::string& endpoint, const nlohmann::json& jso res.ts_process_start = ParseAt(endpoint, json, "ts_process_start"); res.ts_process_done = ParseAt(endpoint, json, "ts_process_done"); res.ts_expiration = ParseAt(endpoint, json, "ts_expiration"); + res.progress = ParseAt>(endpoint, json, "progress"); return res; } diff --git a/tests/src/batch_tests.cpp b/tests/src/batch_tests.cpp index 09260d8..01eff0a 100644 --- a/tests/src/batch_tests.cpp +++ b/tests/src/batch_tests.cpp @@ -35,7 +35,8 @@ TEST(BatchTests, TestBatchJobToString) { {}, {}, {}, - {}}; + {}, + std::optional{50}}; const auto res = ToString(target); ASSERT_EQ(res, R"(BatchJob { id = "AN_ID", @@ -67,7 +68,8 @@ TEST(BatchTests, TestBatchJobToString) { ts_queued = "", ts_process_start = "", ts_process_done = "", - ts_expiration = "" + ts_expiration = "", + progress = 50 })"); } } // namespace databento::tests From 20bb7e889bcdbc11c8cd59f7c8dc94c7389ca30f Mon Sep 17 00:00:00 2001 From: Carter Green Date: Tue, 17 Mar 2026 14:35:25 -0500 Subject: [PATCH 2/2] VER: Release 0.51.0 --- CHANGELOG.md | 2 +- CMakeLists.txt | 2 +- pkg/PKGBUILD | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e8c919..405669b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## 0.51.0 - TBD +## 0.51.0 - 2026-03-17 ### Enhancements - Added support for `progress` field in `BatchJob` response diff --git a/CMakeLists.txt b/CMakeLists.txt index 38f9f83..06cedcc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.24..4.2) project( databento - VERSION 0.50.0 + VERSION 0.51.0 LANGUAGES CXX DESCRIPTION "Official Databento client library" ) diff --git a/pkg/PKGBUILD b/pkg/PKGBUILD index 7e9f33b..2bfc88e 100644 --- a/pkg/PKGBUILD +++ b/pkg/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: Databento _pkgname=databento-cpp pkgname=databento-cpp-git -pkgver=0.50.0 +pkgver=0.51.0 pkgrel=1 pkgdesc="Official C++ client for Databento" arch=('any')