TornSharp 1.0.1.1
See the version list below for details.
dotnet add package TornSharp --version 1.0.1.1
NuGet\Install-Package TornSharp -Version 1.0.1.1
<PackageReference Include="TornSharp" Version="1.0.1.1" />
paket add TornSharp --version 1.0.1.1
#r "nuget: TornSharp, 1.0.1.1"
// Install TornSharp as a Cake Addin #addin nuget:?package=TornSharp&version=1.0.1.1 // Install TornSharp as a Cake Tool #tool nuget:?package=TornSharp&version=1.0.1.1
TornSharp
A C# Wrapper for Torn City API based on the now depreciated wrapper by CarlHalstead.
Features
- Asynchronous Calls
- Support for most endpoints
- Logging unknown Json properties
Installation
Install RiotSharp through NuGet:
PM> Install-Package TornSharp
Usage
You first have to create API key here.
Entry point for the API:
var api = new TornApiWrapper("YOUR_API_KEY");
Specifying rate limit (unspecified defaults to unlimited):
var api = new TornApiWrapper("YOUR_API_KEY", yourRateLimit);
Disabling unknown Json logging:
var api = new TornApiWrapper("YOUR_API_KEY", yourRateLimit, false);
To get basic data of a Torn User:
try
{
//example: Chedburn [1]
var user = api.GetFromUserApi<UserBasic>("1").Result;
var name = user.Name;
var level = user.Level;
var playerId = user.PlayerId;
}
catch (Exception e)
{
// Handle the exception
}
These are the current endpoint category available:
- User
- Property
- Faction
- Company
- Market
- Torn
- Key
All endpoints can be found on the Unofficial Torn Api.
Notes
- Some endpoints/types are incomplete due to unknown variable types/enum types
- Incorrect data or errors may occur on integer types (int vs long)
These problems are mostly due to incomplete/unknown data from the unofficial documentation.<br />
If any of these problems above occur you can open an issue here.<br /> (please report unknown/incomplete data to the Unofficial Torn Api as well)!
Contributing
Contributions can be made by opening a pull request here.
Dependencies
- System.Text.Json
- System.Text.Json.EnumExtensions
Licence
This wrapper is under the Apache 2.0 License.
Credits
This is heavily based on TornCityApiSharp by CarlHalstead.<br /> All the Json models are based on the Unofficial Torn Api.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net8.0
- EnumExtensions.System.Text.Json (>= 1.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Added nuget to README.md