Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 0.51.0 - 2026-03-17

### Enhancements
- Added support for `progress` field in `BatchJob` response

## 0.50.0 - 2026-03-03

### Enhancements
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
3 changes: 3 additions & 0 deletions include/databento/batch.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <cstdint>
#include <optional>
#include <ostream>
#include <string>
#include <vector>
Expand Down Expand Up @@ -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<std::uint8_t> progress;
};

// Description of a batch file.
Expand Down
3 changes: 3 additions & 0 deletions include/databento/detail/json_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,8 @@ std::vector<std::string> 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<std::uint8_t> ParseAt(std::string_view endpoint,
const nlohmann::json& json, std::string_view key);

} // namespace databento::detail
2 changes: 1 addition & 1 deletion pkg/PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Maintainer: Databento <support@databento.com>
_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')
Expand Down
1 change: 1 addition & 0 deletions src/batch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
16 changes: 16 additions & 0 deletions src/detail/json_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,20 @@ date::year_month_day ParseAt(std::string_view endpoint, const nlohmann::json& js
}
return start;
}
template <>
std::optional<std::uint8_t> 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<std::uint8_t>();
}
} // namespace databento::detail
1 change: 1 addition & 0 deletions src/historical.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ databento::BatchJob Parse(const std::string& endpoint, const nlohmann::json& jso
res.ts_process_start = ParseAt<std::string>(endpoint, json, "ts_process_start");
res.ts_process_done = ParseAt<std::string>(endpoint, json, "ts_process_done");
res.ts_expiration = ParseAt<std::string>(endpoint, json, "ts_expiration");
res.progress = ParseAt<std::optional<std::uint8_t>>(endpoint, json, "progress");
return res;
}

Expand Down
6 changes: 4 additions & 2 deletions tests/src/batch_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ TEST(BatchTests, TestBatchJobToString) {
{},
{},
{},
{}};
{},
std::optional<std::uint8_t>{50}};
const auto res = ToString(target);
ASSERT_EQ(res, R"(BatchJob {
id = "AN_ID",
Expand Down Expand Up @@ -67,7 +68,8 @@ TEST(BatchTests, TestBatchJobToString) {
ts_queued = "",
ts_process_start = "",
ts_process_done = "",
ts_expiration = ""
ts_expiration = "",
progress = 50
})");
}
} // namespace databento::tests
Loading