1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! A wrapper library for Tebex's Headless API, aka creating the serverside for your headless Tebex webstore.
//!
//! # Installation
//!
//! ```toml
//! tebex_headless_rust = "*"
//! ```
//!
//! # Example Usage
//! ```rust
//! 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);
//! }
//! }
//! }
//! ```
static BASE_URL: &str = "https://headless.tebex.io/api";