Crates.io | femtorinth |
lib.rs | femtorinth |
version | 0.1.3 |
source | src |
created_at | 2021-10-20 20:01:42.161783 |
updated_at | 2021-11-29 20:26:41.989984 |
description | (Unmaintained) Femtorinth is a library to interact with a sub-set of the Modrinth API. |
homepage | |
repository | https://github.com/vivyir/femtorinth |
max_upload_size | |
id | 468081 |
size | 50,199 |
⚠️ This library is no longer maintained, I lost interest in this project after discovering a minecraft launcher called "MultiMC", however if you want to interact with the Modrinth api have a look at the Ferinth crate which is more up-to-date :D.
Femtorinth is a rust library to interact with a sub-set of the Modrinth api, it only includes the api calls that don't need auth (a.k.a only GET calls), it includes parsing for all the structs that exist in the v1 documentation of Modrinth's api and the structs themselves aswell, plus, helper functions that will return those structs and handle calling the Modrinth api, currently this library is using the ureq crate as it's back-end to call the Modrinth api but that's planned to change in the near future so the library can become backend agnostic (although i have no idea what the use of this library would then be).
Right now Femtorinth is still very much in infancy, it does have good enough error handling,
documentation and code but i think there's still room for improvement, have a look at the
Roadmap
section of this readme if you're interested in contributing!
Getting the latest sodium version + a bit of flair
fn main() -> Result<(), Box<dyn std::error::Error>> {
let results = femtorinth::search_mods("Sodium".into(), None, Some(1))?;
let modres = results.hits[0].clone();
println!("Found: {} from {}", &modres.title, &modres.author);
println!("Description: {}", &modres.description);
println!(
"Downloads and follows: {} and {}",
&modres.downloads, &modres.follows
);
println!(
"Latest supported minecraft version: {}",
&modres.latest_version
);
println!("Licensed under: {}", &modres.license);
let version_list = femtorinth::version_list(modres.get_clean_id())?;
let mod_version_data = version_list[0].clone();
println!("Name of the newest version: {}", &mod_version_data.name);
println!("Files for download with filenames:");
for i in mod_version_data.files {
println!("{}: {}", i.filename, i.url);
}
Ok(())
}
For more examples check out the examples/ directory on github
Femtorinth is a name that's made up of two words, Femtometre and Modrinth, Femtometre is an extremely small metric (10^-15, even smaller than pico!) and since this library only covers a subset of Modrinth's v1 API, this name would be perfect!
ureq
can be usedThanks for your interest in contributing! please open an issue or merge request to contribute, and remember to look at the roadmap and see if you can help with the goals on there. Code contributions submitted for inclusion in the work by you, as defined in the MPL2.0 license, shall be licensed as the above without any additional terms or conditions.
This project is licenced under the Mozilla Public License 2.0.