minehut

Crates.iominehut
lib.rsminehut
version2.0.0
sourcesrc
created_at2022-06-04 18:49:45.444928
updated_at2022-06-10 15:48:15.958268
descriptionSimple, easy to use Rust wrapper for the Minehut API
homepage
repositoryhttps://github.com/Quzacks/minehut
max_upload_size
id599848
size39,688
Quzack (Quzacks)

documentation

README

crates.io

minehut

Simple, easy to use Rust wrapper for the Minehut API. View the documentation by clicking here. This is my first Rust project, as well as my first API wrapper.

Provides a Client struct to handle data that requires authorization. Use minehut::Client::new(String, String) to instantiate. All functionality provided can be seen in the documentations.

Example

This is an example programme that you can make with this crate:

use minehut::Client;

#[tokio::main]
async fn main() {
    // Starting a Minehut client.
    let client = Client::new("my-auth", "session-id"); 

    // Get an owned server.
    // Using unwrap() here is for simplicity sake. Handle errors properly.
    let my_server = client.my_server("Wife").await.unwrap();

    println!("Starting Wife...");
    // Start the server.
    // Again, handle errors properly.
    match my_server.start_service(&client).await {
        Err(_) => println!("Could not launch server"),
        Ok(_) => println!("Successfully started server")
    }
}

Installation

Add this to your Cargo.toml file:

[dependencies]
minehut = "2.0.0"

Keep in mind you'll need tokio to use this crate properly.

Commit count: 0

cargo fmt