pub struct Ferinth { /* private fields */ }
Expand description

An instance of the API to invoke API calls on.

To initialise this container,

let modrinth = Ferinth::new();
// Use the instance to call the API
let sodium_mod = modrinth.get_project("sodium");

Implementations

Get a project with ID project_id

Example:

let sodium_mod = modrinth.get_project("AANobbMI").await?;
assert_eq!(
    sodium_mod.title,
    "Sodium",
);

// You can also use the project slug
let ok_zoomer_mod = modrinth.get_project("ok-zoomer").await?;
assert_eq!(
    ok_zoomer_mod.title,
    "Ok Zoomer",
);

Get the dependencies of the project with ID project_id

Example:

let fabric_api = modrinth.get_project_dependencies("fabric-api").await?;
// The Fabric API should not have any dependencies
assert!(fabric_api.projects.is_empty());

List the categories a project can take

List the Minecraft mod loaders

List the Minecraft versions

List licenses

List donation platforms

List report types

Get user with ID user_id

Example:

let jellysquid = modrinth.get_user("TEZXhE2U").await?;
assert!(jellysquid.role == UserRole::Developer);

Get a list of projects that the user owns

Example:

let jellysquid_projects = modrinth.list_projects("TEZXhE2U").await?;
assert!(jellysquid_projects.len() == 4);

List the members of team with ID team_id

Example:

let mod_menu_team = modrinth.list_team_members("VMz4FpgB").await?;
assert!(mod_menu_team.len() == 4);

Get the versions of project with ID project_id

Example:

let sodium_versions = modrinth.list_versions("AANobbMI").await?;
assert!(sodium_versions[0].project_id == "AANobbMI");

Get version with ID version_id

Example:

let sodium_version = modrinth.get_version("xuWxRZPd").await?;
assert!(sodium_version.project_id == "AANobbMI");

Get the version of a version file with hash file_hash. Only supports SHA1 hashes for now

Example:

// A version file has the hash `795d4c12bffdb1b21eed5ff87c07ce5ca3c0dcbf`, so we can get the version it belongs to
let sodium_version = modrinth.get_version_from_file_hash("795d4c12bffdb1b21eed5ff87c07ce5ca3c0dcbf").await?;
// That version file belongs to (surprise, surprise) the Sodium mod!
assert!(sodium_version.project_id == "AANobbMI");

Download version_file’s contents

Example:

let sodium_versions = modrinth.list_versions("AANobbMI").await?;
let version_file = &sodium_versions[0].files[0];
// You can write this to a file and load it using a mod loader (Fabric in this case)
let file_contents = modrinth.download_version_file(version_file).await?;

Create a new API instance

user_agent should be the name of the program

let modrinth = Ferinth::new();

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more