/tebex_headless_rust

Primary LanguageRustGNU General Public License v3.0GPL-3.0

Tebex Headless Wrapper

A wrapper library for Tebex's Headless API, aka creating the serverside for your headless Tebex webstore.

  • Fast: One of our main aims, both when choosing to do this in Rust, and choosing our dependencies, was the fact that this should be blazing fast.
  • Reliable: This should pretty much be as reliable as possible, as it is a straight/raw wrapper for all Tebex API calls.

Crates.io Documentation Discord chat

Overview

This is a simple but straight forward to use wrapper library for Tebex's Headless API. If you do not know what that is already, then please read this first.

Example

use tebex_headless_rust::handlers::{misc::set_public_api_key, package::get_all_packages};

// tokio is used to allow an async main function
#[tokio::main]
async fn main() {
    // set public api key
    set_public_api_key(String::from("public_api_key_tebex"));

    // fetch packages
    let packages = get_all_packages(None, None).await;

    match packages {
        // if packages successfully fetched
        Ok (packages) => {
            println!("Package amount: {}", packages.len());
        }

        // handle issue with fetching of packages
        Err (err) => {
            println!("Could not fetch pacakges: {}", err);
        }
    }
}

Todo

  • Some of the structs are empty as it the structure of them are unknown
  • Find some way to generate & use auth link via tests, as that would allow us to improve tests drastically

Issues, suggestions, etcetera

If you encounter an issue with our template, simply open an issue here

Contribution

We gladly accept all contributions, contributing can be done via forking this repo and then creating a PR.