Skip to content

Commit 76037d2

Browse files
authored
VER: Release 0.51.0
2 parents 418bfb2 + 20bb7e8 commit 76037d2

File tree

9 files changed

+35
-4
lines changed

9 files changed

+35
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 0.51.0 - 2026-03-17
4+
5+
### Enhancements
6+
- Added support for `progress` field in `BatchJob` response
7+
38
## 0.50.0 - 2026-03-03
49

510
### Enhancements

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.24..4.2)
66

77
project(
88
databento
9-
VERSION 0.50.0
9+
VERSION 0.51.0
1010
LANGUAGES CXX
1111
DESCRIPTION "Official Databento client library"
1212
)

include/databento/batch.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include <cstdint>
4+
#include <optional>
45
#include <ostream>
56
#include <string>
67
#include <vector>
@@ -49,6 +50,8 @@ struct BatchJob {
4950
// Empty if it hasn't finished processing. The expiration is set based on when
5051
// the job finishes processing, not when it was requested.
5152
std::string ts_expiration;
53+
// Progress percentage (0-100). `nullopt` for jobs that were just submitted.
54+
std::optional<std::uint8_t> progress;
5255
};
5356

5457
// Description of a batch file.

include/databento/detail/json_helpers.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,8 @@ std::vector<std::string> ParseAt(std::string_view endpoint, const nlohmann::json
9393
template <>
9494
date::year_month_day ParseAt(std::string_view endpoint, const nlohmann::json& json,
9595
std::string_view key);
96+
template <>
97+
std::optional<std::uint8_t> ParseAt(std::string_view endpoint,
98+
const nlohmann::json& json, std::string_view key);
9699

97100
} // namespace databento::detail

pkg/PKGBUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Maintainer: Databento <support@databento.com>
22
_pkgname=databento-cpp
33
pkgname=databento-cpp-git
4-
pkgver=0.50.0
4+
pkgver=0.51.0
55
pkgrel=1
66
pkgdesc="Official C++ client for Databento"
77
arch=('any')

src/batch.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ std::ostream& operator<<(std::ostream& stream, const BatchJob& batch_job) {
4747
.AddField("ts_process_start", batch_job.ts_process_start)
4848
.AddField("ts_process_done", batch_job.ts_process_done)
4949
.AddField("ts_expiration", batch_job.ts_expiration)
50+
.AddField("progress", batch_job.progress)
5051
.Finish();
5152
}
5253

src/detail/json_helpers.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,20 @@ date::year_month_day ParseAt(std::string_view endpoint, const nlohmann::json& js
138138
}
139139
return start;
140140
}
141+
template <>
142+
std::optional<std::uint8_t> ParseAt(std::string_view endpoint,
143+
const nlohmann::json& json, std::string_view key) {
144+
if (!json.contains(key)) {
145+
return {};
146+
}
147+
const auto& val_json = json.at(key);
148+
if (val_json.is_null()) {
149+
return {};
150+
}
151+
if (!val_json.is_number_unsigned()) {
152+
throw JsonResponseError::TypeMismatch(
153+
endpoint, std::string{key} + " unsigned number", val_json);
154+
}
155+
return val_json.get<std::uint8_t>();
156+
}
141157
} // namespace databento::detail

src/historical.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ databento::BatchJob Parse(const std::string& endpoint, const nlohmann::json& jso
104104
res.ts_process_start = ParseAt<std::string>(endpoint, json, "ts_process_start");
105105
res.ts_process_done = ParseAt<std::string>(endpoint, json, "ts_process_done");
106106
res.ts_expiration = ParseAt<std::string>(endpoint, json, "ts_expiration");
107+
res.progress = ParseAt<std::optional<std::uint8_t>>(endpoint, json, "progress");
107108
return res;
108109
}
109110

tests/src/batch_tests.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ TEST(BatchTests, TestBatchJobToString) {
3535
{},
3636
{},
3737
{},
38-
{}};
38+
{},
39+
std::optional<std::uint8_t>{50}};
3940
const auto res = ToString(target);
4041
ASSERT_EQ(res, R"(BatchJob {
4142
id = "AN_ID",
@@ -67,7 +68,8 @@ TEST(BatchTests, TestBatchJobToString) {
6768
ts_queued = "",
6869
ts_process_start = "",
6970
ts_process_done = "",
70-
ts_expiration = ""
71+
ts_expiration = "",
72+
progress = 50
7173
})");
7274
}
7375
} // namespace databento::tests

0 commit comments

Comments
 (0)