thunderstore

A library for interacting with the Thunderstore API

2 unstable releases

0.2.0 Aug 16, 2024
0.1.0 Jul 15, 2024
Download history 93/week @ 2024-07-11 16/week @ 2024-07-18 5/week @ 2024-07-25 2/week @ 2024-08-01 160/week @ 2024-08-15 2/week @ 2024-08-22 2/week @ 2024-08-29 4/week @ 2024-09-05 22/week @ 2024-09-12 13/week @ 2024-09-19 21/week @ 2024-09-26 12/week @ 2024-10-03

68 downloads per month

MIT/Apache

56KB
1K SLoC

Thunderstore Client

A library for interacting with the Thunderstore API.

See the crate docs for more information.

Example

#[tokio::main]
async fn main() -> thunderstore::Result<()> {
    let client = thunderstore::Client::builder()
        .with_token("tss_XXX")
        .build()?;

    let package = client.get_package(("Kesomannen", "GaleModManager")).await?;
     client.download_to_dir(&package.latest, r"C:\Users\bobbo\Downloads").await?;

     client.publish_file(
         "CoolMod.zip",
         PackageMetadata::new("Kesomannen", ["lethal-company"])
             .with_global_categories(["tools"])
             .with_categories("lethal-company", ["serverside"])
     ).await?;
 }

lib.rs:

A library for interacting with the Thunderstore API.

The main struct is Client, which provides methods for fetching, downloading and publishing packages. The easiest way to get up and running is to use the Client::new method, which creates a client with the default configuration. If you need more control over the client's configuration, use the Client::builder method instead (see ClientBuilder).

Some methods, including uploading and submitting packages, require an API token to be set on the client. You can set this token using the ClientBuilder::with_token method.

Examples

#[tokio::main]
async fn main() -> thunderstore::Result<()> {
    let client = thunderstore::Client::builder()
        .with_token("tss_XXX")
        .build()?;

    let package = client.get_package(("Kesomannen", "GaleModManager")).await?;
    client.download_to_dir(&package.latest, r"C:\Users\bobbo\Downloads").await?;

    client.publish_file(
        "CoolMod.zip",
        PackageMetadata::new("Kesomannen", ["lethal-company"])
            .with_global_categories(["tools"])
            .with_categories("lethal-company", ["serverside"])
    ).await?;
}

Dependencies

~7–19MB
~262K SLoC