babelshift-ci - SteamWebAPI2 4.0.15-64

This is a .NET library that makes it easy to use the Steam Web API. It conveniently wraps around all of the JSON data and ugly API details with clean methods, structures and classes.

PM> Install-Package SteamWebAPI2 -Version 4.0.15-64 -Source https://www.myget.org/F/babelshift-ci/api/v3/index.json

Copy to clipboard

> nuget.exe install SteamWebAPI2 -Version 4.0.15-64 -Source https://www.myget.org/F/babelshift-ci/api/v3/index.json

Copy to clipboard

> dotnet add package SteamWebAPI2 --version 4.0.15-64 --source https://www.myget.org/F/babelshift-ci/api/v3/index.json

Copy to clipboard
<PackageReference Include="SteamWebAPI2" Version="4.0.15-64" />
Copy to clipboard
source https://www.myget.org/F/babelshift-ci/api/v3/index.json

nuget SteamWebAPI2  ~> 4.0.15-64
Copy to clipboard

> choco install SteamWebAPI2 --version 4.0.15-64 --source https://www.myget.org/F/babelshift-ci/api/v2

Copy to clipboard
Import-Module PowerShellGet
Register-PSRepository -Name "babelshift-ci" -SourceLocation "https://www.myget.org/F/babelshift-ci/api/v2"
Install-Module -Name "SteamWebAPI2" -RequiredVersion "4.0.15-64" -Repository "babelshift-ci" -AllowPreRelease
Copy to clipboard

SteamWebAPI2

Build Status NuGet MyGet CI

This is a .NET library that makes it easy to use the Steam Web API. It conveniently wraps around all of the JSON data and ugly API details with clean methods, structures and classes.

Please refer here for details regarding the Steam Web API, its endpoints, and how this library consumes them.

Check this README and the Wiki for more details about getting started and common use cases.

About this Library

This library was created to address the (at times) awful nature of the Steam Web API. Many of the exposed endpoints have little to no documentation on the parameters and absolutely no documentation on any of the responses. In addition, many of the endpoints do not follow any type of coding convention as it appears that different developers created different endpoints without collaborating with one another.

For example, some responses have a containing "response" object while others have a containing "result" object. To make it worse, some have a containing "results" or "responses" or "applist" or "playerstats" object or a number of other unconventional choices.

Instead of stressing about parsing the ugly JSON responses yourself, just use this library to make a method call and get back a response with everything in a more C#/.NET style. These are the rules on which the library was built:

  • Make the library as easy and user friendly as possible.
  • Document everything as thoroughly as possible.
  • Standardize all property names on returned JSON objects.
  • Deserialize UNIX TimeStamps to DateTime.
  • Deserialize "types" into enum where possible.
  • Clean up some of the more egregious JSON responses where JSON arrays should have been used but weren't.
  • Offer a sane way of handling the various representations and conversions of Steam ID by offering a SteamId class.
    • Handles legacy, modern, and 64-bit Steam Id representations

NOTE: Valve's Steamworks documentation doesn't do a good job at explaining the difference between their public API and partner API. This library only works with the public-facing API located at: api.steampowered.com. Any endpoints from their documentation that are located at the partner.steam-api.com will not be accessible with this library. I am not a registered publisher and thus don't have access to any of the partner endpoints.

Install the Library from NuGet

See the library in the NuGet gallery here.

Package Manager:

Install-Package SteamWebAPI2 

.NET Core CLI:

dotnet add package SteamWebAPI2

How to Use the Library

  1. Read the About section so you understand why this library exists
  2. Install the library from NuGet
  3. Get a Steam Web API developer key. Get one here. KEEP THIS SECRET.
  4. Instantiate a SteamWebInterfaceFactory to use as a helper to create objects for various endpoint calls.
  5. Use the factory to create endpoint interface classes.
  6. Use the interface class and call a method with your parameters.

The library is structured to mirror the Steam Web API endpoint structure. For example, the "DOTA2Econ" class will expose methods to communicate with the "IDOTA2Econ" endpoints. See here for more endpoint details.

Each method returns a SteamWebResponse object which contains the following:

Field Type Description
Data T Maps to the payload returned by the Steam Web API.
ContentLength long? Maps to the HTTP ContentLength header.
ContentType string Maps to the HTTP ContentType header.
ContentTypeCharSet string Maps to the HTTP ContentType charset header.
Expires DateTimeOffset? Maps to the HTTP Expires header. Optional.
LastModified DateTimeOffset? Maps to the HTTP LastModified header. Optional

Sample Usage

// factory to be used to generate various web interfaces
var webInterfaceFactory = new SteamWebInterfaceFactory(<dev api key here>);

// this will map to the ISteamUser endpoint
// note that you have full control over HttpClient lifecycle here
var steamInterface = webInterfaceFactory.CreateSteamWebInterface<SteamUser>(new HttpClient());

// this will map to ISteamUser/GetPlayerSummaries method in the Steam Web API
// see PlayerSummaryResultContainer.cs for response documentation
var playerSummaryResponse = await steamInterface.GetPlayerSummaryAsync(<steamIdHere>);
var playerSummaryData = playerSummaryResponse.Data;
var playerSummaryLastModified = playerSummaryResponse.LastModified;

// this will map to ISteamUser/GetFriendsListAsync method in the Steam Web API
// see FriendListResultContainer.cs for response documentation
var friendsListResponse = await steamInterface.GetFriendsListAsync(<steamIdHere>);
var friendsList = friendsListResponse.Data;
  • .NETStandard 2.0
    • automapper (>= 9.0.0)
    • newtonsoft.json (>= 12.0.3)
    • Steam.Models (>= 3.0.10)
  • .NETStandard 2.0: 2.0.0.0

Owners

jskiles

Authors

Justin Skiles

Project URL

https://github.com/babelshift/SteamWebAPI2

License

MIT

Info

4276 total downloads
75 downloads for version 4.0.15-64
Download (125.34 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
4.1.0 124.93 KB Sat, 07 Mar 2020 15:57:13 GMT 96
4.1.0-75 124.97 KB Thu, 26 Mar 2020 16:01:13 GMT 80
4.1.0-74 124.97 KB Thu, 26 Mar 2020 15:59:07 GMT 78
4.1.0-73 124.86 KB Sat, 07 Mar 2020 16:13:07 GMT 92
4.1.0-71 124.96 KB Sat, 07 Mar 2020 15:54:33 GMT 64
4.0.16 125.33 KB Mon, 24 Feb 2020 00:32:43 GMT 84
4.0.16-69 124.92 KB Tue, 25 Feb 2020 17:30:46 GMT 71
4.0.16-68 124.92 KB Tue, 25 Feb 2020 17:26:32 GMT 79
4.0.16-67 124.89 KB Tue, 25 Feb 2020 16:57:13 GMT 78
4.0.15 125.59 KB Fri, 21 Feb 2020 19:57:03 GMT 74
4.0.15-64 125.34 KB Sun, 23 Feb 2020 22:35:01 GMT 75
4.0.14 126.32 KB Wed, 18 Dec 2019 20:25:43 GMT 85
4.0.14-61 125.59 KB Fri, 21 Feb 2020 19:49:55 GMT 78
4.0.14-60 125.59 KB Thu, 13 Feb 2020 11:04:38 GMT 82
4.0.14-59 126.36 KB Thu, 19 Dec 2019 03:01:46 GMT 83
4.0.14-57 126.35 KB Wed, 18 Dec 2019 20:22:11 GMT 78
4.0.13 126.14 KB Wed, 18 Dec 2019 19:28:45 GMT 87
4.0.12 126.13 KB Wed, 18 Dec 2019 19:17:42 GMT 79
4.0.12-52 126.17 KB Thu, 12 Dec 2019 01:25:31 GMT 87
4.0.11-49 125.73 KB Fri, 22 Nov 2019 01:42:00 GMT 91
4.0.9 125.72 KB Mon, 12 Aug 2019 17:37:08 GMT 81
4.0.9-47 125.74 KB Fri, 18 Oct 2019 21:16:34 GMT 78
4.0.9-45 125.74 KB Mon, 12 Aug 2019 17:29:45 GMT 74
4.0.9-43 125.74 KB Mon, 12 Aug 2019 16:09:08 GMT 74
4.0.8 125.5 KB Sat, 03 Mar 2018 21:08:49 GMT 74
4.0.8-41 125.51 KB Sat, 03 Mar 2018 21:06:00 GMT 70
4.0.7 125.83 KB Sat, 27 Jan 2018 03:50:13 GMT 78
4.0.7-40 125.51 KB Sat, 03 Mar 2018 21:01:46 GMT 80
4.0.7-38 125.85 KB Sat, 27 Jan 2018 03:47:17 GMT 74
4.0.6 125.84 KB Wed, 17 Jan 2018 01:25:12 GMT 79
4.0.6-37 125.85 KB Sat, 27 Jan 2018 03:39:29 GMT 89
4.0.6-35 125.86 KB Wed, 17 Jan 2018 01:20:43 GMT 77
4.0.5 121.94 KB Thu, 09 Nov 2017 00:45:25 GMT 81
4.0.5-34 125.87 KB Wed, 17 Jan 2018 01:05:07 GMT 73
4.0.5-33 121.95 KB Mon, 15 Jan 2018 12:29:54 GMT 78
4.0.4 121.92 KB Sat, 04 Nov 2017 21:30:09 GMT 73
4.0.3-ci-00025 122 KB Sat, 21 Oct 2017 16:05:20 GMT 72
4.0.3-ci-00024 122 KB Mon, 02 Oct 2017 01:49:13 GMT 70
4.0.2 120.97 KB Sat, 26 Aug 2017 20:03:27 GMT 76
4.0.2-ci-00020 121.01 KB Sat, 26 Aug 2017 19:54:46 GMT 78
4.0.2-ci-00019 241.02 KB Sun, 16 Jul 2017 01:16:11 GMT 74
4.0.2-ci-00018 240.85 KB Sat, 10 Jun 2017 16:22:11 GMT 99
4.0.2-ci-00017 240.82 KB Fri, 05 May 2017 03:14:29 GMT 74
4.0.1 240.77 KB Fri, 05 May 2017 03:07:26 GMT 84
4.0.1-ci-00014 240.81 KB Fri, 05 May 2017 02:01:04 GMT 81
4.0.1-ci-00012 237.94 KB Mon, 20 Feb 2017 16:20:36 GMT 77
4.0.1-ci-00011 238.04 KB Mon, 20 Feb 2017 16:01:48 GMT 83
4.0.1-ci-00010 237.13 KB Mon, 20 Feb 2017 14:00:18 GMT 81
4.0.1-ci-00009 237.13 KB Tue, 07 Feb 2017 13:21:51 GMT 81
4.0.1-ci-00008 237.13 KB Mon, 06 Feb 2017 21:26:11 GMT 83
4.0.1-ci-00007 237.12 KB Mon, 06 Feb 2017 21:11:18 GMT 78
4.0.1-ci-00006 237.13 KB Sat, 04 Feb 2017 16:07:42 GMT 78
4.0.0 235.51 KB Fri, 03 Feb 2017 17:32:07 GMT 73
3.2.0-ci-00000 235.56 KB Fri, 03 Feb 2017 15:19:57 GMT 80