1 unstable release
new 0.0.1 | Mar 4, 2025 |
---|
#34 in #early
91 downloads per month
15KB
148 lines
bluewhale
is a (still very early) Rust SDK for the Docker Hub API v2
At the moment only listing the repositories and the tags for a given org or username is supported, the API may be unstable and subject to breaking changes.
Requirements are only cargo add bluewhale
and a Docker Hub Personal Access Token (PAT) to
be generated from https://app.docker.com/settings/personal-access-tokens.
use anyhow::Context;
use bluewhale::DockerHubClient;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let client = DockerHubClient::new("dckr_pat_***");
// Fetch the repositories under a given org or username on the Docker Hub
let repositories = client.list_repositories("ollama")
.await
.context("failed while fetching the repositories")?;
// Fetch the tags for a given repository on the Docker Hub
let tags = client.list_repositories("ollama", "quantize")
.await
.context("failed while fetching the tags")?;
Ok(())
}
Note that the bluewhale
name is tentative, most likely to be renamed to something
like docker-hub-sdk
or something more meaningful. P.S. It originally had the name
whale
but I was too slow and it was taken ~13 days before I published it, so the
story is "ship faster" or "lock crate names in advance".
Dependencies
~8–19MB
~254K SLoC