TornSharp 1.0.1.1

There is a newer version of this package available.
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
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="TornSharp" Version="1.0.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TornSharp --version 1.0.1.1
#r "nuget: TornSharp, 1.0.1.1"
#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 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

NuGet version

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.1.2 84 6/6/2024
1.1.1 59 6/2/2024
1.1.0 57 6/1/2024
1.0.5 53 5/31/2024
1.0.4 47 5/31/2024
1.0.3 51 5/29/2024
1.0.2 48 5/29/2024
1.0.1.2-beta 45 5/29/2024
1.0.1.1 52 5/29/2024
1.0.1 53 5/29/2024
1.0.0 58 5/29/2024

Added nuget to README.md