curseforgecommunity / .net-apiclient Goto Github PK
View Code? Open in Web Editor NEWA CurseForge API Client (For CurseForge Core)
License: MIT License
A CurseForge API Client (For CurseForge Core)
License: MIT License
in readme.md
Please make note that the ApiClient inheirits of IDisposable, so that you dispose of it when you're done with it.
consider this code:
await Parallel.ForEachAsync(Enumerable.Range(1, 100), async (i, token) =>
{
try
{
using var apiClient = new ApiClient("MY_API_KEY", "MY_EMAIL");
var file = await apiClient.GetModAsync(238222);
}
catch (Exception e)
{
Console.WriteLine(e);
}
});
it pops out some exceptions like this:
System.Threading.Tasks.TaskCanceledException: OperationCanceled
---> System.IO.IOException: net_io_read
---> System.ObjectDisposedException: ObjectDisposed_Generic
ObjectDisposed_ObjectName_Name, System.Net.Sockets.NetworkStream
at System.Net.Sockets.NetworkStream.<ThrowIfDisposed>g__ThrowObjectDisposedException|63_0()
.......
at CurseForge.APIClient.ApiClient.GET[T](String endpoint, ValueTuple`2[] queryParameters) in D:\Git\CurseForge.APIClient\ApiClient.cs:line 79
at CurseForge.APIClient.ApiClient.GetModAsync(UInt32 modId) in D:\Git\CurseForge.APIClient\Mods.cs:line 22
at Program.<>c.<<<Main>$>b__0_0>d.MoveNext() in C:\Users\cyl18\source\repos\TestDotNet6\TestDotNet6\Program.cs:line 15
in ApiClient.cs, the _httpClient is static, which means a single instance disposes would affect all existing instances
Line 13 in 05caa75
i have made a simple pull request to fix this problem :) (#2)
Hello! First of all, I'd like to say thank you for such a great implementation of CurseForge API. I have just a few improvements ideas I'd like to see.
Recently, I started looking for Mod Files using ProjectId and FileId from Minecraft modpacks manifest.json file. Most of them was successfuly found, but some have missing files. I mean, mods being deleted from CurseForge. So ApiClient class have to throw not a very informative Exception about it, as CurseForge API response was 404 NotFound StatusCode. This messes up with many another http exceptions, where rate-limit gets applied or API key have been rejected.
I'd like to ask you just add some information about "bad" response being received. Split all types of CurseForge API exception to different classes, or at least, add a Message property to Exception, so we can identify Mods that cannot be found, or Rate Limit exception.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.