Modrinth.Net
3.0.6
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Modrinth.Net --version 3.0.6
NuGet\Install-Package Modrinth.Net -Version 3.0.6
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Modrinth.Net" Version="3.0.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Modrinth.Net --version 3.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Modrinth.Net, 3.0.6"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Modrinth.Net as a Cake Addin #addin nuget:?package=Modrinth.Net&version=3.0.6 // Install Modrinth.Net as a Cake Tool #tool nuget:?package=Modrinth.Net&version=3.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Modrinth.Net
- C# Wrapper for the Modrinth API
Usage
- Install the NuGet package
using Modrinth;
// You must provide a user-agent, and optionally an authentication token if you wish to access authenticated API endpoints
var client = new ModrinthClient(userAgent: "My_Awesome_Project", token: "Your_Authentication_Token");
var project = await client.Project.GetAsync("sodium");
Console.WriteLine(project.Description);
User-Agent
- You can also use the UserAgent class to help you create a valid user-agent
- User-Agent current cannot be changed after the client has been created
- More info about the User-Agent can be found here
using Modrinth;
using Modrinth.Client;
// Note: All properties are optional, and will be ignored if they are null or empty
var userAgent = new UserAgent
{
ProjectName = "ProjectName",
ProjectVersion = "1.0.0",
GitHubUsername = "Username",
Contact = "contact@contact.com"
};
var client = new ModrinthClient(userAgent: userAgent, token: "Your_Authentication_Token");
Unsuccesful API calls
- If the API call was unsuccessful, the client will throw an
ModrinthApiException
exception - This will be thrown if the API call return non-200 status code, or if the response body is not valid JSON
- This approach will be revisited in future versions
using Modrinth;
using Modrinth.Exceptions;
using System.Net;
var client = new ModrinthClient(userAgent: "My_Awesome_Project");
try
{
var project = await _client.Project.GetAsync("non-existent-project");
Console.WriteLine(project.Title);
}
// You can catch the exception and only handle the 404 status code
catch (ModrinthApiException e) when (e.StatusCode == HttpStatusCode.NotFound)
{
Console.WriteLine("Project not found");
}
// Or you can catch the exception and handle all non-200 status codes
catch (ModrinthApiException e)
{
Console.WriteLine($"API call failed with status code {e.StatusCode}");
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- Flurl (>= 3.0.7)
- Flurl.Http (>= 3.2.4)
- Newtonsoft.Json (>= 13.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
3.4.5 | 990 | 4/22/2024 | |
3.4.4 | 118 | 4/21/2024 | |
3.4.3 | 262 | 2/22/2024 | |
3.4.2 | 164 | 2/22/2024 | |
3.4.1 | 139 | 1/29/2024 | |
3.4.0 | 407 | 11/28/2023 | |
3.4.0-alpha2 | 130 | 9/29/2023 | |
3.4.0-alpha | 117 | 9/29/2023 | |
3.3.0 | 318 | 8/7/2023 | |
3.2.2 | 283 | 6/21/2023 | |
3.2.1 | 143 | 6/21/2023 | |
3.2.0 | 257 | 5/20/2023 | |
3.2.0-rc2 | 110 | 5/13/2023 | |
3.2.0-rc1 | 126 | 5/12/2023 | |
3.2.0-beta1 | 150 | 4/25/2023 | |
3.1.1 | 330 | 4/14/2023 | |
3.1.0 | 251 | 4/2/2023 | |
3.1.0-rc4 | 137 | 3/31/2023 | |
3.1.0-rc3 | 182 | 3/25/2023 | |
3.1.0-rc2 | 144 | 3/24/2023 | |
3.1.0-rc1 | 132 | 3/23/2023 | |
3.1.0-alpha3 | 141 | 3/21/2023 | |
3.1.0-alpha2 | 150 | 3/20/2023 | |
3.1.0-alpha | 154 | 3/20/2023 | |
3.0.10 | 238 | 3/20/2023 | |
3.0.9 | 209 | 3/16/2023 | |
3.0.8 | 221 | 3/15/2023 | |
3.0.7 | 212 | 3/15/2023 | |
3.0.6 | 216 | 3/11/2023 | |
3.0.5 | 311 | 2/20/2023 | |
3.0.4 | 250 | 2/20/2023 | |
3.0.3 | 273 | 2/18/2023 | |
3.0.2 | 279 | 2/2/2023 | |
3.0.1 | 312 | 1/29/2023 |