Skip to content

BinDist/bindist-api-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bindist

Crates.io Docs.rs

Rust client for the BinDist Customer API — the customer-facing half of an application distribution platform. Covers listing applications and versions, browsing version files, requesting pre-signed download URLs, and minting public share links.

Install

[dependencies]
bindist = "0.1"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }

The crate is async and uses reqwest with rustls-tls (no OpenSSL).

Usage

use bindist::{Client, GetDownloadInfoOptions, ListApplicationsOptions, ListVersionsOptions};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new("https://api.bindist.eu", "your-api-key")?;

    let apps = client
        .list_applications(&ListApplicationsOptions::default())
        .await?;
    for app in &apps.items {
        println!("{} ({})", app.name, app.application_id);
    }

    let versions = client
        .list_versions("myapp", &ListVersionsOptions::default())
        .await?;
    for v in &versions.items {
        println!("  {} ({} bytes)", v.version, v.file_size);
    }

    let info = client
        .get_download_info("myapp", "1.0.0", &GetDownloadInfoOptions::default())
        .await?;
    println!("Download URL: {}", info.url);

    Ok(())
}

Release channels

Versions can be published on non-default channels (for example, disabled pre-release builds sit on the Test channel). Pass channel: Some(Channel::Test) in the options struct to send the X-Channel header:

use bindist::{Channel, ListVersionsOptions};

let versions = client
    .list_versions(
        "myapp",
        &ListVersionsOptions {
            channel: Some(Channel::Test),
            ..Default::default()
        },
    )
    .await?;

Errors

All API methods return Result<T, bindist::Error>. Error::Api(ApiError) covers both server-returned error envelopes and non-2xx responses from auth middleware / proxies / load balancers that never reach the API's structured error renderer — in the latter case, ApiError::code is derived from the HTTP status (unauthorized, forbidden, not_found, rate_limited, server_error, http_error) and http_status holds the underlying status.

Example

BINDIST_API_KEY=... cargo run --example list

License

MIT — see LICENSE.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages