Skip to main content

hyperdb_bootstrap/
url.rs

1// Copyright (c) 2026, Salesforce, Inc. All rights reserved.
2// SPDX-License-Identifier: Apache-2.0 OR MIT
3
4//! Builds canonical download URLs for Tableau's public Hyper C++ API
5//! release bundles.
6
7use crate::platform::Platform;
8use crate::release::PinnedRelease;
9
10const BASE_URL: &str = "https://downloads.tableau.com/tssoftware";
11
12/// Builds the `downloads.tableau.com` URL for the given release / platform
13/// combination.
14///
15/// The URL template matches
16/// `https://downloads.tableau.com/tssoftware/tableauhyperapi-cxx-<platform>-release-main.<version>.<build_id>.zip`.
17#[must_use]
18pub fn build_download_url(release: &PinnedRelease, platform: Platform) -> String {
19    format!(
20        "{base}/tableauhyperapi-cxx-{plat}-release-main.{version}.{build_id}.zip",
21        base = BASE_URL,
22        plat = platform.slug(),
23        version = release.version,
24        build_id = release.build_id,
25    )
26}
27
28#[cfg(test)]
29mod tests {
30    use super::*;
31    use std::collections::HashMap;
32
33    #[test]
34    fn url_matches_expected_template() {
35        let r = PinnedRelease {
36            version: "0.0.24457".to_string(),
37            build_id: "rc36858b6".to_string(),
38            sha256: HashMap::new(),
39        };
40        let url = build_download_url(&r, Platform::MacosArm64);
41        assert_eq!(
42            url,
43            "https://downloads.tableau.com/tssoftware/tableauhyperapi-cxx-macos-arm64-release-main.0.0.24457.rc36858b6.zip"
44        );
45    }
46}