dotNS 0.3.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package dotNS --version 0.3.1                
NuGet\Install-Package dotNS -Version 0.3.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="dotNS" Version="0.3.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add dotNS --version 0.3.1                
#r "nuget: dotNS, 0.3.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 dotNS as a Cake Addin
#addin nuget:?package=dotNS&version=0.3.1

// Install dotNS as a Cake Tool
#tool nuget:?package=dotNS&version=0.3.1                

dotNS - NationStates API access in C#

A C# library for NationStates API access. Developed by The Empire of IKTeam (Our Glorious Nation)

Flag of Our Glorious Nation

We are now on NuGet! We are now on NuGet!

Features

  • High level API access to nation and region information, some public and private shards.
  • Low level API access for public and private shards
  • Issues interaction
  • PIN-code authentication
  • May act like both a low-level wrapper and high-level OOP library

Usage

Initialization

For public shards only, this should be sufficient:

using dotNS;
<...>
DotNS api = new DotNS();

If you later wish to authenticate, you can use this method call:

// Updates PIN value of the class. Can be used to re-auth.
api.UpdatePin("nation name", "password");

or just use this constructor:

// Initializes NS API wrapper and automatically acquires a PIN for private API
DotNS api = new DotNS("nation name", "password");

You can (and actually should) also define your own UserAgent. You can do it either using a constructor:

DotNS api = new DotNS("nation name", "password", "UserAgent");

or after initialization

api.UserAgent = "UserAgent";

High level API example

Get basic nation information
using dotNS;
using dotNS.Classes;
<...>
// Create an API wrapper
DotNS api = new DotNS();
// Use it to acquire nation information
PublicNationInfo nation = api.GetNationInfo("nation name");
// Access information you need
Console.WriteLine($"Population: {nation.Population}, motto: {nation.Motto}");
Get basic public shard information
using dotNS;
using dotNS.Classes;
<...>
// Create an API wrapper
DotNS api = new DotNS();
// Use it to acquire basic public shard
string shard = api.PublicShard("nation name", Shards.PublicShard.Capital);
// Access information you've requested
Console.WriteLine($"The capital is {shard}");
Get basic region information
using dotNS;
using dotNS.Classes;
<...>
// Create an API wrapper
DotNS api = new DotNS();
// Use it to acquire basic region info
PublicRegionInfo info = api.GetRegionInfo("region name");
// Access information you need
Console.WriteLine($"The founder is {info.Founder} and there are {info.NumNations} in this region.");
Verification API
using dotNS;
<...>
// Create an API wrapper
DotNS api = new DotNS();
// Make a call to the API
bool result = api.Verify("nation name", "code");
// Output "Correct!" if the code is correct, or "Incorrect!" if it isn't
Console.WriteLine(result ? "Correct!" : "Incorrect!");
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
0.5.1 183 1/5/2024
0.5.0 321 1/27/2023
0.4.1 283 1/21/2023
0.4.0 388 10/28/2021
0.3.4 389 7/30/2021
0.3.3 394 6/30/2021
0.3.2 347 6/26/2021
0.3.1 319 6/25/2021
0.3.0 326 6/18/2021
0.2.0 343 6/15/2021