From f866bdca4146dd407ec5138fedb44a0b21757ffa Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Mon, 12 Aug 2019 11:52:28 -0400 Subject: [PATCH 001/107] Refactored to allow injecting custom HttpClient. Also some cleanup. --- src/SteamWebAPI2/AutoMapperConfiguration.cs | 2 - src/SteamWebAPI2/Interfaces/CSGOServers.cs | 4 +- src/SteamWebAPI2/Interfaces/DOTA2Econ.cs | 4 +- src/SteamWebAPI2/Interfaces/DOTA2Fantasy.cs | 4 +- src/SteamWebAPI2/Interfaces/DOTA2Match.cs | 4 +- src/SteamWebAPI2/Interfaces/DOTA2Ticket.cs | 6 +-- src/SteamWebAPI2/Interfaces/EconItems.cs | 6 +-- src/SteamWebAPI2/Interfaces/EconService.cs | 6 +-- src/SteamWebAPI2/Interfaces/GCVersion.cs | 6 +-- .../Interfaces/GameServersService.cs | 6 +-- src/SteamWebAPI2/Interfaces/PlayerService.cs | 6 +-- src/SteamWebAPI2/Interfaces/SteamApps.cs | 6 +-- src/SteamWebAPI2/Interfaces/SteamEconomy.cs | 4 +- src/SteamWebAPI2/Interfaces/SteamNews.cs | 6 +-- .../Interfaces/SteamRemoteStorage.cs | 6 +-- src/SteamWebAPI2/Interfaces/SteamUser.cs | 6 +-- src/SteamWebAPI2/Interfaces/SteamUserAuth.cs | 6 +-- src/SteamWebAPI2/Interfaces/SteamUserStats.cs | 6 +-- .../Interfaces/SteamWebAPIUtil.cs | 6 +-- src/SteamWebAPI2/Interfaces/TFItems.cs | 6 +-- src/SteamWebAPI2/Models/SteamId.cs | 17 ++----- src/SteamWebAPI2/SteamStoreInterface.cs | 3 +- src/SteamWebAPI2/SteamStoreRequest.cs | 2 - .../Utilities/SteamWebHttpClient.cs | 11 ++-- .../Utilities/SteamWebInterface.cs | 39 ++++++-------- .../Utilities/SteamWebInterfaceFactory.cs | 51 +++++++++++++++++++ src/SteamWebAPI2/Utilities/SteamWebRequest.cs | 22 ++++---- 27 files changed, 144 insertions(+), 107 deletions(-) create mode 100644 src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs diff --git a/src/SteamWebAPI2/AutoMapperConfiguration.cs b/src/SteamWebAPI2/AutoMapperConfiguration.cs index ec6391b..b853856 100644 --- a/src/SteamWebAPI2/AutoMapperConfiguration.cs +++ b/src/SteamWebAPI2/AutoMapperConfiguration.cs @@ -20,7 +20,6 @@ using SteamWebAPI2.Utilities; using System; using System.Collections.Generic; -using System.Collections.ObjectModel; using System.Linq; namespace SteamWebAPI2 @@ -88,7 +87,6 @@ public static void Initialize() CreateSteamWebResponseMap>(x); CreateSteamWebResponseMap>(x); CreateSteamWebResponseMap(x); - //CreateSteamWebResponseMap(x); CreateSteamWebResponseMap(x); CreateSteamWebResponseMap(x); CreateSteamWebResponseMap(x); diff --git a/src/SteamWebAPI2/Interfaces/CSGOServers.cs b/src/SteamWebAPI2/Interfaces/CSGOServers.cs index 7986ba1..d92dbc6 100644 --- a/src/SteamWebAPI2/Interfaces/CSGOServers.cs +++ b/src/SteamWebAPI2/Interfaces/CSGOServers.cs @@ -16,10 +16,10 @@ public class CSGOServers : ICSGOServers /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public CSGOServers(string steamWebApiKey, ISteamWebInterface steamWebInterface = null) + public CSGOServers(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null - ? new SteamWebInterface(steamWebApiKey, "ICSGOServers_730") + ? new SteamWebInterface("ICSGOServers_730", steamWebRequest) : steamWebInterface; } diff --git a/src/SteamWebAPI2/Interfaces/DOTA2Econ.cs b/src/SteamWebAPI2/Interfaces/DOTA2Econ.cs index ea2b76b..e0eb051 100644 --- a/src/SteamWebAPI2/Interfaces/DOTA2Econ.cs +++ b/src/SteamWebAPI2/Interfaces/DOTA2Econ.cs @@ -19,10 +19,10 @@ public class DOTA2Econ : IDOTA2Econ /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public DOTA2Econ(string steamWebApiKey, ISteamWebInterface steamWebInterface = null) + public DOTA2Econ(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null - ? new SteamWebInterface(steamWebApiKey, "IEconDOTA2_570") + ? new SteamWebInterface("IEconDOTA2_570", steamWebRequest) : steamWebInterface; } diff --git a/src/SteamWebAPI2/Interfaces/DOTA2Fantasy.cs b/src/SteamWebAPI2/Interfaces/DOTA2Fantasy.cs index 6648ee9..0b6acb7 100644 --- a/src/SteamWebAPI2/Interfaces/DOTA2Fantasy.cs +++ b/src/SteamWebAPI2/Interfaces/DOTA2Fantasy.cs @@ -14,10 +14,10 @@ public class DOTA2Fantasy : IDOTA2Fantasy /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public DOTA2Fantasy(string steamWebApiKey, ISteamWebInterface steamWebInterface = null) + public DOTA2Fantasy(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null - ? new SteamWebInterface(steamWebApiKey, "IDOTA2Fantasy_570") + ? new SteamWebInterface("IDOTA2Fantasy_570", steamWebRequest) : steamWebInterface; } diff --git a/src/SteamWebAPI2/Interfaces/DOTA2Match.cs b/src/SteamWebAPI2/Interfaces/DOTA2Match.cs index 8a4fe0b..fa4f9bc 100644 --- a/src/SteamWebAPI2/Interfaces/DOTA2Match.cs +++ b/src/SteamWebAPI2/Interfaces/DOTA2Match.cs @@ -16,10 +16,10 @@ public class DOTA2Match : IDOTA2Match /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public DOTA2Match(string steamWebApiKey, ISteamWebInterface steamWebInterface = null) + public DOTA2Match(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null - ? new SteamWebInterface(steamWebApiKey, "IDOTA2Match_570") + ? new SteamWebInterface("IDOTA2Match_570", steamWebRequest) : steamWebInterface; } diff --git a/src/SteamWebAPI2/Interfaces/DOTA2Ticket.cs b/src/SteamWebAPI2/Interfaces/DOTA2Ticket.cs index 9c1b647..5e2140e 100644 --- a/src/SteamWebAPI2/Interfaces/DOTA2Ticket.cs +++ b/src/SteamWebAPI2/Interfaces/DOTA2Ticket.cs @@ -9,11 +9,11 @@ public class DOTA2Ticket : IDOTA2Ticket /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// - /// - public DOTA2Ticket(string steamWebApiKey, ISteamWebInterface steamWebInterface = null) + /// + public DOTA2Ticket(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null - ? new SteamWebInterface(steamWebApiKey, "IDOTA2Ticket_570") + ? new SteamWebInterface("IDOTA2Ticket_570", steamWebRequest) : steamWebInterface; } } diff --git a/src/SteamWebAPI2/Interfaces/EconItems.cs b/src/SteamWebAPI2/Interfaces/EconItems.cs index f62d88c..413dd07 100644 --- a/src/SteamWebAPI2/Interfaces/EconItems.cs +++ b/src/SteamWebAPI2/Interfaces/EconItems.cs @@ -36,8 +36,8 @@ public class EconItems : IEconItems /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// - /// - public EconItems(string steamWebApiKey, EconItemsAppId appId, ISteamWebInterface steamWebInterface = null) + /// + public EconItems(ISteamWebRequest steamWebRequest, EconItemsAppId appId, ISteamWebInterface steamWebInterface = null) { if (appId <= 0) { @@ -45,7 +45,7 @@ public EconItems(string steamWebApiKey, EconItemsAppId appId, ISteamWebInterface } this.steamWebInterface = steamWebInterface == null - ? new SteamWebInterface(steamWebApiKey, "IEconItems_" + (uint)appId) + ? new SteamWebInterface("IEconItems_" + (uint)appId, steamWebRequest) : steamWebInterface; this.appId = (uint)appId; diff --git a/src/SteamWebAPI2/Interfaces/EconService.cs b/src/SteamWebAPI2/Interfaces/EconService.cs index e4c89d2..29541a7 100644 --- a/src/SteamWebAPI2/Interfaces/EconService.cs +++ b/src/SteamWebAPI2/Interfaces/EconService.cs @@ -12,11 +12,11 @@ public class EconService : IEconService /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// - /// - public EconService(string steamWebApiKey, ISteamWebInterface steamWebInterface = null) + /// + public EconService(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null - ? new SteamWebInterface(steamWebApiKey, "IEconService") + ? new SteamWebInterface("IEconService", steamWebRequest) : steamWebInterface; } diff --git a/src/SteamWebAPI2/Interfaces/GCVersion.cs b/src/SteamWebAPI2/Interfaces/GCVersion.cs index fe745cf..c4c152b 100644 --- a/src/SteamWebAPI2/Interfaces/GCVersion.cs +++ b/src/SteamWebAPI2/Interfaces/GCVersion.cs @@ -29,11 +29,11 @@ public class GCVersion : IGCVersion /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// - /// - public GCVersion(string steamWebApiKey, GCVersionAppId appId, ISteamWebInterface steamWebInterface = null) + /// + public GCVersion(ISteamWebRequest steamWebRequest, GCVersionAppId appId, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null - ? new SteamWebInterface(steamWebApiKey, "IGCVersion_" + (uint)appId) + ? new SteamWebInterface("IGCVersion_" + (uint)appId, steamWebRequest) : steamWebInterface; if (appId <= 0) diff --git a/src/SteamWebAPI2/Interfaces/GameServersService.cs b/src/SteamWebAPI2/Interfaces/GameServersService.cs index 391b605..1a81c10 100644 --- a/src/SteamWebAPI2/Interfaces/GameServersService.cs +++ b/src/SteamWebAPI2/Interfaces/GameServersService.cs @@ -11,11 +11,11 @@ public class GameServersService : IGameServersService /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// - /// - public GameServersService(string steamWebApiKey, ISteamWebInterface steamWebInterface = null) + /// + public GameServersService(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null - ? new SteamWebInterface(steamWebApiKey, "IGameServersService") + ? new SteamWebInterface("IGameServersService", steamWebRequest) : steamWebInterface; } diff --git a/src/SteamWebAPI2/Interfaces/PlayerService.cs b/src/SteamWebAPI2/Interfaces/PlayerService.cs index f5d5c2b..2a1befd 100644 --- a/src/SteamWebAPI2/Interfaces/PlayerService.cs +++ b/src/SteamWebAPI2/Interfaces/PlayerService.cs @@ -17,11 +17,11 @@ public class PlayerService : IPlayerService /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// - /// - public PlayerService(string steamWebApiKey, ISteamWebInterface steamWebInterface = null) + /// + public PlayerService(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null - ? new SteamWebInterface(steamWebApiKey, "IPlayerService") + ? new SteamWebInterface("IPlayerService", steamWebRequest) : steamWebInterface; } diff --git a/src/SteamWebAPI2/Interfaces/SteamApps.cs b/src/SteamWebAPI2/Interfaces/SteamApps.cs index 2e8b325..b5a859a 100644 --- a/src/SteamWebAPI2/Interfaces/SteamApps.cs +++ b/src/SteamWebAPI2/Interfaces/SteamApps.cs @@ -14,11 +14,11 @@ public class SteamApps : ISteamApps /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// - /// - public SteamApps(string steamWebApiKey, ISteamWebInterface steamWebInterface = null) + /// + public SteamApps(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null - ? new SteamWebInterface(steamWebApiKey, "ISteamApps") + ? new SteamWebInterface("ISteamApps", steamWebRequest) : steamWebInterface; } diff --git a/src/SteamWebAPI2/Interfaces/SteamEconomy.cs b/src/SteamWebAPI2/Interfaces/SteamEconomy.cs index bac125f..894c0b6 100644 --- a/src/SteamWebAPI2/Interfaces/SteamEconomy.cs +++ b/src/SteamWebAPI2/Interfaces/SteamEconomy.cs @@ -15,10 +15,10 @@ public class SteamEconomy : ISteamEconomy /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public SteamEconomy(string steamWebApiKey, ISteamWebInterface steamWebInterface = null) + public SteamEconomy(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null - ? new SteamWebInterface(steamWebApiKey, "ISteamEconomy") + ? new SteamWebInterface("ISteamEconomy", steamWebRequest) : steamWebInterface; } diff --git a/src/SteamWebAPI2/Interfaces/SteamNews.cs b/src/SteamWebAPI2/Interfaces/SteamNews.cs index cb5ae15..7ba2ec2 100644 --- a/src/SteamWebAPI2/Interfaces/SteamNews.cs +++ b/src/SteamWebAPI2/Interfaces/SteamNews.cs @@ -14,11 +14,11 @@ public class SteamNews : ISteamNews /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// - /// - public SteamNews(string steamWebApiKey, ISteamWebInterface steamWebInterface = null) + /// + public SteamNews(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null - ? new SteamWebInterface(steamWebApiKey, "ISteamNews") + ? new SteamWebInterface("ISteamNews", steamWebRequest) : steamWebInterface; } diff --git a/src/SteamWebAPI2/Interfaces/SteamRemoteStorage.cs b/src/SteamWebAPI2/Interfaces/SteamRemoteStorage.cs index a6188b0..812b0d6 100644 --- a/src/SteamWebAPI2/Interfaces/SteamRemoteStorage.cs +++ b/src/SteamWebAPI2/Interfaces/SteamRemoteStorage.cs @@ -17,11 +17,11 @@ public class SteamRemoteStorage : ISteamRemoteStorage /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// - /// - public SteamRemoteStorage(string steamWebApiKey, ISteamWebInterface steamWebInterface = null) + /// + public SteamRemoteStorage(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null - ? new SteamWebInterface(steamWebApiKey, "ISteamRemoteStorage") + ? new SteamWebInterface("ISteamRemoteStorage", steamWebRequest) : steamWebInterface; } diff --git a/src/SteamWebAPI2/Interfaces/SteamUser.cs b/src/SteamWebAPI2/Interfaces/SteamUser.cs index e84b0d2..c85b8bd 100644 --- a/src/SteamWebAPI2/Interfaces/SteamUser.cs +++ b/src/SteamWebAPI2/Interfaces/SteamUser.cs @@ -21,11 +21,11 @@ public class SteamUser : ISteamUser /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// - /// - public SteamUser(string steamWebApiKey, ISteamWebInterface steamWebInterface = null) + /// + public SteamUser(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null - ? new SteamWebInterface(steamWebApiKey, "ISteamUser") + ? new SteamWebInterface("ISteamUser", steamWebRequest) : steamWebInterface; } diff --git a/src/SteamWebAPI2/Interfaces/SteamUserAuth.cs b/src/SteamWebAPI2/Interfaces/SteamUserAuth.cs index 17cc185..c3f7eb5 100644 --- a/src/SteamWebAPI2/Interfaces/SteamUserAuth.cs +++ b/src/SteamWebAPI2/Interfaces/SteamUserAuth.cs @@ -11,11 +11,11 @@ public class SteamUserAuth : ISteamUserAuth /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// - /// - public SteamUserAuth(string steamWebApiKey, ISteamWebInterface steamWebInterface = null) + /// + public SteamUserAuth(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null - ? new SteamWebInterface(steamWebApiKey, "ISteamUserAuth") + ? new SteamWebInterface("ISteamUserAuth", steamWebRequest) : steamWebInterface; } diff --git a/src/SteamWebAPI2/Interfaces/SteamUserStats.cs b/src/SteamWebAPI2/Interfaces/SteamUserStats.cs index 3d36f40..375c0d7 100644 --- a/src/SteamWebAPI2/Interfaces/SteamUserStats.cs +++ b/src/SteamWebAPI2/Interfaces/SteamUserStats.cs @@ -19,11 +19,11 @@ public class SteamUserStats : ISteamUserStats /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// - /// - public SteamUserStats(string steamWebApiKey, ISteamWebInterface steamWebInterface = null) + /// + public SteamUserStats(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null - ? new SteamWebInterface(steamWebApiKey, "ISteamUserStats") + ? new SteamWebInterface("ISteamUserStats", steamWebRequest) : steamWebInterface; } diff --git a/src/SteamWebAPI2/Interfaces/SteamWebAPIUtil.cs b/src/SteamWebAPI2/Interfaces/SteamWebAPIUtil.cs index 84cd468..cd88e8e 100644 --- a/src/SteamWebAPI2/Interfaces/SteamWebAPIUtil.cs +++ b/src/SteamWebAPI2/Interfaces/SteamWebAPIUtil.cs @@ -14,11 +14,11 @@ public class SteamWebAPIUtil : ISteamWebAPIUtil /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// - /// - public SteamWebAPIUtil(string steamWebApiKey, ISteamWebInterface steamWebInterface = null) + /// + public SteamWebAPIUtil(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null - ? new SteamWebInterface(steamWebApiKey, "ISteamWebAPIUtil") + ? new SteamWebInterface("ISteamWebAPIUtil", steamWebRequest) : steamWebInterface; } diff --git a/src/SteamWebAPI2/Interfaces/TFItems.cs b/src/SteamWebAPI2/Interfaces/TFItems.cs index 983e0c1..e6429d3 100644 --- a/src/SteamWebAPI2/Interfaces/TFItems.cs +++ b/src/SteamWebAPI2/Interfaces/TFItems.cs @@ -14,11 +14,11 @@ public class TFItems : ITFItems /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// - /// - public TFItems(string steamWebApiKey, ISteamWebInterface steamWebInterface = null) + /// + public TFItems(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null - ? new SteamWebInterface(steamWebApiKey, "ITFItems_440") + ? new SteamWebInterface("ITFItems_440", steamWebRequest) : steamWebInterface; } diff --git a/src/SteamWebAPI2/Models/SteamId.cs b/src/SteamWebAPI2/Models/SteamId.cs index ab8e0a4..88344d1 100644 --- a/src/SteamWebAPI2/Models/SteamId.cs +++ b/src/SteamWebAPI2/Models/SteamId.cs @@ -1,5 +1,6 @@ using SteamWebAPI2.Exceptions; using SteamWebAPI2.Interfaces; +using SteamWebAPI2.Utilities; using System; using System.Runtime.ExceptionServices; using System.Text.RegularExpressions; @@ -187,8 +188,8 @@ public SteamId(ulong steamId64) /// to receive a return value from this method in the event that the Steam Web API is required. /// /// Value to parse, can be a 64-bit Steam ID, a full Steam Community Profile URL, or the user's Steam Community Profile Name. - /// Required in the event that the Steam Web API is needed to resolve a Profile URL to a 64-bit Steam ID. - public SteamId(string value, string steamWebApiKey = "") + /// Required in the event that the Steam Web API is needed to resolve a Profile URL to a 64-bit Steam ID. + public SteamId(string value, ISteamWebRequest steamWebRequest) { if (String.IsNullOrEmpty(value)) { @@ -241,7 +242,7 @@ public SteamId(string value, string steamWebApiKey = "") bool isUri = Uri.TryCreate(value, UriKind.Absolute, out uriResult) && (uriResult.Scheme == "http" || uriResult.Scheme == "https"); - SteamUser steamUser = new SteamUser(steamWebApiKey); + SteamUser steamUser = new SteamUser(steamWebRequest); try { @@ -261,11 +262,6 @@ public SteamId(string value, string steamWebApiKey = "") // the third segment isn't a 64-bit Steam ID, check if it's a profile name which resolves to a 64-bit Steam ID if (!isSteamId64) { - if (String.IsNullOrEmpty(steamWebApiKey)) - { - throw new InvalidOperationException(ErrorMessages.SteamWebApiKeyNotProvided); - } - steamId = await ResolveSteamIdFromValueAsync(steamUser, profileId); } @@ -280,11 +276,6 @@ public SteamId(string value, string steamWebApiKey = "") } else { - if (String.IsNullOrEmpty(steamWebApiKey)) - { - throw new InvalidOperationException(ErrorMessages.SteamWebApiKeyNotProvided); - } - // not a 64-bit Steam ID and not a uri, try to just resolve it as if it was a Steam Community Profile Name steamId = await ResolveSteamIdFromValueAsync(steamUser, value); diff --git a/src/SteamWebAPI2/SteamStoreInterface.cs b/src/SteamWebAPI2/SteamStoreInterface.cs index e707033..cf3d373 100644 --- a/src/SteamWebAPI2/SteamStoreInterface.cs +++ b/src/SteamWebAPI2/SteamStoreInterface.cs @@ -15,8 +15,7 @@ public abstract class SteamStoreInterface { private const string steamStoreApiBaseUrl = "http://store.steampowered.com/api/"; private readonly SteamStoreRequest steamStoreRequest; - private readonly string endpointName; - + /// /// Constructs and maps the default objects for Steam Store Web API use /// diff --git a/src/SteamWebAPI2/SteamStoreRequest.cs b/src/SteamWebAPI2/SteamStoreRequest.cs index 148947e..9e6f667 100644 --- a/src/SteamWebAPI2/SteamStoreRequest.cs +++ b/src/SteamWebAPI2/SteamStoreRequest.cs @@ -3,9 +3,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; -using System.Linq; using System.Net.Http; -using System.Text; using System.Threading.Tasks; namespace SteamWebAPI2 diff --git a/src/SteamWebAPI2/Utilities/SteamWebHttpClient.cs b/src/SteamWebAPI2/Utilities/SteamWebHttpClient.cs index 3823eae..46d5c89 100644 --- a/src/SteamWebAPI2/Utilities/SteamWebHttpClient.cs +++ b/src/SteamWebAPI2/Utilities/SteamWebHttpClient.cs @@ -11,6 +11,13 @@ namespace SteamWebAPI2.Utilities /// internal class SteamWebHttpClient : ISteamWebHttpClient { + private HttpClient httpClient; + + public SteamWebHttpClient(HttpClient httpClient) + { + this.httpClient = httpClient; + } + /// /// Performs an HTTP GET with the passed URL command. /// @@ -20,8 +27,6 @@ public async Task GetAsync(string command) { Debug.Assert(!String.IsNullOrWhiteSpace(command)); - HttpClient httpClient = new HttpClient(); - var response = await httpClient.GetAsync(command); response.EnsureSuccessStatusCode(); @@ -44,8 +49,6 @@ public async Task PostAsync(string command, HttpContent con { Debug.Assert(!String.IsNullOrWhiteSpace(command)); - HttpClient httpClient = new HttpClient(); - var response = await httpClient.PostAsync(command, content); response.EnsureSuccessStatusCode(); diff --git a/src/SteamWebAPI2/Utilities/SteamWebInterface.cs b/src/SteamWebAPI2/Utilities/SteamWebInterface.cs index 6d55847..ea418da 100644 --- a/src/SteamWebAPI2/Utilities/SteamWebInterface.cs +++ b/src/SteamWebAPI2/Utilities/SteamWebInterface.cs @@ -11,7 +11,7 @@ namespace SteamWebAPI2.Utilities /// internal sealed class SteamWebInterface : ISteamWebInterface { - private const string steamWebApiBaseUrl = "https://api.steampowered.com/"; + private readonly string steamWebApiBaseUrl = "https://api.steampowered.com/"; private readonly ISteamWebRequest steamWebRequest; private readonly string interfaceName; @@ -21,20 +21,20 @@ internal sealed class SteamWebInterface : ISteamWebInterface /// Steam Web API key (secret to each developer) /// Name for this web interface (such as "IDOTA2Match_570). Must match the Steam Web API interface name exactly as this value /// is used to construct the URL to perform the GET or POST. - public SteamWebInterface(string steamWebApiKey, string interfaceName, ISteamWebRequest steamWebRequest = null) + public SteamWebInterface(string interfaceName, ISteamWebRequest steamWebRequest) { - if (String.IsNullOrWhiteSpace(steamWebApiKey)) + if (String.IsNullOrWhiteSpace(interfaceName)) { - throw new ArgumentNullException("steamWebApiKey"); + throw new ArgumentNullException(nameof(interfaceName)); + } + + if (steamWebRequest == null) + { + throw new ArgumentNullException(nameof(steamWebRequest)); } - - Debug.Assert(!String.IsNullOrWhiteSpace(interfaceName)); this.interfaceName = interfaceName; - - this.steamWebRequest = steamWebRequest == null - ? new SteamWebRequest(steamWebApiBaseUrl, steamWebApiKey) - : steamWebRequest; + this.steamWebRequest = steamWebRequest; AutoMapperConfiguration.Initialize(); } @@ -46,22 +46,15 @@ public SteamWebInterface(string steamWebApiKey, string interfaceName, ISteamWebR /// Steam Web API key (secret to each developer) /// Name for this web interface (such as "IDOTA2Match_570). Must match the Steam Web API interface name exactly as this value /// is used to construct the URL to perform the GET or POST. - public SteamWebInterface(string steamWebApiBaseUrl, string steamWebApiKey, string interfaceName, ISteamWebRequest steamWebRequest = null) + public SteamWebInterface(string steamWebApiBaseUrl, string interfaceName, ISteamWebRequest steamWebRequest) + : this(interfaceName, steamWebRequest) { - if (String.IsNullOrWhiteSpace(steamWebApiKey)) + if (String.IsNullOrWhiteSpace(steamWebApiBaseUrl)) { - throw new ArgumentNullException("steamWebApiKey"); + throw new ArgumentNullException(nameof(steamWebApiBaseUrl)); } - - Debug.Assert(!String.IsNullOrWhiteSpace(interfaceName)); - - this.interfaceName = interfaceName; - - this.steamWebRequest = steamWebRequest == null - ? new SteamWebRequest(steamWebApiBaseUrl, steamWebApiKey) - : steamWebRequest; - - AutoMapperConfiguration.Initialize(); + + this.steamWebApiBaseUrl = steamWebApiBaseUrl; } /// diff --git a/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs b/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs new file mode 100644 index 0000000..75e85c9 --- /dev/null +++ b/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs @@ -0,0 +1,51 @@ +using System; +using System.Net.Http; +using SteamWebAPI2.Interfaces; + +namespace SteamWebAPI2.Utilities +{ + public class SteamWebInterfaceFactory + { + private readonly string steamWebApiBaseUrl = "https://api.steampowered.com/"; + private string steamWebApiKey; + + /// + /// Factory to create web interface objects to communicate with Steam Web API + /// + /// Unique Steam Web API key issued to you (do not share this with anyone!) + /// Base URL of the Steam Web API (optional) + public SteamWebInterfaceFactory(string steamWebApiKey, string steamWebApiBaseUrl = null) + { + if(string.IsNullOrWhiteSpace(steamWebApiKey)) + { + throw new ArgumentNullException(nameof(steamWebApiKey)); + } + + this.steamWebApiKey = steamWebApiKey; + + if(!string.IsNullOrWhiteSpace(steamWebApiBaseUrl)) + { + this.steamWebApiBaseUrl = steamWebApiBaseUrl; + } + } + + /// + /// Creates a web interface object connected to a specific Steam Web API interfac endpoint + /// + /// Custom http client injected with your customization (if necessary) + /// Type of the web interface to create + /// Instance of the web interface + public T CreateSteamWebInterface(HttpClient httpClient) + { + var steamWebRequest = CreateSteamWebRequest(httpClient); + return (T)Activator.CreateInstance(typeof(T), steamWebRequest, null); + } + + private ISteamWebRequest CreateSteamWebRequest(HttpClient httpClient) + { + SteamWebHttpClient steamWebHttpClient = new SteamWebHttpClient(httpClient); + return new SteamWebRequest(steamWebApiBaseUrl, steamWebApiKey, steamWebHttpClient); + } + + } +} \ No newline at end of file diff --git a/src/SteamWebAPI2/Utilities/SteamWebRequest.cs b/src/SteamWebAPI2/Utilities/SteamWebRequest.cs index 4e148e7..9d2a86c 100644 --- a/src/SteamWebAPI2/Utilities/SteamWebRequest.cs +++ b/src/SteamWebAPI2/Utilities/SteamWebRequest.cs @@ -24,30 +24,34 @@ internal class SteamWebRequest : ISteamWebRequest { private string steamWebApiBaseUrl; private readonly string steamWebApiKey; - private ISteamWebHttpClient httpClient; + private ISteamWebHttpClient steamWebHttpClient; /// /// Every web request requires a secret Steam Web API key /// /// Base URL for the API (such as http://api.steampowered.com) /// Secret Steam Web API key provided at the Valve developer website - /// Optional custom http client implementation for dependency injection - public SteamWebRequest(string steamWebApiBaseUrl, string steamWebApiKey, ISteamWebHttpClient httpClient = null) + /// Optional custom http client implementation for dependency injection + public SteamWebRequest(string steamWebApiBaseUrl, string steamWebApiKey, ISteamWebHttpClient steamWebHttpClient) { - this.httpClient = httpClient == null ? new SteamWebHttpClient() : httpClient; - if (String.IsNullOrWhiteSpace(steamWebApiBaseUrl)) { - throw new ArgumentNullException("steamWebApiBaseUrl"); + throw new ArgumentNullException(nameof(steamWebApiBaseUrl)); } if (String.IsNullOrWhiteSpace(steamWebApiKey)) { - throw new ArgumentNullException("steamWebApiKey"); + throw new ArgumentNullException(nameof(steamWebApiKey)); + } + + if(steamWebHttpClient == null) + { + throw new ArgumentNullException(nameof(steamWebHttpClient)); } this.steamWebApiBaseUrl = steamWebApiBaseUrl; this.steamWebApiKey = steamWebApiKey; + this.steamWebHttpClient = steamWebHttpClient; } /// @@ -115,7 +119,7 @@ private async Task> SendWebRequestAsync(HttpMethod httpM { string command = BuildRequestCommand(interfaceName, methodName, methodVersion, parameters); - httpResponse = await httpClient.GetAsync(command).ConfigureAwait(false); + httpResponse = await steamWebHttpClient.GetAsync(command).ConfigureAwait(false); } else if (httpMethod == HttpMethod.POST) { @@ -125,7 +129,7 @@ private async Task> SendWebRequestAsync(HttpMethod httpM // Instead, parameters are passed through this container. FormUrlEncodedContent content = BuildRequestContent(parameters); - httpResponse = await httpClient.PostAsync(command, content).ConfigureAwait(false); + httpResponse = await steamWebHttpClient.PostAsync(command, content).ConfigureAwait(false); } var headers = httpResponse.Content?.Headers; From 75466d837ad4cc81553fa8128f9997a172b039c9 Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Mon, 12 Aug 2019 12:00:25 -0400 Subject: [PATCH 002/107] Rolled version --- src/SteamWebAPI2/SteamWebAPI2.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index 49841d9..651825c 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -2,7 +2,7 @@ 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. - 4.0.8 + 4.0.9 Justin Skiles SteamWebAPI2 SteamWebAPI2 From eb4dd3c58884011e486e2e664b0e0c1aee7520d8 Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Mon, 12 Aug 2019 13:26:55 -0400 Subject: [PATCH 003/107] Update appveyor.yml Updated API key --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 02981e3..ca426d2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -36,7 +36,7 @@ deploy: - provider: NuGet name: production api_key: - secure: vIHuOdB4aYJEqNACb3jjCg3m/qZLqpwYlruu8J0BOiX81lRrmussVEUqiWRBTrRQ + secure: 30KN4qmkCGCJfgASQdhJtWf4BjY9GM7dGuGRi9gQRnJreQPiXFzvreBHYwPjQ4YN on: branch: master - appveyor_repo_tag: true \ No newline at end of file + appveyor_repo_tag: true From 5ae81a810d8fb556908eeb2aa06779ca0de18008 Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Fri, 18 Oct 2019 17:12:29 -0400 Subject: [PATCH 004/107] Update samples based on interface factory --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 35a4370..f12b44e 100644 --- a/README.md +++ b/README.md @@ -57,8 +57,12 @@ Each method returns a SteamWebResponse object which contains the following: ## Sample Usage ```cs +// factory to be used to generate various web interfaces +var webInterfaceFactory = new SteamWebInterfaceFactory(); + // this will map to the ISteamUser endpoint -var steamInterface = new SteamUser(""); +// note that you have full control over HttpClient lifecycle here +var steamInterface = webInterfaceFactory.CreateSteamWebInterface(new HttpClient()); // this will map to ISteamUser/GetPlayerSummaries method in the Steam Web API // see PlayerSummaryResultContainer.cs for response documentation From b19a23c0ab77e16b86f7dde1b053714f58255113 Mon Sep 17 00:00:00 2001 From: Michael Peppler Date: Sat, 9 Nov 2019 18:41:09 -0500 Subject: [PATCH 005/107] add price overview to app details data --- src/SteamWebAPI2/AutoMapperConfiguration.cs | 3 ++- .../Models/SteamStore/AppDetailsContainer.cs | 26 ++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/SteamWebAPI2/AutoMapperConfiguration.cs b/src/SteamWebAPI2/AutoMapperConfiguration.cs index b853856..a4e9a7c 100644 --- a/src/SteamWebAPI2/AutoMapperConfiguration.cs +++ b/src/SteamWebAPI2/AutoMapperConfiguration.cs @@ -579,6 +579,7 @@ public static void Initialize() x.CreateMap(); x.CreateMap(); x.CreateMap(); + x.CreateMap(); x.CreateMap(); x.CreateMap(); @@ -658,4 +659,4 @@ public static void Reset() mapper = null; } } -} \ No newline at end of file +} diff --git a/src/SteamWebAPI2/Models/SteamStore/AppDetailsContainer.cs b/src/SteamWebAPI2/Models/SteamStore/AppDetailsContainer.cs index d28e288..12934b4 100644 --- a/src/SteamWebAPI2/Models/SteamStore/AppDetailsContainer.cs +++ b/src/SteamWebAPI2/Models/SteamStore/AppDetailsContainer.cs @@ -159,6 +159,27 @@ internal class SupportInfo public string Email { get; set; } } + internal class Price + { + [JsonProperty("currency")] + public string Currency { get; set; } + + [JsonProperty("initial")] + public uint Initial { get; set; } + + [JsonProperty("final")] + public uint Final { get; set; } + + [JsonProperty("discount_percent")] + public uint DiscountPercent { get; set; } + + [JsonProperty("initial_formatted")] + public string InitialFormatted { get; set; } + + [JsonProperty("final_formatted")] + public string FinalFormatted { get; set; } + } + internal class Data { [JsonProperty("type")] @@ -206,6 +227,9 @@ internal class Data [JsonProperty("developers")] public string[] Developers { get; set; } + [JsonProperty("price_overview")] + public Price PriceOverview { get; set; } + [JsonProperty("publishers")] public string[] Publishers { get; set; } @@ -255,4 +279,4 @@ internal class AppDetailsContainer [JsonProperty("data")] public Data Data { get; set; } } -} \ No newline at end of file +} From 3cdbc336f647d04d45ecd5ddfbd6a6c7d84e4bd0 Mon Sep 17 00:00:00 2001 From: Michael Peppler Date: Sat, 9 Nov 2019 17:34:29 -0500 Subject: [PATCH 006/107] add short description to app details data --- src/SteamWebAPI2/Models/SteamStore/AppDetailsContainer.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/SteamWebAPI2/Models/SteamStore/AppDetailsContainer.cs b/src/SteamWebAPI2/Models/SteamStore/AppDetailsContainer.cs index 12934b4..68d9889 100644 --- a/src/SteamWebAPI2/Models/SteamStore/AppDetailsContainer.cs +++ b/src/SteamWebAPI2/Models/SteamStore/AppDetailsContainer.cs @@ -206,6 +206,9 @@ internal class Data [JsonProperty("about_the_game")] public string AboutTheGame { get; set; } + [JsonProperty("short_description")] + public string ShortDescription { get; set; } + [JsonProperty("supported_languages")] public string SupportedLanguages { get; set; } From 4e164e7b61bdd836a7a90e10b844b172bb2d0c8b Mon Sep 17 00:00:00 2001 From: Justin Date: Thu, 21 Nov 2019 20:31:49 -0500 Subject: [PATCH 007/107] Fixed data type on match sequence number. Roll version. --- src/SteamWebAPI2/Models/DOTA2/MatchDetailResultContainer.cs | 2 +- src/SteamWebAPI2/Models/DOTA2/MatchHistoryResultContainer.cs | 2 +- src/SteamWebAPI2/SteamWebAPI2.csproj | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SteamWebAPI2/Models/DOTA2/MatchDetailResultContainer.cs b/src/SteamWebAPI2/Models/DOTA2/MatchDetailResultContainer.cs index 759911a..17f8ef4 100644 --- a/src/SteamWebAPI2/Models/DOTA2/MatchDetailResultContainer.cs +++ b/src/SteamWebAPI2/Models/DOTA2/MatchDetailResultContainer.cs @@ -105,7 +105,7 @@ internal class MatchDetailResult public ulong MatchId { get; set; } [JsonProperty(PropertyName = "match_seq_num")] - public uint MatchSequenceNumber { get; set; } + public ulong MatchSequenceNumber { get; set; } [JsonProperty(PropertyName = "tower_status_radiant")] public uint TowerStatusRadiant { get; set; } diff --git a/src/SteamWebAPI2/Models/DOTA2/MatchHistoryResultContainer.cs b/src/SteamWebAPI2/Models/DOTA2/MatchHistoryResultContainer.cs index 7afc0f2..7c1204e 100644 --- a/src/SteamWebAPI2/Models/DOTA2/MatchHistoryResultContainer.cs +++ b/src/SteamWebAPI2/Models/DOTA2/MatchHistoryResultContainer.cs @@ -11,7 +11,7 @@ internal class MatchHistoryMatch public ulong MatchId { get; set; } [JsonProperty(PropertyName = "match_seq_num")] - public uint MatchSequenceNumber { get; set; } + public ulong MatchSequenceNumber { get; set; } [JsonProperty(PropertyName = "start_time")] [JsonConverter(typeof(UnixTimeJsonConverter))] diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index 651825c..f5c403d 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -2,7 +2,7 @@ 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. - 4.0.9 + 4.0.10 Justin Skiles SteamWebAPI2 SteamWebAPI2 @@ -14,7 +14,7 @@ - + From 608348c805535cf3c58b031c01a48db2d58e74c6 Mon Sep 17 00:00:00 2001 From: Justin Date: Thu, 21 Nov 2019 20:38:37 -0500 Subject: [PATCH 008/107] Roll version. --- src/SteamWebAPI2/SteamWebAPI2.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index f5c403d..0a917a2 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -2,7 +2,7 @@ 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. - 4.0.10 + 4.0.11 Justin Skiles SteamWebAPI2 SteamWebAPI2 From 73eaa5aeda05fa6d067ed97b4113dad8c8dd958f Mon Sep 17 00:00:00 2001 From: Justin Date: Thu, 21 Nov 2019 20:44:14 -0500 Subject: [PATCH 009/107] Rolled version. --- src/SteamWebAPI2/SteamWebAPI2.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index 0a917a2..8d6cff6 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -2,7 +2,7 @@ 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. - 4.0.11 + 4.0.12 Justin Skiles SteamWebAPI2 SteamWebAPI2 From f69db4e77fb94d69277deb9088e73b29af3d3584 Mon Sep 17 00:00:00 2001 From: Michael Peppler Date: Fri, 22 Nov 2019 13:42:44 -0500 Subject: [PATCH 010/107] update Steam.Models nuget package to 3.0.10 --- src/SteamWebAPI2/SteamWebAPI2.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index 651825c..a2b1162 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -14,7 +14,7 @@ - + From 24af4e67a83b6a3f11c11eb6c3eb2cb639aa9324 Mon Sep 17 00:00:00 2001 From: Michael Peppler Date: Tue, 3 Dec 2019 09:45:03 -0500 Subject: [PATCH 011/107] allow injecting custom httpclient to steamstore --- src/SteamWebAPI2/Interfaces/SteamStore.cs | 11 ++++++++- src/SteamWebAPI2/SteamStoreInterface.cs | 28 ++++++++++++++++++++--- src/SteamWebAPI2/SteamStoreRequest.cs | 18 ++++++++++++--- 3 files changed, 50 insertions(+), 7 deletions(-) diff --git a/src/SteamWebAPI2/Interfaces/SteamStore.cs b/src/SteamWebAPI2/Interfaces/SteamStore.cs index 207562d..5973b5f 100644 --- a/src/SteamWebAPI2/Interfaces/SteamStore.cs +++ b/src/SteamWebAPI2/Interfaces/SteamStore.cs @@ -2,12 +2,21 @@ using SteamWebAPI2.Models.SteamStore; using SteamWebAPI2.Utilities; using System.Collections.Generic; +using System.Net.Http; using System.Threading.Tasks; namespace SteamWebAPI2.Interfaces { public class SteamStore : SteamStoreInterface, ISteamStore { + public SteamStore() : base() + { + } + + public SteamStore(HttpClient httpClient) : base(httpClient) + { + } + /// /// Maps to the steam store api endpoint: GET http://store.steampowered.com/api/appdetails/ /// @@ -52,4 +61,4 @@ public async Task GetStoreFeaturedProductsAsync() return featuredProductsModel; } } -} \ No newline at end of file +} diff --git a/src/SteamWebAPI2/SteamStoreInterface.cs b/src/SteamWebAPI2/SteamStoreInterface.cs index cf3d373..a3d2777 100644 --- a/src/SteamWebAPI2/SteamStoreInterface.cs +++ b/src/SteamWebAPI2/SteamStoreInterface.cs @@ -2,8 +2,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; -using System.Linq; -using System.Text; +using System.Net.Http; using System.Threading.Tasks; namespace SteamWebAPI2 @@ -15,7 +14,7 @@ public abstract class SteamStoreInterface { private const string steamStoreApiBaseUrl = "http://store.steampowered.com/api/"; private readonly SteamStoreRequest steamStoreRequest; - + /// /// Constructs and maps the default objects for Steam Store Web API use /// @@ -26,6 +25,17 @@ public SteamStoreInterface() AutoMapperConfiguration.Initialize(); } + /// + /// Constructs and maps based on a custom http client + /// + /// Client to make requests with + public SteamStoreInterface(HttpClient httpClient) + { + this.steamStoreRequest = new SteamStoreRequest(steamStoreApiBaseUrl, httpClient); + + AutoMapperConfiguration.Initialize(); + } + /// /// Constructs and maps based on a custom Steam Store Web API URL /// @@ -37,6 +47,18 @@ public SteamStoreInterface(string steamStoreApiBaseUrl) AutoMapperConfiguration.Initialize(); } + /// + /// Constructs and maps based on a custom http client and custom Steam Store Web API URL + /// + /// Steam Store Web API URL + /// Client to make requests with + public SteamStoreInterface(string steamStoreApiBaseUrl, HttpClient httpClient) + { + this.steamStoreRequest = new SteamStoreRequest(steamStoreApiBaseUrl, httpClient); + + AutoMapperConfiguration.Initialize(); + } + /// /// Calls a endpoint on the constructed Web API with parameters /// diff --git a/src/SteamWebAPI2/SteamStoreRequest.cs b/src/SteamWebAPI2/SteamStoreRequest.cs index 9e6f667..f6166cd 100644 --- a/src/SteamWebAPI2/SteamStoreRequest.cs +++ b/src/SteamWebAPI2/SteamStoreRequest.cs @@ -14,6 +14,7 @@ namespace SteamWebAPI2 internal class SteamStoreRequest { private string steamStoreApiBaseUrl; + private readonly HttpClient httpClient; /// /// Constructs a Steam Store Web API request @@ -29,6 +30,17 @@ public SteamStoreRequest(string steamStoreApiBaseUrl) this.steamStoreApiBaseUrl = steamStoreApiBaseUrl; } + public SteamStoreRequest(string steamStoreApiBaseUrl, HttpClient httpClient) + { + if (String.IsNullOrEmpty(steamStoreApiBaseUrl)) + { + throw new ArgumentNullException("steamStoreApiBaseUrl"); + } + + this.steamStoreApiBaseUrl = steamStoreApiBaseUrl; + this.httpClient = httpClient; + } + /// /// Sends a request to a Steam Store Web API endpoint /// @@ -71,10 +83,10 @@ public async Task SendStoreRequestAsync(string endpointName, IList /// Command (method endpoint) to send to an interface /// HTTP response as a string without tabs and newlines - private static async Task GetHttpStringResponseAsync(string command) + private async Task GetHttpStringResponseAsync(string command) { - HttpClient httpClient = new HttpClient(); - string response = await httpClient.GetStringAsync(command); + HttpClient client = httpClient ?? new HttpClient(); + string response = await client.GetStringAsync(command); response = response.Replace("\n", ""); response = response.Replace("\t", ""); return response; From cb6702fe931dbdfc913e681764567e53dccbdbab Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Wed, 18 Dec 2019 14:20:28 -0500 Subject: [PATCH 012/107] Rolled version --- src/SteamWebAPI2/SteamWebAPI2.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index 8d6cff6..01ed121 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -2,7 +2,7 @@ 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. - 4.0.12 + 4.0.13 Justin Skiles SteamWebAPI2 SteamWebAPI2 From 742c956b74d3118c9e02f58a7f67f97788637017 Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Wed, 18 Dec 2019 15:12:23 -0500 Subject: [PATCH 013/107] Deprecating GetSchema in favor of GetSchemaItems and GetSchemaOverview. --- src/SteamWebAPI2/AutoMapperConfiguration.cs | 5 -- src/SteamWebAPI2/Interfaces/EconItems.cs | 26 +++--- src/SteamWebAPI2/Interfaces/IEconItems.cs | 4 +- .../GameEconomy/SchemaItemResultContainer.cs | 23 ++++++ .../SchemaOverviewResultContainer.cs | 35 ++++++++ .../GameEconomy/SchemaResultContainer.cs | 80 +++++-------------- .../Utilities/SteamWebInterfaceFactory.cs | 12 +++ 7 files changed, 102 insertions(+), 83 deletions(-) create mode 100644 src/SteamWebAPI2/Models/GameEconomy/SchemaItemResultContainer.cs create mode 100644 src/SteamWebAPI2/Models/GameEconomy/SchemaOverviewResultContainer.cs diff --git a/src/SteamWebAPI2/AutoMapperConfiguration.cs b/src/SteamWebAPI2/AutoMapperConfiguration.cs index a4e9a7c..27b298d 100644 --- a/src/SteamWebAPI2/AutoMapperConfiguration.cs +++ b/src/SteamWebAPI2/AutoMapperConfiguration.cs @@ -87,7 +87,6 @@ public static void Initialize() CreateSteamWebResponseMap>(x); CreateSteamWebResponseMap>(x); CreateSteamWebResponseMap(x); - CreateSteamWebResponseMap(x); CreateSteamWebResponseMap(x); CreateSteamWebResponseMap(x); CreateSteamWebResponseMap(x); @@ -139,7 +138,6 @@ public static void Initialize() x.CreateMap().ConvertUsing(src => src.Result != null ? src.Result.Path : null); - x.CreateMap(); x.CreateMap(); x.CreateMap(); x.CreateMap(); @@ -159,9 +157,6 @@ public static void Initialize() x.CreateMap(); x.CreateMap(); x.CreateMap(); - x.CreateMap().ConvertUsing( - src => Mapper.Map(src.Result) - ); // TODO: Rework the way Schema models are used for different games (TF2 / DOTA2) //x.CreateMap() diff --git a/src/SteamWebAPI2/Interfaces/EconItems.cs b/src/SteamWebAPI2/Interfaces/EconItems.cs index 413dd07..8edec42 100644 --- a/src/SteamWebAPI2/Interfaces/EconItems.cs +++ b/src/SteamWebAPI2/Interfaces/EconItems.cs @@ -86,34 +86,32 @@ public async Task> GetPlayerItemsAsync(ul } /// - /// Returns the economy / item schema for a specific App ID. + /// Returns the item schema for TF2 specifically. /// /// /// - public async Task> GetSchemaAsync(string language = "en_us") + public async Task> GetSchemaItemsForTF2Async(string language = "en_us") { - if (!validSchemaAppIds.Contains(appId)) + if (this.appId != (int)EconItemsAppId.TeamFortress2) { - throw new InvalidOperationException(String.Format("AppId {0} is not valid for the GetSchema method.", appId)); + throw new InvalidOperationException(String.Format("AppId {0} is not valid for the GetSchemaTF2 method.", appId)); } List parameters = new List(); parameters.AddIfHasValue(language, "language"); - var steamWebResponse = await steamWebInterface.GetAsync("GetSchema", 1, parameters); + var steamWebResponse = await steamWebInterface.GetAsync("GetSchemaItems", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map, ISteamWebResponse>(steamWebResponse); - - return steamWebResponseModel; + return steamWebResponse; } - /// - /// Returns the economy / item schema for TF2 specifically. + /// + /// Returns the schema overview for TF2 specifically. /// /// /// - public async Task> GetSchemaForTF2Async(string language = "en_us") + public async Task> GetSchemaOverviewForTF2Async(string language = "en_us") { if (this.appId != (int)EconItemsAppId.TeamFortress2) { @@ -124,11 +122,9 @@ public async Task> GetPlayerItemsAsync(ul parameters.AddIfHasValue(language, "language"); - var steamWebResponse = await steamWebInterface.GetAsync("GetSchema", 1, parameters); - - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map, ISteamWebResponse>(steamWebResponse); + var steamWebResponse = await steamWebInterface.GetAsync("GetSchemaOverview", 1, parameters); - return steamWebResponseModel; + return steamWebResponse; } /// diff --git a/src/SteamWebAPI2/Interfaces/IEconItems.cs b/src/SteamWebAPI2/Interfaces/IEconItems.cs index c063be0..88c1861 100644 --- a/src/SteamWebAPI2/Interfaces/IEconItems.cs +++ b/src/SteamWebAPI2/Interfaces/IEconItems.cs @@ -9,9 +9,9 @@ public interface IEconItems { Task> GetPlayerItemsAsync(ulong steamId); - Task> GetSchemaAsync(string language = "en_us"); + Task> GetSchemaItemsForTF2Async(string language = "en_us"); - Task> GetSchemaForTF2Async(string language = "en_us"); + Task> GetSchemaOverviewForTF2Async(string language = "en_us"); Task> GetSchemaUrlAsync(); diff --git a/src/SteamWebAPI2/Models/GameEconomy/SchemaItemResultContainer.cs b/src/SteamWebAPI2/Models/GameEconomy/SchemaItemResultContainer.cs new file mode 100644 index 0000000..bd1bb66 --- /dev/null +++ b/src/SteamWebAPI2/Models/GameEconomy/SchemaItemResultContainer.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace SteamWebAPI2.Models.GameEconomy +{ + public class SchemaItemsResult + { + [JsonProperty("status")] + public uint Status { get; set; } + [JsonProperty("items_game_url")] + public string ItemsGameUrl { get; set; } + [JsonProperty("items")] + public IList Items { get; set; } + [JsonProperty("next")] + public uint Next { get; set; } + } + + public class SchemaItemsResultContainer + { + [JsonProperty("result")] + public SchemaItemsResult Result { get; set; } + } +} \ No newline at end of file diff --git a/src/SteamWebAPI2/Models/GameEconomy/SchemaOverviewResultContainer.cs b/src/SteamWebAPI2/Models/GameEconomy/SchemaOverviewResultContainer.cs new file mode 100644 index 0000000..1105c9f --- /dev/null +++ b/src/SteamWebAPI2/Models/GameEconomy/SchemaOverviewResultContainer.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace SteamWebAPI2.Models.GameEconomy +{ + public class SchemaOverviewResult + { + [JsonProperty("status")] + public uint Status { get; set; } + [JsonProperty("items_game_url")] + public string ItemsGameUrl { get; set; } + [JsonProperty("qualities")] + public SchemaQualities Qualities { get; set; } + [JsonProperty("originNames")] + public IList OriginNames { get; set; } + [JsonProperty("attributes")] + public IList Attributes { get; set; } + [JsonProperty("item_sets")] + public IList ItemSets { get; set; } + [JsonProperty("attribute_controlled_attached_particles")] + public IList AttributeControlledAttachedParticles { get; set; } + [JsonProperty("item_levels")] + public IList ItemLevels { get; set; } + [JsonProperty("kill_eater_score_types")] + public IList KillEaterScoreTypes { get; set; } + [JsonProperty("string_lookups")] + public IList StringLookups { get; set; } + } + + public class SchemaOverviewResultContainer + { + [JsonProperty("result")] + public SchemaOverviewResult Result { get; set; } + } +} \ No newline at end of file diff --git a/src/SteamWebAPI2/Models/GameEconomy/SchemaResultContainer.cs b/src/SteamWebAPI2/Models/GameEconomy/SchemaResultContainer.cs index 09635b2..e89e0c1 100644 --- a/src/SteamWebAPI2/Models/GameEconomy/SchemaResultContainer.cs +++ b/src/SteamWebAPI2/Models/GameEconomy/SchemaResultContainer.cs @@ -3,7 +3,7 @@ namespace SteamWebAPI2.Models.GameEconomy { - internal class SchemaQualities + public class SchemaQualities { /// /// Normal item rarity: https://wiki.teamfortress.com/wiki/Normal @@ -99,7 +99,7 @@ internal class SchemaQualities public uint PaintKitWeapon { get; set; } } - internal class SchemaOriginName + public class SchemaOriginName { [JsonProperty("origin")] public uint Origin { get; set; } @@ -108,7 +108,7 @@ internal class SchemaOriginName public string Name { get; set; } } - internal class SchemaCapabilities + public class SchemaCapabilities { [JsonProperty("nameable")] public bool Nameable { get; set; } @@ -171,7 +171,7 @@ internal class SchemaCapabilities public bool? Decodable { get; set; } } - internal class SchemaAdditionalHiddenBodygroups + public class SchemaAdditionalHiddenBodygroups { [JsonProperty("hat")] public uint Hat { get; set; } @@ -183,7 +183,7 @@ internal class SchemaAdditionalHiddenBodygroups public uint? Head { get; set; } } - internal class SchemaStyle + public class SchemaStyle { [JsonProperty("name")] public string Name { get; set; } @@ -192,7 +192,7 @@ internal class SchemaStyle public SchemaAdditionalHiddenBodygroups AdditionalHiddenBodygroups { get; set; } } - internal class SchemaItemAttribute + public class SchemaItemAttribute { [JsonProperty("name")] public string Name { get; set; } @@ -204,7 +204,7 @@ internal class SchemaItemAttribute public double Value { get; set; } } - internal class SchemaPerClassLoadoutSlots + public class SchemaPerClassLoadoutSlots { [JsonProperty("Soldier")] public string Soldier { get; set; } @@ -222,7 +222,7 @@ internal class SchemaPerClassLoadoutSlots public string Demoman { get; set; } } - internal class SchemaUsageCapabilities + public class SchemaUsageCapabilities { [JsonProperty("nameable")] public bool Nameable { get; set; } @@ -264,7 +264,7 @@ internal class SchemaUsageCapabilities public bool? CanConsume { get; set; } } - internal class SchemaTool + public class SchemaTool { [JsonProperty("type")] public string Type { get; set; } @@ -279,7 +279,7 @@ internal class SchemaTool public string Restriction { get; set; } } - internal class SchemaItem + public class SchemaItem { [JsonProperty("defindex")] public uint DefIndex { get; set; } @@ -363,7 +363,7 @@ internal class SchemaItem public SchemaTool Tool { get; set; } } - internal class SchemaAttribute + public class SchemaAttribute { [JsonProperty("name")] public string Name { get; set; } @@ -390,7 +390,7 @@ internal class SchemaAttribute public bool StoredAsInteger { get; set; } } - internal class SchemaItemSetAttribute + public class SchemaItemSetAttribute { [JsonProperty("name")] public string Name { get; set; } @@ -402,7 +402,7 @@ internal class SchemaItemSetAttribute public double Value { get; set; } } - internal class SchemaItemSet + public class SchemaItemSet { [JsonProperty("item_set")] public string ItemSet { get; set; } @@ -420,7 +420,7 @@ internal class SchemaItemSet public string StoreBundleName { get; set; } } - internal class SchemaAttributeControlledAttachedParticle + public class SchemaAttributeControlledAttachedParticle { [JsonProperty("system")] public string System { get; set; } @@ -438,7 +438,7 @@ internal class SchemaAttributeControlledAttachedParticle public string Attachment { get; set; } } - internal class SchemaLevel + public class SchemaLevel { [JsonProperty("level")] public uint Level { get; set; } @@ -450,7 +450,7 @@ internal class SchemaLevel public string Name { get; set; } } - internal class SchemaItemLevel + public class SchemaItemLevel { [JsonProperty("name")] public string Name { get; set; } @@ -459,7 +459,7 @@ internal class SchemaItemLevel public IList Levels { get; set; } } - internal class SchemaKillEaterScoreType + public class SchemaKillEaterScoreType { [JsonProperty("type")] public uint Type { get; set; } @@ -471,7 +471,7 @@ internal class SchemaKillEaterScoreType public string LevelData { get; set; } } - internal class SchemaString + public class SchemaString { [JsonProperty("index")] public uint Index { get; set; } @@ -480,7 +480,7 @@ internal class SchemaString public string String { get; set; } } - internal class SchemaStringLookup + public class SchemaStringLookup { [JsonProperty("table_name")] public string TableName { get; set; } @@ -488,46 +488,4 @@ internal class SchemaStringLookup [JsonProperty("strings")] public IList Strings { get; set; } } - - internal class SchemaResult - { - [JsonProperty("status")] - public uint Status { get; set; } - - [JsonProperty("items_game_url")] - public string ItemsGameUrl { get; set; } - - [JsonProperty("qualities")] - public SchemaQualities Qualities { get; set; } - - [JsonProperty("originNames")] - public IList OriginNames { get; set; } - - [JsonProperty("items")] - public IList Items { get; set; } - - [JsonProperty("attributes")] - public IList Attributes { get; set; } - - [JsonProperty("item_sets")] - public IList ItemSets { get; set; } - - [JsonProperty("attribute_controlled_attached_particles")] - public IList AttributeControlledAttachedParticles { get; set; } - - [JsonProperty("item_levels")] - public IList ItemLevels { get; set; } - - [JsonProperty("kill_eater_score_types")] - public IList KillEaterScoreTypes { get; set; } - - [JsonProperty("string_lookups")] - public IList StringLookups { get; set; } - } - - internal class SchemaResultContainer - { - [JsonProperty("result")] - public SchemaResult Result { get; set; } - } } \ No newline at end of file diff --git a/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs b/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs index 75e85c9..4820f7e 100644 --- a/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs +++ b/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs @@ -41,6 +41,18 @@ public T CreateSteamWebInterface(HttpClient httpClient) return (T)Activator.CreateInstance(typeof(T), steamWebRequest, null); } + /// + /// Creates a web interface object connected to a specific Steam Web API interfac endpoint + /// + /// Custom http client injected with your customization (if necessary) + /// Type of the web interface to create + /// Instance of the web interface + public T CreateSteamWebInterface(HttpClient httpClient, EconItemsAppId appId) + { + var steamWebRequest = CreateSteamWebRequest(httpClient); + return (T)Activator.CreateInstance(typeof(T), steamWebRequest, appId, null); + } + private ISteamWebRequest CreateSteamWebRequest(HttpClient httpClient) { SteamWebHttpClient steamWebHttpClient = new SteamWebHttpClient(httpClient); From 0d8fb34635275ddba589d24786f706da7454a881 Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Wed, 18 Dec 2019 15:17:56 -0500 Subject: [PATCH 014/107] Rolled version --- src/SteamWebAPI2/SteamWebAPI2.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index 01ed121..f6f278c 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -2,7 +2,7 @@ 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. - 4.0.13 + 4.0.14 Justin Skiles SteamWebAPI2 SteamWebAPI2 From e22a0c1cd5c168d19284e2ea275b194c259d181f Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Wed, 18 Dec 2019 21:58:41 -0500 Subject: [PATCH 015/107] Update README.md Update out of date steps. --- README.md | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index f12b44e..0b7bd67 100644 --- a/README.md +++ b/README.md @@ -30,18 +30,15 @@ See the library in the NuGet gallery [here](https://www.nuget.org/packages/Steam Install-Package SteamWebAPI2 ``` -## How Valve's Steam Web API is Architected -Gain a basic understanding of how Valve's Steam Web API is laid out: please see [this helper site](http://steamwebapi.azurewebsites.net/) that I made to more easily describe the available endpoints. - ## How to Use the Library 1. Read the `About` section so you understand why this library exists 2. Install the library from NuGet - 3. Instantiate an object from any class that inherits from `SteamWebInterface` for whatever endpoint you want to use - 1. Requires a Steam Web API developer key. [Get one here](https://steamcommunity.com/dev/apikey). **KEEP THIS SECRET**. - 2. Some endpoints require an AppId (such as 440 for Team Fortress 2) - 4. Call the method with your parameters that you want to use + 3. Get a Steam Web API developer key. [Get one here](https://steamcommunity.com/dev/apikey). **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. + 5. Use the interface class and call a method with your parameters. -The library is structured to mirror the endpoint structure. For example, the "DOTA2Econ" class will expose methods to communicate with the "IDOTA2Econ" endpoints. +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. Each method returns a SteamWebResponse object which contains the following: From 4015148d34d4d018e6eb45dd57f0f0813f4f713e Mon Sep 17 00:00:00 2001 From: Justin Date: Wed, 12 Feb 2020 21:51:17 -0500 Subject: [PATCH 016/107] Updated AutoMapper to 9 --- src/SteamWebAPI2/AutoMapperConfiguration.cs | 12 ++++++------ src/SteamWebAPI2/SteamWebAPI2.csproj | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/SteamWebAPI2/AutoMapperConfiguration.cs b/src/SteamWebAPI2/AutoMapperConfiguration.cs index 27b298d..a304f91 100644 --- a/src/SteamWebAPI2/AutoMapperConfiguration.cs +++ b/src/SteamWebAPI2/AutoMapperConfiguration.cs @@ -311,7 +311,7 @@ public static void Initialize() src => Mapper.Map(src.Result) ); - x.CreateMap().ConvertUsing(src => + x.CreateMap().ConvertUsing((src, dest) => { if (src.Result == null) { @@ -324,7 +324,7 @@ public static void Initialize() }); x.CreateMap() - .ForMember(dest => dest.PlaytimeLastTwoWeeks, opts => opts.ResolveUsing(src => + .ForMember(dest => dest.PlaytimeLastTwoWeeks, opts => opts.MapFrom((src, dest) => { if (!src.Playtime2weeks.HasValue) { @@ -332,7 +332,7 @@ public static void Initialize() } return TimeSpan.FromMinutes(src.Playtime2weeks.Value); })) - .ForMember(dest => dest.PlaytimeForever, opts => opts.ResolveUsing(src => + .ForMember(dest => dest.PlaytimeForever, opts => opts.MapFrom((src, dest) => { return TimeSpan.FromMinutes(src.PlaytimeForever); })); @@ -376,7 +376,7 @@ public static void Initialize() #region Endpoint: SteamRemoteStorage x.CreateMap() - .ConvertUsing(src => + .ConvertUsing((src, dest) => { return (PublishedFileVisibility)src; }); @@ -385,12 +385,12 @@ public static void Initialize() .ForMember(dest => dest.PreviewUrl, opts => opts.MapFrom(source => new Uri(source.PreviewUrl))); x.CreateMap>() .ConvertUsing( - src => Mapper.Map, IReadOnlyCollection>( + (src, dest) => Mapper.Map, IReadOnlyCollection>( src.Result?.Result == 1 ? src.Result.Details : null) ); x.CreateMap() .ConvertUsing( - src => Mapper.Map( + (src, dest) => Mapper.Map( src.Result?.Result == 1 ? src.Result.Details?.SingleOrDefault() : null) ); diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index f6f278c..091bac3 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -12,7 +12,7 @@ - + From c3afa4b4b1e9e886b035b8fbbff0dbbe1de68efd Mon Sep 17 00:00:00 2001 From: Justin Date: Fri, 21 Feb 2020 14:46:33 -0500 Subject: [PATCH 017/107] Updated Newtonsoft.Json --- src/SteamWebAPI2/SteamWebAPI2.csproj | 2 +- src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index 091bac3..7bcabc8 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -13,7 +13,7 @@ - + diff --git a/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs b/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs index 4820f7e..cff0485 100644 --- a/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs +++ b/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs @@ -58,6 +58,5 @@ private ISteamWebRequest CreateSteamWebRequest(HttpClient httpClient) SteamWebHttpClient steamWebHttpClient = new SteamWebHttpClient(httpClient); return new SteamWebRequest(steamWebApiBaseUrl, steamWebApiKey, steamWebHttpClient); } - } } \ No newline at end of file From c66910783976f53c4ee7db37b06a4e0d3a5c5fbd Mon Sep 17 00:00:00 2001 From: Justin Date: Fri, 21 Feb 2020 14:52:19 -0500 Subject: [PATCH 018/107] Rolled version --- src/SteamWebAPI2/SteamWebAPI2.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index 7bcabc8..1fb442c 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -2,7 +2,7 @@ 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. - 4.0.14 + 4.0.15 Justin Skiles SteamWebAPI2 SteamWebAPI2 From 7610645c3ba3a67ba4348e73dcd11c1cb32b0b88 Mon Sep 17 00:00:00 2001 From: Justin Date: Sun, 23 Feb 2020 17:32:05 -0500 Subject: [PATCH 019/107] Refactored the fuzzy Steam ID lookup logic. --- src/SteamWebAPI2/Models/SteamId.cs | 72 ++++++++++++++++-------------- 1 file changed, 38 insertions(+), 34 deletions(-) diff --git a/src/SteamWebAPI2/Models/SteamId.cs b/src/SteamWebAPI2/Models/SteamId.cs index 88344d1..16b05be 100644 --- a/src/SteamWebAPI2/Models/SteamId.cs +++ b/src/SteamWebAPI2/Models/SteamId.cs @@ -66,6 +66,8 @@ public class SteamId { #region Members + private ISteamWebRequest steamWebRequest; + // Special flags for chat accounts in the high 8 bits of the Steam ID instance. Adopted from https://github.com/xPaw/SteamID.php. //private uint instanceFlagClan = 524288; // (SteamAccountInstanceMask + 1) >> 1 //private uint instanceFlagLobby = 262144; // (SteamAccountInstanceMask + 1) >> 2 @@ -183,19 +185,24 @@ public SteamId(ulong steamId64) } /// - /// Constructs a Steam Id by parsing the provided value. This constructor will try to parse the value to a 64-bit Steam Id or a Steam Community Profile URL depending on the input. + /// Constructs a Steam Id helper with deferred parsing and resolution because a fuzzy lookup will be needed. Follow up with the ResolveAsync method to + /// asynchronously resolve the Steam Id information. This is typically used when you only know the users vanity URL name or don't know what type of Steam Id + /// you have on hand. + /// + /// Required in the event that the Steam Web API is needed to resolve a Profile URL to a 64-bit Steam ID. + public SteamId(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + { + this.steamWebRequest = steamWebRequest; + } + + /// + /// Constructs a Steam Id by parsing the provided value. This will try to parse the value to a 64-bit Steam Id or a Steam Community Profile URL depending on the input. /// If a Profile URL is provided but is unable to be resolved to a 64-bit Steam ID, a VanityUrlNotResolvedException will be thrown. Network access may be required /// to receive a return value from this method in the event that the Steam Web API is required. /// /// Value to parse, can be a 64-bit Steam ID, a full Steam Community Profile URL, or the user's Steam Community Profile Name. - /// Required in the event that the Steam Web API is needed to resolve a Profile URL to a 64-bit Steam ID. - public SteamId(string value, ISteamWebRequest steamWebRequest) + public async Task ResolveAsync(string value) { - if (String.IsNullOrEmpty(value)) - { - throw new ArgumentNullException("value"); - } - ulong steamId = 0; MatchCollection legacyCheckResult = null; MatchCollection modernCheckResult = null; @@ -246,44 +253,41 @@ public SteamId(string value, ISteamWebRequest steamWebRequest) try { - Task.Run(async () => + // the caller provided a uri + if (isUri) { - // the caller provided a uri - if (isUri) + // the caller provided a uri in the format we expected + if (uriResult.Segments.Length == 3) { - // the caller provided a uri in the format we expected - if (uriResult.Segments.Length == 3) - { - string profileId = uriResult.Segments[2]; - - // try to parse the 3rd segment as a 64-bit Steam ID (http://steamcommunity.com/profiles/762541427451 for example) - bool isSteamId64 = ulong.TryParse(profileId, out steamId); + string profileId = uriResult.Segments[2]; - // the third segment isn't a 64-bit Steam ID, check if it's a profile name which resolves to a 64-bit Steam ID - if (!isSteamId64) - { - steamId = await ResolveSteamIdFromValueAsync(steamUser, profileId); - } + // try to parse the 3rd segment as a 64-bit Steam ID (http://steamcommunity.com/profiles/762541427451 for example) + bool isSteamId64 = ulong.TryParse(profileId, out steamId); - ConstructFromSteamId64(steamId); - } - else + // the third segment isn't a 64-bit Steam ID, check if it's a profile name which resolves to a 64-bit Steam ID + if (!isSteamId64) { - throw new InvalidSteamCommunityUriException(ErrorMessages.InvalidSteamCommunityUri); + steamId = await ResolveSteamIdFromValueAsync(steamUser, profileId); } - ResolvedFrom = SteamIdResolvedFrom.SteamCommunityUri; + ConstructFromSteamId64(steamId); } else { - // not a 64-bit Steam ID and not a uri, try to just resolve it as if it was a Steam Community Profile Name - steamId = await ResolveSteamIdFromValueAsync(steamUser, value); + throw new InvalidSteamCommunityUriException(ErrorMessages.InvalidSteamCommunityUri); + } - ConstructFromSteamId64(steamId); + ResolvedFrom = SteamIdResolvedFrom.SteamCommunityUri; + } + else + { + // not a 64-bit Steam ID and not a uri, try to just resolve it as if it was a Steam Community Profile Name + steamId = await ResolveSteamIdFromValueAsync(steamUser, value); - ResolvedFrom = SteamIdResolvedFrom.SteamCommunityProfileName; - } - }).Wait(); + ConstructFromSteamId64(steamId); + + ResolvedFrom = SteamIdResolvedFrom.SteamCommunityProfileName; + } } catch (AggregateException ex) { From b2d762911f6002e31d03fcc3d2b5b501886853e7 Mon Sep 17 00:00:00 2001 From: Justin Date: Sun, 23 Feb 2020 19:28:21 -0500 Subject: [PATCH 020/107] Rolled version --- src/SteamWebAPI2/SteamWebAPI2.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index 1fb442c..ea25599 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -2,7 +2,7 @@ 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. - 4.0.15 + 4.0.16 Justin Skiles SteamWebAPI2 SteamWebAPI2 From a6f68b9d9d8af2514efa3996b53f2594970b0453 Mon Sep 17 00:00:00 2001 From: Justin Date: Tue, 25 Feb 2020 11:37:33 -0500 Subject: [PATCH 021/107] Removed unnecessary duplicate HttpClient. --- .../Utilities/ISteamWebHttpClient.cs | 23 ------- .../Utilities/SteamWebHttpClient.cs | 64 ------------------- .../Utilities/SteamWebInterfaceFactory.cs | 3 +- src/SteamWebAPI2/Utilities/SteamWebRequest.cs | 56 ++++++++-------- 4 files changed, 32 insertions(+), 114 deletions(-) delete mode 100644 src/SteamWebAPI2/Utilities/ISteamWebHttpClient.cs delete mode 100644 src/SteamWebAPI2/Utilities/SteamWebHttpClient.cs diff --git a/src/SteamWebAPI2/Utilities/ISteamWebHttpClient.cs b/src/SteamWebAPI2/Utilities/ISteamWebHttpClient.cs deleted file mode 100644 index 9c4f1f9..0000000 --- a/src/SteamWebAPI2/Utilities/ISteamWebHttpClient.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Net.Http; -using System.Threading.Tasks; - -namespace SteamWebAPI2.Utilities -{ - public interface ISteamWebHttpClient - { - /// - /// Performs an HTTP GET with the passed URL command. - /// - /// URL command for GET operation - /// String response such as JSON or XML - Task GetAsync(string uri); - - /// - /// Performs an HTTP POST with the passed URL command. - /// - /// URL command for POST operation - /// The HTTP request content sent to the server. - /// String response such as JSON or XML - Task PostAsync(string uri, HttpContent content); - } -} \ No newline at end of file diff --git a/src/SteamWebAPI2/Utilities/SteamWebHttpClient.cs b/src/SteamWebAPI2/Utilities/SteamWebHttpClient.cs deleted file mode 100644 index 46d5c89..0000000 --- a/src/SteamWebAPI2/Utilities/SteamWebHttpClient.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; -using System.Diagnostics; -using System.Net; -using System.Net.Http; -using System.Threading.Tasks; - -namespace SteamWebAPI2.Utilities -{ - /// - /// Wraps HttpClient for convenience and testability. Note that newlines and tabs are stripped from responses. - /// - internal class SteamWebHttpClient : ISteamWebHttpClient - { - private HttpClient httpClient; - - public SteamWebHttpClient(HttpClient httpClient) - { - this.httpClient = httpClient; - } - - /// - /// Performs an HTTP GET with the passed URL command. - /// - /// URL command for GET operation - /// String response such as JSON or XML - public async Task GetAsync(string command) - { - Debug.Assert(!String.IsNullOrWhiteSpace(command)); - - var response = await httpClient.GetAsync(command); - - response.EnsureSuccessStatusCode(); - - if (response.Content == null) - { - return new HttpResponseMessage(HttpStatusCode.NoContent); - } - - return response; - } - - /// - /// Performs an HTTP POST with the passed URL command. - /// - /// URL command for POST operation - /// The HTTP request content sent to the server. - /// String response such as JSON or XML - public async Task PostAsync(string command, HttpContent content) - { - Debug.Assert(!String.IsNullOrWhiteSpace(command)); - - var response = await httpClient.PostAsync(command, content); - - response.EnsureSuccessStatusCode(); - - if (response.Content == null) - { - return new HttpResponseMessage(HttpStatusCode.NoContent); - } - - return response; - } - } -} \ No newline at end of file diff --git a/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs b/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs index cff0485..6b2e6dd 100644 --- a/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs +++ b/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs @@ -55,8 +55,7 @@ public T CreateSteamWebInterface(HttpClient httpClient, EconItemsAppId appId) private ISteamWebRequest CreateSteamWebRequest(HttpClient httpClient) { - SteamWebHttpClient steamWebHttpClient = new SteamWebHttpClient(httpClient); - return new SteamWebRequest(steamWebApiBaseUrl, steamWebApiKey, steamWebHttpClient); + return new SteamWebRequest(steamWebApiBaseUrl, steamWebApiKey, httpClient); } } } \ No newline at end of file diff --git a/src/SteamWebAPI2/Utilities/SteamWebRequest.cs b/src/SteamWebAPI2/Utilities/SteamWebRequest.cs index 9d2a86c..b31b610 100644 --- a/src/SteamWebAPI2/Utilities/SteamWebRequest.cs +++ b/src/SteamWebAPI2/Utilities/SteamWebRequest.cs @@ -24,7 +24,7 @@ internal class SteamWebRequest : ISteamWebRequest { private string steamWebApiBaseUrl; private readonly string steamWebApiKey; - private ISteamWebHttpClient steamWebHttpClient; + private readonly HttpClient httpClient; /// /// Every web request requires a secret Steam Web API key @@ -32,26 +32,21 @@ internal class SteamWebRequest : ISteamWebRequest /// Base URL for the API (such as http://api.steampowered.com) /// Secret Steam Web API key provided at the Valve developer website /// Optional custom http client implementation for dependency injection - public SteamWebRequest(string steamWebApiBaseUrl, string steamWebApiKey, ISteamWebHttpClient steamWebHttpClient) + public SteamWebRequest(string steamWebApiBaseUrl, string steamWebApiKey, HttpClient httpClient = null) { - if (String.IsNullOrWhiteSpace(steamWebApiBaseUrl)) + if (string.IsNullOrWhiteSpace(steamWebApiBaseUrl)) { throw new ArgumentNullException(nameof(steamWebApiBaseUrl)); } - if (String.IsNullOrWhiteSpace(steamWebApiKey)) + if (string.IsNullOrWhiteSpace(steamWebApiKey)) { throw new ArgumentNullException(nameof(steamWebApiKey)); } - if(steamWebHttpClient == null) - { - throw new ArgumentNullException(nameof(steamWebHttpClient)); - } - this.steamWebApiBaseUrl = steamWebApiBaseUrl; this.steamWebApiKey = steamWebApiKey; - this.steamWebHttpClient = steamWebHttpClient; + this.httpClient = httpClient ?? new HttpClient(); } /// @@ -65,8 +60,8 @@ public SteamWebRequest(string steamWebApiBaseUrl, string steamWebApiKey, ISteamW /// Deserialized object from JSON response public async Task> GetAsync(string interfaceName, string methodName, int methodVersion, IList parameters = null) { - Debug.Assert(!String.IsNullOrWhiteSpace(interfaceName)); - Debug.Assert(!String.IsNullOrWhiteSpace(methodName)); + Debug.Assert(!string.IsNullOrWhiteSpace(interfaceName)); + Debug.Assert(!string.IsNullOrWhiteSpace(methodName)); Debug.Assert(methodVersion > 0); return await SendWebRequestAsync(HttpMethod.GET, interfaceName, methodName, methodVersion, parameters); @@ -83,8 +78,8 @@ public async Task> GetAsync(string interfaceName, string /// Deserialized object from JSON response public async Task> PostAsync(string interfaceName, string methodName, int methodVersion, IList parameters = null) { - Debug.Assert(!String.IsNullOrWhiteSpace(interfaceName)); - Debug.Assert(!String.IsNullOrWhiteSpace(methodName)); + Debug.Assert(!string.IsNullOrWhiteSpace(interfaceName)); + Debug.Assert(!string.IsNullOrWhiteSpace(methodName)); Debug.Assert(methodVersion > 0); return await SendWebRequestAsync(HttpMethod.POST, interfaceName, methodName, methodVersion, parameters); @@ -102,8 +97,8 @@ public async Task> PostAsync(string interfaceName, strin /// Deserialized object from JSON response private async Task> SendWebRequestAsync(HttpMethod httpMethod, string interfaceName, string methodName, int methodVersion, IList parameters = null) { - Debug.Assert(!String.IsNullOrWhiteSpace(interfaceName)); - Debug.Assert(!String.IsNullOrWhiteSpace(methodName)); + Debug.Assert(!string.IsNullOrWhiteSpace(interfaceName)); + Debug.Assert(!string.IsNullOrWhiteSpace(methodName)); Debug.Assert(methodVersion > 0); if (parameters == null) @@ -119,7 +114,13 @@ private async Task> SendWebRequestAsync(HttpMethod httpM { string command = BuildRequestCommand(interfaceName, methodName, methodVersion, parameters); - httpResponse = await steamWebHttpClient.GetAsync(command).ConfigureAwait(false); + httpResponse = await httpClient.GetAsync(command).ConfigureAwait(false); + httpResponse.EnsureSuccessStatusCode(); + if(httpResponse.Content == null) + { + httpResponse = new HttpResponseMessage(HttpStatusCode.NoContent); + } + } else if (httpMethod == HttpMethod.POST) { @@ -129,7 +130,12 @@ private async Task> SendWebRequestAsync(HttpMethod httpM // Instead, parameters are passed through this container. FormUrlEncodedContent content = BuildRequestContent(parameters); - httpResponse = await steamWebHttpClient.PostAsync(command, content).ConfigureAwait(false); + httpResponse = await httpClient.PostAsync(command, content).ConfigureAwait(false); + httpResponse.EnsureSuccessStatusCode(); + if (httpResponse.Content == null) + { + httpResponse = new HttpResponseMessage(HttpStatusCode.NoContent); + } } var headers = httpResponse.Content?.Headers; @@ -166,8 +172,8 @@ private async Task> SendWebRequestAsync(HttpMethod httpM /// private string BuildRequestCommand(string interfaceName, string methodName, int methodVersion, IEnumerable parameters) { - Debug.Assert(!String.IsNullOrWhiteSpace(interfaceName)); - Debug.Assert(!String.IsNullOrWhiteSpace(methodName)); + Debug.Assert(!string.IsNullOrWhiteSpace(interfaceName)); + Debug.Assert(!string.IsNullOrWhiteSpace(methodName)); Debug.Assert(methodVersion > 0); if (steamWebApiBaseUrl.EndsWith("/")) @@ -175,13 +181,13 @@ private string BuildRequestCommand(string interfaceName, string methodName, int steamWebApiBaseUrl = steamWebApiBaseUrl.Remove(steamWebApiBaseUrl.Length - 1, 1); } - string commandUrl = String.Format("{0}/{1}/{2}/v{3}/", steamWebApiBaseUrl, interfaceName, methodName, methodVersion); + string commandUrl = string.Format("{0}/{1}/{2}/v{3}/", steamWebApiBaseUrl, interfaceName, methodName, methodVersion); // if we have parameters, join them together with & delimiter and append them to the command URL if (parameters != null && parameters.Count() > 0) { - string parameterString = String.Join("&", parameters); - commandUrl += String.Format("?{0}", parameterString); + string parameterString = string.Join("&", parameters); + commandUrl += string.Format("?{0}", parameterString); } return commandUrl; @@ -210,9 +216,9 @@ private static FormUrlEncodedContent BuildRequestContent(IEnumerableString containing the http endpoint response contents private static string CleanupResponseString(string stringToClean) { - if (String.IsNullOrWhiteSpace(stringToClean)) + if (string.IsNullOrWhiteSpace(stringToClean)) { - return String.Empty; + return string.Empty; } stringToClean = stringToClean.Replace("\n", ""); From cce81fc5db311d7be635f29fea4b0d3caf191a25 Mon Sep 17 00:00:00 2001 From: Justin Date: Tue, 25 Feb 2020 12:04:55 -0500 Subject: [PATCH 022/107] General cleanup. --- src/SteamWebAPI2/AutoMapperConfiguration.cs | 47 +++++++++---------- src/SteamWebAPI2/Interfaces/DOTA2Econ.cs | 3 +- src/SteamWebAPI2/Interfaces/DOTA2Match.cs | 2 - src/SteamWebAPI2/Interfaces/EconItems.cs | 16 +++---- src/SteamWebAPI2/Interfaces/EconService.cs | 6 +-- src/SteamWebAPI2/Interfaces/GCVersion.cs | 4 +- src/SteamWebAPI2/Interfaces/IEconItems.cs | 7 ++- src/SteamWebAPI2/Interfaces/PlayerService.cs | 3 +- src/SteamWebAPI2/Interfaces/SteamApps.cs | 3 +- src/SteamWebAPI2/Interfaces/SteamEconomy.cs | 5 +- src/SteamWebAPI2/Interfaces/SteamNews.cs | 2 +- .../Interfaces/SteamRemoteStorage.cs | 6 ++- src/SteamWebAPI2/Interfaces/SteamStore.cs | 2 +- src/SteamWebAPI2/Interfaces/SteamUser.cs | 10 ++-- src/SteamWebAPI2/Interfaces/SteamUserStats.cs | 5 +- .../Interfaces/SteamWebAPIUtil.cs | 5 +- src/SteamWebAPI2/Interfaces/TFItems.cs | 3 +- .../Models/DOTA2/GameItemResultContainer.cs | 2 +- .../Models/DOTA2/HeroResultContainer.cs | 2 +- .../DOTA2/LiveLeagueGameResultContainer.cs | 1 - .../GameEconomy/SchemaItemResultContainer.cs | 5 +- .../SchemaOverviewResultContainer.cs | 11 ++++- .../GameEconomy/SchemaResultContainer.cs | 2 +- .../PublishedFileDetailsResultContainer.cs | 7 ++- .../SteamCommunity/SteamCommunityProfile.cs | 33 ++++++++----- .../CancelTradeOfferResultContainer.cs | 9 +--- .../DeclineTradeOfferResultContainer.cs | 9 +--- src/SteamWebAPI2/Models/SteamId.cs | 8 ++-- .../Models/SteamStore/AppDetailsContainer.cs | 2 +- src/SteamWebAPI2/SteamStoreInterface.cs | 13 +++-- src/SteamWebAPI2/SteamStoreRequest.cs | 18 +++---- .../JsonConverters/TagsJsonConverter.cs | 7 ++- .../Utilities/SteamWebInterface.cs | 12 ++--- .../Utilities/SteamWebInterfaceFactory.cs | 8 ++-- src/SteamWebAPI2/Utilities/SteamWebRequest.cs | 3 +- .../Utilities/SteamWebRequestParameter.cs | 8 ++-- .../SteamWebRequestParameterExtensions.cs | 5 +- 37 files changed, 142 insertions(+), 152 deletions(-) diff --git a/src/SteamWebAPI2/AutoMapperConfiguration.cs b/src/SteamWebAPI2/AutoMapperConfiguration.cs index a304f91..b0408e3 100644 --- a/src/SteamWebAPI2/AutoMapperConfiguration.cs +++ b/src/SteamWebAPI2/AutoMapperConfiguration.cs @@ -28,9 +28,7 @@ internal static class AutoMapperConfiguration { private static bool isInitialized = false; private static MapperConfiguration config; - private static IMapper mapper; - - public static IMapper Mapper { get { return mapper; } } + public static IMapper Mapper { get; private set; } private static SteamWebResponse ConstructSteamWebResponse(ISteamWebResponse response) { @@ -180,7 +178,7 @@ public static void Initialize() x.CreateMap().ConvertUsing(src => src.Result != null ? src.Result.PrizePool : default(uint)); - #endregion + #endregion Endpoint: DOTA2Econ #region Endpoint: DOTA2Fantasy @@ -193,7 +191,7 @@ public static void Initialize() x.CreateMap(); x.CreateMap(); - #endregion + #endregion Endpoint: DOTA2Fantasy #region Endpoint: DOTA2Match @@ -253,7 +251,7 @@ public static void Initialize() src => Mapper.Map, IReadOnlyCollection>(src.Result != null ? src.Result.Teams : null) ); - #endregion + #endregion Endpoint: DOTA2Match #region Endpoint: EconService @@ -284,7 +282,7 @@ public static void Initialize() src => Mapper.Map(src.Result) ); - #endregion + #endregion Endpoint: EconService #region Endpoint: GCVersion @@ -293,7 +291,7 @@ public static void Initialize() src => Mapper.Map(src.Result) ); - #endregion + #endregion Endpoint: GCVersion #region Endpoint: PlayerService @@ -347,7 +345,7 @@ public static void Initialize() src => Mapper.Map(src.Result) ); - #endregion + #endregion Endpoint: PlayerService #region Endpoint: SteamApps @@ -361,7 +359,7 @@ public static void Initialize() src => Mapper.Map(src.Result) ); - #endregion + #endregion Endpoint: SteamApps #region Endpoint: SteamNews @@ -371,7 +369,7 @@ public static void Initialize() src => Mapper.Map(src.Result) ); - #endregion + #endregion Endpoint: SteamNews #region Endpoint: SteamRemoteStorage @@ -399,7 +397,7 @@ public static void Initialize() src => Mapper.Map(src.Result) ); - #endregion + #endregion Endpoint: SteamRemoteStorage #region Endpoint: SteamUser @@ -429,7 +427,7 @@ public static void Initialize() x.CreateMap().ConvertUsing(src => src.Result != null ? src.Result.SteamId : default(ulong)); - #endregion + #endregion Endpoint: SteamUser #region Endpoint: SteamUserStats @@ -465,7 +463,7 @@ public static void Initialize() src => Mapper.Map(src.Result) ); - #endregion + #endregion Endpoint: SteamUserStats #region Endpoint: SteamWebAPIUtil @@ -478,7 +476,7 @@ public static void Initialize() src => Mapper.Map, IReadOnlyCollection>(src.Result != null ? src.Result.Interfaces : null) ); - #endregion + #endregion Endpoint: SteamWebAPIUtil #region Endpoint: TFItems @@ -487,7 +485,7 @@ public static void Initialize() src => Mapper.Map, IReadOnlyCollection>(src.Result != null ? src.Result.GoldenWrenches : null) ); - #endregion + #endregion Endpoint: TFItems #region Endpoint: SteamEconomy @@ -513,7 +511,7 @@ public static void Initialize() src => Mapper.Map(src.Result) ); - #endregion + #endregion Endpoint: SteamEconomy x.CreateMap().ConvertUsing(src => src.Result != null ? src.Result.ItemsGameUrl : null); @@ -592,7 +590,7 @@ public static void Initialize() x.CreateMap(); x.CreateMap(); - #endregion + #endregion Endpoint: SteamStore x.CreateMap() .ForMember(dest => dest.GameIcon, opts => opts.MapFrom(source => source.GameIcon)) @@ -607,7 +605,7 @@ public static void Initialize() .ForMember(dest => dest.Logo, opts => opts.MapFrom(source => new Uri(source.GameLogo))) .ForMember(dest => dest.LogoSmall, opts => opts.MapFrom(source => new Uri(source.GameLogoSmall))) .ForMember(dest => dest.Name, opts => opts.MapFrom(source => source.GameName)) - .ForMember(dest => dest.HoursOnRecord, opts => opts.MapFrom(source => !String.IsNullOrEmpty(source.HoursOnRecord) ? double.Parse(source.HoursOnRecord) : 0d)) + .ForMember(dest => dest.HoursOnRecord, opts => opts.MapFrom(source => !string.IsNullOrEmpty(source.HoursOnRecord) ? double.Parse(source.HoursOnRecord) : 0d)) .ForMember(dest => dest.HoursPlayed, opts => opts.MapFrom(source => (double)source.HoursPlayed)) .ForMember(dest => dest.StatsName, opts => opts.MapFrom(source => source.StatsName)); @@ -625,7 +623,7 @@ public static void Initialize() .ForMember(dest => dest.State, opts => opts.MapFrom(source => source.OnlineState)) .ForMember(dest => dest.StateMessage, opts => opts.MapFrom(source => source.StateMessage)) .ForMember(dest => dest.SteamID, opts => opts.MapFrom(source => source.SteamID64)) - .ForMember(dest => dest.SteamRating, opts => opts.MapFrom(source => !String.IsNullOrEmpty(source.SteamRating) ? double.Parse(source.SteamRating) : 0d)) + .ForMember(dest => dest.SteamRating, opts => opts.MapFrom(source => !string.IsNullOrEmpty(source.SteamRating) ? double.Parse(source.SteamRating) : 0d)) .ForMember(dest => dest.Summary, opts => opts.MapFrom(source => source.Summary)) .ForMember(dest => dest.TradeBanState, opts => opts.MapFrom(source => source.TradeBanState)) .ForMember(dest => dest.IsVacBanned, opts => opts.MapFrom(source => source.VacBanned == 1 ? true : false)) @@ -633,12 +631,11 @@ public static void Initialize() .ForMember(dest => dest.InGameServerIP, opts => opts.MapFrom(source => source.InGameServerIP)) .ForMember(dest => dest.InGameInfo, opts => opts.MapFrom(source => source.InGameInfo)); }); - } - if (mapper == null) + if (Mapper == null) { - mapper = config.CreateMapper(); + Mapper = config.CreateMapper(); } isInitialized = true; @@ -651,7 +648,7 @@ public static void Initialize() public static void Reset() { config = null; - mapper = null; + Mapper = null; } } -} +} \ No newline at end of file diff --git a/src/SteamWebAPI2/Interfaces/DOTA2Econ.cs b/src/SteamWebAPI2/Interfaces/DOTA2Econ.cs index e0eb051..a46611c 100644 --- a/src/SteamWebAPI2/Interfaces/DOTA2Econ.cs +++ b/src/SteamWebAPI2/Interfaces/DOTA2Econ.cs @@ -3,7 +3,6 @@ using SteamWebAPI2.Utilities; using System; using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; namespace SteamWebAPI2.Interfaces @@ -74,7 +73,7 @@ public async Task>> GetHeroesAs /// public async Task> GetItemIconPathAsync(string iconName, string iconType = "") { - if (String.IsNullOrEmpty(iconName)) + if (string.IsNullOrEmpty(iconName)) { throw new ArgumentNullException("iconName"); } diff --git a/src/SteamWebAPI2/Interfaces/DOTA2Match.cs b/src/SteamWebAPI2/Interfaces/DOTA2Match.cs index fa4f9bc..d94fece 100644 --- a/src/SteamWebAPI2/Interfaces/DOTA2Match.cs +++ b/src/SteamWebAPI2/Interfaces/DOTA2Match.cs @@ -2,8 +2,6 @@ using SteamWebAPI2.Models.DOTA2; using SteamWebAPI2.Utilities; using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; using System.Threading.Tasks; namespace SteamWebAPI2.Interfaces diff --git a/src/SteamWebAPI2/Interfaces/EconItems.cs b/src/SteamWebAPI2/Interfaces/EconItems.cs index 8edec42..53c7c1d 100644 --- a/src/SteamWebAPI2/Interfaces/EconItems.cs +++ b/src/SteamWebAPI2/Interfaces/EconItems.cs @@ -92,9 +92,9 @@ public async Task> GetPlayerItemsAsync(ul /// public async Task> GetSchemaItemsForTF2Async(string language = "en_us") { - if (this.appId != (int)EconItemsAppId.TeamFortress2) + if (appId != (int)EconItemsAppId.TeamFortress2) { - throw new InvalidOperationException(String.Format("AppId {0} is not valid for the GetSchemaTF2 method.", appId)); + throw new InvalidOperationException(string.Format("AppId {0} is not valid for the GetSchemaTF2 method.", appId)); } List parameters = new List(); @@ -106,16 +106,16 @@ public async Task> GetSchemaItemsF return steamWebResponse; } - /// + /// /// Returns the schema overview for TF2 specifically. /// /// /// public async Task> GetSchemaOverviewForTF2Async(string language = "en_us") { - if (this.appId != (int)EconItemsAppId.TeamFortress2) + if (appId != (int)EconItemsAppId.TeamFortress2) { - throw new InvalidOperationException(String.Format("AppId {0} is not valid for the GetSchemaTF2 method.", appId)); + throw new InvalidOperationException(string.Format("AppId {0} is not valid for the GetSchemaTF2 method.", appId)); } List parameters = new List(); @@ -135,7 +135,7 @@ public async Task> GetSchemaUrlAsync() { if (!validSchemaUrlAppIds.Contains(appId)) { - throw new InvalidOperationException(String.Format("AppId {0} is not valid for the GetSchemaUrl method.", appId)); + throw new InvalidOperationException(string.Format("AppId {0} is not valid for the GetSchemaUrl method.", appId)); } var steamWebResponse = await steamWebInterface.GetAsync("GetSchemaURL", 1); @@ -154,7 +154,7 @@ public async Task> GetStoreMetaDataAsync(s { if (!validStoreMetaDataAppIds.Contains(appId)) { - throw new InvalidOperationException(String.Format("AppId {0} is not valid for the GetStoreMetaData method.", appId)); + throw new InvalidOperationException(string.Format("AppId {0} is not valid for the GetStoreMetaData method.", appId)); } List parameters = new List(); @@ -176,7 +176,7 @@ public async Task> GetStoreStatusAsync() { if (!validStoreStatusAppIds.Contains(appId)) { - throw new InvalidOperationException(String.Format("AppId {0} is not valid for the GetStoreStatus method.", appId)); + throw new InvalidOperationException(string.Format("AppId {0} is not valid for the GetStoreStatus method.", appId)); } var steamWebResponse = await steamWebInterface.GetAsync("GetStoreStatus", 1); diff --git a/src/SteamWebAPI2/Interfaces/EconService.cs b/src/SteamWebAPI2/Interfaces/EconService.cs index 29541a7..24fb803 100644 --- a/src/SteamWebAPI2/Interfaces/EconService.cs +++ b/src/SteamWebAPI2/Interfaces/EconService.cs @@ -48,7 +48,7 @@ public EconService(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWeb var steamWebResponse = await steamWebInterface.GetAsync("GetTradeHistory", 1, parameters); var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< - ISteamWebResponse, + ISteamWebResponse, ISteamWebResponse>(steamWebResponse); return steamWebResponseModel; @@ -83,7 +83,7 @@ public EconService(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWeb var steamWebResponse = await steamWebInterface.GetAsync("GetTradeOffers", 1, parameters); var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< - ISteamWebResponse, + ISteamWebResponse, ISteamWebResponse>(steamWebResponse); return steamWebResponseModel; @@ -105,7 +105,7 @@ public EconService(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWeb var steamWebResponse = await steamWebInterface.GetAsync("GetTradeOffer", 1, parameters); var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< - ISteamWebResponse, + ISteamWebResponse, ISteamWebResponse>(steamWebResponse); return steamWebResponseModel; diff --git a/src/SteamWebAPI2/Interfaces/GCVersion.cs b/src/SteamWebAPI2/Interfaces/GCVersion.cs index c4c152b..cd42626 100644 --- a/src/SteamWebAPI2/Interfaces/GCVersion.cs +++ b/src/SteamWebAPI2/Interfaces/GCVersion.cs @@ -59,7 +59,7 @@ public async Task> GetClientVersionAsyn { if (!validClientVersionAppIds.Contains(appId)) { - throw new InvalidOperationException(String.Format("AppId {0} is not valid for the GetClientVersion method.", appId)); + throw new InvalidOperationException(string.Format("AppId {0} is not valid for the GetClientVersion method.", appId)); } var steamWebResponse = await steamWebInterface.GetAsync("GetClientVersion", 1); @@ -77,7 +77,7 @@ public async Task> GetServerVersionAsyn { if (!validServerVersionAppIds.Contains(appId)) { - throw new InvalidOperationException(String.Format("AppId {0} is not valid for the GetServerVersion method.", appId)); + throw new InvalidOperationException(string.Format("AppId {0} is not valid for the GetServerVersion method.", appId)); } var steamWebResponse = await steamWebInterface.GetAsync("GetServerVersion", 1); diff --git a/src/SteamWebAPI2/Interfaces/IEconItems.cs b/src/SteamWebAPI2/Interfaces/IEconItems.cs index 88c1861..264612c 100644 --- a/src/SteamWebAPI2/Interfaces/IEconItems.cs +++ b/src/SteamWebAPI2/Interfaces/IEconItems.cs @@ -1,5 +1,4 @@ -using Steam.Models.DOTA2; -using Steam.Models.GameEconomy; +using Steam.Models.GameEconomy; using SteamWebAPI2.Utilities; using System.Threading.Tasks; @@ -10,7 +9,7 @@ public interface IEconItems Task> GetPlayerItemsAsync(ulong steamId); Task> GetSchemaItemsForTF2Async(string language = "en_us"); - + Task> GetSchemaOverviewForTF2Async(string language = "en_us"); Task> GetSchemaUrlAsync(); @@ -19,4 +18,4 @@ public interface IEconItems Task> GetStoreStatusAsync(); } -} +} \ No newline at end of file diff --git a/src/SteamWebAPI2/Interfaces/PlayerService.cs b/src/SteamWebAPI2/Interfaces/PlayerService.cs index 2a1befd..2b1071e 100644 --- a/src/SteamWebAPI2/Interfaces/PlayerService.cs +++ b/src/SteamWebAPI2/Interfaces/PlayerService.cs @@ -3,7 +3,6 @@ using SteamWebAPI2.Models.SteamCommunity; using SteamWebAPI2.Models.SteamPlayer; using SteamWebAPI2.Utilities; -using System; using System.Collections.Generic; using System.Net; using System.Threading.Tasks; @@ -173,7 +172,7 @@ public async Task> GetOwnedGamesAsync(u { foreach (var ownedGame in steamWebResponse.Data.Result.OwnedGames) { - if (!String.IsNullOrWhiteSpace(ownedGame.Name)) + if (!string.IsNullOrWhiteSpace(ownedGame.Name)) { ownedGame.Name = ownedGame.Name.Trim(); } diff --git a/src/SteamWebAPI2/Interfaces/SteamApps.cs b/src/SteamWebAPI2/Interfaces/SteamApps.cs index b5a859a..c21269f 100644 --- a/src/SteamWebAPI2/Interfaces/SteamApps.cs +++ b/src/SteamWebAPI2/Interfaces/SteamApps.cs @@ -2,7 +2,6 @@ using SteamWebAPI2.Models; using SteamWebAPI2.Utilities; using System.Collections.Generic; -using System.Collections.ObjectModel; using System.Threading.Tasks; namespace SteamWebAPI2.Interfaces @@ -53,7 +52,7 @@ public async Task> UpToDateCheckAs var steamWebResponse = await steamWebInterface.GetAsync("UpToDateCheck", 1, parameters); var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< - ISteamWebResponse, + ISteamWebResponse, ISteamWebResponse>(steamWebResponse); return steamWebResponseModel; diff --git a/src/SteamWebAPI2/Interfaces/SteamEconomy.cs b/src/SteamWebAPI2/Interfaces/SteamEconomy.cs index 894c0b6..50a866f 100644 --- a/src/SteamWebAPI2/Interfaces/SteamEconomy.cs +++ b/src/SteamWebAPI2/Interfaces/SteamEconomy.cs @@ -1,7 +1,6 @@ using Steam.Models.SteamEconomy; using SteamWebAPI2.Models.SteamEconomy; using SteamWebAPI2.Utilities; -using System; using System.Collections.Generic; using System.Threading.Tasks; @@ -39,7 +38,7 @@ public async Task> GetAssetClassInf for (int i = 0; i < classIds.Count; i++) { - parameters.AddIfHasValue(classIds[i], String.Format("classid{0}", i)); + parameters.AddIfHasValue(classIds[i], string.Format("classid{0}", i)); } var steamWebResponse = await steamWebInterface.GetAsync("GetAssetClassInfo", 1, parameters); @@ -69,7 +68,7 @@ public async Task> GetAssetPricesAsync( var steamWebResponse = await steamWebInterface.GetAsync("GetAssetPrices", 1, parameters); var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< - ISteamWebResponse, + ISteamWebResponse, ISteamWebResponse>(steamWebResponse); return steamWebResponseModel; diff --git a/src/SteamWebAPI2/Interfaces/SteamNews.cs b/src/SteamWebAPI2/Interfaces/SteamNews.cs index 7ba2ec2..a5ed20e 100644 --- a/src/SteamWebAPI2/Interfaces/SteamNews.cs +++ b/src/SteamWebAPI2/Interfaces/SteamNews.cs @@ -49,7 +49,7 @@ public async Task> GetNewsForAppAsync(ui var steamWebResponse = await steamWebInterface.GetAsync("GetNewsForApp", 2, parameters); var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< - ISteamWebResponse, + ISteamWebResponse, ISteamWebResponse>(steamWebResponse); return steamWebResponseModel; diff --git a/src/SteamWebAPI2/Interfaces/SteamRemoteStorage.cs b/src/SteamWebAPI2/Interfaces/SteamRemoteStorage.cs index 812b0d6..4f13dff 100644 --- a/src/SteamWebAPI2/Interfaces/SteamRemoteStorage.cs +++ b/src/SteamWebAPI2/Interfaces/SteamRemoteStorage.cs @@ -34,7 +34,8 @@ public SteamRemoteStorage(ISteamWebRequest steamWebRequest, ISteamWebInterface s /// A collection of the details of each file or null if the request failed. /// Thrown when is null. /// Thrown when is empty or is greater than the number of elements in . - public async Task>> GetPublishedFileDetailsAsync(uint itemCount, IList publishedFileIds) { + public async Task>> GetPublishedFileDetailsAsync(uint itemCount, IList publishedFileIds) + { if (publishedFileIds == null) { throw new ArgumentNullException(nameof(publishedFileIds)); @@ -132,7 +133,8 @@ public async Task> GetUGCFileDetailsAsync /// The type to which to map the data of the response. /// The parameters of the request. /// The response of the request to the API or null if the request failed. - private async Task> GetPublishedFileDetailsAsync(IList parameters) { + private async Task> GetPublishedFileDetailsAsync(IList parameters) + { try { var steamWebResponse = await steamWebInterface.PostAsync("GetPublishedFileDetails", 1, parameters); diff --git a/src/SteamWebAPI2/Interfaces/SteamStore.cs b/src/SteamWebAPI2/Interfaces/SteamStore.cs index 5973b5f..05aa8c8 100644 --- a/src/SteamWebAPI2/Interfaces/SteamStore.cs +++ b/src/SteamWebAPI2/Interfaces/SteamStore.cs @@ -61,4 +61,4 @@ public async Task GetStoreFeaturedProductsAsync() return featuredProductsModel; } } -} +} \ No newline at end of file diff --git a/src/SteamWebAPI2/Interfaces/SteamUser.cs b/src/SteamWebAPI2/Interfaces/SteamUser.cs index c85b8bd..e15c548 100644 --- a/src/SteamWebAPI2/Interfaces/SteamUser.cs +++ b/src/SteamWebAPI2/Interfaces/SteamUser.cs @@ -3,9 +3,7 @@ using SteamWebAPI2.Models.SteamCommunity; using SteamWebAPI2.Models.SteamPlayer; using SteamWebAPI2.Utilities; -using System; using System.Collections.Generic; -using System.Collections.ObjectModel; using System.IO; using System.Linq; using System.Net.Http; @@ -121,14 +119,14 @@ public async Task>> GetPl { List parameters = new List(); - string steamIdsParamValue = String.Join(",", steamIds); + string steamIdsParamValue = string.Join(",", steamIds); parameters.AddIfHasValue(steamIdsParamValue, "steamids"); var steamWebResponse = await steamWebInterface.GetAsync("GetPlayerBans", 1, parameters); var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< - ISteamWebResponse, + ISteamWebResponse, ISteamWebResponse>>(steamWebResponse); return steamWebResponseModel; @@ -173,7 +171,7 @@ public async Task> ResolveVanityUrlAsync(string vanityU { throw new VanityUrlNotResolvedException(ErrorMessages.VanityUrlNotResolved); } - + var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< ISteamWebResponse, ISteamWebResponse>(steamWebResponse); @@ -189,7 +187,7 @@ public async Task> ResolveVanityUrlAsync(string vanityU public async Task GetCommunityProfileAsync(ulong steamId) { HttpClient httpClient = new HttpClient(); - string xml = await httpClient.GetStringAsync(String.Format("http://steamcommunity.com/profiles/{0}?xml=1", steamId)); + string xml = await httpClient.GetStringAsync(string.Format("http://steamcommunity.com/profiles/{0}?xml=1", steamId)); var profile = DeserializeXML(xml); diff --git a/src/SteamWebAPI2/Interfaces/SteamUserStats.cs b/src/SteamWebAPI2/Interfaces/SteamUserStats.cs index 375c0d7..0994daf 100644 --- a/src/SteamWebAPI2/Interfaces/SteamUserStats.cs +++ b/src/SteamWebAPI2/Interfaces/SteamUserStats.cs @@ -7,7 +7,6 @@ using SteamWebAPI2.Utilities; using System; using System.Collections.Generic; -using System.Collections.ObjectModel; using System.Threading.Tasks; namespace SteamWebAPI2.Interfaces @@ -77,7 +76,7 @@ public async Task>> GetGl for (int i = 0; i < statNames.Count; i++) { - parameters.AddIfHasValue(statNames[i], String.Format("name[{0}]", i)); + parameters.AddIfHasValue(statNames[i], string.Format("name[{0}]", i)); } var steamWebResponse = await steamWebInterface.GetAsync("GetGlobalStatsForGame", 1, parameters); @@ -167,7 +166,7 @@ public async Task> GetUserStatsFo var steamWebResponse = await steamWebInterface.GetAsync("GetUserStatsForGame", 2, parameters); var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< - ISteamWebResponse, + ISteamWebResponse, ISteamWebResponse>(steamWebResponse); return steamWebResponseModel; diff --git a/src/SteamWebAPI2/Interfaces/SteamWebAPIUtil.cs b/src/SteamWebAPI2/Interfaces/SteamWebAPIUtil.cs index cd88e8e..4ad59c3 100644 --- a/src/SteamWebAPI2/Interfaces/SteamWebAPIUtil.cs +++ b/src/SteamWebAPI2/Interfaces/SteamWebAPIUtil.cs @@ -2,7 +2,6 @@ using SteamWebAPI2.Models; using SteamWebAPI2.Utilities; using System.Collections.Generic; -using System.Collections.ObjectModel; using System.Threading.Tasks; namespace SteamWebAPI2.Interfaces @@ -31,7 +30,7 @@ public async Task> GetServerInfoAsync() var steamServerInfo = await steamWebInterface.GetAsync("GetServerInfo", 1); var steamServerInfoModel = AutoMapperConfiguration.Mapper.Map< - ISteamWebResponse, + ISteamWebResponse, ISteamWebResponse>(steamServerInfo); return steamServerInfoModel; @@ -46,7 +45,7 @@ public async Task>> G var steamWebResponse = await steamWebInterface.GetAsync("GetSupportedAPIList", 1); var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< - ISteamWebResponse, + ISteamWebResponse, ISteamWebResponse>>(steamWebResponse); return steamWebResponseModel; diff --git a/src/SteamWebAPI2/Interfaces/TFItems.cs b/src/SteamWebAPI2/Interfaces/TFItems.cs index e6429d3..55ebd17 100644 --- a/src/SteamWebAPI2/Interfaces/TFItems.cs +++ b/src/SteamWebAPI2/Interfaces/TFItems.cs @@ -2,7 +2,6 @@ using SteamWebAPI2.Models.TF2; using SteamWebAPI2.Utilities; using System.Collections.Generic; -using System.Collections.ObjectModel; using System.Threading.Tasks; namespace SteamWebAPI2.Interfaces @@ -31,7 +30,7 @@ public async Task>> Get var steamWebResponse = await steamWebInterface.GetAsync("GetGoldenWrenches", 2); var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< - ISteamWebResponse, + ISteamWebResponse, ISteamWebResponse>>(steamWebResponse); return steamWebResponseModel; diff --git a/src/SteamWebAPI2/Models/DOTA2/GameItemResultContainer.cs b/src/SteamWebAPI2/Models/DOTA2/GameItemResultContainer.cs index 4f8c204..447bfa9 100644 --- a/src/SteamWebAPI2/Models/DOTA2/GameItemResultContainer.cs +++ b/src/SteamWebAPI2/Models/DOTA2/GameItemResultContainer.cs @@ -20,7 +20,7 @@ internal class GameItem [JsonProperty(PropertyName = "localized_name")] public string LocalizedName { get; set; } - public bool IsAvailableAtSecretShop { get { return SecretShop == 1 ? true : false; } } + public bool IsAvailableAtSecretShop { get { return SecretShop == 1 ? true : false; } } public bool IsAvailableAtSideShop { get { return SideShop == 1 ? true : false; } } public bool IsRecipe { get { return Recipe == 1 ? true : false; } } } diff --git a/src/SteamWebAPI2/Models/DOTA2/HeroResultContainer.cs b/src/SteamWebAPI2/Models/DOTA2/HeroResultContainer.cs index 8db2f7c..397d817 100644 --- a/src/SteamWebAPI2/Models/DOTA2/HeroResultContainer.cs +++ b/src/SteamWebAPI2/Models/DOTA2/HeroResultContainer.cs @@ -7,7 +7,7 @@ internal class Hero { public string Name { get; set; } public uint Id { get; set; } - + [JsonProperty(PropertyName = "localized_name")] public string LocalizedName { get; set; } } diff --git a/src/SteamWebAPI2/Models/DOTA2/LiveLeagueGameResultContainer.cs b/src/SteamWebAPI2/Models/DOTA2/LiveLeagueGameResultContainer.cs index 78b4b42..6d4f083 100644 --- a/src/SteamWebAPI2/Models/DOTA2/LiveLeagueGameResultContainer.cs +++ b/src/SteamWebAPI2/Models/DOTA2/LiveLeagueGameResultContainer.cs @@ -1,6 +1,5 @@ using Newtonsoft.Json; using Steam.Models.DOTA2; -using SteamWebAPI2.Interfaces; using System.Collections.Generic; namespace SteamWebAPI2.Models.DOTA2 diff --git a/src/SteamWebAPI2/Models/GameEconomy/SchemaItemResultContainer.cs b/src/SteamWebAPI2/Models/GameEconomy/SchemaItemResultContainer.cs index bd1bb66..1ced99c 100644 --- a/src/SteamWebAPI2/Models/GameEconomy/SchemaItemResultContainer.cs +++ b/src/SteamWebAPI2/Models/GameEconomy/SchemaItemResultContainer.cs @@ -1,5 +1,5 @@ -using System.Collections.Generic; using Newtonsoft.Json; +using System.Collections.Generic; namespace SteamWebAPI2.Models.GameEconomy { @@ -7,10 +7,13 @@ public class SchemaItemsResult { [JsonProperty("status")] public uint Status { get; set; } + [JsonProperty("items_game_url")] public string ItemsGameUrl { get; set; } + [JsonProperty("items")] public IList Items { get; set; } + [JsonProperty("next")] public uint Next { get; set; } } diff --git a/src/SteamWebAPI2/Models/GameEconomy/SchemaOverviewResultContainer.cs b/src/SteamWebAPI2/Models/GameEconomy/SchemaOverviewResultContainer.cs index 1105c9f..a6b00fd 100644 --- a/src/SteamWebAPI2/Models/GameEconomy/SchemaOverviewResultContainer.cs +++ b/src/SteamWebAPI2/Models/GameEconomy/SchemaOverviewResultContainer.cs @@ -1,5 +1,5 @@ -using System.Collections.Generic; using Newtonsoft.Json; +using System.Collections.Generic; namespace SteamWebAPI2.Models.GameEconomy { @@ -7,22 +7,31 @@ public class SchemaOverviewResult { [JsonProperty("status")] public uint Status { get; set; } + [JsonProperty("items_game_url")] public string ItemsGameUrl { get; set; } + [JsonProperty("qualities")] public SchemaQualities Qualities { get; set; } + [JsonProperty("originNames")] public IList OriginNames { get; set; } + [JsonProperty("attributes")] public IList Attributes { get; set; } + [JsonProperty("item_sets")] public IList ItemSets { get; set; } + [JsonProperty("attribute_controlled_attached_particles")] public IList AttributeControlledAttachedParticles { get; set; } + [JsonProperty("item_levels")] public IList ItemLevels { get; set; } + [JsonProperty("kill_eater_score_types")] public IList KillEaterScoreTypes { get; set; } + [JsonProperty("string_lookups")] public IList StringLookups { get; set; } } diff --git a/src/SteamWebAPI2/Models/GameEconomy/SchemaResultContainer.cs b/src/SteamWebAPI2/Models/GameEconomy/SchemaResultContainer.cs index e89e0c1..814f28c 100644 --- a/src/SteamWebAPI2/Models/GameEconomy/SchemaResultContainer.cs +++ b/src/SteamWebAPI2/Models/GameEconomy/SchemaResultContainer.cs @@ -301,7 +301,7 @@ public class SchemaItem [JsonProperty("item_class")] public string ItemClass { get; set; } - + [JsonProperty("proper_name")] public bool ProperName { get; set; } diff --git a/src/SteamWebAPI2/Models/PublishedFileDetailsResultContainer.cs b/src/SteamWebAPI2/Models/PublishedFileDetailsResultContainer.cs index 46ee2be..83ca5f4 100644 --- a/src/SteamWebAPI2/Models/PublishedFileDetailsResultContainer.cs +++ b/src/SteamWebAPI2/Models/PublishedFileDetailsResultContainer.cs @@ -1,8 +1,7 @@ -using System; +using Newtonsoft.Json; +using System; using System.Collections.Generic; -using Newtonsoft.Json; - namespace SteamWebAPI2.Models { using SteamWebAPI2.Utilities.JsonConverters; @@ -102,4 +101,4 @@ internal class PublishedFileDetails [JsonConverter(typeof(TagsJsonConverter))] public IList Tags { get; set; } } -} +} \ No newline at end of file diff --git a/src/SteamWebAPI2/Models/SteamCommunity/SteamCommunityProfile.cs b/src/SteamWebAPI2/Models/SteamCommunity/SteamCommunityProfile.cs index fd86cf5..9885ad1 100644 --- a/src/SteamWebAPI2/Models/SteamCommunity/SteamCommunityProfile.cs +++ b/src/SteamWebAPI2/Models/SteamCommunity/SteamCommunityProfile.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; +using System.Collections.Generic; using System.Runtime.Serialization; -using System.Xml.Serialization; namespace SteamWebAPI2.Models.SteamCommunity { @@ -37,7 +34,7 @@ internal class SteamCommunityProfile public string AvatarFull { get; set; } [DataMember(Name = "vacBanned", Order = 9)] - public byte VacBanned {get; set; } + public byte VacBanned { get; set; } [DataMember(Name = "tradeBanState", Order = 10)] public string TradeBanState { get; set; } @@ -158,36 +155,46 @@ internal class ProfileGroup [DataMember(Name = "memberCount", Order = 8)] public uint MemberCount { get; set; } - + public bool MemberCountSpecified { get; set; } [DataMember(Name = "membersInChat", Order = 9)] public uint MembersInChat { get; set; } - + public bool MembersInChatSpecified { get; set; } [DataMember(Name = "membersInGame", Order = 10)] public uint MembersInGame { get; set; } - + public bool MembersInGameSpecified { get; set; } [DataMember(Name = "membersOnline", Order = 11)] public uint MembersOnline { get; set; } - + public bool MembersOnlineSpecified { get; set; } } [CollectionDataContract(ItemName = "mostPlayedGame", Namespace = "")] internal class ProfileMostPlayedGameList : List { - public ProfileMostPlayedGameList() { } - public ProfileMostPlayedGameList(IEnumerable collection) : base(collection) { } + public ProfileMostPlayedGameList() + { + } + + public ProfileMostPlayedGameList(IEnumerable collection) : base(collection) + { + } } [CollectionDataContract(ItemName = "group", Namespace = "")] internal class ProfileGroupList : List { - public ProfileGroupList() { } - public ProfileGroupList(IEnumerable collection) : base(collection) { } + public ProfileGroupList() + { + } + + public ProfileGroupList(IEnumerable collection) : base(collection) + { + } } } \ No newline at end of file diff --git a/src/SteamWebAPI2/Models/SteamEconomy/CancelTradeOfferResultContainer.cs b/src/SteamWebAPI2/Models/SteamEconomy/CancelTradeOfferResultContainer.cs index cdee0ee..e59890c 100644 --- a/src/SteamWebAPI2/Models/SteamEconomy/CancelTradeOfferResultContainer.cs +++ b/src/SteamWebAPI2/Models/SteamEconomy/CancelTradeOfferResultContainer.cs @@ -1,15 +1,10 @@ using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SteamWebAPI2.Models.SteamEconomy { internal class CancelTradeOfferResult { - // ?? + // ?? TBD? } internal class CancelTradeOfferResultContainer @@ -17,4 +12,4 @@ internal class CancelTradeOfferResultContainer [JsonProperty("response")] public CancelTradeOfferResult Result { get; set; } } -} +} \ No newline at end of file diff --git a/src/SteamWebAPI2/Models/SteamEconomy/DeclineTradeOfferResultContainer.cs b/src/SteamWebAPI2/Models/SteamEconomy/DeclineTradeOfferResultContainer.cs index e21e3be..e19279e 100644 --- a/src/SteamWebAPI2/Models/SteamEconomy/DeclineTradeOfferResultContainer.cs +++ b/src/SteamWebAPI2/Models/SteamEconomy/DeclineTradeOfferResultContainer.cs @@ -1,15 +1,10 @@ using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SteamWebAPI2.Models.SteamEconomy { internal class DeclineTradeOfferResult { - // ?? + // ?? TBD? } internal class DeclineTradeOfferResultContainer @@ -17,4 +12,4 @@ internal class DeclineTradeOfferResultContainer [JsonProperty("response")] public DeclineTradeOfferResult Result { get; set; } } -} +} \ No newline at end of file diff --git a/src/SteamWebAPI2/Models/SteamId.cs b/src/SteamWebAPI2/Models/SteamId.cs index 16b05be..0930d01 100644 --- a/src/SteamWebAPI2/Models/SteamId.cs +++ b/src/SteamWebAPI2/Models/SteamId.cs @@ -224,7 +224,7 @@ public async Task ResolveAsync(string value) string accountTypeCharacter = modernCheckResult[0].Groups[1].Value; string universe = modernCheckResult[0].Groups[2].Value; string accountId = modernCheckResult[0].Groups[3].Value; - string instance = String.Empty; + string instance = string.Empty; if (modernCheckResult[0].Groups.Count == 5) { instance = modernCheckResult[0].Groups[4].Value; @@ -320,7 +320,7 @@ private void ConstructFromModernSteamId(string accountTypeCharacter, string inst else { Instance = SteamInstance.All; } // override if an instance was provided - if (!String.IsNullOrEmpty(instance)) + if (!string.IsNullOrEmpty(instance)) { Instance = (SteamInstance)uint.Parse(instance); } @@ -430,7 +430,7 @@ public string ToLegacyFormat() // Y = lowest bit of Account Id (always 0 or 1) uint y = AccountId & 1; - return String.Format("STEAM_{0}:{1}:{2}", x, y, z); + return string.Format("STEAM_{0}:{1}:{2}", x, y, z); } /// @@ -449,7 +449,7 @@ public string ToModernFormat() // A = account id uint a = AccountId; - return String.Format("[{0}:{1}:{2}]", c, u, a); + return string.Format("[{0}:{1}:{2}]", c, u, a); } /// diff --git a/src/SteamWebAPI2/Models/SteamStore/AppDetailsContainer.cs b/src/SteamWebAPI2/Models/SteamStore/AppDetailsContainer.cs index 68d9889..656109f 100644 --- a/src/SteamWebAPI2/Models/SteamStore/AppDetailsContainer.cs +++ b/src/SteamWebAPI2/Models/SteamStore/AppDetailsContainer.cs @@ -282,4 +282,4 @@ internal class AppDetailsContainer [JsonProperty("data")] public Data Data { get; set; } } -} +} \ No newline at end of file diff --git a/src/SteamWebAPI2/SteamStoreInterface.cs b/src/SteamWebAPI2/SteamStoreInterface.cs index a3d2777..66cf781 100644 --- a/src/SteamWebAPI2/SteamStoreInterface.cs +++ b/src/SteamWebAPI2/SteamStoreInterface.cs @@ -1,5 +1,4 @@ using SteamWebAPI2.Utilities; -using System; using System.Collections.Generic; using System.Diagnostics; using System.Net.Http; @@ -20,7 +19,7 @@ public abstract class SteamStoreInterface /// public SteamStoreInterface() { - this.steamStoreRequest = new SteamStoreRequest(steamStoreApiBaseUrl); + steamStoreRequest = new SteamStoreRequest(steamStoreApiBaseUrl); AutoMapperConfiguration.Initialize(); } @@ -31,7 +30,7 @@ public SteamStoreInterface() /// Client to make requests with public SteamStoreInterface(HttpClient httpClient) { - this.steamStoreRequest = new SteamStoreRequest(steamStoreApiBaseUrl, httpClient); + steamStoreRequest = new SteamStoreRequest(steamStoreApiBaseUrl, httpClient); AutoMapperConfiguration.Initialize(); } @@ -42,7 +41,7 @@ public SteamStoreInterface(HttpClient httpClient) /// Steam Store Web API URL public SteamStoreInterface(string steamStoreApiBaseUrl) { - this.steamStoreRequest = new SteamStoreRequest(steamStoreApiBaseUrl); + steamStoreRequest = new SteamStoreRequest(steamStoreApiBaseUrl); AutoMapperConfiguration.Initialize(); } @@ -54,7 +53,7 @@ public SteamStoreInterface(string steamStoreApiBaseUrl) /// Client to make requests with public SteamStoreInterface(string steamStoreApiBaseUrl, HttpClient httpClient) { - this.steamStoreRequest = new SteamStoreRequest(steamStoreApiBaseUrl, httpClient); + steamStoreRequest = new SteamStoreRequest(steamStoreApiBaseUrl, httpClient); AutoMapperConfiguration.Initialize(); } @@ -68,9 +67,9 @@ public SteamStoreInterface(string steamStoreApiBaseUrl, HttpClient httpClient) /// Deserialized response object internal async Task CallMethodAsync(string endpointName, IList parameters = null) { - Debug.Assert(!String.IsNullOrEmpty(endpointName)); + Debug.Assert(!string.IsNullOrEmpty(endpointName)); return await steamStoreRequest.SendStoreRequestAsync(endpointName, parameters); } } -} +} \ No newline at end of file diff --git a/src/SteamWebAPI2/SteamStoreRequest.cs b/src/SteamWebAPI2/SteamStoreRequest.cs index f6166cd..dd92ced 100644 --- a/src/SteamWebAPI2/SteamStoreRequest.cs +++ b/src/SteamWebAPI2/SteamStoreRequest.cs @@ -22,7 +22,7 @@ internal class SteamStoreRequest /// Steam Store Web API URL public SteamStoreRequest(string steamStoreApiBaseUrl) { - if (String.IsNullOrEmpty(steamStoreApiBaseUrl)) + if (string.IsNullOrEmpty(steamStoreApiBaseUrl)) { throw new ArgumentNullException("steamStoreApiBaseUrl"); } @@ -32,7 +32,7 @@ public SteamStoreRequest(string steamStoreApiBaseUrl) public SteamStoreRequest(string steamStoreApiBaseUrl, HttpClient httpClient) { - if (String.IsNullOrEmpty(steamStoreApiBaseUrl)) + if (string.IsNullOrEmpty(steamStoreApiBaseUrl)) { throw new ArgumentNullException("steamStoreApiBaseUrl"); } @@ -49,7 +49,7 @@ public SteamStoreRequest(string steamStoreApiBaseUrl, HttpClient httpClient) /// public async Task SendStoreRequestAsync(string endpointName) { - Debug.Assert(!String.IsNullOrEmpty(endpointName)); + Debug.Assert(!string.IsNullOrEmpty(endpointName)); return await SendStoreRequestAsync(endpointName, null); } @@ -63,7 +63,7 @@ public async Task SendStoreRequestAsync(string endpointName) /// Deserialized response object public async Task SendStoreRequestAsync(string endpointName, IList parameters) { - Debug.Assert(!String.IsNullOrEmpty(endpointName)); + Debug.Assert(!string.IsNullOrEmpty(endpointName)); if (parameters == null) { @@ -100,23 +100,23 @@ private async Task GetHttpStringResponseAsync(string command) /// Deserialized response object public string BuildRequestCommand(string endpointName, IList parameters) { - Debug.Assert(!String.IsNullOrEmpty(endpointName)); + Debug.Assert(!string.IsNullOrEmpty(endpointName)); if (steamStoreApiBaseUrl.EndsWith("/")) { steamStoreApiBaseUrl = steamStoreApiBaseUrl.Remove(steamStoreApiBaseUrl.Length - 1, 1); } - string commandUrl = String.Format("{0}/{1}/", steamStoreApiBaseUrl, endpointName); + string commandUrl = string.Format("{0}/{1}/", steamStoreApiBaseUrl, endpointName); // if we have parameters, join them together with & delimiter and append them to the command URL if (parameters != null && parameters.Count > 0) { - string parameterString = String.Join("&", parameters); - commandUrl += String.Format("?{0}", parameterString); + string parameterString = string.Join("&", parameters); + commandUrl += string.Format("?{0}", parameterString); } return commandUrl; } } -} +} \ No newline at end of file diff --git a/src/SteamWebAPI2/Utilities/JsonConverters/TagsJsonConverter.cs b/src/SteamWebAPI2/Utilities/JsonConverters/TagsJsonConverter.cs index 91a19a5..039f00d 100644 --- a/src/SteamWebAPI2/Utilities/JsonConverters/TagsJsonConverter.cs +++ b/src/SteamWebAPI2/Utilities/JsonConverters/TagsJsonConverter.cs @@ -1,9 +1,8 @@ -using System; +using Newtonsoft.Json; +using System; using System.Collections.Generic; using System.Reflection; -using Newtonsoft.Json; - namespace SteamWebAPI2.Utilities.JsonConverters { /// @@ -35,4 +34,4 @@ public override bool CanConvert(Type objectType) return typeof(IList>).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo()); } } -} +} \ No newline at end of file diff --git a/src/SteamWebAPI2/Utilities/SteamWebInterface.cs b/src/SteamWebAPI2/Utilities/SteamWebInterface.cs index ea418da..33d8933 100644 --- a/src/SteamWebAPI2/Utilities/SteamWebInterface.cs +++ b/src/SteamWebAPI2/Utilities/SteamWebInterface.cs @@ -23,11 +23,11 @@ internal sealed class SteamWebInterface : ISteamWebInterface /// is used to construct the URL to perform the GET or POST. public SteamWebInterface(string interfaceName, ISteamWebRequest steamWebRequest) { - if (String.IsNullOrWhiteSpace(interfaceName)) + if (string.IsNullOrWhiteSpace(interfaceName)) { throw new ArgumentNullException(nameof(interfaceName)); } - + if (steamWebRequest == null) { throw new ArgumentNullException(nameof(steamWebRequest)); @@ -49,11 +49,11 @@ public SteamWebInterface(string interfaceName, ISteamWebRequest steamWebRequest) public SteamWebInterface(string steamWebApiBaseUrl, string interfaceName, ISteamWebRequest steamWebRequest) : this(interfaceName, steamWebRequest) { - if (String.IsNullOrWhiteSpace(steamWebApiBaseUrl)) + if (string.IsNullOrWhiteSpace(steamWebApiBaseUrl)) { throw new ArgumentNullException(nameof(steamWebApiBaseUrl)); } - + this.steamWebApiBaseUrl = steamWebApiBaseUrl; } @@ -67,7 +67,7 @@ public SteamWebInterface(string steamWebApiBaseUrl, string interfaceName, ISteam /// public async Task> GetAsync(string methodName, int version, IList parameters = null) { - Debug.Assert(!String.IsNullOrWhiteSpace(methodName)); + Debug.Assert(!string.IsNullOrWhiteSpace(methodName)); Debug.Assert(version > 0); return await steamWebRequest.GetAsync(interfaceName, methodName, version, parameters); @@ -83,7 +83,7 @@ public async Task> GetAsync(string methodName, int versi /// public async Task> PostAsync(string methodName, int version, IList parameters = null) { - Debug.Assert(!String.IsNullOrWhiteSpace(methodName)); + Debug.Assert(!string.IsNullOrWhiteSpace(methodName)); Debug.Assert(version > 0); return await steamWebRequest.PostAsync(interfaceName, methodName, version, parameters); diff --git a/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs b/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs index 6b2e6dd..1304884 100644 --- a/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs +++ b/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs @@ -1,6 +1,6 @@ +using SteamWebAPI2.Interfaces; using System; using System.Net.Http; -using SteamWebAPI2.Interfaces; namespace SteamWebAPI2.Utilities { @@ -16,14 +16,14 @@ public class SteamWebInterfaceFactory /// Base URL of the Steam Web API (optional) public SteamWebInterfaceFactory(string steamWebApiKey, string steamWebApiBaseUrl = null) { - if(string.IsNullOrWhiteSpace(steamWebApiKey)) + if (string.IsNullOrWhiteSpace(steamWebApiKey)) { throw new ArgumentNullException(nameof(steamWebApiKey)); } this.steamWebApiKey = steamWebApiKey; - if(!string.IsNullOrWhiteSpace(steamWebApiBaseUrl)) + if (!string.IsNullOrWhiteSpace(steamWebApiBaseUrl)) { this.steamWebApiBaseUrl = steamWebApiBaseUrl; } @@ -41,7 +41,7 @@ public T CreateSteamWebInterface(HttpClient httpClient) return (T)Activator.CreateInstance(typeof(T), steamWebRequest, null); } - /// + /// /// Creates a web interface object connected to a specific Steam Web API interfac endpoint /// /// Custom http client injected with your customization (if necessary) diff --git a/src/SteamWebAPI2/Utilities/SteamWebRequest.cs b/src/SteamWebAPI2/Utilities/SteamWebRequest.cs index b31b610..147f8bf 100644 --- a/src/SteamWebAPI2/Utilities/SteamWebRequest.cs +++ b/src/SteamWebAPI2/Utilities/SteamWebRequest.cs @@ -116,11 +116,10 @@ private async Task> SendWebRequestAsync(HttpMethod httpM httpResponse = await httpClient.GetAsync(command).ConfigureAwait(false); httpResponse.EnsureSuccessStatusCode(); - if(httpResponse.Content == null) + if (httpResponse.Content == null) { httpResponse = new HttpResponseMessage(HttpStatusCode.NoContent); } - } else if (httpMethod == HttpMethod.POST) { diff --git a/src/SteamWebAPI2/Utilities/SteamWebRequestParameter.cs b/src/SteamWebAPI2/Utilities/SteamWebRequestParameter.cs index b70e891..c2efa1b 100644 --- a/src/SteamWebAPI2/Utilities/SteamWebRequestParameter.cs +++ b/src/SteamWebAPI2/Utilities/SteamWebRequestParameter.cs @@ -25,13 +25,13 @@ public class SteamWebRequestParameter /// Value to give this parameter public SteamWebRequestParameter(string name, string value) { - if (String.IsNullOrWhiteSpace(name)) + if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentNullException("name"); } - this.Name = name; - this.Value = value; + Name = name; + Value = value; } /// @@ -39,7 +39,7 @@ public SteamWebRequestParameter(string name, string value) /// public override string ToString() { - return String.Format("{0}={1}", Name, Value.ToString()); + return string.Format("{0}={1}", Name, Value.ToString()); } } } \ No newline at end of file diff --git a/src/SteamWebAPI2/Utilities/SteamWebRequestParameterExtensions.cs b/src/SteamWebAPI2/Utilities/SteamWebRequestParameterExtensions.cs index 0dfda27..af44925 100644 --- a/src/SteamWebAPI2/Utilities/SteamWebRequestParameterExtensions.cs +++ b/src/SteamWebAPI2/Utilities/SteamWebRequestParameterExtensions.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; namespace SteamWebAPI2.Utilities { @@ -43,7 +42,7 @@ internal static void AddIfHasValue(this IList list, /// List of web request parameters that will be used in the building of the request URL internal static void AddIfHasValue(this IList list, string value, string name) { - if (!String.IsNullOrEmpty(value)) + if (!string.IsNullOrEmpty(value)) { list.Add(new SteamWebRequestParameter(name, value)); } From 44f2916cf5c2570f98fe712cf98275d4d567d279 Mon Sep 17 00:00:00 2001 From: Justin Date: Tue, 25 Feb 2020 12:22:27 -0500 Subject: [PATCH 023/107] Removed Steam.Models nuget dependency --- src/Steam.Models/AvailableGameStatsModel.cs | 11 ++ src/Steam.Models/CSGO/ServerStatusAppModel.cs | 9 + .../CSGO/ServerStatusDatacenterModel.cs | 9 + .../CSGO/ServerStatusMatchmakingModel.cs | 15 ++ src/Steam.Models/CSGO/ServerStatusModel.cs | 12 ++ .../CSGO/ServerStatusServicesModel.cs | 10 + .../DOTA2/AbilitySchemaItemModel.cs | 55 ++++++ .../DOTA2/AbilitySpecialSchemaItemModel.cs | 10 + src/Steam.Models/DOTA2/BarracksStateModel.cs | 26 +++ src/Steam.Models/DOTA2/DotaAttackType.cs | 13 ++ src/Steam.Models/DOTA2/DotaBlogFeedItem.cs | 20 ++ src/Steam.Models/DOTA2/DotaDamageType.cs | 14 ++ src/Steam.Models/DOTA2/DotaEnumType.cs | 23 +++ .../DOTA2/DotaHeroAbilityBehaviorType.cs | 36 ++++ src/Steam.Models/DOTA2/DotaHeroAbilityType.cs | 14 ++ .../DOTA2/DotaHeroPrimaryAttributeType.cs | 13 ++ .../DOTA2/DotaItemDeclarationType.cs | 14 ++ .../DOTA2/DotaItemDisassembleType.cs | 13 ++ .../DOTA2/DotaItemShareabilityType.cs | 14 ++ src/Steam.Models/DOTA2/DotaLeagueTier.cs | 9 + .../DOTA2/DotaSpellImmunityType.cs | 15 ++ src/Steam.Models/DOTA2/DotaTeamType.cs | 13 ++ src/Steam.Models/DOTA2/DotaUnitTargetFlag.cs | 17 ++ .../DOTA2/DotaUnitTargetTeamType.cs | 15 ++ src/Steam.Models/DOTA2/DotaUnitTargetType.cs | 15 ++ src/Steam.Models/DOTA2/GameFile.cs | 14 ++ src/Steam.Models/DOTA2/GameItemModel.cs | 13 ++ .../DOTA2/HeroAbilityDetailModel.cs | 41 ++++ .../DOTA2/HeroAbilitySpecialDetailModel.cs | 10 + src/Steam.Models/DOTA2/HeroDetailModel.cs | 123 ++++++++++++ src/Steam.Models/DOTA2/HeroModel.cs | 9 + src/Steam.Models/DOTA2/HeroRoleModel.cs | 8 + src/Steam.Models/DOTA2/HeroSchemaModel.cs | 181 ++++++++++++++++++ .../DOTA2/ItemAbilitySchemaItemModel.cs | 91 +++++++++ .../DOTA2/ItemBuildGroupSchemaItemModel.cs | 10 + .../DOTA2/ItemBuildSchemaItemModel.cs | 13 ++ src/Steam.Models/DOTA2/LeagueModel.cs | 34 ++++ .../DOTA2/LiveLeagueGameAbilityModel.cs | 9 + .../DOTA2/LiveLeagueGameBanModel.cs | 7 + .../DOTA2/LiveLeagueGameFlattenedModel.cs | 35 ++++ .../DOTA2/LiveLeagueGameHeroModel.cs | 10 + .../DOTA2/LiveLeagueGameItemModel.cs | 9 + src/Steam.Models/DOTA2/LiveLeagueGameModel.cs | 43 +++++ .../DOTA2/LiveLeagueGamePickModel.cs | 7 + .../DOTA2/LiveLeagueGamePlayerDetailModel.cs | 30 +++ .../DOTA2/LiveLeagueGamePlayerInfoModel.cs | 13 ++ .../DOTA2/LiveLeagueGamePlayerModel.cs | 34 ++++ .../DOTA2/LiveLeagueGameScoreboardModel.cs | 12 ++ .../LiveLeagueGameTeamDireDetailModel.cs | 20 ++ .../DOTA2/LiveLeagueGameTeamDireInfoModel.cs | 13 ++ .../LiveLeagueGameTeamRadiantDetailModel.cs | 21 ++ .../LiveLeagueGameTeamRadiantInfoModel.cs | 13 ++ src/Steam.Models/DOTA2/MatchDetailModel.cs | 76 ++++++++ .../MatchHistoryBySequenceNumberMatchModel.cs | 63 ++++++ ...nceNumberMatchPlayerAbilityUpgradeModel.cs | 17 ++ ...HistoryBySequenceNumberMatchPlayerModel.cs | 59 ++++++ .../DOTA2/MatchHistoryMatchModel.cs | 22 +++ src/Steam.Models/DOTA2/MatchHistoryModel.cs | 17 ++ .../DOTA2/MatchHistoryPlayerModel.cs | 11 ++ src/Steam.Models/DOTA2/MatchPickBanModel.cs | 12 ++ .../DOTA2/MatchPlayerAbilityUpgradeModel.cs | 9 + src/Steam.Models/DOTA2/MatchPlayerModel.cs | 53 +++++ src/Steam.Models/DOTA2/PlayerCountModel.cs | 9 + .../DOTA2/PlayerOfficialInfoModel.cs | 11 ++ .../DOTA2/ProPlayerDetailModel.cs | 11 ++ src/Steam.Models/DOTA2/ProPlayerInfoModel.cs | 23 +++ .../DOTA2/ProPlayerLeaderboardModel.cs | 11 ++ src/Steam.Models/DOTA2/RarityModel.cs | 11 ++ src/Steam.Models/DOTA2/SchemaColorModel.cs | 11 ++ src/Steam.Models/DOTA2/SchemaGameInfoModel.cs | 15 ++ .../DOTA2/SchemaItemAutographModel.cs | 19 ++ src/Steam.Models/DOTA2/SchemaItemModel.cs | 44 +++++ .../DOTA2/SchemaItemPriceInfoModel.cs | 19 ++ src/Steam.Models/DOTA2/SchemaItemSetModel.cs | 15 ++ src/Steam.Models/DOTA2/SchemaItemToolModel.cs | 7 + .../DOTA2/SchemaItemToolUsageModel.cs | 13 ++ src/Steam.Models/DOTA2/SchemaModel.cs | 23 +++ .../DOTA2/SchemaPrefabCapabilityModel.cs | 23 +++ src/Steam.Models/DOTA2/SchemaPrefabModel.cs | 29 +++ src/Steam.Models/DOTA2/SchemaQualityModel.cs | 11 ++ src/Steam.Models/DOTA2/SchemaRarityModel.cs | 15 ++ src/Steam.Models/DOTA2/SourceFileModel.cs | 14 ++ src/Steam.Models/DOTA2/TeamInfoModel.cs | 21 ++ src/Steam.Models/DOTA2/TowerStateModel.cs | 36 ++++ src/Steam.Models/GameClientResultModel.cs | 11 ++ .../EconItemAttributeAccountInfoModel.cs | 8 + .../GameEconomy/EconItemAttributeModel.cs | 12 ++ .../GameEconomy/EconItemEquippedModel.cs | 9 + src/Steam.Models/GameEconomy/EconItemModel.cs | 25 +++ .../GameEconomy/EconItemResultModel.cs | 13 ++ .../SchemaAdditionalHiddenBodygroupsModel.cs | 11 ++ ...ttributeControlledAttachedParticleModel.cs | 15 ++ .../GameEconomy/SchemaAttributeModel.cs | 21 ++ .../GameEconomy/SchemaCapabilitiesModel.cs | 45 +++++ .../GameEconomy/SchemaItemAttributeModel.cs | 11 ++ .../GameEconomy/SchemaItemLevelModel.cs | 11 ++ .../GameEconomy/SchemaItemModel.cs | 81 ++++++++ .../SchemaItemSetAttributeModel.cs | 11 ++ .../GameEconomy/SchemaItemSetModel.cs | 19 ++ .../SchemaKillEaterScoreTypeModel.cs | 11 ++ .../GameEconomy/SchemaLevelModel.cs | 11 ++ src/Steam.Models/GameEconomy/SchemaModel.cs | 29 +++ .../GameEconomy/SchemaOriginNameModel.cs | 9 + .../SchemaPerClassLoadoutSlotsModel.cs | 15 ++ .../GameEconomy/SchemaQualitiesModel.cs | 82 ++++++++ .../GameEconomy/SchemaStringLookupModel.cs | 11 ++ .../GameEconomy/SchemaStringModel.cs | 9 + .../GameEconomy/SchemaStyleModel.cs | 9 + .../GameEconomy/SchemaToolModel.cs | 17 ++ .../SchemaUsageCapabilitiesModel.cs | 31 +++ .../GameEconomy/StoreBannerModel.cs | 13 ++ .../GameEconomy/StoreCarouselDataModel.cs | 11 ++ .../GameEconomy/StoreConfigModel.cs | 13 ++ .../GameEconomy/StoreDropdownDataModel.cs | 11 ++ .../GameEconomy/StoreDropdownModel.cs | 15 ++ .../GameEconomy/StoreFilterAllElementModel.cs | 9 + .../GameEconomy/StoreFilterElementModel.cs | 11 ++ .../GameEconomy/StoreFilterModel.cs | 19 ++ .../GameEconomy/StoreHomePageDataModel.cs | 11 ++ .../GameEconomy/StoreMetaDataModel.cs | 21 ++ .../GameEconomy/StorePlayerClassDataModel.cs | 11 ++ .../GameEconomy/StorePopularItemModel.cs | 9 + .../GameEconomy/StorePrefabModel.cs | 13 ++ .../GameEconomy/StoreSorterIdModel.cs | 7 + .../GameEconomy/StoreSorterModel.cs | 17 ++ .../GameEconomy/StoreSortingModel.cs | 11 ++ .../GameEconomy/StoreSortingPrefabModel.cs | 15 ++ .../GameEconomy/StoreTabChildModel.cs | 9 + src/Steam.Models/GameEconomy/StoreTabModel.cs | 25 +++ src/Steam.Models/NewsItemModel.cs | 23 +++ src/Steam.Models/PublishedFileDetailsModel.cs | 56 ++++++ src/Steam.Models/PublishedFileVisibility.cs | 9 + src/Steam.Models/SchemaForGameResultModel.cs | 11 ++ .../SchemaGameAchievementModel.cs | 19 ++ src/Steam.Models/SchemaGameStatModel.cs | 11 ++ src/Steam.Models/Steam.Models.csproj | 14 ++ src/Steam.Models/SteamAppModel.cs | 9 + .../SteamAppUpToDateCheckModel.cs | 15 ++ src/Steam.Models/SteamCommunity/BadgeModel.cs | 21 ++ .../SteamCommunity/BadgeQuestModel.cs | 9 + .../SteamCommunity/BadgesResultModel.cs | 17 ++ .../SteamCommunity/CommentPermission.cs | 13 ++ .../SteamCommunity/FriendModel.cs | 13 ++ .../GlobalAchievementPercentageModel.cs | 9 + .../SteamCommunity/GlobalStatModel.cs | 8 + .../SteamCommunity/OwnedGameModel.cs | 21 ++ .../SteamCommunity/OwnedGamesResultModel.cs | 11 ++ .../SteamCommunity/PlayerBansModel.cs | 19 ++ .../SteamCommunity/PlayerSummaryModel.cs | 104 ++++++++++ .../SteamCommunity/ProfileVisibility.cs | 13 ++ .../SteamCommunity/RecentlyPlayedGameModel.cs | 17 ++ .../RecentlyPlayedGamesResultModel.cs | 11 ++ .../SteamCommunityProfileModel.cs | 51 +++++ src/Steam.Models/SteamCommunity/UserStatus.cs | 16 ++ .../SteamEconomy/AssetClassActionModel.cs | 9 + .../AssetClassAppDataFilterModel.cs | 9 + .../SteamEconomy/AssetClassAppDataModel.cs | 19 ++ .../AssetClassDescriptionModel.cs | 13 ++ .../SteamEconomy/AssetClassInfoModel.cs | 49 +++++ .../SteamEconomy/AssetClassInfoResultModel.cs | 11 ++ .../AssetClassMarketActionModel.cs | 9 + .../SteamEconomy/AssetClassModel.cs | 9 + .../SteamEconomy/AssetClassTagModel.cs | 15 ++ src/Steam.Models/SteamEconomy/AssetModel.cs | 21 ++ .../SteamEconomy/AssetPriceResultModel.cs | 15 ++ .../SteamEconomy/AssetPricesModel.cs | 59 ++++++ .../SteamEconomy/AssetTagIdsModel.cs | 23 +++ .../SteamEconomy/AssetTagsModel.cs | 23 +++ .../SteamEconomy/TradeAssetModel.cs | 39 ++++ .../SteamEconomy/TradeHistoryModel.cs | 27 +++ src/Steam.Models/SteamEconomy/TradeModel.cs | 53 +++++ .../TradeOfferConfirmationMethod.cs | 12 ++ .../SteamEconomy/TradeOfferModel.cs | 73 +++++++ .../SteamEconomy/TradeOfferResultModel.cs | 17 ++ .../SteamEconomy/TradeOfferState.cs | 20 ++ .../SteamEconomy/TradeOffersResultModel.cs | 22 +++ src/Steam.Models/SteamEconomy/TradeStatus.cs | 21 ++ .../SteamEconomy/TradedAssetModel.cs | 43 +++++ .../SteamEconomy/TradedCurrencyModel.cs | 35 ++++ src/Steam.Models/SteamInterfaceModel.cs | 10 + src/Steam.Models/SteamMethodModel.cs | 13 ++ src/Steam.Models/SteamNewsResultModel.cs | 11 ++ src/Steam.Models/SteamParameterModel.cs | 12 ++ .../SteamPlayer/PlayerAchievementModel.cs | 13 ++ .../PlayerAchievementResultModel.cs | 15 ++ .../SteamPlayer/UserStatAchievementModel.cs | 9 + src/Steam.Models/SteamPlayer/UserStatModel.cs | 9 + .../UserStatsForGameResultModel.cs | 15 ++ src/Steam.Models/SteamServerInfo.cs | 12 ++ src/Steam.Models/SteamServerInfoModel.cs | 12 ++ .../SteamStore/StoreAppDetailsDataModel.cs | 71 +++++++ .../SteamStore/StoreCategoryModel.cs | 15 ++ .../SteamStore/StoreComingSoonModel.cs | 17 ++ .../StoreFeaturedCategoriesModel.cs | 25 +++ .../StoreFeaturedCategoryGenreModel.cs | 15 ++ .../SteamStore/StoreFeaturedLinuxModel.cs | 43 +++++ .../SteamStore/StoreFeaturedMacModel.cs | 43 +++++ .../SteamStore/StoreFeaturedProductsModel.cs | 23 +++ .../SteamStore/StoreFeaturedWinModel.cs | 45 +++++ .../SteamStore/StoreGenreModel.cs | 15 ++ src/Steam.Models/SteamStore/StoreItemModel.cs | 47 +++++ .../SteamStore/StoreLargeCapsuleModel.cs | 45 +++++ .../SteamStore/StoreMetacriticModel.cs | 15 ++ .../SteamStore/StoreMovieModel.cs | 21 ++ .../SteamStore/StoreNewReleasesModel.cs | 17 ++ .../SteamStore/StorePackageGroupModel.cs | 27 +++ .../SteamStore/StorePlatformsModel.cs | 17 ++ .../SteamStore/StorePriceOverview.cs | 17 ++ .../SteamStore/StoreRecommendationsModel.cs | 13 ++ .../SteamStore/StoreReleaseDateModel.cs | 15 ++ .../SteamStore/StoreScreenshotModel.cs | 17 ++ .../SteamStore/StoreSpecialsModel.cs | 17 ++ src/Steam.Models/SteamStore/StoreSubModel.cs | 27 +++ .../SteamStore/StoreSupportInfoModel.cs | 15 ++ .../SteamStore/StoreTopSellersModel.cs | 17 ++ .../SteamStore/StoreTrailerSlideshowModel.cs | 15 ++ src/Steam.Models/SteamStore/StoreWebmModel.cs | 15 ++ src/Steam.Models/TF2/GoldenWrenchModel.cs | 15 ++ .../SchemaAdditionalHiddenBodygroupsModel.cs | 17 ++ ...ttributeControlledAttachedParticleModel.cs | 21 ++ src/Steam.Models/TF2/SchemaAttributeModel.cs | 27 +++ .../TF2/SchemaCapabilitiesModel.cs | 51 +++++ .../TF2/SchemaItemAttributeModel.cs | 17 ++ src/Steam.Models/TF2/SchemaItemLevelModel.cs | 15 ++ src/Steam.Models/TF2/SchemaItemModel.cs | 65 +++++++ .../TF2/SchemaItemSetAttributeModel.cs | 17 ++ src/Steam.Models/TF2/SchemaItemSetModel.cs | 21 ++ .../TF2/SchemaKillEaterScoreTypeModel.cs | 17 ++ src/Steam.Models/TF2/SchemaLevelModel.cs | 17 ++ src/Steam.Models/TF2/SchemaModel.cs | 31 +++ src/Steam.Models/TF2/SchemaOriginNameModel.cs | 15 ++ .../TF2/SchemaPerClassLoadoutSlotsModel.cs | 21 ++ src/Steam.Models/TF2/SchemaQualitiesModel.cs | 88 +++++++++ .../TF2/SchemaStringLookupModel.cs | 15 ++ src/Steam.Models/TF2/SchemaStringModel.cs | 15 ++ src/Steam.Models/TF2/SchemaStyleModel.cs | 15 ++ src/Steam.Models/TF2/SchemaToolModel.cs | 19 ++ .../TF2/SchemaUsageCapabilitiesModel.cs | 37 ++++ src/Steam.Models/UGCFileDetailsModel.cs | 9 + .../Utilities/DateTimeExtensions.cs | 32 ++++ src/SteamWebAPI2.sln | 12 +- src/SteamWebAPI2/SteamWebAPI2.csproj | 5 +- 242 files changed, 5332 insertions(+), 4 deletions(-) create mode 100644 src/Steam.Models/AvailableGameStatsModel.cs create mode 100644 src/Steam.Models/CSGO/ServerStatusAppModel.cs create mode 100644 src/Steam.Models/CSGO/ServerStatusDatacenterModel.cs create mode 100644 src/Steam.Models/CSGO/ServerStatusMatchmakingModel.cs create mode 100644 src/Steam.Models/CSGO/ServerStatusModel.cs create mode 100644 src/Steam.Models/CSGO/ServerStatusServicesModel.cs create mode 100644 src/Steam.Models/DOTA2/AbilitySchemaItemModel.cs create mode 100644 src/Steam.Models/DOTA2/AbilitySpecialSchemaItemModel.cs create mode 100644 src/Steam.Models/DOTA2/BarracksStateModel.cs create mode 100644 src/Steam.Models/DOTA2/DotaAttackType.cs create mode 100644 src/Steam.Models/DOTA2/DotaBlogFeedItem.cs create mode 100644 src/Steam.Models/DOTA2/DotaDamageType.cs create mode 100644 src/Steam.Models/DOTA2/DotaEnumType.cs create mode 100644 src/Steam.Models/DOTA2/DotaHeroAbilityBehaviorType.cs create mode 100644 src/Steam.Models/DOTA2/DotaHeroAbilityType.cs create mode 100644 src/Steam.Models/DOTA2/DotaHeroPrimaryAttributeType.cs create mode 100644 src/Steam.Models/DOTA2/DotaItemDeclarationType.cs create mode 100644 src/Steam.Models/DOTA2/DotaItemDisassembleType.cs create mode 100644 src/Steam.Models/DOTA2/DotaItemShareabilityType.cs create mode 100644 src/Steam.Models/DOTA2/DotaLeagueTier.cs create mode 100644 src/Steam.Models/DOTA2/DotaSpellImmunityType.cs create mode 100644 src/Steam.Models/DOTA2/DotaTeamType.cs create mode 100644 src/Steam.Models/DOTA2/DotaUnitTargetFlag.cs create mode 100644 src/Steam.Models/DOTA2/DotaUnitTargetTeamType.cs create mode 100644 src/Steam.Models/DOTA2/DotaUnitTargetType.cs create mode 100644 src/Steam.Models/DOTA2/GameFile.cs create mode 100644 src/Steam.Models/DOTA2/GameItemModel.cs create mode 100644 src/Steam.Models/DOTA2/HeroAbilityDetailModel.cs create mode 100644 src/Steam.Models/DOTA2/HeroAbilitySpecialDetailModel.cs create mode 100644 src/Steam.Models/DOTA2/HeroDetailModel.cs create mode 100644 src/Steam.Models/DOTA2/HeroModel.cs create mode 100644 src/Steam.Models/DOTA2/HeroRoleModel.cs create mode 100644 src/Steam.Models/DOTA2/HeroSchemaModel.cs create mode 100644 src/Steam.Models/DOTA2/ItemAbilitySchemaItemModel.cs create mode 100644 src/Steam.Models/DOTA2/ItemBuildGroupSchemaItemModel.cs create mode 100644 src/Steam.Models/DOTA2/ItemBuildSchemaItemModel.cs create mode 100644 src/Steam.Models/DOTA2/LeagueModel.cs create mode 100644 src/Steam.Models/DOTA2/LiveLeagueGameAbilityModel.cs create mode 100644 src/Steam.Models/DOTA2/LiveLeagueGameBanModel.cs create mode 100644 src/Steam.Models/DOTA2/LiveLeagueGameFlattenedModel.cs create mode 100644 src/Steam.Models/DOTA2/LiveLeagueGameHeroModel.cs create mode 100644 src/Steam.Models/DOTA2/LiveLeagueGameItemModel.cs create mode 100644 src/Steam.Models/DOTA2/LiveLeagueGameModel.cs create mode 100644 src/Steam.Models/DOTA2/LiveLeagueGamePickModel.cs create mode 100644 src/Steam.Models/DOTA2/LiveLeagueGamePlayerDetailModel.cs create mode 100644 src/Steam.Models/DOTA2/LiveLeagueGamePlayerInfoModel.cs create mode 100644 src/Steam.Models/DOTA2/LiveLeagueGamePlayerModel.cs create mode 100644 src/Steam.Models/DOTA2/LiveLeagueGameScoreboardModel.cs create mode 100644 src/Steam.Models/DOTA2/LiveLeagueGameTeamDireDetailModel.cs create mode 100644 src/Steam.Models/DOTA2/LiveLeagueGameTeamDireInfoModel.cs create mode 100644 src/Steam.Models/DOTA2/LiveLeagueGameTeamRadiantDetailModel.cs create mode 100644 src/Steam.Models/DOTA2/LiveLeagueGameTeamRadiantInfoModel.cs create mode 100644 src/Steam.Models/DOTA2/MatchDetailModel.cs create mode 100644 src/Steam.Models/DOTA2/MatchHistoryBySequenceNumberMatchModel.cs create mode 100644 src/Steam.Models/DOTA2/MatchHistoryBySequenceNumberMatchPlayerAbilityUpgradeModel.cs create mode 100644 src/Steam.Models/DOTA2/MatchHistoryBySequenceNumberMatchPlayerModel.cs create mode 100644 src/Steam.Models/DOTA2/MatchHistoryMatchModel.cs create mode 100644 src/Steam.Models/DOTA2/MatchHistoryModel.cs create mode 100644 src/Steam.Models/DOTA2/MatchHistoryPlayerModel.cs create mode 100644 src/Steam.Models/DOTA2/MatchPickBanModel.cs create mode 100644 src/Steam.Models/DOTA2/MatchPlayerAbilityUpgradeModel.cs create mode 100644 src/Steam.Models/DOTA2/MatchPlayerModel.cs create mode 100644 src/Steam.Models/DOTA2/PlayerCountModel.cs create mode 100644 src/Steam.Models/DOTA2/PlayerOfficialInfoModel.cs create mode 100644 src/Steam.Models/DOTA2/ProPlayerDetailModel.cs create mode 100644 src/Steam.Models/DOTA2/ProPlayerInfoModel.cs create mode 100644 src/Steam.Models/DOTA2/ProPlayerLeaderboardModel.cs create mode 100644 src/Steam.Models/DOTA2/RarityModel.cs create mode 100644 src/Steam.Models/DOTA2/SchemaColorModel.cs create mode 100644 src/Steam.Models/DOTA2/SchemaGameInfoModel.cs create mode 100644 src/Steam.Models/DOTA2/SchemaItemAutographModel.cs create mode 100644 src/Steam.Models/DOTA2/SchemaItemModel.cs create mode 100644 src/Steam.Models/DOTA2/SchemaItemPriceInfoModel.cs create mode 100644 src/Steam.Models/DOTA2/SchemaItemSetModel.cs create mode 100644 src/Steam.Models/DOTA2/SchemaItemToolModel.cs create mode 100644 src/Steam.Models/DOTA2/SchemaItemToolUsageModel.cs create mode 100644 src/Steam.Models/DOTA2/SchemaModel.cs create mode 100644 src/Steam.Models/DOTA2/SchemaPrefabCapabilityModel.cs create mode 100644 src/Steam.Models/DOTA2/SchemaPrefabModel.cs create mode 100644 src/Steam.Models/DOTA2/SchemaQualityModel.cs create mode 100644 src/Steam.Models/DOTA2/SchemaRarityModel.cs create mode 100644 src/Steam.Models/DOTA2/SourceFileModel.cs create mode 100644 src/Steam.Models/DOTA2/TeamInfoModel.cs create mode 100644 src/Steam.Models/DOTA2/TowerStateModel.cs create mode 100644 src/Steam.Models/GameClientResultModel.cs create mode 100644 src/Steam.Models/GameEconomy/EconItemAttributeAccountInfoModel.cs create mode 100644 src/Steam.Models/GameEconomy/EconItemAttributeModel.cs create mode 100644 src/Steam.Models/GameEconomy/EconItemEquippedModel.cs create mode 100644 src/Steam.Models/GameEconomy/EconItemModel.cs create mode 100644 src/Steam.Models/GameEconomy/EconItemResultModel.cs create mode 100644 src/Steam.Models/GameEconomy/SchemaAdditionalHiddenBodygroupsModel.cs create mode 100644 src/Steam.Models/GameEconomy/SchemaAttributeControlledAttachedParticleModel.cs create mode 100644 src/Steam.Models/GameEconomy/SchemaAttributeModel.cs create mode 100644 src/Steam.Models/GameEconomy/SchemaCapabilitiesModel.cs create mode 100644 src/Steam.Models/GameEconomy/SchemaItemAttributeModel.cs create mode 100644 src/Steam.Models/GameEconomy/SchemaItemLevelModel.cs create mode 100644 src/Steam.Models/GameEconomy/SchemaItemModel.cs create mode 100644 src/Steam.Models/GameEconomy/SchemaItemSetAttributeModel.cs create mode 100644 src/Steam.Models/GameEconomy/SchemaItemSetModel.cs create mode 100644 src/Steam.Models/GameEconomy/SchemaKillEaterScoreTypeModel.cs create mode 100644 src/Steam.Models/GameEconomy/SchemaLevelModel.cs create mode 100644 src/Steam.Models/GameEconomy/SchemaModel.cs create mode 100644 src/Steam.Models/GameEconomy/SchemaOriginNameModel.cs create mode 100644 src/Steam.Models/GameEconomy/SchemaPerClassLoadoutSlotsModel.cs create mode 100644 src/Steam.Models/GameEconomy/SchemaQualitiesModel.cs create mode 100644 src/Steam.Models/GameEconomy/SchemaStringLookupModel.cs create mode 100644 src/Steam.Models/GameEconomy/SchemaStringModel.cs create mode 100644 src/Steam.Models/GameEconomy/SchemaStyleModel.cs create mode 100644 src/Steam.Models/GameEconomy/SchemaToolModel.cs create mode 100644 src/Steam.Models/GameEconomy/SchemaUsageCapabilitiesModel.cs create mode 100644 src/Steam.Models/GameEconomy/StoreBannerModel.cs create mode 100644 src/Steam.Models/GameEconomy/StoreCarouselDataModel.cs create mode 100644 src/Steam.Models/GameEconomy/StoreConfigModel.cs create mode 100644 src/Steam.Models/GameEconomy/StoreDropdownDataModel.cs create mode 100644 src/Steam.Models/GameEconomy/StoreDropdownModel.cs create mode 100644 src/Steam.Models/GameEconomy/StoreFilterAllElementModel.cs create mode 100644 src/Steam.Models/GameEconomy/StoreFilterElementModel.cs create mode 100644 src/Steam.Models/GameEconomy/StoreFilterModel.cs create mode 100644 src/Steam.Models/GameEconomy/StoreHomePageDataModel.cs create mode 100644 src/Steam.Models/GameEconomy/StoreMetaDataModel.cs create mode 100644 src/Steam.Models/GameEconomy/StorePlayerClassDataModel.cs create mode 100644 src/Steam.Models/GameEconomy/StorePopularItemModel.cs create mode 100644 src/Steam.Models/GameEconomy/StorePrefabModel.cs create mode 100644 src/Steam.Models/GameEconomy/StoreSorterIdModel.cs create mode 100644 src/Steam.Models/GameEconomy/StoreSorterModel.cs create mode 100644 src/Steam.Models/GameEconomy/StoreSortingModel.cs create mode 100644 src/Steam.Models/GameEconomy/StoreSortingPrefabModel.cs create mode 100644 src/Steam.Models/GameEconomy/StoreTabChildModel.cs create mode 100644 src/Steam.Models/GameEconomy/StoreTabModel.cs create mode 100644 src/Steam.Models/NewsItemModel.cs create mode 100644 src/Steam.Models/PublishedFileDetailsModel.cs create mode 100644 src/Steam.Models/PublishedFileVisibility.cs create mode 100644 src/Steam.Models/SchemaForGameResultModel.cs create mode 100644 src/Steam.Models/SchemaGameAchievementModel.cs create mode 100644 src/Steam.Models/SchemaGameStatModel.cs create mode 100644 src/Steam.Models/Steam.Models.csproj create mode 100644 src/Steam.Models/SteamAppModel.cs create mode 100644 src/Steam.Models/SteamAppUpToDateCheckModel.cs create mode 100644 src/Steam.Models/SteamCommunity/BadgeModel.cs create mode 100644 src/Steam.Models/SteamCommunity/BadgeQuestModel.cs create mode 100644 src/Steam.Models/SteamCommunity/BadgesResultModel.cs create mode 100644 src/Steam.Models/SteamCommunity/CommentPermission.cs create mode 100644 src/Steam.Models/SteamCommunity/FriendModel.cs create mode 100644 src/Steam.Models/SteamCommunity/GlobalAchievementPercentageModel.cs create mode 100644 src/Steam.Models/SteamCommunity/GlobalStatModel.cs create mode 100644 src/Steam.Models/SteamCommunity/OwnedGameModel.cs create mode 100644 src/Steam.Models/SteamCommunity/OwnedGamesResultModel.cs create mode 100644 src/Steam.Models/SteamCommunity/PlayerBansModel.cs create mode 100644 src/Steam.Models/SteamCommunity/PlayerSummaryModel.cs create mode 100644 src/Steam.Models/SteamCommunity/ProfileVisibility.cs create mode 100644 src/Steam.Models/SteamCommunity/RecentlyPlayedGameModel.cs create mode 100644 src/Steam.Models/SteamCommunity/RecentlyPlayedGamesResultModel.cs create mode 100644 src/Steam.Models/SteamCommunity/SteamCommunityProfileModel.cs create mode 100644 src/Steam.Models/SteamCommunity/UserStatus.cs create mode 100644 src/Steam.Models/SteamEconomy/AssetClassActionModel.cs create mode 100644 src/Steam.Models/SteamEconomy/AssetClassAppDataFilterModel.cs create mode 100644 src/Steam.Models/SteamEconomy/AssetClassAppDataModel.cs create mode 100644 src/Steam.Models/SteamEconomy/AssetClassDescriptionModel.cs create mode 100644 src/Steam.Models/SteamEconomy/AssetClassInfoModel.cs create mode 100644 src/Steam.Models/SteamEconomy/AssetClassInfoResultModel.cs create mode 100644 src/Steam.Models/SteamEconomy/AssetClassMarketActionModel.cs create mode 100644 src/Steam.Models/SteamEconomy/AssetClassModel.cs create mode 100644 src/Steam.Models/SteamEconomy/AssetClassTagModel.cs create mode 100644 src/Steam.Models/SteamEconomy/AssetModel.cs create mode 100644 src/Steam.Models/SteamEconomy/AssetPriceResultModel.cs create mode 100644 src/Steam.Models/SteamEconomy/AssetPricesModel.cs create mode 100644 src/Steam.Models/SteamEconomy/AssetTagIdsModel.cs create mode 100644 src/Steam.Models/SteamEconomy/AssetTagsModel.cs create mode 100644 src/Steam.Models/SteamEconomy/TradeAssetModel.cs create mode 100644 src/Steam.Models/SteamEconomy/TradeHistoryModel.cs create mode 100644 src/Steam.Models/SteamEconomy/TradeModel.cs create mode 100644 src/Steam.Models/SteamEconomy/TradeOfferConfirmationMethod.cs create mode 100644 src/Steam.Models/SteamEconomy/TradeOfferModel.cs create mode 100644 src/Steam.Models/SteamEconomy/TradeOfferResultModel.cs create mode 100644 src/Steam.Models/SteamEconomy/TradeOfferState.cs create mode 100644 src/Steam.Models/SteamEconomy/TradeOffersResultModel.cs create mode 100644 src/Steam.Models/SteamEconomy/TradeStatus.cs create mode 100644 src/Steam.Models/SteamEconomy/TradedAssetModel.cs create mode 100644 src/Steam.Models/SteamEconomy/TradedCurrencyModel.cs create mode 100644 src/Steam.Models/SteamInterfaceModel.cs create mode 100644 src/Steam.Models/SteamMethodModel.cs create mode 100644 src/Steam.Models/SteamNewsResultModel.cs create mode 100644 src/Steam.Models/SteamParameterModel.cs create mode 100644 src/Steam.Models/SteamPlayer/PlayerAchievementModel.cs create mode 100644 src/Steam.Models/SteamPlayer/PlayerAchievementResultModel.cs create mode 100644 src/Steam.Models/SteamPlayer/UserStatAchievementModel.cs create mode 100644 src/Steam.Models/SteamPlayer/UserStatModel.cs create mode 100644 src/Steam.Models/SteamPlayer/UserStatsForGameResultModel.cs create mode 100644 src/Steam.Models/SteamServerInfo.cs create mode 100644 src/Steam.Models/SteamServerInfoModel.cs create mode 100644 src/Steam.Models/SteamStore/StoreAppDetailsDataModel.cs create mode 100644 src/Steam.Models/SteamStore/StoreCategoryModel.cs create mode 100644 src/Steam.Models/SteamStore/StoreComingSoonModel.cs create mode 100644 src/Steam.Models/SteamStore/StoreFeaturedCategoriesModel.cs create mode 100644 src/Steam.Models/SteamStore/StoreFeaturedCategoryGenreModel.cs create mode 100644 src/Steam.Models/SteamStore/StoreFeaturedLinuxModel.cs create mode 100644 src/Steam.Models/SteamStore/StoreFeaturedMacModel.cs create mode 100644 src/Steam.Models/SteamStore/StoreFeaturedProductsModel.cs create mode 100644 src/Steam.Models/SteamStore/StoreFeaturedWinModel.cs create mode 100644 src/Steam.Models/SteamStore/StoreGenreModel.cs create mode 100644 src/Steam.Models/SteamStore/StoreItemModel.cs create mode 100644 src/Steam.Models/SteamStore/StoreLargeCapsuleModel.cs create mode 100644 src/Steam.Models/SteamStore/StoreMetacriticModel.cs create mode 100644 src/Steam.Models/SteamStore/StoreMovieModel.cs create mode 100644 src/Steam.Models/SteamStore/StoreNewReleasesModel.cs create mode 100644 src/Steam.Models/SteamStore/StorePackageGroupModel.cs create mode 100644 src/Steam.Models/SteamStore/StorePlatformsModel.cs create mode 100644 src/Steam.Models/SteamStore/StorePriceOverview.cs create mode 100644 src/Steam.Models/SteamStore/StoreRecommendationsModel.cs create mode 100644 src/Steam.Models/SteamStore/StoreReleaseDateModel.cs create mode 100644 src/Steam.Models/SteamStore/StoreScreenshotModel.cs create mode 100644 src/Steam.Models/SteamStore/StoreSpecialsModel.cs create mode 100644 src/Steam.Models/SteamStore/StoreSubModel.cs create mode 100644 src/Steam.Models/SteamStore/StoreSupportInfoModel.cs create mode 100644 src/Steam.Models/SteamStore/StoreTopSellersModel.cs create mode 100644 src/Steam.Models/SteamStore/StoreTrailerSlideshowModel.cs create mode 100644 src/Steam.Models/SteamStore/StoreWebmModel.cs create mode 100644 src/Steam.Models/TF2/GoldenWrenchModel.cs create mode 100644 src/Steam.Models/TF2/SchemaAdditionalHiddenBodygroupsModel.cs create mode 100644 src/Steam.Models/TF2/SchemaAttributeControlledAttachedParticleModel.cs create mode 100644 src/Steam.Models/TF2/SchemaAttributeModel.cs create mode 100644 src/Steam.Models/TF2/SchemaCapabilitiesModel.cs create mode 100644 src/Steam.Models/TF2/SchemaItemAttributeModel.cs create mode 100644 src/Steam.Models/TF2/SchemaItemLevelModel.cs create mode 100644 src/Steam.Models/TF2/SchemaItemModel.cs create mode 100644 src/Steam.Models/TF2/SchemaItemSetAttributeModel.cs create mode 100644 src/Steam.Models/TF2/SchemaItemSetModel.cs create mode 100644 src/Steam.Models/TF2/SchemaKillEaterScoreTypeModel.cs create mode 100644 src/Steam.Models/TF2/SchemaLevelModel.cs create mode 100644 src/Steam.Models/TF2/SchemaModel.cs create mode 100644 src/Steam.Models/TF2/SchemaOriginNameModel.cs create mode 100644 src/Steam.Models/TF2/SchemaPerClassLoadoutSlotsModel.cs create mode 100644 src/Steam.Models/TF2/SchemaQualitiesModel.cs create mode 100644 src/Steam.Models/TF2/SchemaStringLookupModel.cs create mode 100644 src/Steam.Models/TF2/SchemaStringModel.cs create mode 100644 src/Steam.Models/TF2/SchemaStyleModel.cs create mode 100644 src/Steam.Models/TF2/SchemaToolModel.cs create mode 100644 src/Steam.Models/TF2/SchemaUsageCapabilitiesModel.cs create mode 100644 src/Steam.Models/UGCFileDetailsModel.cs create mode 100644 src/Steam.Models/Utilities/DateTimeExtensions.cs diff --git a/src/Steam.Models/AvailableGameStatsModel.cs b/src/Steam.Models/AvailableGameStatsModel.cs new file mode 100644 index 0000000..efd9eb4 --- /dev/null +++ b/src/Steam.Models/AvailableGameStatsModel.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; + +namespace Steam.Models +{ + public class AvailableGameStatsModel + { + public IReadOnlyCollection Stats { get; set; } + + public IReadOnlyCollection Achievements { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/CSGO/ServerStatusAppModel.cs b/src/Steam.Models/CSGO/ServerStatusAppModel.cs new file mode 100644 index 0000000..5f25b32 --- /dev/null +++ b/src/Steam.Models/CSGO/ServerStatusAppModel.cs @@ -0,0 +1,9 @@ +namespace Steam.Models.CSGO +{ + public class ServerStatusAppModel + { + public uint Version { get; set; } + public ulong Timestamp { get; set; } + public string Time { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/CSGO/ServerStatusDatacenterModel.cs b/src/Steam.Models/CSGO/ServerStatusDatacenterModel.cs new file mode 100644 index 0000000..e78365d --- /dev/null +++ b/src/Steam.Models/CSGO/ServerStatusDatacenterModel.cs @@ -0,0 +1,9 @@ +namespace Steam.Models.CSGO +{ + public class ServerStatusDatacenterModel + { + public string Name { get; set; } + public string Capacity { get; set; } + public string Load { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/CSGO/ServerStatusMatchmakingModel.cs b/src/Steam.Models/CSGO/ServerStatusMatchmakingModel.cs new file mode 100644 index 0000000..b713253 --- /dev/null +++ b/src/Steam.Models/CSGO/ServerStatusMatchmakingModel.cs @@ -0,0 +1,15 @@ +namespace Steam.Models.CSGO +{ + public class ServerStatusMatchmakingModel + { + public string Scheduler { get; set; } + + public uint OnlineServers { get; set; } + + public uint OnlinePlayers { get; set; } + + public uint SearchingPlayers { get; set; } + + public uint SearchSecondsAverage { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/CSGO/ServerStatusModel.cs b/src/Steam.Models/CSGO/ServerStatusModel.cs new file mode 100644 index 0000000..fbaf84f --- /dev/null +++ b/src/Steam.Models/CSGO/ServerStatusModel.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; + +namespace Steam.Models.CSGO +{ + public class ServerStatusModel + { + public ServerStatusAppModel App { get; set; } + public ServerStatusServicesModel Services { get; set; } + public IReadOnlyCollection Datacenters { get; set; } + public ServerStatusMatchmakingModel Matchmaking { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/CSGO/ServerStatusServicesModel.cs b/src/Steam.Models/CSGO/ServerStatusServicesModel.cs new file mode 100644 index 0000000..eff9b6a --- /dev/null +++ b/src/Steam.Models/CSGO/ServerStatusServicesModel.cs @@ -0,0 +1,10 @@ +namespace Steam.Models.CSGO +{ + public class ServerStatusServicesModel + { + public string SessionsLogon { get; set; } + public string SteamCommunity { get; set; } + public string IEconItems { get; set; } + public string Leaderboards { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/AbilitySchemaItemModel.cs b/src/Steam.Models/DOTA2/AbilitySchemaItemModel.cs new file mode 100644 index 0000000..5ade057 --- /dev/null +++ b/src/Steam.Models/DOTA2/AbilitySchemaItemModel.cs @@ -0,0 +1,55 @@ +using System.Collections.Generic; + +namespace Steam.Models.DOTA2 +{ + public class AbilitySchemaItemModel + { + public uint Id { get; set; } + + public string Name { get; set; } + + public string AbilityType { get; set; } + + public string AbilityBehavior { get; set; } + + public bool OnCastbar { get; set; } + + public bool OnLearnbar { get; set; } + + public string FightRecapLevel { get; set; } + + public string AbilityCastRange { get; set; } + + public uint AbilityRangeBuffer { get; set; } + + public string AbilityCastPoint { get; set; } + + public string AbilityChannelTime { get; set; } + + public string AbilityCooldown { get; set; } + + public string AbilityDuration { get; set; } + + public string AbilitySharedCooldown { get; set; } + + public string AbilityDamage { get; set; } + + public string AbilityManaCost { get; set; } + + public double AbilityModifierSupportValue { get; set; } + + public double AbilityModifierSupportBonus { get; set; } + + public string AbilityUnitTargetTeam { get; set; } + + public string AbilityUnitDamageType { get; set; } + + public string SpellImmunityType { get; set; } + + public string AbilityUnitTargetFlags { get; set; } + + public string AbilityUnitTargetType { get; set; } + + public IList AbilitySpecials { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/AbilitySpecialSchemaItemModel.cs b/src/Steam.Models/DOTA2/AbilitySpecialSchemaItemModel.cs new file mode 100644 index 0000000..eaa2702 --- /dev/null +++ b/src/Steam.Models/DOTA2/AbilitySpecialSchemaItemModel.cs @@ -0,0 +1,10 @@ +namespace Steam.Models.DOTA2 +{ + public class AbilitySpecialSchemaItemModel + { + public string Name { get; set; } + public string Value { get; set; } + public string VarType { get; set; } + public string LinkedSpecialBonus { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/BarracksStateModel.cs b/src/Steam.Models/DOTA2/BarracksStateModel.cs new file mode 100644 index 0000000..0abdf74 --- /dev/null +++ b/src/Steam.Models/DOTA2/BarracksStateModel.cs @@ -0,0 +1,26 @@ +namespace Steam.Models.DOTA2 +{ + public class BarracksStateModel + { + public BarracksStateModel() + { + } + + public BarracksStateModel(uint barracksState) + { + IsTopMeleeAlive = ((barracksState >> 0) & 1) == 1 ? true : false; + IsTopRangedAlive = ((barracksState >> 1) & 1) == 1 ? true : false; + IsMiddleMeleeAlive = ((barracksState >> 2) & 1) == 1 ? true : false; + IsMiddleRangedAlive = ((barracksState >> 3) & 1) == 1 ? true : false; + IsBottomMeleeAlive = ((barracksState >> 4) & 1) == 1 ? true : false; + IsBottomRangedAlive = ((barracksState >> 5) & 1) == 1 ? true : false; + } + + public bool IsTopMeleeAlive { get; set; } + public bool IsTopRangedAlive { get; set; } + public bool IsMiddleMeleeAlive { get; set; } + public bool IsMiddleRangedAlive { get; set; } + public bool IsBottomMeleeAlive { get; set; } + public bool IsBottomRangedAlive { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/DotaAttackType.cs b/src/Steam.Models/DOTA2/DotaAttackType.cs new file mode 100644 index 0000000..c10f015 --- /dev/null +++ b/src/Steam.Models/DOTA2/DotaAttackType.cs @@ -0,0 +1,13 @@ +namespace Steam.Models.DOTA2 +{ + public sealed class DotaAttackType : DotaEnumType + { + public static readonly DotaAttackType UNKNOWN = new DotaAttackType("DOTA_UNIT_CAP_UNKNOWN", "Unknown", "This attack type is unknown."); + public static readonly DotaAttackType RANGED = new DotaAttackType("DOTA_UNIT_CAP_RANGED_ATTACK", "Ranged", "The attack can be performed from a distance."); + public static readonly DotaAttackType MELEE = new DotaAttackType("DOTA_UNIT_CAP_MELEE_ATTACK", "Melee", "The attack must be performed within arm's reach."); + + public DotaAttackType(string key, string displayName, string description) + : base(key, displayName, description) + { } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/DotaBlogFeedItem.cs b/src/Steam.Models/DOTA2/DotaBlogFeedItem.cs new file mode 100644 index 0000000..f1fd6c8 --- /dev/null +++ b/src/Steam.Models/DOTA2/DotaBlogFeedItem.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.DOTA2 +{ + public class DotaBlogFeedItem + { + public string Title { get; set; } + public string Link { get; set; } + public DateTime PublishDate { get; set; } + public string Author { get; set; } + public string Category { get; set; } + public string Description { get; set; } + public string ContentEncoded { get; set; } + public string ImageUrl { get; set; } + } +} diff --git a/src/Steam.Models/DOTA2/DotaDamageType.cs b/src/Steam.Models/DOTA2/DotaDamageType.cs new file mode 100644 index 0000000..d6a1eed --- /dev/null +++ b/src/Steam.Models/DOTA2/DotaDamageType.cs @@ -0,0 +1,14 @@ +namespace Steam.Models.DOTA2 +{ + public sealed class DotaDamageType : DotaEnumType + { + public static readonly DotaDamageType UNKNOWN = new DotaDamageType("DAMAGE_TYPE_UNKNOWN", "Unknown", "This damage type is unknown."); + public static readonly DotaDamageType PURE = new DotaDamageType("DAMAGE_TYPE_PURE", "Pure", "The damage dealt is not reduced by any resistance."); + public static readonly DotaDamageType PHYSICAL = new DotaDamageType("DAMAGE_TYPE_PHYSICAL", "Physical", "The damage dealth is reduced by armor."); + public static readonly DotaDamageType MAGICAL = new DotaDamageType("DAMAGE_TYPE_MAGICAL", "Magical", "The damage dealt is reduced by spell resistance."); + + public DotaDamageType(string key, string displayName, string description) + : base(key, displayName, description) + { } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/DotaEnumType.cs b/src/Steam.Models/DOTA2/DotaEnumType.cs new file mode 100644 index 0000000..fe22256 --- /dev/null +++ b/src/Steam.Models/DOTA2/DotaEnumType.cs @@ -0,0 +1,23 @@ +namespace Steam.Models.DOTA2 +{ + public abstract class DotaEnumType + { + protected readonly string key; + protected readonly string displayName; + protected readonly string description; + + public DotaEnumType(string key, string displayName, string description) + { + this.key = key; + this.displayName = displayName; + this.description = description; + } + + public string Key { get { return key; } } + + public override string ToString() + { + return displayName; + } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/DotaHeroAbilityBehaviorType.cs b/src/Steam.Models/DOTA2/DotaHeroAbilityBehaviorType.cs new file mode 100644 index 0000000..e6a8f6a --- /dev/null +++ b/src/Steam.Models/DOTA2/DotaHeroAbilityBehaviorType.cs @@ -0,0 +1,36 @@ +namespace Steam.Models.DOTA2 +{ + public sealed class DotaHeroAbilityBehaviorType : DotaEnumType + { + public static readonly DotaHeroAbilityBehaviorType UNKNOWN = new DotaHeroAbilityBehaviorType("DOTA_ABILITY_BEHAVIOR_UNKNOWN", "Unknown", "This behavior could not be found."); + public static readonly DotaHeroAbilityBehaviorType HIDDEN = new DotaHeroAbilityBehaviorType("DOTA_ABILITY_BEHAVIOR_HIDDEN", "Hidden", "This ability can be owned by a unit but can't be casted and wont show up on the HUD."); + public static readonly DotaHeroAbilityBehaviorType PASSIVE = new DotaHeroAbilityBehaviorType("DOTA_ABILITY_BEHAVIOR_PASSIVE", "Passive", "Can't be casted but shows up on the ability HUD."); + public static readonly DotaHeroAbilityBehaviorType NO_TARGET = new DotaHeroAbilityBehaviorType("DOTA_ABILITY_BEHAVIOR_NO_TARGET", "No Target", "Doesn't need a target to be cast, ability fires off as soon as the button is pressed."); + public static readonly DotaHeroAbilityBehaviorType UNIT_TARGET = new DotaHeroAbilityBehaviorType("DOTA_ABILITY_BEHAVIOR_UNIT_TARGET", "Unit Target", "Ability needs a target to be casted on."); + public static readonly DotaHeroAbilityBehaviorType POINT = new DotaHeroAbilityBehaviorType("DOTA_ABILITY_BEHAVIOR_POINT", "Cursor Target", "Ability can be cast anywhere the mouse cursor is (If a unit is clicked it will just be cast where the unit was standing)."); + public static readonly DotaHeroAbilityBehaviorType AOE = new DotaHeroAbilityBehaviorType("DOTA_ABILITY_BEHAVIOR_AOE", "Area of Effect", "This ability draws a radius where the ability will have effect. YOU STILL NEED A TARGETTING BEHAVIOR LIKE DOTA_ABILITY_BEHAVIOR_POINT FOR THIS TO WORK."); + public static readonly DotaHeroAbilityBehaviorType NOT_LEARNABLE = new DotaHeroAbilityBehaviorType("DOTA_ABILITY_BEHAVIOR_NOT_LEARNABLE", "Not Learnable", "This abillity is channelled. If the user moves or is silenced the ability is interrupted."); + public static readonly DotaHeroAbilityBehaviorType CHANNELLED = new DotaHeroAbilityBehaviorType("DOTA_ABILITY_BEHAVIOR_CHANNELLED", "Channelled", "This abillity is channelled. If the user moves or is silenced the ability is interrupted."); + public static readonly DotaHeroAbilityBehaviorType ITEM = new DotaHeroAbilityBehaviorType("DOTA_ABILITY_BEHAVIOR_ITEM", "On Item", "This ability is tied up to an item."); + public static readonly DotaHeroAbilityBehaviorType TOGGLE = new DotaHeroAbilityBehaviorType("DOTA_ABILITY_BEHAVIOR_TOGGLE", "Toggle", "This ability toggles on and off."); + public static readonly DotaHeroAbilityBehaviorType IMMEDIATE = new DotaHeroAbilityBehaviorType("DOTA_ABILITY_BEHAVIOR_IMMEDIATE", "Immediate", "This ability is casted immediately."); + public static readonly DotaHeroAbilityBehaviorType ROOT_DISABLES = new DotaHeroAbilityBehaviorType("DOTA_ABILITY_BEHAVIOR_ROOT_DISABLES", "Disables Roots", "This ability breaks the hero free of root effects."); + public static readonly DotaHeroAbilityBehaviorType DONT_RESUME_MOVEMENT = new DotaHeroAbilityBehaviorType("DOTA_ABILITY_BEHAVIOR_DONT_RESUME_MOVEMENT", "Stops Movement", "This ability stops the hero from moving in their direction when casted."); + public static readonly DotaHeroAbilityBehaviorType IGNORE_BACKSWING = new DotaHeroAbilityBehaviorType("DOTA_ABILITY_BEHAVIOR_IGNORE_BACKSWING", "Ignore Animations", "Causes the spell to ignore the backswing animation. It causes the visual animation to instantly stop once the cast point is reached."); + public static readonly DotaHeroAbilityBehaviorType DONT_RESUME_ATTACK = new DotaHeroAbilityBehaviorType("DOTA_ABILITY_BEHAVIOR_DONT_RESUME_ATTACK", "Stops Attacking", "This ability stops the hero from attacking their target after casting."); + public static readonly DotaHeroAbilityBehaviorType IGNORE_PSEUDO_QUEUE = new DotaHeroAbilityBehaviorType("DOTA_ABILITY_BEHAVIOR_IGNORE_PSEUDO_QUEUE", "Ignore Pseudo Queue", "Unknown."); + public static readonly DotaHeroAbilityBehaviorType AUTOCAST = new DotaHeroAbilityBehaviorType("DOTA_ABILITY_BEHAVIOR_AUTOCAST", "Autocast", "This ability can be set to autocast."); + public static readonly DotaHeroAbilityBehaviorType IGNORE_CHANNEL = new DotaHeroAbilityBehaviorType("DOTA_ABILITY_BEHAVIOR_IGNORE_CHANNEL", "Ignore Channel", "Unknown."); + public static readonly DotaHeroAbilityBehaviorType DIRECTIONAL = new DotaHeroAbilityBehaviorType("DOTA_ABILITY_BEHAVIOR_DIRECTIONAL", "Directional", "This ability has a directional component."); + public static readonly DotaHeroAbilityBehaviorType AURA = new DotaHeroAbilityBehaviorType("DOTA_ABILITY_BEHAVIOR_AURA", "Aura", "This ability has an aura effect."); + public static readonly DotaHeroAbilityBehaviorType NORMAL_WHEN_STOLEN = new DotaHeroAbilityBehaviorType("DOTA_ABILITY_BEHAVIOR_NORMAL_WHEN_STOLEN", "Normal When Stolen", "Unknown."); + public static readonly DotaHeroAbilityBehaviorType DONT_ALERT_TARGET = new DotaHeroAbilityBehaviorType("DOTA_ABILITY_BEHAVIOR_DONT_ALERT_TARGET", "Does Not Alert Target", "This ability will not be seen by the target through debuffs or other spell effects."); + public static readonly DotaHeroAbilityBehaviorType UNRESTRICTED = new DotaHeroAbilityBehaviorType("DOTA_ABILITY_BEHAVIOR_UNRESTRICTED", "Unrestricted", "Unknown."); + public static readonly DotaHeroAbilityBehaviorType RUNE_TARGET = new DotaHeroAbilityBehaviorType("DOTA_ABILITY_BEHAVIOR_RUNE_TARGET", "Rune Target", "Unknown."); + public static readonly DotaHeroAbilityBehaviorType DONT_CANCEL_MOVEMENT = new DotaHeroAbilityBehaviorType("DOTA_ABILITY_BEHAVIOR_DONT_CANCEL_MOVEMENT", "Does Not Cancel Movement", "This ability does not stop hero movement."); + + public DotaHeroAbilityBehaviorType(string key, string displayName, string description) + : base(key, displayName, description) + { } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/DotaHeroAbilityType.cs b/src/Steam.Models/DOTA2/DotaHeroAbilityType.cs new file mode 100644 index 0000000..33bf6db --- /dev/null +++ b/src/Steam.Models/DOTA2/DotaHeroAbilityType.cs @@ -0,0 +1,14 @@ +namespace Steam.Models.DOTA2 +{ + public sealed class DotaHeroAbilityType : DotaEnumType + { + public static readonly DotaHeroAbilityType UNKNOWN = new DotaHeroAbilityType("DOTA_ABILITY_TYPE_UNKNOWN", "Unknown", "This is a an unknown ability type."); + public static readonly DotaHeroAbilityType BASIC = new DotaHeroAbilityType("DOTA_ABILITY_TYPE_BASIC", "Basic", "This is a basic ability learnable at any level."); + public static readonly DotaHeroAbilityType ULTIMATE = new DotaHeroAbilityType("DOTA_ABILITY_TYPE_ULTIMATE", "Ultimate", "This is a unique ultimate ability learnable at certain levels."); + public static readonly DotaHeroAbilityType TALENTS = new DotaHeroAbilityType("DOTA_ABILITY_TYPE_ATTRIBUTES", "Talent", "This is a talent selectable at levels 10, 15, 20, and 25. Previously known as an 'Attribute'."); + + public DotaHeroAbilityType(string key, string displayName, string description) + : base(key, displayName, description) + { } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/DotaHeroPrimaryAttributeType.cs b/src/Steam.Models/DOTA2/DotaHeroPrimaryAttributeType.cs new file mode 100644 index 0000000..d010244 --- /dev/null +++ b/src/Steam.Models/DOTA2/DotaHeroPrimaryAttributeType.cs @@ -0,0 +1,13 @@ +namespace Steam.Models.DOTA2 +{ + public sealed class DotaHeroPrimaryAttributeType : DotaEnumType + { + public static readonly DotaHeroPrimaryAttributeType STRENGTH = new DotaHeroPrimaryAttributeType("DOTA_ATTRIBUTE_STRENGTH", "Strength", "Strength health and health regeneration."); + public static readonly DotaHeroPrimaryAttributeType AGILITY = new DotaHeroPrimaryAttributeType("DOTA_ATTRIBUTE_AGILITY", "Agility", "Agility increases armor."); + public static readonly DotaHeroPrimaryAttributeType INTELLECT = new DotaHeroPrimaryAttributeType("DOTA_ATTRIBUTE_INTELLECT", "Intellect", "Intellect increases mana and mana regeneration."); + + public DotaHeroPrimaryAttributeType(string key, string displayName, string description) + : base(key, displayName, description) + { } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/DotaItemDeclarationType.cs b/src/Steam.Models/DOTA2/DotaItemDeclarationType.cs new file mode 100644 index 0000000..d3dec3e --- /dev/null +++ b/src/Steam.Models/DOTA2/DotaItemDeclarationType.cs @@ -0,0 +1,14 @@ +namespace Steam.Models.DOTA2 +{ + public sealed class DotaItemDeclarationType : DotaEnumType + { + public static readonly DotaItemDeclarationType UNKNOWN = new DotaItemDeclarationType("DECLARE_PURCHASES_UNKNOWN", "Unknown", "The declaration of this item is unknown."); + public static readonly DotaItemDeclarationType PURCHASES_TO_TEAMMATES = new DotaItemDeclarationType("DECLARE_PURCHASES_TO_TEAMMATES", "To Teammates", "Declare this item to teammates when purchased."); + public static readonly DotaItemDeclarationType PURCHASES_IN_SPEECH = new DotaItemDeclarationType("DECLARE_PURCHASES_IN_SPEECH", "In Speech", "Declare this item in speech when purchased."); + public static readonly DotaItemDeclarationType PURCHASES_TO_SPECTATORS = new DotaItemDeclarationType("DECLARE_PURCHASES_TO_SPECTATORS", "To Spectators", "Declare this item to spectators when purchased."); + + public DotaItemDeclarationType(string key, string displayName, string description) + : base(key, displayName, description) + { } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/DotaItemDisassembleType.cs b/src/Steam.Models/DOTA2/DotaItemDisassembleType.cs new file mode 100644 index 0000000..f903a8e --- /dev/null +++ b/src/Steam.Models/DOTA2/DotaItemDisassembleType.cs @@ -0,0 +1,13 @@ +namespace Steam.Models.DOTA2 +{ + public sealed class DotaItemDisassembleType : DotaEnumType + { + public static readonly DotaItemDisassembleType UNKNOWN = new DotaItemDisassembleType("DOTA_ITEM_DISASSEMBLE_UNKNOWN", "Unknown", "It is unknown if this item can be disassembled."); + public static readonly DotaItemDisassembleType NEVER = new DotaItemDisassembleType("DOTA_ITEM_DISASSEMBLE_NEVER", "Never", "This item can never be disassembled."); + public static readonly DotaItemDisassembleType ALWAYS = new DotaItemDisassembleType("DOTA_ITEM_DISASSEMBLE_ALWAYS", "Always", "This item can always be disassembled."); + + public DotaItemDisassembleType(string key, string displayName, string description) + : base(key, displayName, description) + { } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/DotaItemShareabilityType.cs b/src/Steam.Models/DOTA2/DotaItemShareabilityType.cs new file mode 100644 index 0000000..9615d58 --- /dev/null +++ b/src/Steam.Models/DOTA2/DotaItemShareabilityType.cs @@ -0,0 +1,14 @@ +namespace Steam.Models.DOTA2 +{ + public sealed class DotaItemShareabilityType : DotaEnumType + { + public static readonly DotaItemShareabilityType UNKNOWN = new DotaItemShareabilityType("ITEM_UNKNOWN_SHAREABLE", "Unknown", "The shareability of this item is unknown."); + public static readonly DotaItemShareabilityType PARTIALLY_SHAREABLE = new DotaItemShareabilityType("ITEM_PARTIALLY_SHAREABLE", "Partially", "This item is partially shareable."); + public static readonly DotaItemShareabilityType FULLY_SHAREABLE = new DotaItemShareabilityType("ITEM_FULLY_SHAREABLE", "Fully", "This item is fully shareable."); + public static readonly DotaItemShareabilityType FULLY_SHAREABLE_STACKING = new DotaItemShareabilityType("ITEM_FULLY_SHAREABLE_STACKING", "Fully (stacking)", "This item is fully shareable in stacking quantities."); + + public DotaItemShareabilityType(string key, string displayName, string description) + : base(key, displayName, description) + { } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/DotaLeagueTier.cs b/src/Steam.Models/DOTA2/DotaLeagueTier.cs new file mode 100644 index 0000000..565e688 --- /dev/null +++ b/src/Steam.Models/DOTA2/DotaLeagueTier.cs @@ -0,0 +1,9 @@ +namespace Steam.Models.DOTA2 +{ + public enum DotaLeagueTier + { + Amateur = 1, + Professional, + Premier + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/DotaSpellImmunityType.cs b/src/Steam.Models/DOTA2/DotaSpellImmunityType.cs new file mode 100644 index 0000000..0caabc4 --- /dev/null +++ b/src/Steam.Models/DOTA2/DotaSpellImmunityType.cs @@ -0,0 +1,15 @@ +namespace Steam.Models.DOTA2 +{ + public sealed class DotaSpellImmunityType : DotaEnumType + { + public static readonly DotaSpellImmunityType UNKNOWN = new DotaSpellImmunityType("SPELL_IMMUNITY_UNKNOWN", "Unknown", "Spell immunity is unknown on this ability."); + public static readonly DotaSpellImmunityType ALLIES_YES = new DotaSpellImmunityType("SPELL_IMMUNITY_ALLIES_YES", "Allies", "This ability pierces spell immunity on allies."); + public static readonly DotaSpellImmunityType ALLIES_NO = new DotaSpellImmunityType("SPELL_IMMUNITY_ALLIES_NO", "Not Allies", "This ability does not pierce spell immunity on allies."); + public static readonly DotaSpellImmunityType ENEMIES_YES = new DotaSpellImmunityType("SPELL_IMMUNITY_ENEMIES_YES", "Enemies", "This ability pierces spell immunity on enemies."); + public static readonly DotaSpellImmunityType ENEMIES_NO = new DotaSpellImmunityType("SPELL_IMMUNITY_ENEMIES_NO", "Not Enemies", "This ability does not pierce spell immunity on enemies."); + + public DotaSpellImmunityType(string key, string displayName, string description) + : base(key, displayName, description) + { } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/DotaTeamType.cs b/src/Steam.Models/DOTA2/DotaTeamType.cs new file mode 100644 index 0000000..e4c792f --- /dev/null +++ b/src/Steam.Models/DOTA2/DotaTeamType.cs @@ -0,0 +1,13 @@ +namespace Steam.Models.DOTA2 +{ + public sealed class DotaTeamType : DotaEnumType + { + public static readonly DotaTeamType UNKNOWN = new DotaTeamType("Unknown", "Unknown", "This team is unknown."); + public static readonly DotaTeamType GOOD = new DotaTeamType("Good", "Radiant", "The 'good' team."); + public static readonly DotaTeamType BAD = new DotaTeamType("Bad", "Dire", "The 'bad' team."); + + public DotaTeamType(string key, string displayName, string description) + : base(key, displayName, description) + { } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/DotaUnitTargetFlag.cs b/src/Steam.Models/DOTA2/DotaUnitTargetFlag.cs new file mode 100644 index 0000000..b3e99b4 --- /dev/null +++ b/src/Steam.Models/DOTA2/DotaUnitTargetFlag.cs @@ -0,0 +1,17 @@ +namespace Steam.Models.DOTA2 +{ + public sealed class DotaUnitTargetFlag : DotaEnumType + { + public static readonly DotaUnitTargetFlag UNKNOWN = new DotaUnitTargetFlag("DOTA_UNIT_TARGET_FLAG_UNKNOWN", "Unknown", "This flag is an unknown type."); + public static readonly DotaUnitTargetFlag MAGIC_IMMUNE_ENEMIES = new DotaUnitTargetFlag("DOTA_UNIT_TARGET_FLAG_MAGIC_IMMUNE_ENEMIES", "Affects Magic Immune Enemies", "This ability affects magic immune enemies."); + public static readonly DotaUnitTargetFlag INVULNERABLE = new DotaUnitTargetFlag("DOTA_UNIT_TARGET_FLAG_INVULNERABLE", "Affects Invulnerable Units", "This ability affects invulernable targets."); + public static readonly DotaUnitTargetFlag NOT_MAGIC_IMMUNE_ALLIES = new DotaUnitTargetFlag("DOTA_UNIT_TARGET_FLAG_NOT_MAGIC_IMMUNE_ALLIES", "Does Not Affect Magic Immune Allies", "This ability does not affect magic immune allies."); + public static readonly DotaUnitTargetFlag NOT_ANCIENTS = new DotaUnitTargetFlag("DOTA_UNIT_TARGET_FLAG_NOT_ANCIENTS", "Does Not Affect Ancients", "This ability does not affect ancients."); + public static readonly DotaUnitTargetFlag NOT_SUMMONED = new DotaUnitTargetFlag("DOTA_UNIT_TARGET_FLAG_NOT_SUMMONED", "Does Not Affect Summoned", "This ability does not affect summoned targets."); + public static readonly DotaUnitTargetFlag NOT_CREEP_HERO = new DotaUnitTargetFlag("DOTA_UNIT_TARGET_FLAG_NOT_CREEP_HERO", "Does Not Affect Creeps or Heroes", "This ability does not affect creep or hero targets."); + + public DotaUnitTargetFlag(string key, string displayName, string description) + : base(key, displayName, description) + { } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/DotaUnitTargetTeamType.cs b/src/Steam.Models/DOTA2/DotaUnitTargetTeamType.cs new file mode 100644 index 0000000..9b85ca6 --- /dev/null +++ b/src/Steam.Models/DOTA2/DotaUnitTargetTeamType.cs @@ -0,0 +1,15 @@ +namespace Steam.Models.DOTA2 +{ + public sealed class DotaUnitTargetTeamType : DotaEnumType + { + public static readonly DotaUnitTargetTeamType UNKNOWN = new DotaUnitTargetTeamType("DOTA_UNIT_TARGET_TEAM_UNKNOWN", "Unknown", "This unit target type is unknown."); + public static readonly DotaUnitTargetTeamType ENEMY = new DotaUnitTargetTeamType("DOTA_UNIT_TARGET_TEAM_ENEMY", "Enemies", "The target of the ability must be an enemy."); + public static readonly DotaUnitTargetTeamType FRIENDLY = new DotaUnitTargetTeamType("DOTA_UNIT_TARGET_TEAM_FRIENDLY", "Friendlies", "The target of the ability must be a friendly."); + public static readonly DotaUnitTargetTeamType CUSTOM = new DotaUnitTargetTeamType("DOTA_UNIT_TARGET_TEAM_CUSTOM", "Custom", "The target of the ability is a custom type."); + public static readonly DotaUnitTargetTeamType BOTH = new DotaUnitTargetTeamType("DOTA_UNIT_TARGET_TEAM_BOTH", "Both", "The target of the ability can be both teams."); + + public DotaUnitTargetTeamType(string key, string displayName, string description) + : base(key, displayName, description) + { } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/DotaUnitTargetType.cs b/src/Steam.Models/DOTA2/DotaUnitTargetType.cs new file mode 100644 index 0000000..b0b2bdf --- /dev/null +++ b/src/Steam.Models/DOTA2/DotaUnitTargetType.cs @@ -0,0 +1,15 @@ +namespace Steam.Models.DOTA2 +{ + public sealed class DotaUnitTargetType : DotaEnumType + { + public static readonly DotaUnitTargetType UNKNOWN = new DotaUnitTargetType("DOTA_UNIT_TARGET_UNKNOWN", "Unknown", "This unit target type is unknown."); + public static readonly DotaUnitTargetType HERO = new DotaUnitTargetType("DOTA_UNIT_TARGET_HERO", "Hero", "The target of the ability can be a hero."); + public static readonly DotaUnitTargetType BASIC = new DotaUnitTargetType("DOTA_UNIT_TARGET_BASIC", "Basic", "The target of the ability can be any basic unit."); + public static readonly DotaUnitTargetType CUSTOM = new DotaUnitTargetType("DOTA_UNIT_TARGET_CUSTOM", "Custom", "The target of the ability is a custom type."); + public static readonly DotaUnitTargetType BUILDING = new DotaUnitTargetType("DOTA_UNIT_TARGET_BUILDING", "Building", "The target of the ability can be a building."); + + public DotaUnitTargetType(string key, string displayName, string description) + : base(key, displayName, description) + { } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/GameFile.cs b/src/Steam.Models/DOTA2/GameFile.cs new file mode 100644 index 0000000..03ea593 --- /dev/null +++ b/src/Steam.Models/DOTA2/GameFile.cs @@ -0,0 +1,14 @@ +namespace Steam.Models.DOTA2 +{ + public enum GameFile + { + HeroAbilities, + ItemAbilities, + Heroes, + InGameItems, + MainSchema, + MainSchemaLocalization, + PublicLocalization, + PanoramaLocalization + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/GameItemModel.cs b/src/Steam.Models/DOTA2/GameItemModel.cs new file mode 100644 index 0000000..1089c0f --- /dev/null +++ b/src/Steam.Models/DOTA2/GameItemModel.cs @@ -0,0 +1,13 @@ +namespace Steam.Models.DOTA2 +{ + public class GameItemModel + { + public uint Id { get; set; } + public uint Cost { get; set; } + public string Name { get; set; } + public string LocalizedName { get; set; } + public bool IsRecipe { get; set; } + public bool IsAvailableAtSecretShop { get; set; } + public bool IsAvailableAtSideShop { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/HeroAbilityDetailModel.cs b/src/Steam.Models/DOTA2/HeroAbilityDetailModel.cs new file mode 100644 index 0000000..4525fae --- /dev/null +++ b/src/Steam.Models/DOTA2/HeroAbilityDetailModel.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Steam.Models.DOTA2 +{ + public class HeroAbilityDetailModel + { + public uint Id { get; set; } + public string Name { get; set; } + public string AvatarImagePath { get; set; } + public string Description { get; set; } + public IReadOnlyCollection Attributes { get; set; } + public string Behaviors { get; set; } + public string TeamTargets { get; set; } + public string TargetTypes { get; set; } + public string TargetFlags { get; set; } + public DotaSpellImmunityType SpellImmunityType { get; set; } + public DotaDamageType DamageType { get; set; } + public string CastRange { get; set; } + public string CastPoint { get; set; } + public string Cooldown { get; set; } + public string Duration { get; set; } + public string Damage { get; set; } + public string ManaCost { get; set; } + public DotaHeroAbilityType AbilityType { get; set; } + public string Note0 { get; set; } + public string Note1 { get; set; } + public string Note2 { get; set; } + public string Note3 { get; set; } + public string Note4 { get; set; } + public string Note5 { get; set; } + public bool HasLinkedSpecialBonus + { + get + { + return Attributes.Any(x => !String.IsNullOrWhiteSpace(x.LinkedSpecialBonus)); + } + } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/HeroAbilitySpecialDetailModel.cs b/src/Steam.Models/DOTA2/HeroAbilitySpecialDetailModel.cs new file mode 100644 index 0000000..8be62ef --- /dev/null +++ b/src/Steam.Models/DOTA2/HeroAbilitySpecialDetailModel.cs @@ -0,0 +1,10 @@ +namespace Steam.Models.DOTA2 +{ + public class HeroAbilitySpecialDetailModel + { + public string Name { get; set; } + public string Value { get; set; } + public string RawName { get; set; } + public string LinkedSpecialBonus { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/HeroDetailModel.cs b/src/Steam.Models/DOTA2/HeroDetailModel.cs new file mode 100644 index 0000000..00c8c63 --- /dev/null +++ b/src/Steam.Models/DOTA2/HeroDetailModel.cs @@ -0,0 +1,123 @@ +using System; +using System.Collections.Generic; + +namespace Steam.Models.DOTA2 +{ + public class HeroDetailModel + { + private const int baseHealth = 150; + private const int healthPerStrength = 19; + private const int baseMana = 0; + private const int manaPerIntellect = 13; + private const double armorFactor = 0.14; + + public uint Id { get; set; } + public string Url { get; set; } + public string Name { get; set; } + public string NameInSchema { get; set; } + public string Description { get; set; } + public string AvatarImagePath { get; set; } + public uint BaseStrength { get; set; } + public uint BaseAgility { get; set; } + public uint BaseIntelligence { get; set; } + public uint BaseDamageMin { get; set; } + public uint BaseDamageMax { get; set; } + public uint BaseMoveSpeed { get; set; } + public double BaseArmor { get; set; } + public string Team { get; set; } + public double AttackRange { get; set; } + public double AttackRate { get; set; } + public double TurnRate { get; set; } + public string AttackType { get; set; } + public double StrengthGain { get; set; } + public double AgilityGain { get; set; } + public double IntelligenceGain { get; set; } + public DotaHeroPrimaryAttributeType PrimaryAttribute { get; set; } + public string ActiveTab { get; set; } + public string MinimapIconPath { get; set; } + public bool IsEnabled { get; set; } + + public IReadOnlyCollection Roles { get; set; } + public IReadOnlyCollection Abilities { get; set; } + + public double GetBaseHealth() + { + return GetHealth(0); + } + + public double GetBaseMana() + { + return GetMana(0); + } + + public double GetHealth(int level) + { + return Math.Round(baseHealth + (healthPerStrength * (BaseStrength + (level * StrengthGain)))); + } + + public double GetMana(int level) + { + return Math.Round(baseMana + (manaPerIntellect * (BaseIntelligence + (level * IntelligenceGain)))); + } + + public double GetMinDamage(int level) + { + if (PrimaryAttribute.Key == DotaHeroPrimaryAttributeType.STRENGTH.Key) + { + return Math.Round(BaseDamageMin + (BaseStrength + (level * StrengthGain))); + } + else if (PrimaryAttribute.Key == DotaHeroPrimaryAttributeType.INTELLECT.Key) + { + return Math.Round(BaseDamageMin + (BaseIntelligence + (level * IntelligenceGain))); + } + else if (PrimaryAttribute.Key == DotaHeroPrimaryAttributeType.AGILITY.Key) + { + return Math.Round(BaseDamageMin + (BaseAgility + (level * AgilityGain))); + } + else + { + return 0; + } + } + + public double GetMaxDamage(int level) + { + if (PrimaryAttribute.Key == DotaHeroPrimaryAttributeType.STRENGTH.Key) + { + return Math.Round(BaseDamageMax + (BaseStrength + (level * StrengthGain))); + } + else if (PrimaryAttribute.Key == DotaHeroPrimaryAttributeType.INTELLECT.Key) + { + return Math.Round(BaseDamageMax + (BaseIntelligence + (level * IntelligenceGain))); + } + else if (PrimaryAttribute.Key == DotaHeroPrimaryAttributeType.AGILITY.Key) + { + return Math.Round(BaseDamageMax + (BaseAgility + (level * AgilityGain))); + } + else + { + return 0; + } + } + + public double GetArmor(int level) + { + return BaseArmor + (GetAgility(level) * armorFactor); + } + + public double GetStrength(int level) + { + return Math.Round(BaseStrength + (level * StrengthGain)); + } + + public double GetAgility(int level) + { + return Math.Round(BaseAgility + (level * AgilityGain)); + } + + public double GetIntelligence(int level) + { + return Math.Round(BaseIntelligence + (level * IntelligenceGain)); + } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/HeroModel.cs b/src/Steam.Models/DOTA2/HeroModel.cs new file mode 100644 index 0000000..6e2dec6 --- /dev/null +++ b/src/Steam.Models/DOTA2/HeroModel.cs @@ -0,0 +1,9 @@ +namespace Steam.Models.DOTA2 +{ + public class HeroModel + { + public uint Id { get; set; } + public string Name { get; set; } + public string LocalizedName { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/HeroRoleModel.cs b/src/Steam.Models/DOTA2/HeroRoleModel.cs new file mode 100644 index 0000000..f6019af --- /dev/null +++ b/src/Steam.Models/DOTA2/HeroRoleModel.cs @@ -0,0 +1,8 @@ +namespace Steam.Models.DOTA2 +{ + public class HeroRoleModel + { + public string Name { get; set; } + public string Level { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/HeroSchemaModel.cs b/src/Steam.Models/DOTA2/HeroSchemaModel.cs new file mode 100644 index 0000000..6c5a2ae --- /dev/null +++ b/src/Steam.Models/DOTA2/HeroSchemaModel.cs @@ -0,0 +1,181 @@ +namespace Steam.Models.DOTA2 +{ + public class HeroSchemaModel + { + public uint HeroId { get; set; } + + public string Name { get; set; } + + public string BaseClass { get; set; } + + public string Model { get; set; } + + public string SoundSet { get; set; } + + public bool Enabled { get; set; } + + public string Level { get; set; } + + public bool BotImplemented { get; set; } + + public string NewHero { get; set; } + + public string HeroPool1 { get; set; } + + public string HeroUnlockOrder { get; set; } + + public string CMEnabled { get; set; } + + public string CMTournamentIgnore { get; set; } + + public string NewPlayerEnable { get; set; } + + public string AbilityLayout { get; set; } + + public string Ability1 { get; set; } + + public string Ability2 { get; set; } + + public string Ability3 { get; set; } + + public string Ability4 { get; set; } + + public string Ability5 { get; set; } + + public string Ability6 { get; set; } + + public string Ability7 { get; set; } + + public string Ability8 { get; set; } + + public string Ability9 { get; set; } + + public string Ability10 { get; set; } + + public string Ability11 { get; set; } + + public string Ability12 { get; set; } + + public string Ability13 { get; set; } + + public string Ability14 { get; set; } + + public string Ability15 { get; set; } + + public string Ability16 { get; set; } + + public string Ability17 { get; set; } + + public string Ability18 { get; set; } + + public string Ability19 { get; set; } + + public string Ability20 { get; set; } + + public string Ability21 { get; set; } + + public string Ability22 { get; set; } + + public string Ability23 { get; set; } + + public string Ability24 { get; set; } + + public double ArmorPhysical { get; set; } + + public string MagicalResistance { get; set; } + + public string AttackCapabilities { get; set; } + + public uint AttackDamageMin { get; set; } + + public uint AttackDamageMax { get; set; } + + public string AttackDamageType { get; set; } + + public double AttackRate { get; set; } + + public double AttackAnimationPoint { get; set; } + + public uint AttackAcquisitionRange { get; set; } + + public uint AttackRange { get; set; } + + public string ProjectileModel { get; set; } + + public uint ProjectileSpeed { get; set; } + + public string AttributePrimary { get; set; } + + public uint AttributeBaseStrength { get; set; } + + public double AttributeStrengthGain { get; set; } + + public uint AttributeBaseIntelligence { get; set; } + + public double AttributeIntelligenceGain { get; set; } + + public uint AttributeBaseAgility { get; set; } + + public double AttributeAgilityGain { get; set; } + + public uint BountyXP { get; set; } + + public uint BountyGoldMin { get; set; } + + public uint BountyGoldMax { get; set; } + + public string BoundsHullName { get; set; } + + public uint RingRadius { get; set; } + + public string MovementCapabilities { get; set; } + + public uint MovementSpeed { get; set; } + + public double MovementTurnRate { get; set; } + + public bool HasAggressiveStance { get; set; } + + public uint StatusHealth { get; set; } + + public double StatusHealthRegen { get; set; } + + public uint StatusMana { get; set; } + + public double StatusManaRegen { get; set; } + + public string TeamName { get; set; } + + public string Team { get; set; } + + public string CombatClassAttack { get; set; } + + public string CombatClassDefend { get; set; } + + public string UnitRelationshipClass { get; set; } + + public uint VisionDaytimeRange { get; set; } + + public uint VisionNighttimeRange { get; set; } + + public bool HasInventory { get; set; } + + public string VoiceBackgroundSound { get; set; } + + public uint HealthBarOffset { get; set; } + + public string IdleExpression { get; set; } + + public string IdleSoundLoop { get; set; } + + public string AbilityDraftDisabled { get; set; } + + public string ARDMDisabled { get; set; } + + public string Url { get; set; } + + public string Role { get; set; } + + public string RoleLevels { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/ItemAbilitySchemaItemModel.cs b/src/Steam.Models/DOTA2/ItemAbilitySchemaItemModel.cs new file mode 100644 index 0000000..4875c5e --- /dev/null +++ b/src/Steam.Models/DOTA2/ItemAbilitySchemaItemModel.cs @@ -0,0 +1,91 @@ +using System.Collections.Generic; + +namespace Steam.Models.DOTA2 +{ + public class ItemAbilitySchemaItemModel + { + public uint Id { get; set; } + + public string Name { get; set; } + + /// + /// Valve's source files don't include localized names. Instead, the callers are responsibel for populating this value + /// by performing a lookup in the various language/token mapping files. + /// + public string LocalizedName { get; set; } + + public string AbilityBehavior { get; set; } + + public string AbilityCastRange { get; set; } + + public string AbilityCastPoint { get; set; } + + public string AbilityChannelTime { get; set; } + + public string AbilityCooldown { get; set; } + + public string AbilityDuration { get; set; } + + public string AbilitySharedCooldown { get; set; } + + public string AbilityDamage { get; set; } + + public string AbilityManaCost { get; set; } + + public double AbilityModifierSupportValue { get; set; } + + public string AbilityUnitTargetTeam { get; set; } + + public string AbilityUnitDamageType { get; set; } + + public string AbilityUnitTargetFlags { get; set; } + + public string AbilityUnitTargetType { get; set; } + + public IList AbilitySpecials { get; set; } + + public uint ItemCost { get; set; } + + public string ItemShopTags { get; set; } + + public string ItemQuality { get; set; } + + public bool ItemStackable { get; set; } + + public string ItemShareability { get; set; } + + public bool ItemPermanent { get; set; } + + public uint? ItemInitialCharges { get; set; } + + public uint? ItemDisplayCharges { get; set; } + + public uint? ItemStockMax { get; set; } + + public uint? ItemStockInitial { get; set; } + + public double? ItemStockTime { get; set; } + + public bool? ItemPurchasable { get; set; } + + public bool? ItemSellable { get; set; } + + public bool? ItemKillable { get; set; } + + public string ItemDeclarations { get; set; } + + public bool? ItemCastOnPickup { get; set; } + + public bool? ItemSupport { get; set; } + + public string ItemResult { get; set; } + + public bool? ItemAlertable { get; set; } + + public bool? ItemDroppable { get; set; } + + public bool? ItemContributesToNetWorthWhenDropped { get; set; } + + public string ItemDisassembleRule { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/ItemBuildGroupSchemaItemModel.cs b/src/Steam.Models/DOTA2/ItemBuildGroupSchemaItemModel.cs new file mode 100644 index 0000000..051da53 --- /dev/null +++ b/src/Steam.Models/DOTA2/ItemBuildGroupSchemaItemModel.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; + +namespace Steam.Models.DOTA2 +{ + public class ItemBuildGroupSchemaItemModel + { + public string Name { get; set; } + public IList Items { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/ItemBuildSchemaItemModel.cs b/src/Steam.Models/DOTA2/ItemBuildSchemaItemModel.cs new file mode 100644 index 0000000..7635b1e --- /dev/null +++ b/src/Steam.Models/DOTA2/ItemBuildSchemaItemModel.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; + +namespace Steam.Models.DOTA2 +{ + public class ItemBuildSchemaItemModel + { + public string Author { get; set; } + public string Hero { get; set; } + public string Title { get; set; } + + public IList Items { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/LeagueModel.cs b/src/Steam.Models/DOTA2/LeagueModel.cs new file mode 100644 index 0000000..b1fc736 --- /dev/null +++ b/src/Steam.Models/DOTA2/LeagueModel.cs @@ -0,0 +1,34 @@ +using System; + +namespace Steam.Models.DOTA2 +{ + public class LeagueModel + { + public string Name { get; set; } + public uint LeagueId { get; set; } + public string Description { get; set; } + public string TournamentUrl { get; set; } + public uint ItemDef { get; set; } + public string ImageInventoryPath { get; private set; } + public string ImageBannerPath { get; private set; } + public string NameLocalized { get; private set; } + public string DescriptionLocalized { get; private set; } + public string TypeName { get; private set; } + public string Tier { get; private set; } + public string Location { get; private set; } + + public override string ToString() + { + string result = String.Format("Name: {0}", NameLocalized); + if (!String.IsNullOrEmpty(Tier)) + { + result += String.Format(", Tier: {0}", Tier); + } + if (!String.IsNullOrEmpty(Location)) + { + result += String.Format(", Location: {0}", Location); + } + return result; + } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/LiveLeagueGameAbilityModel.cs b/src/Steam.Models/DOTA2/LiveLeagueGameAbilityModel.cs new file mode 100644 index 0000000..9e717dd --- /dev/null +++ b/src/Steam.Models/DOTA2/LiveLeagueGameAbilityModel.cs @@ -0,0 +1,9 @@ +namespace Steam.Models.DOTA2 +{ + public class LiveLeagueGameAbilityModel + { + public uint AbilityId { get; set; } + + public uint AbilityLevel { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/LiveLeagueGameBanModel.cs b/src/Steam.Models/DOTA2/LiveLeagueGameBanModel.cs new file mode 100644 index 0000000..33bc957 --- /dev/null +++ b/src/Steam.Models/DOTA2/LiveLeagueGameBanModel.cs @@ -0,0 +1,7 @@ +namespace Steam.Models.DOTA2 +{ + public class LiveLeagueGameBanModel + { + public uint HeroId { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/LiveLeagueGameFlattenedModel.cs b/src/Steam.Models/DOTA2/LiveLeagueGameFlattenedModel.cs new file mode 100644 index 0000000..9330348 --- /dev/null +++ b/src/Steam.Models/DOTA2/LiveLeagueGameFlattenedModel.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; + +namespace Steam.Models.DOTA2 +{ + public class LiveLeagueGameFlattenedModel + { + public string LeagueName { get; set; } + public uint SpectatorCount { get; set; } + public string RadiantTeamName { get; set; } + public string DireTeamName { get; set; } + public uint RadiantKillCount { get; set; } + public uint DireKillCount { get; set; } + public string ElapsedTimeDisplay { get; set; } + public uint GameNumber { get; set; } + public uint BestOf { get; set; } + public uint RadiantSeriesWins { get; set; } + public uint DireSeriesWins { get; set; } + public string LeagueLogoPath { get; set; } + public string RadiantTeamLogo { get; set; } + public string DireTeamLogo { get; set; } + public uint RoshanRespawnTimer { get; set; } + public ulong LobbyId { get; set; } + public ulong MatchId { get; set; } + public double StreamDelay { get; set; } + public IReadOnlyCollection Players { get; set; } + public double ElapsedTime { get; set; } + public TowerStateModel RadiantTowerStates { get; set; } + public TowerStateModel DireTowerStates { get; set; } + public IReadOnlyCollection RadiantPicks { get; set; } + public IReadOnlyCollection DirePicks { get; set; } + public IReadOnlyCollection RadiantBans { get; set; } + public IReadOnlyCollection DireBans { get; set; } + public string LeagueTier { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/LiveLeagueGameHeroModel.cs b/src/Steam.Models/DOTA2/LiveLeagueGameHeroModel.cs new file mode 100644 index 0000000..05bfbe6 --- /dev/null +++ b/src/Steam.Models/DOTA2/LiveLeagueGameHeroModel.cs @@ -0,0 +1,10 @@ +namespace Steam.Models.DOTA2 +{ + public class LiveLeagueGameHeroModel + { + public uint Id { get; set; } + public string Name { get; set; } + public string AvatarImagePath { get; set; } + public string Url { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/LiveLeagueGameItemModel.cs b/src/Steam.Models/DOTA2/LiveLeagueGameItemModel.cs new file mode 100644 index 0000000..cc7b286 --- /dev/null +++ b/src/Steam.Models/DOTA2/LiveLeagueGameItemModel.cs @@ -0,0 +1,9 @@ +namespace Steam.Models.DOTA2 +{ + public class LiveLeagueGameItemModel + { + public uint Id { get; set; } + public string Name { get; set; } + public string IconFileName { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/LiveLeagueGameModel.cs b/src/Steam.Models/DOTA2/LiveLeagueGameModel.cs new file mode 100644 index 0000000..91a2392 --- /dev/null +++ b/src/Steam.Models/DOTA2/LiveLeagueGameModel.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; + +namespace Steam.Models.DOTA2 +{ + public class LiveLeagueGameModel + { + public IReadOnlyCollection Players { get; set; } + + public LiveLeagueGameTeamRadiantInfoModel RadiantTeam { get; set; } + + public LiveLeagueGameTeamDireInfoModel DireTeam { get; set; } + + public ulong LobbyId { get; set; } + + public ulong MatchId { get; set; } + + public uint Spectators { get; set; } + + public uint SeriesId { get; set; } + + public uint GameNumber { get; set; } + + public uint LeagueId { get; set; } + + public double StreamDelaySeconds { get; set; } + + public uint RadiantSeriesWins { get; set; } + + public uint DireSeriesWins { get; set; } + + public uint SeriesType { get; set; } + + public uint LeagueSeriesId { get; set; } + + public uint LeagueGameId { get; set; } + + public string StageName { get; set; } + + public DotaLeagueTier LeagueTier { get; set; } + + public LiveLeagueGameScoreboardModel Scoreboard { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/LiveLeagueGamePickModel.cs b/src/Steam.Models/DOTA2/LiveLeagueGamePickModel.cs new file mode 100644 index 0000000..c4ddd56 --- /dev/null +++ b/src/Steam.Models/DOTA2/LiveLeagueGamePickModel.cs @@ -0,0 +1,7 @@ +namespace Steam.Models.DOTA2 +{ + public class LiveLeagueGamePickModel + { + public uint HeroId { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/LiveLeagueGamePlayerDetailModel.cs b/src/Steam.Models/DOTA2/LiveLeagueGamePlayerDetailModel.cs new file mode 100644 index 0000000..50a123e --- /dev/null +++ b/src/Steam.Models/DOTA2/LiveLeagueGamePlayerDetailModel.cs @@ -0,0 +1,30 @@ +namespace Steam.Models.DOTA2 +{ + public class LiveLeagueGamePlayerDetailModel + { + public uint PlayerSlot { get; set; } + public uint AccountId { get; set; } + public uint HeroId { get; set; } + public uint Kills { get; set; } + public uint Deaths { get; set; } + public uint Assists { get; set; } + public uint LastHits { get; set; } + public uint Denies { get; set; } + public uint Gold { get; set; } + public uint Level { get; set; } + public uint GoldPerMinute { get; set; } + public uint ExperiencePerMinute { get; set; } + public uint UltimateState { get; set; } + public uint UltimateCooldown { get; set; } + public uint Item0 { get; set; } + public uint Item1 { get; set; } + public uint Item2 { get; set; } + public uint Item3 { get; set; } + public uint Item4 { get; set; } + public uint Item5 { get; set; } + public uint RespawnTimer { get; set; } + public double PositionX { get; set; } + public double PositionY { get; set; } + public uint NetWorth { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/LiveLeagueGamePlayerInfoModel.cs b/src/Steam.Models/DOTA2/LiveLeagueGamePlayerInfoModel.cs new file mode 100644 index 0000000..ce0c05b --- /dev/null +++ b/src/Steam.Models/DOTA2/LiveLeagueGamePlayerInfoModel.cs @@ -0,0 +1,13 @@ +namespace Steam.Models.DOTA2 +{ + public class LiveLeagueGamePlayerInfoModel + { + public uint AccountId { get; set; } + + public string Name { get; set; } + + public uint HeroId { get; set; } + + public uint Team { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/LiveLeagueGamePlayerModel.cs b/src/Steam.Models/DOTA2/LiveLeagueGamePlayerModel.cs new file mode 100644 index 0000000..e1670f3 --- /dev/null +++ b/src/Steam.Models/DOTA2/LiveLeagueGamePlayerModel.cs @@ -0,0 +1,34 @@ +namespace Steam.Models.DOTA2 +{ + public class LiveLeagueGamePlayerModel + { + public uint AccountId { get; set; } + public string Name { get; set; } + public uint HeroId { get; set; } + public string HeroName { get; set; } + public string HeroAvatarImageFilePath { get; set; } + public uint Team { get; set; } + public uint KillCount { get; set; } + public uint DeathCount { get; set; } + public uint AssistCount { get; set; } + public double PositionX { get; set; } + public double PositionY { get; set; } + public string HeroUrl { get; set; } + public LiveLeagueGameItemModel Item0 { get; set; } + public LiveLeagueGameItemModel Item1 { get; set; } + public LiveLeagueGameItemModel Item2 { get; set; } + public LiveLeagueGameItemModel Item3 { get; set; } + public LiveLeagueGameItemModel Item4 { get; set; } + public LiveLeagueGameItemModel Item5 { get; set; } + public uint RespawnTimer { get; set; } + public uint NetWorth { get; set; } + public uint Gold { get; set; } + public uint Level { get; set; } + public uint LastHits { get; set; } + public uint Denies { get; set; } + public uint GoldPerMinute { get; set; } + public uint XpPerMinute { get; set; } + public uint UltimateState { get; set; } + public uint UltimateCooldown { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/LiveLeagueGameScoreboardModel.cs b/src/Steam.Models/DOTA2/LiveLeagueGameScoreboardModel.cs new file mode 100644 index 0000000..966d429 --- /dev/null +++ b/src/Steam.Models/DOTA2/LiveLeagueGameScoreboardModel.cs @@ -0,0 +1,12 @@ +namespace Steam.Models.DOTA2 +{ + public class LiveLeagueGameScoreboardModel + { + public double Duration { get; set; } + + public uint RoshanRespawnTimer { get; set; } + + public LiveLeagueGameTeamRadiantDetailModel Radiant { get; set; } + public LiveLeagueGameTeamDireDetailModel Dire { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/LiveLeagueGameTeamDireDetailModel.cs b/src/Steam.Models/DOTA2/LiveLeagueGameTeamDireDetailModel.cs new file mode 100644 index 0000000..70b2e02 --- /dev/null +++ b/src/Steam.Models/DOTA2/LiveLeagueGameTeamDireDetailModel.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; + +namespace Steam.Models.DOTA2 +{ + public class LiveLeagueGameTeamDireDetailModel + { + public uint Score { get; set; } + + public uint TowerState { get; set; } + + public uint BarracksState { get; set; } + + public IReadOnlyCollection Picks { get; set; } + public IReadOnlyCollection Bans { get; set; } + public IReadOnlyCollection Players { get; set; } + public IReadOnlyCollection Abilities { get; set; } + + public TowerStateModel TowerStates { get { return new TowerStateModel(TowerState); } } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/LiveLeagueGameTeamDireInfoModel.cs b/src/Steam.Models/DOTA2/LiveLeagueGameTeamDireInfoModel.cs new file mode 100644 index 0000000..1947c3f --- /dev/null +++ b/src/Steam.Models/DOTA2/LiveLeagueGameTeamDireInfoModel.cs @@ -0,0 +1,13 @@ +namespace Steam.Models.DOTA2 +{ + public class LiveLeagueGameTeamDireInfoModel + { + public string TeamName { get; set; } + + public uint TeamId { get; set; } + + public ulong TeamLogo { get; set; } + + public bool Complete { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/LiveLeagueGameTeamRadiantDetailModel.cs b/src/Steam.Models/DOTA2/LiveLeagueGameTeamRadiantDetailModel.cs new file mode 100644 index 0000000..71538f1 --- /dev/null +++ b/src/Steam.Models/DOTA2/LiveLeagueGameTeamRadiantDetailModel.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; + +namespace Steam.Models.DOTA2 +{ + public class LiveLeagueGameTeamRadiantDetailModel + { + public uint Score { get; set; } + + public uint TowerState { get; set; } + + public uint BarracksState { get; set; } + + public IReadOnlyCollection Picks { get; set; } + public IReadOnlyCollection Bans { get; set; } + public IReadOnlyCollection Players { get; set; } + public IReadOnlyCollection Abilities { get; set; } + + public TowerStateModel TowerStates { get { return new TowerStateModel(TowerState); } } + public TowerStateModel BarracksStates { get { return new TowerStateModel(BarracksState); } } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/LiveLeagueGameTeamRadiantInfoModel.cs b/src/Steam.Models/DOTA2/LiveLeagueGameTeamRadiantInfoModel.cs new file mode 100644 index 0000000..ce6947a --- /dev/null +++ b/src/Steam.Models/DOTA2/LiveLeagueGameTeamRadiantInfoModel.cs @@ -0,0 +1,13 @@ +namespace Steam.Models.DOTA2 +{ + public class LiveLeagueGameTeamRadiantInfoModel + { + public string TeamName { get; set; } + + public uint TeamId { get; set; } + + public ulong TeamLogo { get; set; } + + public bool Complete { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/MatchDetailModel.cs b/src/Steam.Models/DOTA2/MatchDetailModel.cs new file mode 100644 index 0000000..7cc93c1 --- /dev/null +++ b/src/Steam.Models/DOTA2/MatchDetailModel.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; + +namespace Steam.Models.DOTA2 +{ + public class MatchDetailModel + { + public IReadOnlyCollection Players { get; set; } + + public bool RadiantWin { get; set; } + + public uint Duration { get; set; } + + public DateTime StartTime { get; set; } + + public ulong MatchId { get; set; } + + public ulong MatchSequenceNumber { get; set; } + + public uint TowerStatusRadiant { get; set; } + + public TowerStateModel TowerStatesRadiant { get { return new TowerStateModel(TowerStatusRadiant); } } + + public uint TowerStatusDire { get; set; } + + public TowerStateModel TowerStatesDire { get { return new TowerStateModel(TowerStatusDire); } } + + public uint BarracksStatusRadiant { get; set; } + + public BarracksStateModel BarracksStatesRadiant { get { return new BarracksStateModel(BarracksStatusRadiant); } } + + public uint BarracksStatusDire { get; set; } + + public BarracksStateModel BarracksStatesDire { get { return new BarracksStateModel(BarracksStatusDire); } } + + public uint Cluster { get; set; } + + public uint FirstBloodTime { get; set; } + + public uint LobbyType { get; set; } + + public uint HumanPlayers { get; set; } + + public uint LeagueId { get; set; } + + public uint PositiveVotes { get; set; } + + public uint NegativeVotes { get; set; } + + public uint GameMode { get; set; } + + public uint Engine { get; set; } + + public uint RadiantTeamId { get; set; } + + public string RadiantName { get; set; } + + public ulong RadiantLogo { get; set; } + + public uint RadiantTeamComplete { get; set; } + + public uint DireTeamId { get; set; } + + public string DireName { get; set; } + + public ulong DireLogo { get; set; } + + public uint DireTeamComplete { get; set; } + + public uint RadiantCaptain { get; set; } + + public uint DireCaptain { get; set; } + + public IReadOnlyCollection PicksAndBans { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/MatchHistoryBySequenceNumberMatchModel.cs b/src/Steam.Models/DOTA2/MatchHistoryBySequenceNumberMatchModel.cs new file mode 100644 index 0000000..843da28 --- /dev/null +++ b/src/Steam.Models/DOTA2/MatchHistoryBySequenceNumberMatchModel.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.DOTA2 +{ + public class MatchHistoryBySequenceNumberMatchModel + { + public IList Players { get; set; } + + public bool RadiantWin { get; set; } + + public uint Duration { get; set; } + + public DateTime StartTime { get; set; } + + public ulong MatchId { get; set; } + + public ulong MatchSequenceNumber { get; set; } + + public TowerStateModel TowerStatesRadiant { get { return new TowerStateModel(TowerStatusRadiant); } } + + public uint TowerStatusRadiant { get; set; } + + public TowerStateModel TowerStatesDire { get { return new TowerStateModel(TowerStatusRadiant); } } + + public uint TowerStatusDire { get; set; } + + public BarracksStateModel BarracksStatesRadiant { get { return new BarracksStateModel(BarracksStatusRadiant); } } + + public uint BarracksStatusRadiant { get; set; } + + public BarracksStateModel BarracksStatesDire { get { return new BarracksStateModel(BarracksStatusDire); } } + + public uint BarracksStatusDire { get; set; } + + public uint Cluster { get; set; } + + public DateTime FirstBloodTime { get; set; } + + public uint LobbyType { get; set; } + + public uint HumanPlayers { get; set; } + + public uint LeagueId { get; set; } + + public uint PositiveVotes { get; set; } + + public uint NegativeVotes { get; set; } + + public uint GameMode { get; set; } + + public uint Flags { get; set; } + + public uint Engine { get; set; } + + public uint RadiantScore { get; set; } + + public uint DireScore { get; set; } + } +} diff --git a/src/Steam.Models/DOTA2/MatchHistoryBySequenceNumberMatchPlayerAbilityUpgradeModel.cs b/src/Steam.Models/DOTA2/MatchHistoryBySequenceNumberMatchPlayerAbilityUpgradeModel.cs new file mode 100644 index 0000000..bb445a3 --- /dev/null +++ b/src/Steam.Models/DOTA2/MatchHistoryBySequenceNumberMatchPlayerAbilityUpgradeModel.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.DOTA2 +{ + public class MatchHistoryBySequenceNumberMatchPlayerAbilityUpgradeModel + { + public uint Ability { get; set; } + + public uint Time { get; set; } + + public uint Level { get; set; } + } +} diff --git a/src/Steam.Models/DOTA2/MatchHistoryBySequenceNumberMatchPlayerModel.cs b/src/Steam.Models/DOTA2/MatchHistoryBySequenceNumberMatchPlayerModel.cs new file mode 100644 index 0000000..a1194d4 --- /dev/null +++ b/src/Steam.Models/DOTA2/MatchHistoryBySequenceNumberMatchPlayerModel.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.DOTA2 +{ + public class MatchHistoryBySequenceNumberMatchPlayerModel + { + public IList AbilityUpgrades { get; set; } + + public ulong AccountId { get; set; } + + public uint PlayerSlot { get; set; } + + public uint HeroId { get; set; } + + public uint Item0 { get; set; } + + public uint Item1 { get; set; } + + public uint Item2 { get; set; } + + public uint Item3 { get; set; } + + public uint Item4 { get; set; } + + public uint Item5 { get; set; } + + public uint Kills { get; set; } + + public uint Deaths { get; set; } + + public uint Assists { get; set; } + + public uint LeaverStatus { get; set; } + + public uint LastHits { get; set; } + + public uint Denies { get; set; } + + public uint GoldPerMin { get; set; } + + public uint XpPerMin { get; set; } + + public uint Level { get; set; } + + public uint Gold { get; set; } + + public uint GoldSpent { get; set; } + + public uint HeroDamage { get; set; } + + public uint TowerDamage { get; set; } + + public uint HeroHealing { get; set; } + } +} diff --git a/src/Steam.Models/DOTA2/MatchHistoryMatchModel.cs b/src/Steam.Models/DOTA2/MatchHistoryMatchModel.cs new file mode 100644 index 0000000..f5c0bac --- /dev/null +++ b/src/Steam.Models/DOTA2/MatchHistoryMatchModel.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; + +namespace Steam.Models.DOTA2 +{ + public class MatchHistoryMatchModel + { + public ulong MatchId { get; set; } + + public ulong MatchSequenceNumber { get; set; } + + public DateTime StartTime { get; set; } + + public uint LobbyType { get; set; } + + public uint RadiantTeamId { get; set; } + + public uint DireTeamId { get; set; } + + public IReadOnlyCollection Players { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/MatchHistoryModel.cs b/src/Steam.Models/DOTA2/MatchHistoryModel.cs new file mode 100644 index 0000000..fa521ba --- /dev/null +++ b/src/Steam.Models/DOTA2/MatchHistoryModel.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +namespace Steam.Models.DOTA2 +{ + public class MatchHistoryModel + { + public uint Status { get; set; } + + public uint NumResults { get; set; } + + public uint TotalResults { get; set; } + + public uint ResultsRemaining { get; set; } + + public IReadOnlyCollection Matches { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/MatchHistoryPlayerModel.cs b/src/Steam.Models/DOTA2/MatchHistoryPlayerModel.cs new file mode 100644 index 0000000..80ff4d1 --- /dev/null +++ b/src/Steam.Models/DOTA2/MatchHistoryPlayerModel.cs @@ -0,0 +1,11 @@ +namespace Steam.Models.DOTA2 +{ + public class MatchHistoryPlayerModel + { + public uint AccountId { get; set; } + + public uint PlayerSlot { get; set; } + + public uint HeroId { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/MatchPickBanModel.cs b/src/Steam.Models/DOTA2/MatchPickBanModel.cs new file mode 100644 index 0000000..bc7507d --- /dev/null +++ b/src/Steam.Models/DOTA2/MatchPickBanModel.cs @@ -0,0 +1,12 @@ +namespace Steam.Models.DOTA2 +{ + public class MatchPickBanModel + { + public bool IsPick { get; set; } + + public uint HeroId { get; set; } + + public uint Team { get; set; } + public uint Order { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/MatchPlayerAbilityUpgradeModel.cs b/src/Steam.Models/DOTA2/MatchPlayerAbilityUpgradeModel.cs new file mode 100644 index 0000000..99af35a --- /dev/null +++ b/src/Steam.Models/DOTA2/MatchPlayerAbilityUpgradeModel.cs @@ -0,0 +1,9 @@ +namespace Steam.Models.DOTA2 +{ + public class MatchPlayerAbilityUpgradeModel + { + public uint Ability { get; set; } + public uint Time { get; set; } + public uint Level { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/MatchPlayerModel.cs b/src/Steam.Models/DOTA2/MatchPlayerModel.cs new file mode 100644 index 0000000..f25a35e --- /dev/null +++ b/src/Steam.Models/DOTA2/MatchPlayerModel.cs @@ -0,0 +1,53 @@ +using System.Collections.Generic; + +namespace Steam.Models.DOTA2 +{ + public class MatchPlayerModel + { + public uint AccountId { get; set; } + + public uint PlayerSlot { get; set; } + + public uint HeroId { get; set; } + + public uint Item0 { get; set; } + + public uint Item1 { get; set; } + + public uint Item2 { get; set; } + + public uint Item3 { get; set; } + + public uint Item4 { get; set; } + + public uint Item5 { get; set; } + + public uint Kills { get; set; } + public uint Deaths { get; set; } + public uint Assists { get; set; } + + public uint LeaverStatus { get; set; } + + public uint Gold { get; set; } + + public uint LastHits { get; set; } + + public uint Denies { get; set; } + + public uint GoldPerMinute { get; set; } + + public uint ExperiencePerMinute { get; set; } + + public uint GoldSpent { get; set; } + + public uint HeroDamage { get; set; } + + public uint TowerDamage { get; set; } + + public uint HeroHealing { get; set; } + + public uint Level { get; set; } + + public IReadOnlyCollection AbilityUpgrades { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/PlayerCountModel.cs b/src/Steam.Models/DOTA2/PlayerCountModel.cs new file mode 100644 index 0000000..9e74662 --- /dev/null +++ b/src/Steam.Models/DOTA2/PlayerCountModel.cs @@ -0,0 +1,9 @@ +namespace Steam.Models.DOTA2 +{ + public class PlayerCountModel + { + public uint InGamePlayerCount { get; set; } + public uint DailyPeakPlayerCount { get; set; } + public uint AllTimePeakPlayerCount { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/PlayerOfficialInfoModel.cs b/src/Steam.Models/DOTA2/PlayerOfficialInfoModel.cs new file mode 100644 index 0000000..187d7c3 --- /dev/null +++ b/src/Steam.Models/DOTA2/PlayerOfficialInfoModel.cs @@ -0,0 +1,11 @@ +namespace Steam.Models.DOTA2 +{ + public class PlayerOfficialInfoModel + { + public string Name { get; set; } + public string TeamName { get; set; } + public string TeamTag { get; set; } + public string Sponsor { get; set; } + public uint FantasyRole { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/ProPlayerDetailModel.cs b/src/Steam.Models/DOTA2/ProPlayerDetailModel.cs new file mode 100644 index 0000000..e98b16f --- /dev/null +++ b/src/Steam.Models/DOTA2/ProPlayerDetailModel.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; + +namespace Steam.Models.DOTA2 +{ + public class ProPlayerDetailModel + { + public IReadOnlyCollection ProPlayers { get; set; } + + public IReadOnlyCollection Leaderboards { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/ProPlayerInfoModel.cs b/src/Steam.Models/DOTA2/ProPlayerInfoModel.cs new file mode 100644 index 0000000..e7ee982 --- /dev/null +++ b/src/Steam.Models/DOTA2/ProPlayerInfoModel.cs @@ -0,0 +1,23 @@ +namespace Steam.Models.DOTA2 +{ + public class ProPlayerInfoModel + { + public uint AccountId { get; set; } + + public string Name { get; set; } + + public string CountryCode { get; set; } + + public uint FantasyRole { get; set; } + + public uint TeamId { get; set; } + + public string TeamName { get; set; } + + public string TeamTag { get; set; } + + public bool IsPro { get; set; } + + public string Sponsor { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/ProPlayerLeaderboardModel.cs b/src/Steam.Models/DOTA2/ProPlayerLeaderboardModel.cs new file mode 100644 index 0000000..edc93c8 --- /dev/null +++ b/src/Steam.Models/DOTA2/ProPlayerLeaderboardModel.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; + +namespace Steam.Models.DOTA2 +{ + public class ProPlayerLeaderboardModel + { + public uint Division { get; set; } + + public IReadOnlyCollection AccountIds { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/RarityModel.cs b/src/Steam.Models/DOTA2/RarityModel.cs new file mode 100644 index 0000000..2493738 --- /dev/null +++ b/src/Steam.Models/DOTA2/RarityModel.cs @@ -0,0 +1,11 @@ +namespace Steam.Models.DOTA2 +{ + public class RarityModel + { + public string Name { get; set; } + public uint Id { get; set; } + public uint Order { get; set; } + public string Color { get; set; } + public string LocalizedName { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/SchemaColorModel.cs b/src/Steam.Models/DOTA2/SchemaColorModel.cs new file mode 100644 index 0000000..b2d6039 --- /dev/null +++ b/src/Steam.Models/DOTA2/SchemaColorModel.cs @@ -0,0 +1,11 @@ +namespace Steam.Models.DOTA2 +{ + public class SchemaColorModel + { + public string Name { get; set; } + + public string ColorName { get; set; } + + public string HexColor { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/SchemaGameInfoModel.cs b/src/Steam.Models/DOTA2/SchemaGameInfoModel.cs new file mode 100644 index 0000000..1699fca --- /dev/null +++ b/src/Steam.Models/DOTA2/SchemaGameInfoModel.cs @@ -0,0 +1,15 @@ +namespace Steam.Models.DOTA2 +{ + public class SchemaGameInfoModel + { + public string FirstValidClass { get; set; } + + public string LastValidClass { get; set; } + + public string FirstValidItemSlot { get; set; } + + public string LastValidItemSlot { get; set; } + + public string ItemPresetCount { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/SchemaItemAutographModel.cs b/src/Steam.Models/DOTA2/SchemaItemAutographModel.cs new file mode 100644 index 0000000..57ed2b8 --- /dev/null +++ b/src/Steam.Models/DOTA2/SchemaItemAutographModel.cs @@ -0,0 +1,19 @@ +namespace Steam.Models.DOTA2 +{ + public class SchemaItemAutographModel + { + public string DefIndex { get; set; } + + public string Name { get; set; } + + public string Autograph { get; set; } + + public ulong? WorkshopLink { get; set; } + + public uint Language { get; set; } + + public string IconPath { get; set; } + + public string Modifier { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/SchemaItemModel.cs b/src/Steam.Models/DOTA2/SchemaItemModel.cs new file mode 100644 index 0000000..cdad689 --- /dev/null +++ b/src/Steam.Models/DOTA2/SchemaItemModel.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; + +namespace Steam.Models.DOTA2 +{ + public class SchemaItemModel + { + public string DefIndex { get; set; } + + public string Name { get; set; } + + public string ImageInventoryPath { get; set; } + + public string ItemName { get; set; } + + public string ItemDescription { get; set; } + + public string ItemTypeName { get; set; } + + public string Prefab { get; set; } + + public DateTime? CreationDate { get; set; } + + public DateTime? ExpirationDate { get; set; } + + public SchemaItemToolModel Tool { get; set; } + + public string TournamentUrl { get; set; } + + public string ImageBannerPath { get; set; } + + public string ItemRarity { get; set; } + + public string ItemQuality { get; set; } + + public string ItemSlot { get; set; } + + public SchemaItemPriceInfoModel PriceInfo { get; set; } + + public IList UsedByHeroes { get; set; } + + public IList BundledItems { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/SchemaItemPriceInfoModel.cs b/src/Steam.Models/DOTA2/SchemaItemPriceInfoModel.cs new file mode 100644 index 0000000..7b5e53a --- /dev/null +++ b/src/Steam.Models/DOTA2/SchemaItemPriceInfoModel.cs @@ -0,0 +1,19 @@ +using System; + +namespace Steam.Models.DOTA2 +{ + public class SchemaItemPriceInfoModel + { + public string Bucket { get; set; } + + public string Class { get; set; } + + public string CategoryTags { get; set; } + + public DateTime? Date { get; set; } + + public decimal? Price { get; set; } + + public bool? IsPackItem { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/SchemaItemSetModel.cs b/src/Steam.Models/DOTA2/SchemaItemSetModel.cs new file mode 100644 index 0000000..8ed4769 --- /dev/null +++ b/src/Steam.Models/DOTA2/SchemaItemSetModel.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; + +namespace Steam.Models.DOTA2 +{ + public class SchemaItemSetModel + { + public string RawName { get; set; } + + public string Name { get; set; } + + public string StoreBundleName { get; set; } + + public IList Items { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/SchemaItemToolModel.cs b/src/Steam.Models/DOTA2/SchemaItemToolModel.cs new file mode 100644 index 0000000..785b6b1 --- /dev/null +++ b/src/Steam.Models/DOTA2/SchemaItemToolModel.cs @@ -0,0 +1,7 @@ +namespace Steam.Models.DOTA2 +{ + public class SchemaItemToolModel + { + public SchemaItemToolUsageModel Usage { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/SchemaItemToolUsageModel.cs b/src/Steam.Models/DOTA2/SchemaItemToolUsageModel.cs new file mode 100644 index 0000000..e6e37af --- /dev/null +++ b/src/Steam.Models/DOTA2/SchemaItemToolUsageModel.cs @@ -0,0 +1,13 @@ +namespace Steam.Models.DOTA2 +{ + public class SchemaItemToolUsageModel + { + public uint LeagueId { get; set; } + + public string Tier { get; set; } + + public string Location { get; set; } + + public bool Admin { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/SchemaModel.cs b/src/Steam.Models/DOTA2/SchemaModel.cs new file mode 100644 index 0000000..1d84333 --- /dev/null +++ b/src/Steam.Models/DOTA2/SchemaModel.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; + +namespace Steam.Models.DOTA2 +{ + public class SchemaModel + { + public SchemaGameInfoModel GameInfo { get; set; } + + public IList Rarities { get; set; } + + public IList Qualities { get; set; } + + public IList Colors { get; set; } + + public IList Prefabs { get; set; } + + public IList Items { get; set; } + + public IList ItemSets { get; set; } + + public IList ItemAutographs { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/SchemaPrefabCapabilityModel.cs b/src/Steam.Models/DOTA2/SchemaPrefabCapabilityModel.cs new file mode 100644 index 0000000..0b5d5ba --- /dev/null +++ b/src/Steam.Models/DOTA2/SchemaPrefabCapabilityModel.cs @@ -0,0 +1,23 @@ +namespace Steam.Models.DOTA2 +{ + public class SchemaPrefabCapabilityModel + { + public bool Nameable { get; set; } + + public bool CanHaveSockets { get; set; } + + public bool GemsCanBeExtracted { get; set; } + + public bool CanGiftWrap { get; set; } + + public bool UsableGC { get; set; } + + public bool UsableOutOfGame { get; set; } + + public bool Decodable { get; set; } + + public bool Usable { get; set; } + + public bool IsGem { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/SchemaPrefabModel.cs b/src/Steam.Models/DOTA2/SchemaPrefabModel.cs new file mode 100644 index 0000000..38c656d --- /dev/null +++ b/src/Steam.Models/DOTA2/SchemaPrefabModel.cs @@ -0,0 +1,29 @@ +namespace Steam.Models.DOTA2 +{ + public class SchemaPrefabModel + { + public string Type { get; set; } + + public string TypeName { get; set; } + + public string Class { get; set; } + + public string Name { get; set; } + + public string Slot { get; set; } + + public string Quality { get; set; } + + public string Rarity { get; set; } + + public string MinItemLevel { get; set; } + + public string MaxItemLevel { get; set; } + + public string ImageInventorySizeWidth { get; set; } + + public string ImageInventorySizeHeight { get; set; } + + public SchemaPrefabCapabilityModel Capabilities { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/SchemaQualityModel.cs b/src/Steam.Models/DOTA2/SchemaQualityModel.cs new file mode 100644 index 0000000..d221e6f --- /dev/null +++ b/src/Steam.Models/DOTA2/SchemaQualityModel.cs @@ -0,0 +1,11 @@ +namespace Steam.Models.DOTA2 +{ + public class SchemaQualityModel + { + public string Name { get; set; } + + public uint Value { get; set; } + + public string HexColor { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/SchemaRarityModel.cs b/src/Steam.Models/DOTA2/SchemaRarityModel.cs new file mode 100644 index 0000000..da78aa1 --- /dev/null +++ b/src/Steam.Models/DOTA2/SchemaRarityModel.cs @@ -0,0 +1,15 @@ +namespace Steam.Models.DOTA2 +{ + public class SchemaRarityModel + { + public string Name { get; set; } + + public uint Value { get; set; } + + public string LocKey { get; set; } + + public string Color { get; set; } + + public string NextRarity { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/SourceFileModel.cs b/src/Steam.Models/DOTA2/SourceFileModel.cs new file mode 100644 index 0000000..6888683 --- /dev/null +++ b/src/Steam.Models/DOTA2/SourceFileModel.cs @@ -0,0 +1,14 @@ +namespace Steam.Models.DOTA2 +{ + public enum SourceFileModel + { + HeroAbilities, + ItemAbilities, + Heroes, + InGameItems, + MainSchema, + MainSchemaLocalization, + PublicLocalization, + PanoramaLocalization + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/TeamInfoModel.cs b/src/Steam.Models/DOTA2/TeamInfoModel.cs new file mode 100644 index 0000000..1b3b6db --- /dev/null +++ b/src/Steam.Models/DOTA2/TeamInfoModel.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; + +namespace Steam.Models.DOTA2 +{ + public class TeamInfoModel + { + public uint TeamId { get; set; } + public string Name { get; set; } + public string Tag { get; set; } + public ulong TimeCreated { get; set; } + public string Rating { get; set; } + public ulong Logo { get; set; } + public ulong LogoSponsor { get; set; } + public string CountryCode { get; set; } + public string Url { get; set; } + public uint GamesPlayedWithCurrentRoster { get; set; } + public uint AdminAccountId { get; set; } + public IReadOnlyCollection PlayerIds { get; set; } + public IReadOnlyCollection LeagueIds { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/TowerStateModel.cs b/src/Steam.Models/DOTA2/TowerStateModel.cs new file mode 100644 index 0000000..417f562 --- /dev/null +++ b/src/Steam.Models/DOTA2/TowerStateModel.cs @@ -0,0 +1,36 @@ +namespace Steam.Models.DOTA2 +{ + public class TowerStateModel + { + public TowerStateModel() + { + } + + public TowerStateModel(uint towerState) + { + IsAncientBottomAlive = ((towerState >> 10) & 1) == 1 ? true : false; + IsAncientTopAlive = ((towerState >> 9) & 1) == 1 ? true : false; + IsBottomTier3Alive = ((towerState >> 8) & 1) == 1 ? true : false; + IsBottomTier2Alive = ((towerState >> 7) & 1) == 1 ? true : false; + IsBottomTier1Alive = ((towerState >> 6) & 1) == 1 ? true : false; + IsMiddleTier3Alive = ((towerState >> 5) & 1) == 1 ? true : false; + IsMiddleTier2Alive = ((towerState >> 4) & 1) == 1 ? true : false; + IsMiddleTier1Alive = ((towerState >> 3) & 1) == 1 ? true : false; + IsTopTier3Alive = ((towerState >> 2) & 1) == 1 ? true : false; + IsTopTier2Alive = ((towerState >> 1) & 1) == 1 ? true : false; + IsTopTier1Alive = ((towerState >> 0) & 1) == 1 ? true : false; + } + + public bool IsAncientTopAlive { get; set; } + public bool IsAncientBottomAlive { get; set; } + public bool IsBottomTier3Alive { get; set; } + public bool IsBottomTier2Alive { get; set; } + public bool IsBottomTier1Alive { get; set; } + public bool IsMiddleTier3Alive { get; set; } + public bool IsMiddleTier2Alive { get; set; } + public bool IsMiddleTier1Alive { get; set; } + public bool IsTopTier3Alive { get; set; } + public bool IsTopTier2Alive { get; set; } + public bool IsTopTier1Alive { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameClientResultModel.cs b/src/Steam.Models/GameClientResultModel.cs new file mode 100644 index 0000000..15bff40 --- /dev/null +++ b/src/Steam.Models/GameClientResultModel.cs @@ -0,0 +1,11 @@ +namespace Steam.Models +{ + public class GameClientResultModel + { + public bool Success { get; set; } + + public uint DeployVersion { get; set; } + + public uint ActiveVersion { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/EconItemAttributeAccountInfoModel.cs b/src/Steam.Models/GameEconomy/EconItemAttributeAccountInfoModel.cs new file mode 100644 index 0000000..e9c9c2f --- /dev/null +++ b/src/Steam.Models/GameEconomy/EconItemAttributeAccountInfoModel.cs @@ -0,0 +1,8 @@ +namespace Steam.Models.GameEconomy +{ + public class EconItemAttributeAccountInfoModel + { + public ulong SteamId { get; set; } + public string PersonaName { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/EconItemAttributeModel.cs b/src/Steam.Models/GameEconomy/EconItemAttributeModel.cs new file mode 100644 index 0000000..9ebf7f8 --- /dev/null +++ b/src/Steam.Models/GameEconomy/EconItemAttributeModel.cs @@ -0,0 +1,12 @@ +namespace Steam.Models.GameEconomy +{ + public class EconItemAttributeModel + { + public uint DefIndex { get; set; } + public object Value { get; set; } + + public double FloatValue { get; set; } + + public EconItemAttributeAccountInfoModel AccountInfo { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/EconItemEquippedModel.cs b/src/Steam.Models/GameEconomy/EconItemEquippedModel.cs new file mode 100644 index 0000000..fa5855b --- /dev/null +++ b/src/Steam.Models/GameEconomy/EconItemEquippedModel.cs @@ -0,0 +1,9 @@ +namespace Steam.Models.GameEconomy +{ + public class EconItemEquippedModel + { + public uint ClassId { get; set; } + + public uint Slot { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/EconItemModel.cs b/src/Steam.Models/GameEconomy/EconItemModel.cs new file mode 100644 index 0000000..45ff537 --- /dev/null +++ b/src/Steam.Models/GameEconomy/EconItemModel.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; + +namespace Steam.Models.GameEconomy +{ + public class EconItemModel + { + public ulong Id { get; set; } + + public ulong OriginalId { get; set; } + + public uint DefIndex { get; set; } + public uint Level { get; set; } + public uint Quality { get; set; } + public ulong Inventory { get; set; } + public uint Quantity { get; set; } + public uint Origin { get; set; } + public IReadOnlyCollection Equipped { get; set; } + public uint Style { get; set; } + public IReadOnlyCollection Attributes { get; set; } + + public bool? FlagCannotTrade { get; set; } + + public bool? FlagCannotCraft { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/EconItemResultModel.cs b/src/Steam.Models/GameEconomy/EconItemResultModel.cs new file mode 100644 index 0000000..58b3b10 --- /dev/null +++ b/src/Steam.Models/GameEconomy/EconItemResultModel.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; + +namespace Steam.Models.GameEconomy +{ + public class EconItemResultModel + { + public uint Status { get; set; } + + public uint NumBackpackSlots { get; set; } + + public IReadOnlyCollection Items { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/SchemaAdditionalHiddenBodygroupsModel.cs b/src/Steam.Models/GameEconomy/SchemaAdditionalHiddenBodygroupsModel.cs new file mode 100644 index 0000000..39e8d4a --- /dev/null +++ b/src/Steam.Models/GameEconomy/SchemaAdditionalHiddenBodygroupsModel.cs @@ -0,0 +1,11 @@ +namespace Steam.Models.GameEconomy +{ + public class SchemaAdditionalHiddenBodygroupsModel + { + public uint Hat { get; set; } + + public uint Headphones { get; set; } + + public uint? Head { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/SchemaAttributeControlledAttachedParticleModel.cs b/src/Steam.Models/GameEconomy/SchemaAttributeControlledAttachedParticleModel.cs new file mode 100644 index 0000000..f768272 --- /dev/null +++ b/src/Steam.Models/GameEconomy/SchemaAttributeControlledAttachedParticleModel.cs @@ -0,0 +1,15 @@ +namespace Steam.Models.GameEconomy +{ + public class SchemaAttributeControlledAttachedParticleModel + { + public string System { get; set; } + + public uint Id { get; set; } + + public bool AttachToRootbone { get; set; } + + public string Name { get; set; } + + public string Attachment { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/SchemaAttributeModel.cs b/src/Steam.Models/GameEconomy/SchemaAttributeModel.cs new file mode 100644 index 0000000..809d036 --- /dev/null +++ b/src/Steam.Models/GameEconomy/SchemaAttributeModel.cs @@ -0,0 +1,21 @@ +namespace Steam.Models.GameEconomy +{ + public class SchemaAttributeModel + { + public string Name { get; set; } + + public uint Defindex { get; set; } + + public string AttributeClass { get; set; } + + public string DescriptionString { get; set; } + + public string DescriptionFormat { get; set; } + + public string EffectType { get; set; } + + public bool Hidden { get; set; } + + public bool StoredAsInteger { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/SchemaCapabilitiesModel.cs b/src/Steam.Models/GameEconomy/SchemaCapabilitiesModel.cs new file mode 100644 index 0000000..d3d03e2 --- /dev/null +++ b/src/Steam.Models/GameEconomy/SchemaCapabilitiesModel.cs @@ -0,0 +1,45 @@ +namespace Steam.Models.GameEconomy +{ + public class SchemaCapabilitiesModel + { + public bool Nameable { get; set; } + + public bool CanCraftMark { get; set; } + + public bool CanBeRestored { get; set; } + + public bool StrangeParts { get; set; } + + public bool CanCardUpgrade { get; set; } + + public bool CanStrangify { get; set; } + + public bool CanKillstreakify { get; set; } + + public bool CanConsume { get; set; } + + public bool? CanGiftWrap { get; set; } + + public bool? CanCollect { get; set; } + + public bool? Paintable { get; set; } + + public bool? CanCraftIfPurchased { get; set; } + + public bool? CanCraftCount { get; set; } + + public bool? UsableGc { get; set; } + + public bool? Usable { get; set; } + + public bool? CanCustomizeTexture { get; set; } + + public bool? UsableOutOfGame { get; set; } + + public bool? CanSpellPage { get; set; } + + public bool? DuckUpgradable { get; set; } + + public bool? Decodable { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/SchemaItemAttributeModel.cs b/src/Steam.Models/GameEconomy/SchemaItemAttributeModel.cs new file mode 100644 index 0000000..1d77c2b --- /dev/null +++ b/src/Steam.Models/GameEconomy/SchemaItemAttributeModel.cs @@ -0,0 +1,11 @@ +namespace Steam.Models.GameEconomy +{ + public class SchemaItemAttributeModel + { + public string Name { get; set; } + + public string Class { get; set; } + + public double Value { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/SchemaItemLevelModel.cs b/src/Steam.Models/GameEconomy/SchemaItemLevelModel.cs new file mode 100644 index 0000000..6d10891 --- /dev/null +++ b/src/Steam.Models/GameEconomy/SchemaItemLevelModel.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; + +namespace Steam.Models.GameEconomy +{ + public class SchemaItemLevelModel + { + public string Name { get; set; } + + public IReadOnlyCollection Levels { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/SchemaItemModel.cs b/src/Steam.Models/GameEconomy/SchemaItemModel.cs new file mode 100644 index 0000000..97f0246 --- /dev/null +++ b/src/Steam.Models/GameEconomy/SchemaItemModel.cs @@ -0,0 +1,81 @@ +using Steam.Models.DOTA2; +using System; +using System.Collections.Generic; + +namespace Steam.Models.GameEconomy +{ + public class SchemaItemModel + { + public uint DefIndex { get; set; } + + public string Name { get; set; } + + public string ImageInventoryPath { get; set; } + + public string ItemName { get; set; } + + public string ItemDescription { get; set; } + + public string ItemTypeName { get; set; } + + public string ItemClass { get; set; } + + public bool ProperName { get; set; } + + public string ItemSlot { get; set; } + + public string ModelPlayer { get; set; } + + public uint ItemQuality { get; set; } + + public uint MinIlevel { get; set; } + + public uint MaxIlevel { get; set; } + + public string ImageUrl { get; set; } + + public string ImageUrlLarge { get; set; } + + public string CraftClass { get; set; } + + public string CraftMaterialType { get; set; } + + public string ItemLogName { get; set; } + + public SchemaCapabilitiesModel Capabilities { get; set; } + + public IReadOnlyCollection UsedByClasses { get; set; } + + public IReadOnlyCollection Styles { get; set; } + + public IReadOnlyCollection Attributes { get; set; } + + public string DropType { get; set; } + + public string ItemSet { get; set; } + + public string HolidayRestriction { get; set; } + + public SchemaPerClassLoadoutSlotsModel PerClassLoadoutSlots { get; set; } + + public SchemaToolModel Tool { get; set; } + + public string Prefab { get; set; } + + public DateTime? CreationDate { get; set; } + + public DateTime? ExpirationDate { get; set; } + + public string TournamentUrl { get; set; } + + public string ImageBannerPath { get; set; } + + public string ItemRarity { get; set; } + + public SchemaItemPriceInfoModel PriceInfo { get; set; } + + public IList UsedByHeroes { get; set; } + + public IList BundledItems { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/SchemaItemSetAttributeModel.cs b/src/Steam.Models/GameEconomy/SchemaItemSetAttributeModel.cs new file mode 100644 index 0000000..4584d30 --- /dev/null +++ b/src/Steam.Models/GameEconomy/SchemaItemSetAttributeModel.cs @@ -0,0 +1,11 @@ +namespace Steam.Models.GameEconomy +{ + public class SchemaItemSetAttributeModel + { + public string Name { get; set; } + + public string Class { get; set; } + + public double Value { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/SchemaItemSetModel.cs b/src/Steam.Models/GameEconomy/SchemaItemSetModel.cs new file mode 100644 index 0000000..8650337 --- /dev/null +++ b/src/Steam.Models/GameEconomy/SchemaItemSetModel.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; + +namespace Steam.Models.GameEconomy +{ + public class SchemaItemSetModel + { + public string RawName { get; set; } + + public string ItemSet { get; set; } + + public string Name { get; set; } + + public IReadOnlyCollection Items { get; set; } + + public IReadOnlyCollection Attributes { get; set; } + + public string StoreBundleName { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/SchemaKillEaterScoreTypeModel.cs b/src/Steam.Models/GameEconomy/SchemaKillEaterScoreTypeModel.cs new file mode 100644 index 0000000..355d978 --- /dev/null +++ b/src/Steam.Models/GameEconomy/SchemaKillEaterScoreTypeModel.cs @@ -0,0 +1,11 @@ +namespace Steam.Models.GameEconomy +{ + public class SchemaKillEaterScoreTypeModel + { + public uint Type { get; set; } + + public string TypeName { get; set; } + + public string LevelData { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/SchemaLevelModel.cs b/src/Steam.Models/GameEconomy/SchemaLevelModel.cs new file mode 100644 index 0000000..6dc65ab --- /dev/null +++ b/src/Steam.Models/GameEconomy/SchemaLevelModel.cs @@ -0,0 +1,11 @@ +namespace Steam.Models.GameEconomy +{ + public class SchemaLevelModel + { + public uint Level { get; set; } + + public uint RequiredScore { get; set; } + + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/SchemaModel.cs b/src/Steam.Models/GameEconomy/SchemaModel.cs new file mode 100644 index 0000000..e606d61 --- /dev/null +++ b/src/Steam.Models/GameEconomy/SchemaModel.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; + +namespace Steam.Models.GameEconomy +{ + public class SchemaModel + { + public uint Status { get; set; } + + public string ItemsGameUrl { get; set; } + + public SchemaQualitiesModel Qualities { get; set; } + + public IReadOnlyCollection OriginNames { get; set; } + + public IReadOnlyCollection Items { get; set; } + + public IReadOnlyCollection Attributes { get; set; } + + public IReadOnlyCollection ItemSets { get; set; } + + public IReadOnlyCollection AttributeControlledAttachedParticles { get; set; } + + public IReadOnlyCollection ItemLevels { get; set; } + + public IReadOnlyCollection KillEaterScoreTypes { get; set; } + + public IReadOnlyCollection StringLookups { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/SchemaOriginNameModel.cs b/src/Steam.Models/GameEconomy/SchemaOriginNameModel.cs new file mode 100644 index 0000000..a024211 --- /dev/null +++ b/src/Steam.Models/GameEconomy/SchemaOriginNameModel.cs @@ -0,0 +1,9 @@ +namespace Steam.Models.GameEconomy +{ + public class SchemaOriginNameModel + { + public uint Origin { get; set; } + + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/SchemaPerClassLoadoutSlotsModel.cs b/src/Steam.Models/GameEconomy/SchemaPerClassLoadoutSlotsModel.cs new file mode 100644 index 0000000..2ab709a --- /dev/null +++ b/src/Steam.Models/GameEconomy/SchemaPerClassLoadoutSlotsModel.cs @@ -0,0 +1,15 @@ +namespace Steam.Models.GameEconomy +{ + public class SchemaPerClassLoadoutSlotsModel + { + public string Soldier { get; set; } + + public string Heavy { get; set; } + + public string Pyro { get; set; } + + public string Engineer { get; set; } + + public string Demoman { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/SchemaQualitiesModel.cs b/src/Steam.Models/GameEconomy/SchemaQualitiesModel.cs new file mode 100644 index 0000000..e3bd2b5 --- /dev/null +++ b/src/Steam.Models/GameEconomy/SchemaQualitiesModel.cs @@ -0,0 +1,82 @@ +namespace Steam.Models.GameEconomy +{ + public class SchemaQualitiesModel + { + /// + /// Normal item rarity: https://wiki.teamfortress.com/wiki/Normal + /// + public uint Normal { get; set; } + + /// + /// Genuine item rarity: https://wiki.teamfortress.com/wiki/Genuine + /// + public uint Rarity1 { get; set; } + + /// + /// Unused + /// + public uint Rarity2 { get; set; } + + /// + /// Vintage item rarity: https://wiki.teamfortress.com/wiki/Vintage + /// + public uint Vintage { get; set; } + + /// + /// Unused + /// + public uint Rarity3 { get; set; } + + /// + /// Unusual item rarity: https://wiki.teamfortress.com/wiki/Unusual + /// + public uint Rarity4 { get; set; } + + /// + /// Unique item rarity: https://wiki.teamfortress.com/wiki/Unique + /// + public uint Unique { get; set; } + + /// + /// Community item: https://wiki.teamfortress.com/wiki/Community_(quality) + /// + public uint Community { get; set; } + + /// + /// Developer owned item: https://wiki.teamfortress.com/wiki/Valve_(quality) + /// + public uint Developer { get; set; } + + /// + /// Self made item: https://wiki.teamfortress.com/wiki/Self-Made + /// + public uint SelfMade { get; set; } + + /// + /// Unused + /// + public uint Customized { get; set; } + + /// + /// Strange item: https://wiki.teamfortress.com/wiki/Strange + /// + public uint Strange { get; set; } + + /// + /// Unused + /// + public uint Completed { get; set; } + + /// + /// Haunted item: https://wiki.teamfortress.com/wiki/Haunted + /// + public uint Haunted { get; set; } + + /// + /// Collector's item: https://wiki.teamfortress.com/wiki/Collector%27s + /// + public uint Collectors { get; set; } + + public uint PaintKitWeapon { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/SchemaStringLookupModel.cs b/src/Steam.Models/GameEconomy/SchemaStringLookupModel.cs new file mode 100644 index 0000000..3173730 --- /dev/null +++ b/src/Steam.Models/GameEconomy/SchemaStringLookupModel.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; + +namespace Steam.Models.GameEconomy +{ + public class SchemaStringLookupModel + { + public string TableName { get; set; } + + public IReadOnlyCollection Strings { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/SchemaStringModel.cs b/src/Steam.Models/GameEconomy/SchemaStringModel.cs new file mode 100644 index 0000000..1de1cb4 --- /dev/null +++ b/src/Steam.Models/GameEconomy/SchemaStringModel.cs @@ -0,0 +1,9 @@ +namespace Steam.Models.GameEconomy +{ + public class SchemaStringModel + { + public uint Index { get; set; } + + public string String { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/SchemaStyleModel.cs b/src/Steam.Models/GameEconomy/SchemaStyleModel.cs new file mode 100644 index 0000000..4714080 --- /dev/null +++ b/src/Steam.Models/GameEconomy/SchemaStyleModel.cs @@ -0,0 +1,9 @@ +namespace Steam.Models.GameEconomy +{ + public class SchemaStyleModel + { + public string Name { get; set; } + + public SchemaAdditionalHiddenBodygroupsModel AdditionalHiddenBodygroups { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/SchemaToolModel.cs b/src/Steam.Models/GameEconomy/SchemaToolModel.cs new file mode 100644 index 0000000..ca0e651 --- /dev/null +++ b/src/Steam.Models/GameEconomy/SchemaToolModel.cs @@ -0,0 +1,17 @@ +using Steam.Models.DOTA2; + +namespace Steam.Models.GameEconomy +{ + public class SchemaToolModel + { + public string Type { get; set; } + + public SchemaUsageCapabilitiesModel UsageCapabilities { get; set; } + + public SchemaItemToolUsageModel Usage { get; set; } + + public string UseString { get; set; } + + public string Restriction { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/SchemaUsageCapabilitiesModel.cs b/src/Steam.Models/GameEconomy/SchemaUsageCapabilitiesModel.cs new file mode 100644 index 0000000..17973f2 --- /dev/null +++ b/src/Steam.Models/GameEconomy/SchemaUsageCapabilitiesModel.cs @@ -0,0 +1,31 @@ +namespace Steam.Models.GameEconomy +{ + public class SchemaUsageCapabilitiesModel + { + public bool Nameable { get; set; } + + public bool? Decodable { get; set; } + + public bool? Paintable { get; set; } + + public bool? CanCustomizeTexture { get; set; } + + public bool? CanGiftWrap { get; set; } + + public bool? PaintableTeamColors { get; set; } + + public bool? CanStrangify { get; set; } + + public bool? CanKillstreakify { get; set; } + + public bool? DuckUpgradable { get; set; } + + public bool? StrangeParts { get; set; } + + public bool? CanCardUpgrade { get; set; } + + public bool? CanSpellPage { get; set; } + + public bool? CanConsume { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/StoreBannerModel.cs b/src/Steam.Models/GameEconomy/StoreBannerModel.cs new file mode 100644 index 0000000..cad3d83 --- /dev/null +++ b/src/Steam.Models/GameEconomy/StoreBannerModel.cs @@ -0,0 +1,13 @@ +namespace Steam.Models.GameEconomy +{ + public class StoreBannerModel + { + public string BaseFileName { get; set; } + + public string Action { get; set; } + + public string Placement { get; set; } + + public string ActionParam { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/StoreCarouselDataModel.cs b/src/Steam.Models/GameEconomy/StoreCarouselDataModel.cs new file mode 100644 index 0000000..2fd3b00 --- /dev/null +++ b/src/Steam.Models/GameEconomy/StoreCarouselDataModel.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; + +namespace Steam.Models.GameEconomy +{ + public class StoreCarouselDataModel + { + public uint MaxDisplayBanners { get; set; } + + public IReadOnlyCollection Banners { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/StoreConfigModel.cs b/src/Steam.Models/GameEconomy/StoreConfigModel.cs new file mode 100644 index 0000000..dcdba83 --- /dev/null +++ b/src/Steam.Models/GameEconomy/StoreConfigModel.cs @@ -0,0 +1,13 @@ +namespace Steam.Models.GameEconomy +{ + public class StoreConfigModel + { + public ulong DropdownId { get; set; } + + public string Name { get; set; } + + public bool Enabled { get; set; } + + public ulong DefaultSelectionId { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/StoreDropdownDataModel.cs b/src/Steam.Models/GameEconomy/StoreDropdownDataModel.cs new file mode 100644 index 0000000..8c2474c --- /dev/null +++ b/src/Steam.Models/GameEconomy/StoreDropdownDataModel.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; + +namespace Steam.Models.GameEconomy +{ + public class StoreDropdownDataModel + { + public IReadOnlyCollection Dropdowns { get; set; } + + public IReadOnlyCollection Prefabs { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/StoreDropdownModel.cs b/src/Steam.Models/GameEconomy/StoreDropdownModel.cs new file mode 100644 index 0000000..719d06a --- /dev/null +++ b/src/Steam.Models/GameEconomy/StoreDropdownModel.cs @@ -0,0 +1,15 @@ +namespace Steam.Models.GameEconomy +{ + public class StoreDropdownModel + { + public ulong Id { get; set; } + + public string Name { get; set; } + + public string Type { get; set; } + + public string LabelText { get; set; } + + public string UrlHistoryParamName { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/StoreFilterAllElementModel.cs b/src/Steam.Models/GameEconomy/StoreFilterAllElementModel.cs new file mode 100644 index 0000000..c898b41 --- /dev/null +++ b/src/Steam.Models/GameEconomy/StoreFilterAllElementModel.cs @@ -0,0 +1,9 @@ +namespace Steam.Models.GameEconomy +{ + public class StoreFilterAllElementModel + { + public uint Id { get; set; } + + public string LocalizedText { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/StoreFilterElementModel.cs b/src/Steam.Models/GameEconomy/StoreFilterElementModel.cs new file mode 100644 index 0000000..3600dc0 --- /dev/null +++ b/src/Steam.Models/GameEconomy/StoreFilterElementModel.cs @@ -0,0 +1,11 @@ +namespace Steam.Models.GameEconomy +{ + public class StoreFilterElementModel + { + public string Name { get; set; } + + public string LocalizedText { get; set; } + + public uint Id { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/StoreFilterModel.cs b/src/Steam.Models/GameEconomy/StoreFilterModel.cs new file mode 100644 index 0000000..fa0d3b3 --- /dev/null +++ b/src/Steam.Models/GameEconomy/StoreFilterModel.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; + +namespace Steam.Models.GameEconomy +{ + public class StoreFilterModel + { + public uint Id { get; set; } + + public string Name { get; set; } + + public string UrlHistoryParamName { get; set; } + + public StoreFilterAllElementModel AllElement { get; set; } + + public IReadOnlyCollection Elements { get; set; } + + public uint Count { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/StoreHomePageDataModel.cs b/src/Steam.Models/GameEconomy/StoreHomePageDataModel.cs new file mode 100644 index 0000000..2306471 --- /dev/null +++ b/src/Steam.Models/GameEconomy/StoreHomePageDataModel.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; + +namespace Steam.Models.GameEconomy +{ + public class StoreHomePageDataModel + { + public uint HomeCategoryId { get; set; } + + public IReadOnlyCollection PopularItems { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/StoreMetaDataModel.cs b/src/Steam.Models/GameEconomy/StoreMetaDataModel.cs new file mode 100644 index 0000000..ef69310 --- /dev/null +++ b/src/Steam.Models/GameEconomy/StoreMetaDataModel.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; + +namespace Steam.Models.GameEconomy +{ + public class StoreMetaDataModel + { + public StoreCarouselDataModel CarouselData { get; set; } + + public IReadOnlyCollection Tabs { get; set; } + + public IReadOnlyCollection Filters { get; set; } + + public StoreSortingModel Sorting { get; set; } + + public StoreDropdownDataModel DropdownData { get; set; } + + public IReadOnlyCollection PlayerClassData { get; set; } + + public StoreHomePageDataModel HomePageData { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/StorePlayerClassDataModel.cs b/src/Steam.Models/GameEconomy/StorePlayerClassDataModel.cs new file mode 100644 index 0000000..ff37967 --- /dev/null +++ b/src/Steam.Models/GameEconomy/StorePlayerClassDataModel.cs @@ -0,0 +1,11 @@ +namespace Steam.Models.GameEconomy +{ + public class StorePlayerClassDataModel + { + public uint Id { get; set; } + + public string BaseName { get; set; } + + public string LocalizedText { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/StorePopularItemModel.cs b/src/Steam.Models/GameEconomy/StorePopularItemModel.cs new file mode 100644 index 0000000..261d1c4 --- /dev/null +++ b/src/Steam.Models/GameEconomy/StorePopularItemModel.cs @@ -0,0 +1,9 @@ +namespace Steam.Models.GameEconomy +{ + public class StorePopularItemModel + { + public uint DefIndex { get; set; } + + public uint Order { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/StorePrefabModel.cs b/src/Steam.Models/GameEconomy/StorePrefabModel.cs new file mode 100644 index 0000000..0cab3a2 --- /dev/null +++ b/src/Steam.Models/GameEconomy/StorePrefabModel.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; + +namespace Steam.Models.GameEconomy +{ + public class StorePrefabModel + { + public uint Id { get; set; } + + public string Name { get; set; } + + public IReadOnlyCollection Config { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/StoreSorterIdModel.cs b/src/Steam.Models/GameEconomy/StoreSorterIdModel.cs new file mode 100644 index 0000000..c89b531 --- /dev/null +++ b/src/Steam.Models/GameEconomy/StoreSorterIdModel.cs @@ -0,0 +1,7 @@ +namespace Steam.Models.GameEconomy +{ + public class StoreSorterIdModel + { + public ulong Id { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/StoreSorterModel.cs b/src/Steam.Models/GameEconomy/StoreSorterModel.cs new file mode 100644 index 0000000..2d6dc36 --- /dev/null +++ b/src/Steam.Models/GameEconomy/StoreSorterModel.cs @@ -0,0 +1,17 @@ +namespace Steam.Models.GameEconomy +{ + public class StoreSorterModel + { + public ulong Id { get; set; } + + public string Name { get; set; } + + public string DataType { get; set; } + + public string SortField { get; set; } + + public bool SortReversed { get; set; } + + public string LocalizedText { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/StoreSortingModel.cs b/src/Steam.Models/GameEconomy/StoreSortingModel.cs new file mode 100644 index 0000000..ff56728 --- /dev/null +++ b/src/Steam.Models/GameEconomy/StoreSortingModel.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; + +namespace Steam.Models.GameEconomy +{ + public class StoreSortingModel + { + public IReadOnlyCollection Sorters { get; set; } + + public IReadOnlyCollection SortingPrefabs { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/StoreSortingPrefabModel.cs b/src/Steam.Models/GameEconomy/StoreSortingPrefabModel.cs new file mode 100644 index 0000000..81ecacd --- /dev/null +++ b/src/Steam.Models/GameEconomy/StoreSortingPrefabModel.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; + +namespace Steam.Models.GameEconomy +{ + public class StoreSortingPrefabModel + { + public ulong Id { get; set; } + + public string Name { get; set; } + + public string UrlHistoryParamName { get; set; } + + public IReadOnlyCollection SorterIds { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/StoreTabChildModel.cs b/src/Steam.Models/GameEconomy/StoreTabChildModel.cs new file mode 100644 index 0000000..7dcf604 --- /dev/null +++ b/src/Steam.Models/GameEconomy/StoreTabChildModel.cs @@ -0,0 +1,9 @@ +namespace Steam.Models.GameEconomy +{ + public class StoreTabChildModel + { + public string Name { get; set; } + + public string Id { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/StoreTabModel.cs b/src/Steam.Models/GameEconomy/StoreTabModel.cs new file mode 100644 index 0000000..309de8f --- /dev/null +++ b/src/Steam.Models/GameEconomy/StoreTabModel.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; + +namespace Steam.Models.GameEconomy +{ + public class StoreTabModel + { + public string Label { get; set; } + + public uint Id { get; set; } + + public uint ParentId { get; set; } + + public bool UseLargeCells { get; set; } + + public bool Default { get; set; } + + public IReadOnlyCollection Children { get; set; } + + public bool Home { get; set; } + + public ulong? DropdownPrefabId { get; set; } + + public string ParentName { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/NewsItemModel.cs b/src/Steam.Models/NewsItemModel.cs new file mode 100644 index 0000000..887662e --- /dev/null +++ b/src/Steam.Models/NewsItemModel.cs @@ -0,0 +1,23 @@ +namespace Steam.Models +{ + public class NewsItemModel + { + public string Gid { get; set; } + + public string Title { get; set; } + + public string Url { get; set; } + + public bool IsExternalUrl { get; set; } + + public string Author { get; set; } + + public string Contents { get; set; } + + public string FeedLabel { get; set; } + + public ulong Date { get; set; } + + public string Feedname { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/PublishedFileDetailsModel.cs b/src/Steam.Models/PublishedFileDetailsModel.cs new file mode 100644 index 0000000..733b434 --- /dev/null +++ b/src/Steam.Models/PublishedFileDetailsModel.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; + +namespace Steam.Models +{ + public class PublishedFileDetailsModel + { + public ulong PublishedFileId { get; set; } + + public uint Result { get; set; } + + public ulong Creator { get; set; } + + public uint CreatorAppId { get; set; } + + public uint ConsumerAppId { get; set; } + + public string FileName { get; set; } + + public uint FileSize { get; set; } + + public Uri FileUrl { get; set; } + + public ulong FileContentHandle { get; set; } + + public Uri PreviewUrl { get; set; } + + public ulong PreviewContentHandle { get; set; } + + public string Title { get; set; } + + public string Description { get; set; } + + public DateTime TimeCreated { get; set; } + + public DateTime TimeUpdated { get; set; } + + public PublishedFileVisibility Visibility { get; set; } + + public bool Banned { get; set; } + + public string BanReason { get; set; } + + public ulong Subscriptions { get; set; } + + public ulong Favorited { get; set; } + + public ulong LifetimeSubscriptions { get; set; } + + public ulong LifetimeFavorited { get; set; } + + public ulong Views { get; set; } + + public IList Tags { get; set; } + } +} diff --git a/src/Steam.Models/PublishedFileVisibility.cs b/src/Steam.Models/PublishedFileVisibility.cs new file mode 100644 index 0000000..109c283 --- /dev/null +++ b/src/Steam.Models/PublishedFileVisibility.cs @@ -0,0 +1,9 @@ +namespace Steam.Models +{ + public enum PublishedFileVisibility + { + Public = 0, + FreindsOnly = 1, + Private = 2 + } +} diff --git a/src/Steam.Models/SchemaForGameResultModel.cs b/src/Steam.Models/SchemaForGameResultModel.cs new file mode 100644 index 0000000..c745e9c --- /dev/null +++ b/src/Steam.Models/SchemaForGameResultModel.cs @@ -0,0 +1,11 @@ +namespace Steam.Models +{ + public class SchemaForGameResultModel + { + public string GameName { get; set; } + + public string GameVersion { get; set; } + + public AvailableGameStatsModel AvailableGameStats { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SchemaGameAchievementModel.cs b/src/Steam.Models/SchemaGameAchievementModel.cs new file mode 100644 index 0000000..a5c8332 --- /dev/null +++ b/src/Steam.Models/SchemaGameAchievementModel.cs @@ -0,0 +1,19 @@ +namespace Steam.Models +{ + public class SchemaGameAchievementModel + { + public string Name { get; set; } + + public ulong DefaultValue { get; set; } + + public string DisplayName { get; set; } + + public uint Hidden { get; set; } + + public string Description { get; set; } + + public string Icon { get; set; } + + public string Icongray { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SchemaGameStatModel.cs b/src/Steam.Models/SchemaGameStatModel.cs new file mode 100644 index 0000000..d992cdb --- /dev/null +++ b/src/Steam.Models/SchemaGameStatModel.cs @@ -0,0 +1,11 @@ +namespace Steam.Models +{ + public class SchemaGameStatModel + { + public string Name { get; set; } + + public ulong DefaultValue { get; set; } + + public string DisplayName { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/Steam.Models.csproj b/src/Steam.Models/Steam.Models.csproj new file mode 100644 index 0000000..eee0675 --- /dev/null +++ b/src/Steam.Models/Steam.Models.csproj @@ -0,0 +1,14 @@ + + + + Contains classes that are used as data transports between various application, business, and data layers for Steam related APIs. + 3.0.10 + Justin Skiles + Steam.Models + Steam.Models + https://github.com/babelshift/Steam.Models + https://raw.githubusercontent.com/babelshift/Steam.Models/master/LICENSE + netstandard2.0 + + + diff --git a/src/Steam.Models/SteamAppModel.cs b/src/Steam.Models/SteamAppModel.cs new file mode 100644 index 0000000..9cc1f5a --- /dev/null +++ b/src/Steam.Models/SteamAppModel.cs @@ -0,0 +1,9 @@ +namespace Steam.Models +{ + public class SteamAppModel + { + public uint AppId { get; set; } + + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamAppUpToDateCheckModel.cs b/src/Steam.Models/SteamAppUpToDateCheckModel.cs new file mode 100644 index 0000000..f1d50d6 --- /dev/null +++ b/src/Steam.Models/SteamAppUpToDateCheckModel.cs @@ -0,0 +1,15 @@ +namespace Steam.Models +{ + public class SteamAppUpToDateCheckModel + { + public bool Success { get; set; } + + public bool UpToDate { get; set; } + + public bool VersionIsListable { get; set; } + + public uint RequiredVersion { get; set; } + + public string Message { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamCommunity/BadgeModel.cs b/src/Steam.Models/SteamCommunity/BadgeModel.cs new file mode 100644 index 0000000..858095a --- /dev/null +++ b/src/Steam.Models/SteamCommunity/BadgeModel.cs @@ -0,0 +1,21 @@ +namespace Steam.Models.SteamCommunity +{ + public class BadgeModel + { + public uint BadgeId { get; set; } + + public uint Level { get; set; } + + public ulong CompletionTime { get; set; } + + public uint Xp { get; set; } + + public uint Scarcity { get; set; } + + public uint? AppId { get; set; } + + public string CommunityItemId { get; set; } + + public uint? BorderColor { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamCommunity/BadgeQuestModel.cs b/src/Steam.Models/SteamCommunity/BadgeQuestModel.cs new file mode 100644 index 0000000..3e9d44b --- /dev/null +++ b/src/Steam.Models/SteamCommunity/BadgeQuestModel.cs @@ -0,0 +1,9 @@ +namespace Steam.Models.SteamCommunity +{ + public class BadgeQuestModel + { + public uint QuestId { get; set; } + + public bool Completed { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamCommunity/BadgesResultModel.cs b/src/Steam.Models/SteamCommunity/BadgesResultModel.cs new file mode 100644 index 0000000..976fec2 --- /dev/null +++ b/src/Steam.Models/SteamCommunity/BadgesResultModel.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +namespace Steam.Models.SteamCommunity +{ + public class BadgesResultModel + { + public IReadOnlyCollection Badges { get; set; } + + public uint PlayerXp { get; set; } + + public uint PlayerLevel { get; set; } + + public uint PlayerXpNeededToLevelUp { get; set; } + + public uint PlayerXpNeededCurrentLevel { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamCommunity/CommentPermission.cs b/src/Steam.Models/SteamCommunity/CommentPermission.cs new file mode 100644 index 0000000..ce0c1d4 --- /dev/null +++ b/src/Steam.Models/SteamCommunity/CommentPermission.cs @@ -0,0 +1,13 @@ +namespace Steam.Models.SteamCommunity +{ + /// + /// Indicates the selected privacy/visibility level of the player's comments section on their Steam Community profile + /// + public enum CommentPermission + { + Unknown = 0, + FriendsOnly = 1, + Private = 2, + Public = 3 + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamCommunity/FriendModel.cs b/src/Steam.Models/SteamCommunity/FriendModel.cs new file mode 100644 index 0000000..71a6ae7 --- /dev/null +++ b/src/Steam.Models/SteamCommunity/FriendModel.cs @@ -0,0 +1,13 @@ +using System; + +namespace Steam.Models.SteamCommunity +{ + public class FriendModel + { + public ulong SteamId { get; set; } + + public string Relationship { get; set; } + + public DateTime FriendSince { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamCommunity/GlobalAchievementPercentageModel.cs b/src/Steam.Models/SteamCommunity/GlobalAchievementPercentageModel.cs new file mode 100644 index 0000000..3bcd558 --- /dev/null +++ b/src/Steam.Models/SteamCommunity/GlobalAchievementPercentageModel.cs @@ -0,0 +1,9 @@ +namespace Steam.Models.SteamCommunity +{ + public class GlobalAchievementPercentageModel + { + public string Name { get; set; } + + public double Percent { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamCommunity/GlobalStatModel.cs b/src/Steam.Models/SteamCommunity/GlobalStatModel.cs new file mode 100644 index 0000000..fde657f --- /dev/null +++ b/src/Steam.Models/SteamCommunity/GlobalStatModel.cs @@ -0,0 +1,8 @@ +namespace Steam.Models.SteamCommunity +{ + public class GlobalStatModel + { + public string Name { get; set; } + public uint Total { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamCommunity/OwnedGameModel.cs b/src/Steam.Models/SteamCommunity/OwnedGameModel.cs new file mode 100644 index 0000000..5ce06fe --- /dev/null +++ b/src/Steam.Models/SteamCommunity/OwnedGameModel.cs @@ -0,0 +1,21 @@ +using System; + +namespace Steam.Models.SteamCommunity +{ + public class OwnedGameModel + { + public uint AppId { get; set; } + + public string Name { get; set; } + + public TimeSpan PlaytimeForever { get; set; } + + public string ImgIconUrl { get; set; } + + public string ImgLogoUrl { get; set; } + + public bool HasCommunityVisibleStats { get; set; } + + public TimeSpan? PlaytimeLastTwoWeeks { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamCommunity/OwnedGamesResultModel.cs b/src/Steam.Models/SteamCommunity/OwnedGamesResultModel.cs new file mode 100644 index 0000000..798737f --- /dev/null +++ b/src/Steam.Models/SteamCommunity/OwnedGamesResultModel.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; + +namespace Steam.Models.SteamCommunity +{ + public class OwnedGamesResultModel + { + public uint GameCount { get; set; } + + public IReadOnlyCollection OwnedGames { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamCommunity/PlayerBansModel.cs b/src/Steam.Models/SteamCommunity/PlayerBansModel.cs new file mode 100644 index 0000000..85923d9 --- /dev/null +++ b/src/Steam.Models/SteamCommunity/PlayerBansModel.cs @@ -0,0 +1,19 @@ +namespace Steam.Models.SteamCommunity +{ + public class PlayerBansModel + { + public string SteamId { get; set; } + + public bool CommunityBanned { get; set; } + + public bool VACBanned { get; set; } + + public uint NumberOfVACBans { get; set; } + + public uint DaysSinceLastBan { get; set; } + + public uint NumberOfGameBans { get; set; } + + public string EconomyBan { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamCommunity/PlayerSummaryModel.cs b/src/Steam.Models/SteamCommunity/PlayerSummaryModel.cs new file mode 100644 index 0000000..1a92b44 --- /dev/null +++ b/src/Steam.Models/SteamCommunity/PlayerSummaryModel.cs @@ -0,0 +1,104 @@ +using System; + +namespace Steam.Models.SteamCommunity +{ + public class PlayerSummaryModel + { + /// + /// Unique Steam ID of the player. Resolve this using ResolveVanityUrl interface method. + /// + public ulong SteamId { get; set; } + + /// + /// Determines the visibility of the user's profile (public, private, friends) + /// + public ProfileVisibility ProfileVisibility { get; set; } + + /// + /// If set to 1, the user has configured his profile. + /// + public uint ProfileState { get; set; } + + /// + /// User's current nick name (displayed in profile and friends list) + /// + public string Nickname { get; set; } + + /// + /// The date at which the user last logged off Steam + /// It's a 64-bit integer in the JSON response, so we parse it to a DateTime + /// + public DateTime LastLoggedOffDate { get; set; } + + /// + /// The selected privacy/visibility level of the player's comments section on their Steam Community profile + /// + public CommentPermission CommentPermission { get; set; } + + /// + /// The URL for the player's Steam Community profile + /// + public string ProfileUrl { get; set; } + + /// + /// The normal sized uploaded avatar image for the user's Steam profile + /// + public string AvatarUrl { get; set; } + + /// + /// The medium sized uploaded avatar image for the user's Steam profile + /// + public string AvatarMediumUrl { get; set; } + + /// + /// THe full sized uploaded avatar image for the user's Steam profile + /// + public string AvatarFullUrl { get; set; } + + /// + /// The current status of the user on the Steam network + /// + public UserStatus UserStatus { get; set; } + + /// + /// The player's real name as entered on their Steam profile + /// + public string RealName { get; set; } + + /// + /// The player's selected primary group to display on their Steam profile + /// + public string PrimaryGroupId { get; set; } + + /// + /// The date at which the user created their Steam account + /// It's a 64-bit integer in the JSON response, so we parse it to a DateTime + /// + public DateTime AccountCreatedDate { get; set; } + + /// + /// The player's selected country + /// + public string CountryCode { get; set; } + + /// + /// The player's selected state + /// + public string StateCode { get; set; } + + /// + /// The player's selected city. This seems to refer to a database city id, so I'm not sure how to make use of this field. + /// + public uint CityCode { get; set; } + + /// + /// The name of the game that a player is currently playing + /// + public string PlayingGameName { get; set; } + + /// + /// The id of the game that the player is currently playing. This doesn't seem to be an appid, so I'm not sure how to make use of this field. + /// + public string PlayingGameId { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamCommunity/ProfileVisibility.cs b/src/Steam.Models/SteamCommunity/ProfileVisibility.cs new file mode 100644 index 0000000..8f431da --- /dev/null +++ b/src/Steam.Models/SteamCommunity/ProfileVisibility.cs @@ -0,0 +1,13 @@ +namespace Steam.Models.SteamCommunity +{ + /// + /// Indicates the selected privacy/visibility level of the player's Steam Community profile + /// + public enum ProfileVisibility + { + Unknown = 0, + Private = 1, + FriendsOnly = 2, + Public = 3 + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamCommunity/RecentlyPlayedGameModel.cs b/src/Steam.Models/SteamCommunity/RecentlyPlayedGameModel.cs new file mode 100644 index 0000000..08bea2b --- /dev/null +++ b/src/Steam.Models/SteamCommunity/RecentlyPlayedGameModel.cs @@ -0,0 +1,17 @@ +namespace Steam.Models.SteamCommunity +{ + public class RecentlyPlayedGameModel + { + public uint AppId { get; set; } + + public string Name { get; set; } + + public uint Playtime2Weeks { get; set; } + + public uint PlaytimeForever { get; set; } + + public string ImgIconUrl { get; set; } + + public string ImgLogoUrl { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamCommunity/RecentlyPlayedGamesResultModel.cs b/src/Steam.Models/SteamCommunity/RecentlyPlayedGamesResultModel.cs new file mode 100644 index 0000000..f93a0ef --- /dev/null +++ b/src/Steam.Models/SteamCommunity/RecentlyPlayedGamesResultModel.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; + +namespace Steam.Models.SteamCommunity +{ + public class RecentlyPlayedGamesResultModel + { + public uint TotalCount { get; set; } + + public IReadOnlyCollection RecentlyPlayedGames { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamCommunity/SteamCommunityProfileModel.cs b/src/Steam.Models/SteamCommunity/SteamCommunityProfileModel.cs new file mode 100644 index 0000000..614154b --- /dev/null +++ b/src/Steam.Models/SteamCommunity/SteamCommunityProfileModel.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; + +namespace Steam.Models.SteamCommunity +{ + public class SteamCommunityProfileModel + { + public ulong SteamID { get; set; } + public string State { get; set; } + public string StateMessage { get; set; } + public uint VisibilityState { get; set; } // what is this? + public Uri Avatar { get; set; } + public Uri AvatarMedium { get; set; } + public Uri AvatarFull { get; set; } + public bool IsVacBanned { get; set; } + public string TradeBanState { get; set; } + public bool IsLimitedAccount { get; set; } + public string CustomURL { get; set; } + public string MemberSince { get; set; } + public double SteamRating { get; set; } + public double HoursPlayedLastTwoWeeks { get; set; } + public string Headline { get; set; } + public string Location { get; set; } + public string RealName { get; set; } + public string Summary { get; set; } + public IReadOnlyCollection MostPlayedGames { get; set; } + public string InGameServerIP { get; set; } + public InGameInfoModel InGameInfo { get; set; } + } + + public class SteamCommunityProfileMostPlayedGameModel + { + public string Name { get; set; } + public Uri Link { get; set; } + public Uri Icon { get; set; } + public Uri Logo { get; set; } + public Uri LogoSmall { get; set; } + public double HoursPlayed { get; set; } + public double HoursOnRecord { get; set; } + public string StatsName { get; set; } + } + + public class InGameInfoModel + { + public string GameName { get; set; } + public string GameLink { get; set; } + public string GameIcon { get; set; } + public string GameLogo { get; set; } + public string GameLogoSmall { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamCommunity/UserStatus.cs b/src/Steam.Models/SteamCommunity/UserStatus.cs new file mode 100644 index 0000000..d3a50cc --- /dev/null +++ b/src/Steam.Models/SteamCommunity/UserStatus.cs @@ -0,0 +1,16 @@ +namespace Steam.Models.SteamCommunity +{ + /// + /// Indicates the current status of the user on the Steam network + /// + public enum UserStatus + { + Offline = 0, + Online = 1, + Busy = 2, + Away = 3, + Snooze = 4, + Unknown = 5, + InGame = 6 + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamEconomy/AssetClassActionModel.cs b/src/Steam.Models/SteamEconomy/AssetClassActionModel.cs new file mode 100644 index 0000000..279951b --- /dev/null +++ b/src/Steam.Models/SteamEconomy/AssetClassActionModel.cs @@ -0,0 +1,9 @@ +namespace Steam.Models.SteamEconomy +{ + public class AssetClassActionModel + { + public string Name { get; set; } + + public string Link { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamEconomy/AssetClassAppDataFilterModel.cs b/src/Steam.Models/SteamEconomy/AssetClassAppDataFilterModel.cs new file mode 100644 index 0000000..6de7088 --- /dev/null +++ b/src/Steam.Models/SteamEconomy/AssetClassAppDataFilterModel.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; + +namespace Steam.Models.SteamEconomy +{ + public class AssetClassAppDataFilterModel + { + public IReadOnlyCollection ElementIds { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamEconomy/AssetClassAppDataModel.cs b/src/Steam.Models/SteamEconomy/AssetClassAppDataModel.cs new file mode 100644 index 0000000..b3e8c67 --- /dev/null +++ b/src/Steam.Models/SteamEconomy/AssetClassAppDataModel.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; + +namespace Steam.Models.SteamEconomy +{ + public class AssetClassAppDataModel + { + public uint DefIndex { get; set; } + + public uint Quality { get; set; } + + public uint Slot { get; set; } + + public IReadOnlyCollection FilterData { get; set; } + + public IReadOnlyCollection PlayerClassIds { get; set; } + + public string HighlightColor { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamEconomy/AssetClassDescriptionModel.cs b/src/Steam.Models/SteamEconomy/AssetClassDescriptionModel.cs new file mode 100644 index 0000000..635e7f4 --- /dev/null +++ b/src/Steam.Models/SteamEconomy/AssetClassDescriptionModel.cs @@ -0,0 +1,13 @@ +namespace Steam.Models.SteamEconomy +{ + public class AssetClassDescriptionModel + { + public string Type { get; set; } + + public string Value { get; set; } + + public string Color { get; set; } + + public string AppData { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamEconomy/AssetClassInfoModel.cs b/src/Steam.Models/SteamEconomy/AssetClassInfoModel.cs new file mode 100644 index 0000000..e23ec46 --- /dev/null +++ b/src/Steam.Models/SteamEconomy/AssetClassInfoModel.cs @@ -0,0 +1,49 @@ +using System.Collections.Generic; + +namespace Steam.Models.SteamEconomy +{ + public class AssetClassInfoModel + { + public string IconUrl { get; set; } + + public string IconUrlLarge { get; set; } + + public string IconDragUrl { get; set; } + + public string Name { get; set; } + + public string MarketHashName { get; set; } + + public string MarketName { get; set; } + + public string NameColor { get; set; } + + public string BackgroundColor { get; set; } + + public string Type { get; set; } + + public string Tradable { get; set; } + + public string Marketable { get; set; } + + public string Commodity { get; set; } + + public string MarketTradableRestriction { get; set; } + + public string MarketMarketableRestriction { get; set; } + + public string FraudWarnings { get; set; } + + public IReadOnlyCollection Descriptions { get; set; } + + public IReadOnlyCollection Actions { get; set; } + + public IReadOnlyCollection MarketActions { get; set; } + + public IReadOnlyCollection Tags { get; set; } + + public AssetClassAppDataModel AppData { get; set; } + + public ulong ClassId { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamEconomy/AssetClassInfoResultModel.cs b/src/Steam.Models/SteamEconomy/AssetClassInfoResultModel.cs new file mode 100644 index 0000000..18979fd --- /dev/null +++ b/src/Steam.Models/SteamEconomy/AssetClassInfoResultModel.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; + +namespace Steam.Models.SteamEconomy +{ + public class AssetClassInfoResultModel + { + public IReadOnlyCollection AssetClasses { get; set; } + + public bool Success { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamEconomy/AssetClassMarketActionModel.cs b/src/Steam.Models/SteamEconomy/AssetClassMarketActionModel.cs new file mode 100644 index 0000000..a6cc129 --- /dev/null +++ b/src/Steam.Models/SteamEconomy/AssetClassMarketActionModel.cs @@ -0,0 +1,9 @@ +namespace Steam.Models.SteamEconomy +{ + public class AssetClassMarketActionModel + { + public string Name { get; set; } + + public string Link { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamEconomy/AssetClassModel.cs b/src/Steam.Models/SteamEconomy/AssetClassModel.cs new file mode 100644 index 0000000..e527bef --- /dev/null +++ b/src/Steam.Models/SteamEconomy/AssetClassModel.cs @@ -0,0 +1,9 @@ +namespace Steam.Models.SteamEconomy +{ + public class AssetClassModel + { + public string Name { get; set; } + + public string Value { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamEconomy/AssetClassTagModel.cs b/src/Steam.Models/SteamEconomy/AssetClassTagModel.cs new file mode 100644 index 0000000..0b2721c --- /dev/null +++ b/src/Steam.Models/SteamEconomy/AssetClassTagModel.cs @@ -0,0 +1,15 @@ +namespace Steam.Models.SteamEconomy +{ + public class AssetClassTagModel + { + public string InternalName { get; set; } + + public string Name { get; set; } + + public string Category { get; set; } + + public string Color { get; set; } + + public string CategoryName { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamEconomy/AssetModel.cs b/src/Steam.Models/SteamEconomy/AssetModel.cs new file mode 100644 index 0000000..60cad8a --- /dev/null +++ b/src/Steam.Models/SteamEconomy/AssetModel.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; + +namespace Steam.Models.SteamEconomy +{ + public class AssetModel + { + public AssetPricesModel Prices { get; set; } + + public string Name { get; set; } + + public string Date { get; set; } + + public IReadOnlyCollection Class { get; set; } + + public ulong ClassId { get; set; } + + public IReadOnlyCollection Tags { get; set; } + + public IReadOnlyCollection TagIds { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamEconomy/AssetPriceResultModel.cs b/src/Steam.Models/SteamEconomy/AssetPriceResultModel.cs new file mode 100644 index 0000000..323cbfa --- /dev/null +++ b/src/Steam.Models/SteamEconomy/AssetPriceResultModel.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; + +namespace Steam.Models.SteamEconomy +{ + public class AssetPriceResultModel + { + public bool Success { get; set; } + + public IReadOnlyCollection Assets { get; set; } + + public AssetTagsModel Tags { get; set; } + + public AssetTagIdsModel TagIds { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamEconomy/AssetPricesModel.cs b/src/Steam.Models/SteamEconomy/AssetPricesModel.cs new file mode 100644 index 0000000..564adf4 --- /dev/null +++ b/src/Steam.Models/SteamEconomy/AssetPricesModel.cs @@ -0,0 +1,59 @@ +namespace Steam.Models.SteamEconomy +{ + public class AssetPricesModel + { + public uint USD { get; set; } + + public uint GBP { get; set; } + + public uint EUR { get; set; } + + public uint RUB { get; set; } + + public uint BRL { get; set; } + + public uint JPY { get; set; } + + public uint NOK { get; set; } + + public uint IDR { get; set; } + + public uint MYR { get; set; } + + public uint PHP { get; set; } + + public uint SGD { get; set; } + + public uint THB { get; set; } + + public uint VND { get; set; } + + public uint KRW { get; set; } + + public uint TRY { get; set; } + + public uint UAH { get; set; } + + public uint MXN { get; set; } + + public uint CAD { get; set; } + + public uint AUD { get; set; } + + public uint NZD { get; set; } + + public uint CNY { get; set; } + + public uint TWD { get; set; } + + public uint HKD { get; set; } + + public uint INR { get; set; } + + public uint AED { get; set; } + + public uint SAR { get; set; } + + public uint ZAR { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamEconomy/AssetTagIdsModel.cs b/src/Steam.Models/SteamEconomy/AssetTagIdsModel.cs new file mode 100644 index 0000000..64719ae --- /dev/null +++ b/src/Steam.Models/SteamEconomy/AssetTagIdsModel.cs @@ -0,0 +1,23 @@ +namespace Steam.Models.SteamEconomy +{ + public class AssetTagIdsModel + { + public ulong Tag0 { get; set; } + + public ulong Tag1 { get; set; } + + public ulong Tag2 { get; set; } + + public ulong Tag3 { get; set; } + + public ulong Tag4 { get; set; } + + public ulong Tag5 { get; set; } + + public ulong Tag6 { get; set; } + + public ulong Tag7 { get; set; } + + public ulong Tag8 { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamEconomy/AssetTagsModel.cs b/src/Steam.Models/SteamEconomy/AssetTagsModel.cs new file mode 100644 index 0000000..a18e1c2 --- /dev/null +++ b/src/Steam.Models/SteamEconomy/AssetTagsModel.cs @@ -0,0 +1,23 @@ +namespace Steam.Models.SteamEconomy +{ + public class AssetTagsModel + { + public string Cosmetics { get; set; } + + public string Tools { get; set; } + + public string Weapons { get; set; } + + public string Taunts { get; set; } + + public string Bundles { get; set; } + + public string Limited { get; set; } + + public string New { get; set; } + + public string Maps { get; set; } + + public string Halloween { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamEconomy/TradeAssetModel.cs b/src/Steam.Models/SteamEconomy/TradeAssetModel.cs new file mode 100644 index 0000000..6c5ad9e --- /dev/null +++ b/src/Steam.Models/SteamEconomy/TradeAssetModel.cs @@ -0,0 +1,39 @@ +namespace Steam.Models.SteamEconomy +{ + public class TradeAssetModel + { + public uint AppId { get; set; } + + public uint ContextId { get; set; } + + /// + /// Either assetid or currencyid will be set + /// + public ulong AssetId { get; set; } + + /// + /// Either assetid or currencyid will be set + /// + public ulong CurrencyId { get; set; } + + /// + /// Together with instanceid, uniquely identifies the display of the item + /// + public uint ClassId { get; set; } + + /// + /// Together with classid, uniquely identifies the display of the item + /// + public uint InstanceId { get; set; } + + /// + /// The amount offered in the trade, for stackable items and currency + /// + public uint AmountOffered { get; set; } + + /// + /// A boolean that indicates the item is no longer present in the user's inventory + /// + public bool IsMissing { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamEconomy/TradeHistoryModel.cs b/src/Steam.Models/SteamEconomy/TradeHistoryModel.cs new file mode 100644 index 0000000..d59fd8f --- /dev/null +++ b/src/Steam.Models/SteamEconomy/TradeHistoryModel.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; + +namespace Steam.Models.SteamEconomy +{ + public class TradeHistoryModel + { + /// + /// Total number of trades performed by the account + /// + public uint TotalTradeCount { get; set; } + + /// + /// Whether or not more are available + /// + public bool AreMoreAvailable { get; set; } + + /// + /// Array of CEcon_GetTradeHistory_Response_Trade + /// + public IList Trades { get; set; } + + /// + /// If get_descriptions was set, this will be a list of item display information. This is associated with the data in the assets/currency_received and assets/currency_given lists via the classid / instanceid identifier pair. + /// + public IList Descriptions { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamEconomy/TradeModel.cs b/src/Steam.Models/SteamEconomy/TradeModel.cs new file mode 100644 index 0000000..a0d419c --- /dev/null +++ b/src/Steam.Models/SteamEconomy/TradeModel.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; + +namespace Steam.Models.SteamEconomy +{ + public class TradeModel + { + /// + /// A unique identifier for the trade + /// + public ulong TradeId { get; set; } + + /// + /// The SteamID of your trade partner + /// + public ulong TradeParterSteamId { get; set; } + + /// + /// Unix timestamp of the time the trade started to commit + /// + public DateTime TimeTradeStarted { get; set; } + + /// + /// Unix timestamp of the time the trade will leave escrow + /// + public DateTime TimeEscrowEnds { get; set; } + + /// + /// Status of the Trade + /// + public TradeStatus TradeStatus { get; set; } + + /// + /// Array of CEcon_GetTradeHistory_Response_Trade_TradedAsset showing the items received in the trade + /// + public IList AssetsReceived { get; set; } + + /// + /// Array of CEcon_GetTradeHistory_Response_Trade_TradedAsset showing the items given to the other party in the trade + /// + public IList AssetsGiven { get; set; } + + /// + /// Array of CEcon_GetTradeHistory_Response_Trade_TradedCurrency showing the items received in the trade + /// + public IList CurrencyReceived { get; set; } + + /// + /// array of CEcon_GetTradeHistory_Response_Trade_TradedCurrency showing the items given to the other party in the trade + /// + public IList CurrencyGiven { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamEconomy/TradeOfferConfirmationMethod.cs b/src/Steam.Models/SteamEconomy/TradeOfferConfirmationMethod.cs new file mode 100644 index 0000000..72cb48c --- /dev/null +++ b/src/Steam.Models/SteamEconomy/TradeOfferConfirmationMethod.cs @@ -0,0 +1,12 @@ +namespace Steam.Models.SteamEconomy +{ + /// + /// These are the different methods in which a trade offer can be confirmed. + /// + public enum TradeOfferConfirmationMethod + { + Invalid = 0, + Email = 1, + MobileApp = 2 + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamEconomy/TradeOfferModel.cs b/src/Steam.Models/SteamEconomy/TradeOfferModel.cs new file mode 100644 index 0000000..069dba4 --- /dev/null +++ b/src/Steam.Models/SteamEconomy/TradeOfferModel.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; + +namespace Steam.Models.SteamEconomy +{ + public class TradeOfferModel + { + /// + /// A unique identifier for the trade offer + /// + public uint TradeOfferId { get; set; } + + /// + /// Your partner in the trade offer + /// + public ulong TradePartnerSteamId { get; set; } + + /// + /// A message included by the creator of the trade offer + /// + public string Message { get; set; } + + /// + /// Unix time when the offer will expire (or expired, if it is in the past) + /// + public DateTime TimeExpiration { get; set; } + + /// + /// State of the Trade Offer + /// + public TradeOfferState TradeOfferState { get; set; } + + /// + /// Array of CEcon_Asset, items you will give up in the trade (regardless of who created the offer) + /// + public IList ItemsYouWillGive { get; set; } + + /// + /// Array of CEcon_Asset, items you will receive in the trade (regardless of who created the offer) + /// + public IList ItemsYouWillReceive { get; set; } + + /// + /// Boolean to indicate this is an offer you created. + /// + public bool IsOfferYouCreated { get; set; } + + /// + /// Unix timestamp of the time the offer was sent + /// + public DateTime TimeCreated { get; set; } + + /// + /// Unix timestamp of the time the trade_offer_state last changed. + /// + public DateTime TimeUpdated { get; set; } + + /// + /// Boolean to indicate this is an offer automatically created from a real-time trade. + /// + public bool WasCreatedFromRealTimeTrade { get; set; } + + /// + /// Unix timestamp of when the trade hold period is supposed to be over for this trade offer + /// + public DateTime TimeEscrowEnds { get; set; } + + /// + /// The confirmation method that applies to the user asking about the offer. + /// + public TradeOfferConfirmationMethod ConfirmationMethod { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamEconomy/TradeOfferResultModel.cs b/src/Steam.Models/SteamEconomy/TradeOfferResultModel.cs new file mode 100644 index 0000000..29a04ec --- /dev/null +++ b/src/Steam.Models/SteamEconomy/TradeOfferResultModel.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +namespace Steam.Models.SteamEconomy +{ + public class TradeOfferResultModel + { + /// + /// A CEcon_TradeOffer representing the offer + /// + public TradeOfferModel TradeOffer { get; set; } + + /// + /// If language was set, this will be a list of item display information. This is associated with the data in the items_to_receive and items_to_give lists via the classid / instanceid identifier pair. + /// + public IList Descriptions { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamEconomy/TradeOfferState.cs b/src/Steam.Models/SteamEconomy/TradeOfferState.cs new file mode 100644 index 0000000..b5e77bb --- /dev/null +++ b/src/Steam.Models/SteamEconomy/TradeOfferState.cs @@ -0,0 +1,20 @@ +namespace Steam.Models.SteamEconomy +{ + /// + /// These are the different states for a trade offer. + /// + public enum TradeOfferState + { + Invalid = 1, + Active = 2, + Accepted = 3, + Countered = 4, + Expired = 5, + Canceled = 6, + Declined = 7, + InvalidItems = 8, + CreateNeedsConfirmation = 9, + CanceledBySecondFactor = 10, + InEscrow = 11 + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamEconomy/TradeOffersResultModel.cs b/src/Steam.Models/SteamEconomy/TradeOffersResultModel.cs new file mode 100644 index 0000000..0a25efb --- /dev/null +++ b/src/Steam.Models/SteamEconomy/TradeOffersResultModel.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; + +namespace Steam.Models.SteamEconomy +{ + public class TradeOffersResultModel + { + /// + /// If get_sent_offers was set, this will be an array of CEcon_TradeOffer values that you have sent. + /// + public IList TradeOffersSent { get; set; } + + /// + /// If get_received_offers was set, this will be an array of CEcon_TradeOffer values that have been sent to you. + /// + public IList TradeOffersReceived { get; set; } + + /// + /// If get_descriptions was set, this will be a list of item display information. This is associated with the data in the items_to_receive and items_to_give lists via the classid / instanceid identifier pair. + /// + public IList Descriptions { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamEconomy/TradeStatus.cs b/src/Steam.Models/SteamEconomy/TradeStatus.cs new file mode 100644 index 0000000..d0d62ad --- /dev/null +++ b/src/Steam.Models/SteamEconomy/TradeStatus.cs @@ -0,0 +1,21 @@ +namespace Steam.Models.SteamEconomy +{ + /// + /// Tracks the status of a trade after a trade offer has been accepted. + /// + public enum TradeStatus + { + Init = 0, + PreCommitted = 1, + Committed = 2, + Complete = 3, + Failed = 4, + PartialSupportRollback = 5, + FullSupportRollback = 6, + SupportRollbackSelective = 7, + RollbackFailed = 8, + RollbackAbandoned = 9, + InEscrow = 10, + EscrowRollback = 11 + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamEconomy/TradedAssetModel.cs b/src/Steam.Models/SteamEconomy/TradedAssetModel.cs new file mode 100644 index 0000000..5bb397d --- /dev/null +++ b/src/Steam.Models/SteamEconomy/TradedAssetModel.cs @@ -0,0 +1,43 @@ +namespace Steam.Models.SteamEconomy +{ + public class TradedAssetModel + { + public uint AppId { get; set; } + + public uint ContextId { get; set; } + + public ulong AssetId { get; set; } + + public uint AmountTraded { get; set; } + + /// + /// Together with instanceid, uniquely identifies the display of the item + /// + public uint ClassId { get; set; } + + /// + /// Together with classid, uniquely identifies the display of the item + /// + public uint InstanceId { get; set; } + + /// + /// The asset ID given to the item after the trade completed + /// + public ulong AssetIdAfterTrade { get; set; } + + /// + /// The context ID the item was placed in + /// + public ulong ContextIdAfterTrade { get; set; } + + /// + /// If the trade has been rolled back, the new asset ID given in the rollback + /// + public ulong AssetIdAfterRollback { get; set; } + + /// + /// If the trade has been rolled back, the context ID the new asset was placed in + /// + public ulong ContextIdAfterRollback { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamEconomy/TradedCurrencyModel.cs b/src/Steam.Models/SteamEconomy/TradedCurrencyModel.cs new file mode 100644 index 0000000..c3377fe --- /dev/null +++ b/src/Steam.Models/SteamEconomy/TradedCurrencyModel.cs @@ -0,0 +1,35 @@ +namespace Steam.Models.SteamEconomy +{ + public class TradedCurrencyModel + { + public uint AppId { get; set; } + + public uint ContextId { get; set; } + + public uint CurrencyId { get; set; } + + public uint AmountTraded { get; set; } + + public uint ClassId { get; set; } + + /// + /// The currency ID given after the trade completed + /// + public ulong CurrencyIdAfterTrade { get; set; } + + /// + /// The context ID the currency was placed in + /// + public uint ContextIdAfterTrade { get; set; } + + /// + /// If the trade has been rolled back, the new currency ID given in the rollback + /// + public ulong CurrencyIdAfterRollback { get; set; } + + /// + /// If the trade has been rolled back, the context ID the new asset was placed in + /// + public uint ContextIdAfterRollback { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamInterfaceModel.cs b/src/Steam.Models/SteamInterfaceModel.cs new file mode 100644 index 0000000..7182481 --- /dev/null +++ b/src/Steam.Models/SteamInterfaceModel.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; + +namespace Steam.Models +{ + public class SteamInterfaceModel + { + public string Name { get; set; } + public IReadOnlyCollection Methods { get; private set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamMethodModel.cs b/src/Steam.Models/SteamMethodModel.cs new file mode 100644 index 0000000..30b0876 --- /dev/null +++ b/src/Steam.Models/SteamMethodModel.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; + +namespace Steam.Models +{ + public class SteamMethodModel + { + public string Name { get; set; } + public uint Version { get; set; } + public string HttpMethod { get; set; } + public string Description { get; set; } + public IReadOnlyCollection Parameters { get; private set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamNewsResultModel.cs b/src/Steam.Models/SteamNewsResultModel.cs new file mode 100644 index 0000000..a0c414f --- /dev/null +++ b/src/Steam.Models/SteamNewsResultModel.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; + +namespace Steam.Models +{ + public class SteamNewsResultModel + { + public uint AppId { get; set; } + + public IReadOnlyCollection NewsItems { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamParameterModel.cs b/src/Steam.Models/SteamParameterModel.cs new file mode 100644 index 0000000..5e0d26d --- /dev/null +++ b/src/Steam.Models/SteamParameterModel.cs @@ -0,0 +1,12 @@ +namespace Steam.Models +{ + public class SteamParameterModel + { + public string Name { get; set; } + public string Type { get; set; } + + public bool IsOptional { get; set; } + + public string Description { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamPlayer/PlayerAchievementModel.cs b/src/Steam.Models/SteamPlayer/PlayerAchievementModel.cs new file mode 100644 index 0000000..07d5cb3 --- /dev/null +++ b/src/Steam.Models/SteamPlayer/PlayerAchievementModel.cs @@ -0,0 +1,13 @@ +namespace Steam.Models.SteamPlayer +{ + public class PlayerAchievementModel + { + public string APIName { get; set; } + + public uint Achieved { get; set; } + + public string Name { get; set; } + + public string Description { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamPlayer/PlayerAchievementResultModel.cs b/src/Steam.Models/SteamPlayer/PlayerAchievementResultModel.cs new file mode 100644 index 0000000..637c194 --- /dev/null +++ b/src/Steam.Models/SteamPlayer/PlayerAchievementResultModel.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; + +namespace Steam.Models.SteamPlayer +{ + public class PlayerAchievementResultModel + { + public ulong SteamId { get; set; } + + public string GameName { get; set; } + + public IReadOnlyCollection Achievements { get; set; } + + public bool Success { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamPlayer/UserStatAchievementModel.cs b/src/Steam.Models/SteamPlayer/UserStatAchievementModel.cs new file mode 100644 index 0000000..be07bbf --- /dev/null +++ b/src/Steam.Models/SteamPlayer/UserStatAchievementModel.cs @@ -0,0 +1,9 @@ +namespace Steam.Models.SteamPlayer +{ + public class UserStatAchievementModel + { + public string Name { get; set; } + + public uint Achieved { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamPlayer/UserStatModel.cs b/src/Steam.Models/SteamPlayer/UserStatModel.cs new file mode 100644 index 0000000..82ce789 --- /dev/null +++ b/src/Steam.Models/SteamPlayer/UserStatModel.cs @@ -0,0 +1,9 @@ +namespace Steam.Models.SteamPlayer +{ + public class UserStatModel + { + public string Name { get; set; } + + public double Value { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamPlayer/UserStatsForGameResultModel.cs b/src/Steam.Models/SteamPlayer/UserStatsForGameResultModel.cs new file mode 100644 index 0000000..75e7dce --- /dev/null +++ b/src/Steam.Models/SteamPlayer/UserStatsForGameResultModel.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; + +namespace Steam.Models.SteamPlayer +{ + public class UserStatsForGameResultModel + { + public ulong SteamId { get; set; } + + public string GameName { get; set; } + + public IReadOnlyCollection Stats { get; set; } + + public IReadOnlyCollection Achievements { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamServerInfo.cs b/src/Steam.Models/SteamServerInfo.cs new file mode 100644 index 0000000..54abc56 --- /dev/null +++ b/src/Steam.Models/SteamServerInfo.cs @@ -0,0 +1,12 @@ +using Steam.Models.Utilities; +using System; + +namespace Steam.Models +{ + public class SteamServerInfo + { + public ulong ServerTime { get; set; } + public string ServerTimeString { get; set; } + public DateTime ServerTimeDateTime { get { return ServerTime.ToDateTime(); } } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamServerInfoModel.cs b/src/Steam.Models/SteamServerInfoModel.cs new file mode 100644 index 0000000..46fec9a --- /dev/null +++ b/src/Steam.Models/SteamServerInfoModel.cs @@ -0,0 +1,12 @@ +using Steam.Models.Utilities; +using System; + +namespace Steam.Models +{ + public class SteamServerInfoModel + { + public ulong ServerTime { get; set; } + public string ServerTimeString { get; set; } + public DateTime ServerTimeDateTime { get { return ServerTime.ToDateTime(); } } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamStore/StoreAppDetailsDataModel.cs b/src/Steam.Models/SteamStore/StoreAppDetailsDataModel.cs new file mode 100644 index 0000000..5eb8272 --- /dev/null +++ b/src/Steam.Models/SteamStore/StoreAppDetailsDataModel.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.SteamStore +{ + public class StoreAppDetailsDataModel + { + public string Type { get; set; } + + public string Name { get; set; } + + public uint SteamAppId { get; set; } + + public uint RequiredAge { get; set; } + + public bool IsFree { get; set; } + + public uint[] Dlc { get; set; } + + public string DetailedDescription { get; set; } + + public string AboutTheGame { get; set; } + + public string ShortDescription { get; set; } + + public string SupportedLanguages { get; set; } + + public string HeaderImage { get; set; } + + public string Website { get; set; } + + public dynamic PcRequirements { get; set; } + + public dynamic MacRequirements { get; set; } + + public dynamic LinuxRequirements { get; set; } + + public string[] Developers { get; set; } + + public string[] Publishers { get; set; } + + public StorePriceOverview PriceOverview { get; set; } + + public string[] Packages { get; set; } + + public StorePackageGroupModel[] PackageGroups { get; set; } + + public StorePlatformsModel Platforms { get; set; } + + public StoreMetacriticModel Metacritic { get; set; } + + public StoreCategoryModel[] Categories { get; set; } + + public StoreGenreModel[] Genres { get; set; } + + public StoreScreenshotModel[] Screenshots { get; set; } + + public StoreMovieModel[] Movies { get; set; } + + public StoreRecommendationsModel Recommendations { get; set; } + + public StoreReleaseDateModel ReleaseDate { get; set; } + + public StoreSupportInfoModel SupportInfo { get; set; } + + public string Background { get; set; } + } +} diff --git a/src/Steam.Models/SteamStore/StoreCategoryModel.cs b/src/Steam.Models/SteamStore/StoreCategoryModel.cs new file mode 100644 index 0000000..788c128 --- /dev/null +++ b/src/Steam.Models/SteamStore/StoreCategoryModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.SteamStore +{ + public class StoreCategoryModel + { + public uint Id { get; set; } + + public string Description { get; set; } + } +} diff --git a/src/Steam.Models/SteamStore/StoreComingSoonModel.cs b/src/Steam.Models/SteamStore/StoreComingSoonModel.cs new file mode 100644 index 0000000..eccaf74 --- /dev/null +++ b/src/Steam.Models/SteamStore/StoreComingSoonModel.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.SteamStore +{ + public class StoreComingSoonModel + { + public uint Id { get; set; } + + public string Name { get; set; } + + public StoreItemModel[] Items { get; set; } + } +} diff --git a/src/Steam.Models/SteamStore/StoreFeaturedCategoriesModel.cs b/src/Steam.Models/SteamStore/StoreFeaturedCategoriesModel.cs new file mode 100644 index 0000000..1866c0c --- /dev/null +++ b/src/Steam.Models/SteamStore/StoreFeaturedCategoriesModel.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.SteamStore +{ + public class StoreFeaturedCategoriesModel + { + public StoreSpecialsModel Specials { get; set; } + + public StoreComingSoonModel ComingSoon { get; set; } + + public StoreTopSellersModel TopSellers { get; set; } + + public StoreNewReleasesModel NewReleases { get; set; } + + public StoreFeaturedCategoryGenreModel Genres { get; set; } + + public StoreTrailerSlideshowModel Trailerslideshow { get; set; } + + public uint Status { get; set; } + } +} diff --git a/src/Steam.Models/SteamStore/StoreFeaturedCategoryGenreModel.cs b/src/Steam.Models/SteamStore/StoreFeaturedCategoryGenreModel.cs new file mode 100644 index 0000000..f38fe09 --- /dev/null +++ b/src/Steam.Models/SteamStore/StoreFeaturedCategoryGenreModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.SteamStore +{ + public class StoreFeaturedCategoryGenreModel + { + public uint Id { get; set; } + + public string Name { get; set; } + } +} diff --git a/src/Steam.Models/SteamStore/StoreFeaturedLinuxModel.cs b/src/Steam.Models/SteamStore/StoreFeaturedLinuxModel.cs new file mode 100644 index 0000000..4b6c78a --- /dev/null +++ b/src/Steam.Models/SteamStore/StoreFeaturedLinuxModel.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.SteamStore +{ + public class StoreFeaturedLinuxModel + { + public uint Id { get; set; } + + public uint Type { get; set; } + + public string Name { get; set; } + + public bool Discounted { get; set; } + + public uint DiscountPercent { get; set; } + + public uint? OriginalPrice { get; set; } + + public uint FinalPrice { get; set; } + + public string Currency { get; set; } + + public string LargeCapsuleImage { get; set; } + + public string SmallCapsuleImage { get; set; } + + public bool WindowsAvailable { get; set; } + + public bool MacAvailable { get; set; } + + public bool LinuxAvailable { get; set; } + + public bool StreamingvideoAvailable { get; set; } + + public string HeaderImage { get; set; } + + public string ControllerSupport { get; set; } + } +} diff --git a/src/Steam.Models/SteamStore/StoreFeaturedMacModel.cs b/src/Steam.Models/SteamStore/StoreFeaturedMacModel.cs new file mode 100644 index 0000000..aa3133c --- /dev/null +++ b/src/Steam.Models/SteamStore/StoreFeaturedMacModel.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.SteamStore +{ + public class StoreFeaturedMacModel + { + public uint Id { get; set; } + + public uint Type { get; set; } + + public string Name { get; set; } + + public bool Discounted { get; set; } + + public uint DiscountPercent { get; set; } + + public uint? OriginalPrice { get; set; } + + public uint FinalPrice { get; set; } + + public string Currency { get; set; } + + public string LargeCapsuleImage { get; set; } + + public string SmallCapsuleImage { get; set; } + + public bool WindowsAvailable { get; set; } + + public bool MacAvailable { get; set; } + + public bool LinuxAvailable { get; set; } + + public bool StreamingvideoAvailable { get; set; } + + public string HeaderImage { get; set; } + + public string ControllerSupport { get; set; } + } +} diff --git a/src/Steam.Models/SteamStore/StoreFeaturedProductsModel.cs b/src/Steam.Models/SteamStore/StoreFeaturedProductsModel.cs new file mode 100644 index 0000000..0aad776 --- /dev/null +++ b/src/Steam.Models/SteamStore/StoreFeaturedProductsModel.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.SteamStore +{ + public class StoreFeaturedProductsModel + { + public StoreLargeCapsuleModel[] LargeCapsules { get; set; } + + public StoreFeaturedWinModel[] FeaturedWin { get; set; } + + public StoreFeaturedMacModel[] FeaturedMac { get; set; } + + public StoreFeaturedLinuxModel[] FeaturedLinux { get; set; } + + public string Layout { get; set; } + + public uint Status { get; set; } + } +} diff --git a/src/Steam.Models/SteamStore/StoreFeaturedWinModel.cs b/src/Steam.Models/SteamStore/StoreFeaturedWinModel.cs new file mode 100644 index 0000000..1a385c4 --- /dev/null +++ b/src/Steam.Models/SteamStore/StoreFeaturedWinModel.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.SteamStore +{ + public class StoreFeaturedWinModel + { + public uint Id { get; set; } + + public uint Type { get; set; } + + public string Name { get; set; } + + public bool Discounted { get; set; } + + public uint DiscountPercent { get; set; } + + public uint? OriginalPrice { get; set; } + + public uint FinalPrice { get; set; } + + public string Currency { get; set; } + + public string LargeCapsuleImage { get; set; } + + public string SmallCapsuleImage { get; set; } + + public bool WindowsAvailable { get; set; } + + public bool MacAvailable { get; set; } + + public bool LinuxAvailable { get; set; } + + public bool StreamingvideoAvailable { get; set; } + + public string HeaderImage { get; set; } + + public string ControllerSupport { get; set; } + + public uint? DiscountExpiration { get; set; } + } +} diff --git a/src/Steam.Models/SteamStore/StoreGenreModel.cs b/src/Steam.Models/SteamStore/StoreGenreModel.cs new file mode 100644 index 0000000..22b7998 --- /dev/null +++ b/src/Steam.Models/SteamStore/StoreGenreModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.SteamStore +{ + public class StoreGenreModel + { + public uint Id { get; set; } + + public string Description { get; set; } + } +} diff --git a/src/Steam.Models/SteamStore/StoreItemModel.cs b/src/Steam.Models/SteamStore/StoreItemModel.cs new file mode 100644 index 0000000..82e12c2 --- /dev/null +++ b/src/Steam.Models/SteamStore/StoreItemModel.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.SteamStore +{ + public class StoreItemModel + { + public uint Id { get; set; } + + public uint Type { get; set; } + + public string Name { get; set; } + + public bool Discounted { get; set; } + + public uint DiscountPercent { get; set; } + + public uint? OriginalPrice { get; set; } + + public uint FinalPrice { get; set; } + + public string Currency { get; set; } + + public string LargeCapsuleImage { get; set; } + + public string SmallCapsuleImage { get; set; } + + public bool WindowsAvailable { get; set; } + + public bool MacAvailable { get; set; } + + public bool LinuxAvailable { get; set; } + + public bool StreamingvideoAvailable { get; set; } + + public uint DiscountExpiration { get; set; } + + public string HeaderImage { get; set; } + + public string Body { get; set; } + + public string Url { get; set; } + } +} diff --git a/src/Steam.Models/SteamStore/StoreLargeCapsuleModel.cs b/src/Steam.Models/SteamStore/StoreLargeCapsuleModel.cs new file mode 100644 index 0000000..4e1658d --- /dev/null +++ b/src/Steam.Models/SteamStore/StoreLargeCapsuleModel.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.SteamStore +{ + public class StoreLargeCapsuleModel + { + public uint Id { get; set; } + + public uint Type { get; set; } + + public string Name { get; set; } + + public bool Discounted { get; set; } + + public uint DiscountPercent { get; set; } + + public uint OriginalPrice { get; set; } + + public uint FinalPrice { get; set; } + + public string Currency { get; set; } + + public string LargeCapsuleImage { get; set; } + + public string SmallCapsuleImage { get; set; } + + public bool WindowsAvailable { get; set; } + + public bool MacAvailable { get; set; } + + public bool LinuxAvailable { get; set; } + + public bool StreamingvideoAvailable { get; set; } + + public string HeaderImage { get; set; } + + public string ControllerSupport { get; set; } + + public string Headline { get; set; } + } +} diff --git a/src/Steam.Models/SteamStore/StoreMetacriticModel.cs b/src/Steam.Models/SteamStore/StoreMetacriticModel.cs new file mode 100644 index 0000000..1b1f66a --- /dev/null +++ b/src/Steam.Models/SteamStore/StoreMetacriticModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.SteamStore +{ + public class StoreMetacriticModel + { + public uint Score { get; set; } + + public string Url { get; set; } + } +} diff --git a/src/Steam.Models/SteamStore/StoreMovieModel.cs b/src/Steam.Models/SteamStore/StoreMovieModel.cs new file mode 100644 index 0000000..b8dcbf0 --- /dev/null +++ b/src/Steam.Models/SteamStore/StoreMovieModel.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.SteamStore +{ + public class StoreMovieModel + { + public uint Id { get; set; } + + public string Name { get; set; } + + public string Thumbnail { get; set; } + + public StoreWebmModel Webm { get; set; } + + public bool Highlight { get; set; } + } +} diff --git a/src/Steam.Models/SteamStore/StoreNewReleasesModel.cs b/src/Steam.Models/SteamStore/StoreNewReleasesModel.cs new file mode 100644 index 0000000..d5d5e60 --- /dev/null +++ b/src/Steam.Models/SteamStore/StoreNewReleasesModel.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.SteamStore +{ + public class StoreNewReleasesModel + { + public uint Id { get; set; } + + public string Name { get; set; } + + public StoreItemModel[] Items { get; set; } + } +} diff --git a/src/Steam.Models/SteamStore/StorePackageGroupModel.cs b/src/Steam.Models/SteamStore/StorePackageGroupModel.cs new file mode 100644 index 0000000..2690bb6 --- /dev/null +++ b/src/Steam.Models/SteamStore/StorePackageGroupModel.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.SteamStore +{ + public class StorePackageGroupModel + { + public string Name { get; set; } + + public string Title { get; set; } + + public string Description { get; set; } + + public string SelectionText { get; set; } + + public string SaveText { get; set; } + + public uint DisplayType { get; set; } + + public string IsRecurringSubscription { get; set; } + + public StoreSubModel[] Subs { get; set; } + } +} diff --git a/src/Steam.Models/SteamStore/StorePlatformsModel.cs b/src/Steam.Models/SteamStore/StorePlatformsModel.cs new file mode 100644 index 0000000..74154c1 --- /dev/null +++ b/src/Steam.Models/SteamStore/StorePlatformsModel.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.SteamStore +{ + public class StorePlatformsModel + { + public bool Windows { get; set; } + + public bool Mac { get; set; } + + public bool Linux { get; set; } + } +} diff --git a/src/Steam.Models/SteamStore/StorePriceOverview.cs b/src/Steam.Models/SteamStore/StorePriceOverview.cs new file mode 100644 index 0000000..94b29ff --- /dev/null +++ b/src/Steam.Models/SteamStore/StorePriceOverview.cs @@ -0,0 +1,17 @@ +namespace Steam.Models.SteamStore +{ + public class StorePriceOverview + { + public string Currency { get; set; } + + public uint Initial { get; set; } + + public uint Final { get; set; } + + public uint DiscountPercent { get; set; } + + public string InitialFormatted { get; set; } + + public string FinalFormatted { get; set; } + } +} diff --git a/src/Steam.Models/SteamStore/StoreRecommendationsModel.cs b/src/Steam.Models/SteamStore/StoreRecommendationsModel.cs new file mode 100644 index 0000000..79ed90b --- /dev/null +++ b/src/Steam.Models/SteamStore/StoreRecommendationsModel.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.SteamStore +{ + public class StoreRecommendationsModel + { + public uint Total { get; set; } + } +} diff --git a/src/Steam.Models/SteamStore/StoreReleaseDateModel.cs b/src/Steam.Models/SteamStore/StoreReleaseDateModel.cs new file mode 100644 index 0000000..86bc9d2 --- /dev/null +++ b/src/Steam.Models/SteamStore/StoreReleaseDateModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.SteamStore +{ + public class StoreReleaseDateModel + { + public bool ComingSoon { get; set; } + + public string Date { get; set; } + } +} diff --git a/src/Steam.Models/SteamStore/StoreScreenshotModel.cs b/src/Steam.Models/SteamStore/StoreScreenshotModel.cs new file mode 100644 index 0000000..3e9674e --- /dev/null +++ b/src/Steam.Models/SteamStore/StoreScreenshotModel.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.SteamStore +{ + public class StoreScreenshotModel + { + public uint Id { get; set; } + + public string PathThumbnail { get; set; } + + public string PathFull { get; set; } + } +} diff --git a/src/Steam.Models/SteamStore/StoreSpecialsModel.cs b/src/Steam.Models/SteamStore/StoreSpecialsModel.cs new file mode 100644 index 0000000..07f2925 --- /dev/null +++ b/src/Steam.Models/SteamStore/StoreSpecialsModel.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.SteamStore +{ + public class StoreSpecialsModel + { + public uint Id { get; set; } + + public string Name { get; set; } + + public StoreItemModel[] Items { get; set; } + } +} diff --git a/src/Steam.Models/SteamStore/StoreSubModel.cs b/src/Steam.Models/SteamStore/StoreSubModel.cs new file mode 100644 index 0000000..56e7651 --- /dev/null +++ b/src/Steam.Models/SteamStore/StoreSubModel.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.SteamStore +{ + public class StoreSubModel + { + public uint PackageId { get; set; } + + public string PercentSavingsText { get; set; } + + public uint PercentSavings { get; set; } + + public string OptionText { get; set; } + + public string OptionDescription { get; set; } + + public string CanGetFreeLicense { get; set; } + + public bool IsFreeLicense { get; set; } + + public uint PriceInCentsWithDiscount { get; set; } + } +} diff --git a/src/Steam.Models/SteamStore/StoreSupportInfoModel.cs b/src/Steam.Models/SteamStore/StoreSupportInfoModel.cs new file mode 100644 index 0000000..d87532b --- /dev/null +++ b/src/Steam.Models/SteamStore/StoreSupportInfoModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.SteamStore +{ + public class StoreSupportInfoModel + { + public string Url { get; set; } + + public string Email { get; set; } + } +} diff --git a/src/Steam.Models/SteamStore/StoreTopSellersModel.cs b/src/Steam.Models/SteamStore/StoreTopSellersModel.cs new file mode 100644 index 0000000..6d030d0 --- /dev/null +++ b/src/Steam.Models/SteamStore/StoreTopSellersModel.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.SteamStore +{ + public class StoreTopSellersModel + { + public uint Id { get; set; } + + public string Name { get; set; } + + public StoreItemModel[] Items { get; set; } + } +} diff --git a/src/Steam.Models/SteamStore/StoreTrailerSlideshowModel.cs b/src/Steam.Models/SteamStore/StoreTrailerSlideshowModel.cs new file mode 100644 index 0000000..6998364 --- /dev/null +++ b/src/Steam.Models/SteamStore/StoreTrailerSlideshowModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.SteamStore +{ + public class StoreTrailerSlideshowModel + { + public uint Id { get; set; } + + public string Name { get; set; } + } +} diff --git a/src/Steam.Models/SteamStore/StoreWebmModel.cs b/src/Steam.Models/SteamStore/StoreWebmModel.cs new file mode 100644 index 0000000..efe4f0a --- /dev/null +++ b/src/Steam.Models/SteamStore/StoreWebmModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.SteamStore +{ + public class StoreWebmModel + { + public string Resolution480 { get; set; } + + public string Max { get; set; } + } +} diff --git a/src/Steam.Models/TF2/GoldenWrenchModel.cs b/src/Steam.Models/TF2/GoldenWrenchModel.cs new file mode 100644 index 0000000..94cf167 --- /dev/null +++ b/src/Steam.Models/TF2/GoldenWrenchModel.cs @@ -0,0 +1,15 @@ +using System; + +namespace Steam.Models.TF2 +{ + public class GoldenWrenchModel + { + public ulong SteamId { get; set; } + + public DateTime Timestamp { get; set; } + + public uint ItemId { get; set; } + + public uint WrenchNumber { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/TF2/SchemaAdditionalHiddenBodygroupsModel.cs b/src/Steam.Models/TF2/SchemaAdditionalHiddenBodygroupsModel.cs new file mode 100644 index 0000000..fa2a030 --- /dev/null +++ b/src/Steam.Models/TF2/SchemaAdditionalHiddenBodygroupsModel.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.TF2 +{ + public class SchemaAdditionalHiddenBodygroupsModel + { + public uint Hat { get; set; } + + public uint Headphones { get; set; } + + public uint? Head { get; set; } + } +} diff --git a/src/Steam.Models/TF2/SchemaAttributeControlledAttachedParticleModel.cs b/src/Steam.Models/TF2/SchemaAttributeControlledAttachedParticleModel.cs new file mode 100644 index 0000000..654908d --- /dev/null +++ b/src/Steam.Models/TF2/SchemaAttributeControlledAttachedParticleModel.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.TF2 +{ + public class SchemaAttributeControlledAttachedParticleModel + { + public string System { get; set; } + + public uint Id { get; set; } + + public bool AttachToRootbone { get; set; } + + public string Name { get; set; } + + public string Attachment { get; set; } + } +} diff --git a/src/Steam.Models/TF2/SchemaAttributeModel.cs b/src/Steam.Models/TF2/SchemaAttributeModel.cs new file mode 100644 index 0000000..6cf309c --- /dev/null +++ b/src/Steam.Models/TF2/SchemaAttributeModel.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.TF2 +{ + public class SchemaAttributeModel + { + public string Name { get; set; } + + public uint Defindex { get; set; } + + public string AttributeClass { get; set; } + + public string DescriptionString { get; set; } + + public string DescriptionFormat { get; set; } + + public string EffectType { get; set; } + + public bool Hidden { get; set; } + + public bool StoredAsInteger { get; set; } + } +} diff --git a/src/Steam.Models/TF2/SchemaCapabilitiesModel.cs b/src/Steam.Models/TF2/SchemaCapabilitiesModel.cs new file mode 100644 index 0000000..df30575 --- /dev/null +++ b/src/Steam.Models/TF2/SchemaCapabilitiesModel.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.TF2 +{ + public class SchemaCapabilitiesModel + { + public bool Nameable { get; set; } + + public bool CanCraftMark { get; set; } + + public bool CanBeRestored { get; set; } + + public bool StrangeParts { get; set; } + + public bool CanCardUpgrade { get; set; } + + public bool CanStrangify { get; set; } + + public bool CanKillstreakify { get; set; } + + public bool CanConsume { get; set; } + + public bool? CanGiftWrap { get; set; } + + public bool? CanCollect { get; set; } + + public bool? Paintable { get; set; } + + public bool? CanCraftIfPurchased { get; set; } + + public bool? CanCraftCount { get; set; } + + public bool? UsableGc { get; set; } + + public bool? Usable { get; set; } + + public bool? CanCustomizeTexture { get; set; } + + public bool? UsableOutOfGame { get; set; } + + public bool? CanSpellPage { get; set; } + + public bool? DuckUpgradable { get; set; } + + public bool? Decodable { get; set; } + } +} diff --git a/src/Steam.Models/TF2/SchemaItemAttributeModel.cs b/src/Steam.Models/TF2/SchemaItemAttributeModel.cs new file mode 100644 index 0000000..642af7b --- /dev/null +++ b/src/Steam.Models/TF2/SchemaItemAttributeModel.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.TF2 +{ + public class SchemaItemAttributeModel + { + public string Name { get; set; } + + public string Class { get; set; } + + public double Value { get; set; } + } +} diff --git a/src/Steam.Models/TF2/SchemaItemLevelModel.cs b/src/Steam.Models/TF2/SchemaItemLevelModel.cs new file mode 100644 index 0000000..ec80742 --- /dev/null +++ b/src/Steam.Models/TF2/SchemaItemLevelModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.TF2 +{ + public class SchemaItemLevelModel + { + public string Name { get; set; } + + public IList Levels { get; set; } + } +} diff --git a/src/Steam.Models/TF2/SchemaItemModel.cs b/src/Steam.Models/TF2/SchemaItemModel.cs new file mode 100644 index 0000000..6be0d08 --- /dev/null +++ b/src/Steam.Models/TF2/SchemaItemModel.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.TF2 +{ + public class SchemaItemModel + { + public uint DefIndex { get; set; } + + public string Name { get; set; } + + public string ItemTypeName { get; set; } + + public string ItemName { get; set; } + + public string ItemDescription { get; set; } + + public string ImageInventoryPath { get; set; } + + public string ItemClass { get; set; } + + public bool ProperName { get; set; } + + public string ItemSlot { get; set; } + + public string ModelPlayer { get; set; } + + public uint ItemQuality { get; set; } + + public uint MinIlevel { get; set; } + + public uint MaxIlevel { get; set; } + + public string ImageUrl { get; set; } + + public string ImageUrlLarge { get; set; } + + public string CraftClass { get; set; } + + public string CraftMaterialType { get; set; } + + public string ItemLogName { get; set; } + + public SchemaCapabilitiesModel Capabilities { get; set; } + + public IList UsedByClasses { get; set; } + + public IList Styles { get; set; } + + public IList Attributes { get; set; } + + public string DropType { get; set; } + + public string ItemSet { get; set; } + + public string HolidayRestriction { get; set; } + + public SchemaPerClassLoadoutSlotsModel PerClassLoadoutSlots { get; set; } + + public SchemaToolModel Tool { get; set; } + } +} diff --git a/src/Steam.Models/TF2/SchemaItemSetAttributeModel.cs b/src/Steam.Models/TF2/SchemaItemSetAttributeModel.cs new file mode 100644 index 0000000..df84ab9 --- /dev/null +++ b/src/Steam.Models/TF2/SchemaItemSetAttributeModel.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.TF2 +{ + public class SchemaItemSetAttributeModel + { + public string Name { get; set; } + + public string Class { get; set; } + + public double Value { get; set; } + } +} diff --git a/src/Steam.Models/TF2/SchemaItemSetModel.cs b/src/Steam.Models/TF2/SchemaItemSetModel.cs new file mode 100644 index 0000000..1c0ab8d --- /dev/null +++ b/src/Steam.Models/TF2/SchemaItemSetModel.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.TF2 +{ + public class SchemaItemSetModel + { + public string ItemSet { get; set; } + + public string Name { get; set; } + + public IList Items { get; set; } + + public IList Attributes { get; set; } + + public string StoreBundleName { get; set; } + } +} diff --git a/src/Steam.Models/TF2/SchemaKillEaterScoreTypeModel.cs b/src/Steam.Models/TF2/SchemaKillEaterScoreTypeModel.cs new file mode 100644 index 0000000..66e9a0a --- /dev/null +++ b/src/Steam.Models/TF2/SchemaKillEaterScoreTypeModel.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.TF2 +{ + public class SchemaKillEaterScoreTypeModel + { + public uint Type { get; set; } + + public string TypeName { get; set; } + + public string LevelData { get; set; } + } +} diff --git a/src/Steam.Models/TF2/SchemaLevelModel.cs b/src/Steam.Models/TF2/SchemaLevelModel.cs new file mode 100644 index 0000000..7acf7a3 --- /dev/null +++ b/src/Steam.Models/TF2/SchemaLevelModel.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.TF2 +{ + public class SchemaLevelModel + { + public uint Level { get; set; } + + public uint RequiredScore { get; set; } + + public string Name { get; set; } + } +} diff --git a/src/Steam.Models/TF2/SchemaModel.cs b/src/Steam.Models/TF2/SchemaModel.cs new file mode 100644 index 0000000..a45eda4 --- /dev/null +++ b/src/Steam.Models/TF2/SchemaModel.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.TF2 +{ + public class SchemaModel + { + public string ItemsGameUrl { get; set; } + + public SchemaQualitiesModel Qualities { get; set; } + + public IList OriginNames { get; set; } + + public IList Items { get; set; } + + public IList Attributes { get; set; } + + public IList ItemSets { get; set; } + + public IList AttributeControlledAttachedParticles { get; set; } + + public IList ItemLevels { get; set; } + + public IList KillEaterScoreTypes { get; set; } + + public IList StringLookups { get; set; } + } +} diff --git a/src/Steam.Models/TF2/SchemaOriginNameModel.cs b/src/Steam.Models/TF2/SchemaOriginNameModel.cs new file mode 100644 index 0000000..2c42f63 --- /dev/null +++ b/src/Steam.Models/TF2/SchemaOriginNameModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.TF2 +{ + public class SchemaOriginNameModel + { + public uint Origin { get; set; } + + public string Name { get; set; } + } +} diff --git a/src/Steam.Models/TF2/SchemaPerClassLoadoutSlotsModel.cs b/src/Steam.Models/TF2/SchemaPerClassLoadoutSlotsModel.cs new file mode 100644 index 0000000..c42f65f --- /dev/null +++ b/src/Steam.Models/TF2/SchemaPerClassLoadoutSlotsModel.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.TF2 +{ + public class SchemaPerClassLoadoutSlotsModel + { + public string Soldier { get; set; } + + public string Heavy { get; set; } + + public string Pyro { get; set; } + + public string Engineer { get; set; } + + public string Demoman { get; set; } + } +} diff --git a/src/Steam.Models/TF2/SchemaQualitiesModel.cs b/src/Steam.Models/TF2/SchemaQualitiesModel.cs new file mode 100644 index 0000000..c9527f6 --- /dev/null +++ b/src/Steam.Models/TF2/SchemaQualitiesModel.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.TF2 +{ + public class SchemaQualitiesModel + { + /// + /// Normal item rarity: https://wiki.teamfortress.com/wiki/Normal + /// + public uint Normal { get; set; } + + /// + /// Genuine item rarity: https://wiki.teamfortress.com/wiki/Genuine + /// + public uint Rarity1 { get; set; } + + /// + /// Unused + /// + public uint Rarity2 { get; set; } + + /// + /// Vintage item rarity: https://wiki.teamfortress.com/wiki/Vintage + /// + public uint Vintage { get; set; } + + /// + /// Unused + /// + public uint Rarity3 { get; set; } + + /// + /// Unusual item rarity: https://wiki.teamfortress.com/wiki/Unusual + /// + public uint Rarity4 { get; set; } + + /// + /// Unique item rarity: https://wiki.teamfortress.com/wiki/Unique + /// + public uint Unique { get; set; } + + /// + /// Community item: https://wiki.teamfortress.com/wiki/Community_(quality) + /// + public uint Community { get; set; } + + /// + /// Developer owned item: https://wiki.teamfortress.com/wiki/Valve_(quality) + /// + public uint Developer { get; set; } + + /// + /// Self made item: https://wiki.teamfortress.com/wiki/Self-Made + /// + public uint SelfMade { get; set; } + + /// + /// Unused + /// + public uint Customized { get; set; } + + /// + /// Strange item: https://wiki.teamfortress.com/wiki/Strange + /// + public uint Strange { get; set; } + + /// + /// Unused + /// + public uint Completed { get; set; } + + /// + /// Haunted item: https://wiki.teamfortress.com/wiki/Haunted + /// + public uint Haunted { get; set; } + + /// + /// Collector's item: https://wiki.teamfortress.com/wiki/Collector%27s + /// + public uint Collectors { get; set; } + + public uint PaintKitWeapon { get; set; } + } +} diff --git a/src/Steam.Models/TF2/SchemaStringLookupModel.cs b/src/Steam.Models/TF2/SchemaStringLookupModel.cs new file mode 100644 index 0000000..71dd6b3 --- /dev/null +++ b/src/Steam.Models/TF2/SchemaStringLookupModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.TF2 +{ + public class SchemaStringLookupModel + { + public string TableName { get; set; } + + public IList Strings { get; set; } + } +} diff --git a/src/Steam.Models/TF2/SchemaStringModel.cs b/src/Steam.Models/TF2/SchemaStringModel.cs new file mode 100644 index 0000000..bff15bc --- /dev/null +++ b/src/Steam.Models/TF2/SchemaStringModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.TF2 +{ + public class SchemaStringModel + { + public uint Index { get; set; } + + public string String { get; set; } + } +} diff --git a/src/Steam.Models/TF2/SchemaStyleModel.cs b/src/Steam.Models/TF2/SchemaStyleModel.cs new file mode 100644 index 0000000..f90a16c --- /dev/null +++ b/src/Steam.Models/TF2/SchemaStyleModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.TF2 +{ + public class SchemaStyleModel + { + public string Name { get; set; } + + public SchemaAdditionalHiddenBodygroupsModel AdditionalHiddenBodygroups { get; set; } + } +} diff --git a/src/Steam.Models/TF2/SchemaToolModel.cs b/src/Steam.Models/TF2/SchemaToolModel.cs new file mode 100644 index 0000000..e1ad0a2 --- /dev/null +++ b/src/Steam.Models/TF2/SchemaToolModel.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.TF2 +{ + public class SchemaToolModel + { + public string Type { get; set; } + + public SchemaUsageCapabilitiesModel UsageCapabilities { get; set; } + + public string UseString { get; set; } + + public string Restriction { get; set; } + } +} diff --git a/src/Steam.Models/TF2/SchemaUsageCapabilitiesModel.cs b/src/Steam.Models/TF2/SchemaUsageCapabilitiesModel.cs new file mode 100644 index 0000000..c19204d --- /dev/null +++ b/src/Steam.Models/TF2/SchemaUsageCapabilitiesModel.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Steam.Models.TF2 +{ + public class SchemaUsageCapabilitiesModel + { + public bool Nameable { get; set; } + + public bool? Decodable { get; set; } + + public bool? Paintable { get; set; } + + public bool? CanCustomizeTexture { get; set; } + + public bool? CanGiftWrap { get; set; } + + public bool? PaintableTeamColors { get; set; } + + public bool? CanStrangify { get; set; } + + public bool? CanKillstreakify { get; set; } + + public bool? DuckUpgradable { get; set; } + + public bool? StrangeParts { get; set; } + + public bool? CanCardUpgrade { get; set; } + + public bool? CanSpellPage { get; set; } + + public bool? CanConsume { get; set; } + } +} diff --git a/src/Steam.Models/UGCFileDetailsModel.cs b/src/Steam.Models/UGCFileDetailsModel.cs new file mode 100644 index 0000000..f206d2a --- /dev/null +++ b/src/Steam.Models/UGCFileDetailsModel.cs @@ -0,0 +1,9 @@ +namespace Steam.Models +{ + public class UGCFileDetailsModel + { + public string FileName { get; set; } + public string URL { get; set; } + public uint Size { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/Utilities/DateTimeExtensions.cs b/src/Steam.Models/Utilities/DateTimeExtensions.cs new file mode 100644 index 0000000..1778d45 --- /dev/null +++ b/src/Steam.Models/Utilities/DateTimeExtensions.cs @@ -0,0 +1,32 @@ +using System; + +namespace Steam.Models.Utilities +{ + public static class DateTimeExtensions + { + /// + /// Converts a Unix time to a DateTime + /// + /// + /// + public static DateTime ToDateTime(this ulong unixTimeStamp) + { + DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0); + return origin.AddSeconds(unixTimeStamp); + } + + /// + /// Converts a DateTime to a Unix time + /// + /// + /// + public static ulong ToUnixTimeStamp(this DateTime dateTime) + { + DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0); + + TimeSpan timeSpanSinceOrigin = dateTime.Subtract(origin); + + return Convert.ToUInt64(timeSpanSinceOrigin.TotalSeconds); + } + } +} \ No newline at end of file diff --git a/src/SteamWebAPI2.sln b/src/SteamWebAPI2.sln index 307ac11..6422c58 100644 --- a/src/SteamWebAPI2.sln +++ b/src/SteamWebAPI2.sln @@ -1,9 +1,11 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26730.10 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29806.167 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SteamWebAPI2", "SteamWebAPI2\SteamWebAPI2.csproj", "{73634D2E-7C05-4916-A213-9D181F9992C9}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SteamWebAPI2", "SteamWebAPI2\SteamWebAPI2.csproj", "{73634D2E-7C05-4916-A213-9D181F9992C9}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Steam.Models", "Steam.Models\Steam.Models.csproj", "{AC645B95-E479-4DD2-AFA3-998DCFF66361}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,6 +17,10 @@ Global {73634D2E-7C05-4916-A213-9D181F9992C9}.Debug|Any CPU.Build.0 = Debug|Any CPU {73634D2E-7C05-4916-A213-9D181F9992C9}.Release|Any CPU.ActiveCfg = Release|Any CPU {73634D2E-7C05-4916-A213-9D181F9992C9}.Release|Any CPU.Build.0 = Release|Any CPU + {AC645B95-E479-4DD2-AFA3-998DCFF66361}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AC645B95-E479-4DD2-AFA3-998DCFF66361}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AC645B95-E479-4DD2-AFA3-998DCFF66361}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AC645B95-E479-4DD2-AFA3-998DCFF66361}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index ea25599..33eb1f9 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -14,7 +14,10 @@ - + + + + From 55f39cbb285aca01af72a0b5bc1bdfc2711d2f0f Mon Sep 17 00:00:00 2001 From: Justin Date: Sat, 7 Mar 2020 10:11:11 -0500 Subject: [PATCH 024/107] Fixed issue where parsing SteamId from Vanity URL with digits was failing. --- src/SteamWebAPI2/Models/SteamId.cs | 36 +++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/src/SteamWebAPI2/Models/SteamId.cs b/src/SteamWebAPI2/Models/SteamId.cs index 0930d01..d2b7cbe 100644 --- a/src/SteamWebAPI2/Models/SteamId.cs +++ b/src/SteamWebAPI2/Models/SteamId.cs @@ -261,31 +261,45 @@ public async Task ResolveAsync(string value) { string profileId = uriResult.Segments[2]; - // try to parse the 3rd segment as a 64-bit Steam ID (http://steamcommunity.com/profiles/762541427451 for example) - bool isSteamId64 = ulong.TryParse(profileId, out steamId); - - // the third segment isn't a 64-bit Steam ID, check if it's a profile name which resolves to a 64-bit Steam ID - if (!isSteamId64) + // if a user has a vanity name setup in their steam profile, the steam profile url will be in the format of: + // http://steamcommunity.com/id/ + // otherwise, the format will be: + // http://steamcommunity.com/profiles/<64-bit Steam ID> + if (uriResult.Segments[1] == "id/") { steamId = await ResolveSteamIdFromValueAsync(steamUser, profileId); + ConstructFromSteamId64(steamId); + ResolvedFrom = SteamIdResolvedFrom.SteamCommunityUri; + } + else if (uriResult.Segments[1] == "profiles/") + { + bool isSteamId64 = ulong.TryParse(profileId, out steamId); + + if (isSteamId64) + { + ConstructFromSteamId64(steamId); + ResolvedFrom = SteamIdResolvedFrom.SteamCommunityUri; + } + else + { + throw new InvalidSteamCommunityUriException(ErrorMessages.InvalidSteamCommunityUri); + } + } + else + { + throw new InvalidSteamCommunityUriException(ErrorMessages.InvalidSteamCommunityUri); } - - ConstructFromSteamId64(steamId); } else { throw new InvalidSteamCommunityUriException(ErrorMessages.InvalidSteamCommunityUri); } - - ResolvedFrom = SteamIdResolvedFrom.SteamCommunityUri; } else { // not a 64-bit Steam ID and not a uri, try to just resolve it as if it was a Steam Community Profile Name steamId = await ResolveSteamIdFromValueAsync(steamUser, value); - ConstructFromSteamId64(steamId); - ResolvedFrom = SteamIdResolvedFrom.SteamCommunityProfileName; } } From d783632aab1b47c51f089cfed7ea7da8b5d0dd3c Mon Sep 17 00:00:00 2001 From: Justin Date: Sat, 7 Mar 2020 10:49:36 -0500 Subject: [PATCH 025/107] Rolled version --- src/SteamWebAPI2/SteamWebAPI2.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index 33eb1f9..4412b47 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -2,7 +2,7 @@ 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. - 4.0.16 + 4.1.0 Justin Skiles SteamWebAPI2 SteamWebAPI2 From a2aff9621fd7d1819a8e737abd621a2a7f6dc9db Mon Sep 17 00:00:00 2001 From: Justin Date: Sat, 7 Mar 2020 11:04:39 -0500 Subject: [PATCH 026/107] Updated build script to use newer dotnet sdk --- appveyor.yml | 2 +- default.ps1 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index ca426d2..2a011b7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,6 @@ version: '{build}' -image: Visual Studio 2017 Preview +image: Visual Studio 2019 pull_requests: do_not_increment_build_number: true diff --git a/default.ps1 b/default.ps1 index 4f2a7d7..0ebb94f 100644 --- a/default.ps1 +++ b/default.ps1 @@ -19,9 +19,9 @@ task init { if($isDotNetDownloaded -eq $false) { Write-Output 'Did not find dotnet-sdk.exe. Starting download.' - exec { curl -O dotnet-sdk.exe https://download.microsoft.com/download/0/F/D/0FD852A4-7EA1-4E2A-983A-0484AC19B92C/dotnet-sdk-2.0.0-win-x64.exe | Out-Default } + exec { curl -O dotnet-sdk.exe https://download.visualstudio.microsoft.com/download/pr/5aad9c2c-7bb6-45b1-97e7-98f12cb5b63b/6f6d7944c81b043bdb9a7241529a5504/dotnet-sdk-3.1.102-win-x64.exe | Out-Default } } else { - Write-Output 'Found dotnet-sdk.exe. Skipping download.' + Write-Output 'Found dotnet-sdk.exe. Skipping download.' } Write-Output 'Installing dotnet-sdk.exe.' From 1eef6d6efe2c315511a251901591ec9f1149d1de Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Thu, 26 Mar 2020 11:57:59 -0400 Subject: [PATCH 027/107] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines.yml | 86 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..75a6726 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,86 @@ +# .NET Desktop +# Build and run tests for .NET Desktop or Windows classic desktop solutions. +# Add steps that publish symbols, save build artifacts, and more: +# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net + +trigger: + branches: + include: + - master + tags: + include: + - '*' + +pool: + vmImage: 'windows-latest' + +variables: +- group: my-variable-group +- name: solution + value: '**/*.sln' +- name: buildPlatform + value: 'Any CPU' +- name: buildConfiguration + value: 'Release' + +steps: +- task: NuGetToolInstaller@1 + +- task: NuGetCommand@2 + displayName: NuGet Restore + inputs: + restoreSolution: '$(solution)' + +- task: VSBuild@1 + displayName: Build (Visual Studio) + inputs: + solution: '$(solution)' + platform: '$(buildPlatform)' + configuration: '$(buildConfiguration)' + +- task: VSTest@2 + displayName: Test (Visual Studio) + inputs: + platform: '$(buildPlatform)' + configuration: '$(buildConfiguration)' + +# Only pack if this is from a tag +- task: DotNetCoreCLI@2 + displayName: NuGet Pack (if tagged) + condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/') + inputs: + command: 'pack' + packagesToPack: 'src/SteamWebAPI2/SteamWebAPI2.csproj' + versioningScheme: 'off' + +# Deploy release to NuGet.org +# Custom nuget command has to be used to workaround issue where dotnet core doesn't support encrypted API Key publication +# -n to skip symbols +# --skip-duplicate to prevent publishing the same version more than once +# Only publish if this is from a tag +- task: DotNetCoreCLI@2 + displayName: Push NuGet Package (if tagged) + condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/') + inputs: + command: custom + custom: nuget + arguments: > + push $(Build.ArtifactStagingDirectory)/**.nupkg + -s $(NuGetSourceServerUrl) + -k $(NuGetSourceServerApiKey) + -n true + --skip-duplicate + +# Deploy release to GitHub +# Only publish if this is from a tag +- task: GitHubRelease@1 + displayName: Push GitHub Release (if tagged) + condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/') + inputs: + gitHubConnection: 'GitHub.com OAuth - Babelshift' + repositoryName: 'babelshift/SharpDL' + action: 'create' + target: '$(Build.SourceVersion)' + tagSource: 'gitTag' + changeLogCompareToRelease: 'lastFullRelease' + changeLogType: 'commitBased' \ No newline at end of file From 77326bb51af1a9086c9eacd859051e104d0e3cdf Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Thu, 26 Mar 2020 11:59:12 -0400 Subject: [PATCH 028/107] Update azure-pipelines.yml for Azure Pipelines Wrong variable group name --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 75a6726..f9c88f5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -15,7 +15,7 @@ pool: vmImage: 'windows-latest' variables: -- group: my-variable-group +- group: NuGet - name: solution value: '**/*.sln' - name: buildPlatform From 47da2e25d80e1acdb0bbf39f9ca43d35509bb309 Mon Sep 17 00:00:00 2001 From: Justin Date: Thu, 26 Mar 2020 12:04:45 -0400 Subject: [PATCH 029/107] Removed unused build scripts --- appveyor.yml | 42 - azure-pipelines.yml | 2 +- build/dotnet/install.ps1 | 358 --- build/psake/.gitattributes | 1 - build/psake/.gitignore | 3 - build/psake/NuGetPackageBuilder.ps1 | 28 - build/psake/README.markdown | 50 - .../docs/access-functions-in-another-file.md | 22 - build/psake/docs/build-script-resilience.md | 52 - build/psake/docs/conditional-task.md | 45 - build/psake/docs/cruise-control.md | 47 - build/psake/docs/debug-script.md | 52 - build/psake/docs/dot-net-solution.md | 95 - build/psake/docs/getting-help.md | 60 - build/psake/docs/how-does-psake-work.md | 22 - build/psake/docs/how-to-fail-a-build.md | 56 - build/psake/docs/hudson.md | 45 - build/psake/docs/index.md | 3 - build/psake/docs/logging-errors.md | 72 - build/psake/docs/nested-build.md | 24 - build/psake/docs/pass-parameters.md | 20 - build/psake/docs/print-psake-task-name.md | 73 - build/psake/docs/property-overrides.md | 34 - build/psake/docs/retry-rules.md | 15 - build/psake/docs/run-psake.md | 39 - .../docs/structure-of-a-psake-build-script.md | 59 - build/psake/docs/team-city.md | 31 - build/psake/docs/variable-referencing.md | 120 - build/psake/docs/what-can-i-use-psake-for.md | 2 - build/psake/docs/where-can-i-get-psake.md | 7 - build/psake/docs/who-is-using-psake.md | 6 - build/psake/en-US/psake.psm1-help.xml | 2265 ----------------- build/psake/examples/checkvariables.ps1 | 33 - build/psake/examples/continueonerror.ps1 | 14 - build/psake/examples/default.ps1 | 23 - .../examples/formattaskname_scriptblock.ps1 | 24 - .../psake/examples/formattaskname_string.ps1 | 21 - build/psake/examples/msbuild40.ps1 | 8 - build/psake/examples/nested.ps1 | 17 - build/psake/examples/nested/nested1.ps1 | 1 - build/psake/examples/nested/nested2.ps1 | 1 - build/psake/examples/paralleltasks.ps1 | 20 - build/psake/examples/parameters.ps1 | 9 - .../build.Release.Version.bat | 3 - .../passingParametersString/parameters.ps1 | 22 - build/psake/examples/preandpostaction.ps1 | 13 - build/psake/examples/preandpostcondition.ps1 | 18 - build/psake/examples/properties.ps1 | 13 - build/psake/examples/requiredvariables.ps1 | 14 - build/psake/examples/tasksetupandteardown.ps1 | 17 - build/psake/images/SakeBottle.jpg | Bin 96904 -> 0 bytes build/psake/images/SakeBottleLicense.txt | 4 - build/psake/images/psake.pdn | Bin 168684 -> 0 bytes build/psake/images/psake.png | Bin 15109 -> 0 bytes build/psake/license.txt | 20 - build/psake/mkdocs.yml | 29 - build/psake/nuget/psake.nuspec | 15 - build/psake/nuget/tools/chocolateyInstall.ps1 | 12 - build/psake/nuget/tools/init.ps1 | 4 - build/psake/psake-buildTester.ps1 | 84 - build/psake/psake-config.ps1 | 21 - build/psake/psake.cmd | 14 - build/psake/psake.ps1 | 53 - build/psake/psake.psd1 | 31 - build/psake/psake.psm1 | 925 ------- .../Get-PSakeScriptTasks_should_pass.ps1 | 41 - .../bad_PreAndPostActions_should_fail.ps1 | 11 - .../specs/calling_invoke-task_should_pass.ps1 | 13 - ...rcular_dependency_in_tasks_should_fail.ps1 | 3 - .../default_task_with_action_should_fail.ps1 | 5 - .../psake/specs/detailedDocs_should_pass.ps1 | 52 - build/psake/specs/docs_should_pass.ps1 | 23 - build/psake/specs/dotNet4.5.1_should_pass.ps1 | 8 - build/psake/specs/dotNet4.6.1_should_pass.ps1 | 8 - build/psake/specs/dotNet4.6_should_pass.ps1 | 8 - build/psake/specs/dotNet4_should_pass.ps1 | 7 - .../specs/duplicate_alias_should_fail.ps1 | 4 - .../specs/duplicate_tasks_should_fail.ps1 | 3 - ..._depends_on_another_module_should_pass.ps1 | 5 - ...itly_specified_32bit_build_should_pass.ps1 | 7 - .../failing_postcondition_should_fail.ps1 | 13 - .../psake/specs/missing_task_should_fail.ps1 | 5 - build/psake/specs/modules/ModuleA.psm1 | 5 - build/psake/specs/modules/ModuleB.psm1 | 4 - build/psake/specs/modules/default.ps1 | 5 - build/psake/specs/modules/psake-config.ps1 | 2 - .../specs/multiline_blocks_should_pass.ps1 | 6 - build/psake/specs/nested/always_fail.ps1 | 5 - build/psake/specs/nested/docs.ps1 | 14 - build/psake/specs/nested/nested1.ps1 | 1 - build/psake/specs/nested/nested2.ps1 | 1 - build/psake/specs/nested/whatifpreference.ps1 | 5 - .../psake/specs/nested_builds_should_pass.ps1 | 17 - .../nested_builds_that_fail_should_fail.ps1 | 5 - .../nonzero_lastexitcode_should_pass.ps1 | 5 - ...et_compiler_under_dotNet35_should_pass.ps1 | 11 - ...imple_properties_and_tasks_should_pass.ps1 | 19 - ...ith_alias_and_dependencies_should_pass.ps1 | 5 - .../specs/task_with_alias_should_pass.ps1 | 5 - build/psake/specs/tasksetup_should_pass.ps1 | 17 - .../using_PreAndPostActions_should_pass.ps1 | 13 - ...c_and_nonzero_lastexitcode_should_fail.ps1 | 5 - .../specs/using_framework_should_pass.ps1 | 16 - ...using_initialization_block_should_pass.ps1 | 23 - .../psake/specs/using_msbuild_should_pass.ps1 | 4 - .../specs/using_parameters_should_pass.ps1 | 9 - .../specs/using_postcondition_should_pass.ps1 | 13 - .../specs/using_precondition_should_pass.ps1 | 13 - .../specs/using_properties_should_pass.ps1 | 13 - ...sing_required_when_not_set_should_fail.ps1 | 10 - .../using_required_when_set_should_pass.ps1 | 9 - .../specs/whatif_preference_should_pass.ps1 | 15 - .../writing_psake_variables_should_pass.ps1 | 34 - .../psake/tabexpansion/PsakeTabExpansion.ps1 | 31 - build/psake/tabexpansion/Readme.PsakeTab.txt | 39 - default.ps1 | 50 - psake.bat | 5 - 117 files changed, 1 insertion(+), 5882 deletions(-) delete mode 100644 appveyor.yml delete mode 100644 build/dotnet/install.ps1 delete mode 100644 build/psake/.gitattributes delete mode 100644 build/psake/.gitignore delete mode 100644 build/psake/NuGetPackageBuilder.ps1 delete mode 100644 build/psake/README.markdown delete mode 100644 build/psake/docs/access-functions-in-another-file.md delete mode 100644 build/psake/docs/build-script-resilience.md delete mode 100644 build/psake/docs/conditional-task.md delete mode 100644 build/psake/docs/cruise-control.md delete mode 100644 build/psake/docs/debug-script.md delete mode 100644 build/psake/docs/dot-net-solution.md delete mode 100644 build/psake/docs/getting-help.md delete mode 100644 build/psake/docs/how-does-psake-work.md delete mode 100644 build/psake/docs/how-to-fail-a-build.md delete mode 100644 build/psake/docs/hudson.md delete mode 100644 build/psake/docs/index.md delete mode 100644 build/psake/docs/logging-errors.md delete mode 100644 build/psake/docs/nested-build.md delete mode 100644 build/psake/docs/pass-parameters.md delete mode 100644 build/psake/docs/print-psake-task-name.md delete mode 100644 build/psake/docs/property-overrides.md delete mode 100644 build/psake/docs/retry-rules.md delete mode 100644 build/psake/docs/run-psake.md delete mode 100644 build/psake/docs/structure-of-a-psake-build-script.md delete mode 100644 build/psake/docs/team-city.md delete mode 100644 build/psake/docs/variable-referencing.md delete mode 100644 build/psake/docs/what-can-i-use-psake-for.md delete mode 100644 build/psake/docs/where-can-i-get-psake.md delete mode 100644 build/psake/docs/who-is-using-psake.md delete mode 100644 build/psake/en-US/psake.psm1-help.xml delete mode 100644 build/psake/examples/checkvariables.ps1 delete mode 100644 build/psake/examples/continueonerror.ps1 delete mode 100644 build/psake/examples/default.ps1 delete mode 100644 build/psake/examples/formattaskname_scriptblock.ps1 delete mode 100644 build/psake/examples/formattaskname_string.ps1 delete mode 100644 build/psake/examples/msbuild40.ps1 delete mode 100644 build/psake/examples/nested.ps1 delete mode 100644 build/psake/examples/nested/nested1.ps1 delete mode 100644 build/psake/examples/nested/nested2.ps1 delete mode 100644 build/psake/examples/paralleltasks.ps1 delete mode 100644 build/psake/examples/parameters.ps1 delete mode 100644 build/psake/examples/passingParametersString/build.Release.Version.bat delete mode 100644 build/psake/examples/passingParametersString/parameters.ps1 delete mode 100644 build/psake/examples/preandpostaction.ps1 delete mode 100644 build/psake/examples/preandpostcondition.ps1 delete mode 100644 build/psake/examples/properties.ps1 delete mode 100644 build/psake/examples/requiredvariables.ps1 delete mode 100644 build/psake/examples/tasksetupandteardown.ps1 delete mode 100644 build/psake/images/SakeBottle.jpg delete mode 100644 build/psake/images/SakeBottleLicense.txt delete mode 100644 build/psake/images/psake.pdn delete mode 100644 build/psake/images/psake.png delete mode 100644 build/psake/license.txt delete mode 100644 build/psake/mkdocs.yml delete mode 100644 build/psake/nuget/psake.nuspec delete mode 100644 build/psake/nuget/tools/chocolateyInstall.ps1 delete mode 100644 build/psake/nuget/tools/init.ps1 delete mode 100644 build/psake/psake-buildTester.ps1 delete mode 100644 build/psake/psake-config.ps1 delete mode 100644 build/psake/psake.cmd delete mode 100644 build/psake/psake.ps1 delete mode 100644 build/psake/psake.psd1 delete mode 100644 build/psake/psake.psm1 delete mode 100644 build/psake/specs/Get-PSakeScriptTasks_should_pass.ps1 delete mode 100644 build/psake/specs/bad_PreAndPostActions_should_fail.ps1 delete mode 100644 build/psake/specs/calling_invoke-task_should_pass.ps1 delete mode 100644 build/psake/specs/circular_dependency_in_tasks_should_fail.ps1 delete mode 100644 build/psake/specs/default_task_with_action_should_fail.ps1 delete mode 100644 build/psake/specs/detailedDocs_should_pass.ps1 delete mode 100644 build/psake/specs/docs_should_pass.ps1 delete mode 100644 build/psake/specs/dotNet4.5.1_should_pass.ps1 delete mode 100644 build/psake/specs/dotNet4.6.1_should_pass.ps1 delete mode 100644 build/psake/specs/dotNet4.6_should_pass.ps1 delete mode 100644 build/psake/specs/dotNet4_should_pass.ps1 delete mode 100644 build/psake/specs/duplicate_alias_should_fail.ps1 delete mode 100644 build/psake/specs/duplicate_tasks_should_fail.ps1 delete mode 100644 build/psake/specs/executing_module_function_that_depends_on_another_module_should_pass.ps1 delete mode 100644 build/psake/specs/explicitly_specified_32bit_build_should_pass.ps1 delete mode 100644 build/psake/specs/failing_postcondition_should_fail.ps1 delete mode 100644 build/psake/specs/missing_task_should_fail.ps1 delete mode 100644 build/psake/specs/modules/ModuleA.psm1 delete mode 100644 build/psake/specs/modules/ModuleB.psm1 delete mode 100644 build/psake/specs/modules/default.ps1 delete mode 100644 build/psake/specs/modules/psake-config.ps1 delete mode 100644 build/psake/specs/multiline_blocks_should_pass.ps1 delete mode 100644 build/psake/specs/nested/always_fail.ps1 delete mode 100644 build/psake/specs/nested/docs.ps1 delete mode 100644 build/psake/specs/nested/nested1.ps1 delete mode 100644 build/psake/specs/nested/nested2.ps1 delete mode 100644 build/psake/specs/nested/whatifpreference.ps1 delete mode 100644 build/psake/specs/nested_builds_should_pass.ps1 delete mode 100644 build/psake/specs/nested_builds_that_fail_should_fail.ps1 delete mode 100644 build/psake/specs/nonzero_lastexitcode_should_pass.ps1 delete mode 100644 build/psake/specs/running_aspnet_compiler_under_dotNet35_should_pass.ps1 delete mode 100644 build/psake/specs/simple_properties_and_tasks_should_pass.ps1 delete mode 100644 build/psake/specs/task_with_alias_and_dependencies_should_pass.ps1 delete mode 100644 build/psake/specs/task_with_alias_should_pass.ps1 delete mode 100644 build/psake/specs/tasksetup_should_pass.ps1 delete mode 100644 build/psake/specs/using_PreAndPostActions_should_pass.ps1 delete mode 100644 build/psake/specs/using_exec_and_nonzero_lastexitcode_should_fail.ps1 delete mode 100644 build/psake/specs/using_framework_should_pass.ps1 delete mode 100644 build/psake/specs/using_initialization_block_should_pass.ps1 delete mode 100644 build/psake/specs/using_msbuild_should_pass.ps1 delete mode 100644 build/psake/specs/using_parameters_should_pass.ps1 delete mode 100644 build/psake/specs/using_postcondition_should_pass.ps1 delete mode 100644 build/psake/specs/using_precondition_should_pass.ps1 delete mode 100644 build/psake/specs/using_properties_should_pass.ps1 delete mode 100644 build/psake/specs/using_required_when_not_set_should_fail.ps1 delete mode 100644 build/psake/specs/using_required_when_set_should_pass.ps1 delete mode 100644 build/psake/specs/whatif_preference_should_pass.ps1 delete mode 100644 build/psake/specs/writing_psake_variables_should_pass.ps1 delete mode 100644 build/psake/tabexpansion/PsakeTabExpansion.ps1 delete mode 100644 build/psake/tabexpansion/Readme.PsakeTab.txt delete mode 100644 default.ps1 delete mode 100644 psake.bat diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 2a011b7..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,42 +0,0 @@ -version: '{build}' - -image: Visual Studio 2019 - -pull_requests: - do_not_increment_build_number: true - -branches: - only: - - master - -nuget: - disable_publish_on_pr: true - -build_script: - - cmd: .\psake.bat ci - -test: off - -artifacts: - - path: .\artifacts\**\*.nupkg - name: NuGet - -cache: - - '%APPVEYOR_BUILD_FOLDER%\dotnet-sdk.exe' - -deploy: - - provider: NuGet - server: https://www.myget.org/F/babelshift-ci/api/v2/package - api_key: - secure: zI5gnqOnLVuIzNHVG1eiCpi5mEsT1i6AvwOHwIIm27NOURZFnCHhwG3SE49f0f88 - skip_symbols: true - on: - branch: master - - - provider: NuGet - name: production - api_key: - secure: 30KN4qmkCGCJfgASQdhJtWf4BjY9GM7dGuGRi9gQRnJreQPiXFzvreBHYwPjQ4YN - on: - branch: master - appveyor_repo_tag: true diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f9c88f5..aab6175 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -78,7 +78,7 @@ steps: condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/') inputs: gitHubConnection: 'GitHub.com OAuth - Babelshift' - repositoryName: 'babelshift/SharpDL' + repositoryName: 'babelshift/SteamWebAPI2' action: 'create' target: '$(Build.SourceVersion)' tagSource: 'gitTag' diff --git a/build/dotnet/install.ps1 b/build/dotnet/install.ps1 deleted file mode 100644 index f863814..0000000 --- a/build/dotnet/install.ps1 +++ /dev/null @@ -1,358 +0,0 @@ -# -# Copyright (c) .NET Foundation and contributors. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. -# - -<# -.SYNOPSIS - Installs dotnet cli -.DESCRIPTION - Installs dotnet cli. If dotnet installation already exists in the given directory - it will update it only if the requested version differs from the one already installed. -.PARAMETER Channel - Default: preview - Channel is the way of reasoning about stability and quality of dotnet. This parameter takes one of the values: - - future - Possibly unstable, frequently changing, may contain new finished and unfinished features - - preview - Pre-release stable with known issues and feature gaps - - production - Most stable releases -.PARAMETER Version - Default: latest - Represents a build version on specific channel. Possible values: - - 4-part version in a format A.B.C.D - represents specific version of build - - latest - most latest build on specific channel - - lkg - last known good version on specific channel - Note: LKG work is in progress. Once the work is finished, this will become new default -.PARAMETER InstallDir - Default: %LocalAppData%\Microsoft\dotnet - Path to where to install dotnet. Note that binaries will be placed directly in a given directory. -.PARAMETER Architecture - Default: - this value represents currently running OS architecture - Architecture of dotnet binaries to be installed. - Possible values are: , x64 and x86 -.PARAMETER SharedRuntime - Default: false - Installs just the shared runtime bits, not the entire SDK -.PARAMETER DebugSymbols - If set the installer will include symbols in the installation. -.PARAMETER DryRun - If set it will not perform installation but instead display what command line to use to consistently install - currently requested version of dotnet cli. In example if you specify version 'latest' it will display a link - with specific version so that this command can be used deterministicly in a build script. - It also displays binaries location if you prefer to install or download it yourself. -.PARAMETER NoPath - By default this script will set environment variable PATH for the current process to the binaries folder inside installation folder. - If set it will display binaries location but not set any environment variable. -.PARAMETER Verbose - Displays diagnostics information. -.PARAMETER AzureFeed - Default: https://dotnetcli.blob.core.windows.net/dotnet - This parameter should not be usually changed by user. It allows to change URL for the Azure feed used by this installer. -#> -[cmdletbinding()] -param( - [string]$Channel="rel-1.0.0", - [string]$Version="Latest", - [string]$InstallDir="", - [string]$Architecture="", - [switch]$SharedRuntime, - [switch]$DebugSymbols, # TODO: Switch does not work yet. Symbols zip is not being uploaded yet. - [switch]$DryRun, - [switch]$NoPath, - [string]$AzureFeed="https://dotnetcli.blob.core.windows.net/dotnet" -) - -Set-StrictMode -Version Latest -$ErrorActionPreference="Stop" -$ProgressPreference="SilentlyContinue" - -$BinFolderRelativePath="" - -# example path with regex: shared/1.0.0-beta-12345/somepath -$VersionRegEx="/\d+\.\d+[^/]+/" -$OverrideNonVersionedFiles=$true - -function Say($str) { - Write-Host "dotnet-install: $str" -} - -function Say-Verbose($str) { - Write-Verbose "dotnet-install: $str" -} - -function Say-Invocation($Invocation) { - $command = $Invocation.MyCommand; - $args = (($Invocation.BoundParameters.Keys | foreach { "-$_ `"$($Invocation.BoundParameters[$_])`"" }) -join " ") - Say-Verbose "$command $args" -} - -function Get-Machine-Architecture() { - Say-Invocation $MyInvocation - - # possible values: AMD64, IA64, x86 - return $ENV:PROCESSOR_ARCHITECTURE -} - -# TODO: Architecture and CLIArchitecture should be unified -function Get-CLIArchitecture-From-Architecture([string]$Architecture) { - Say-Invocation $MyInvocation - - switch ($Architecture.ToLower()) { - { $_ -eq "" } { return Get-CLIArchitecture-From-Architecture $(Get-Machine-Architecture) } - { ($_ -eq "amd64") -or ($_ -eq "x64") } { return "x64" } - { $_ -eq "x86" } { return "x86" } - default { throw "Architecture not supported. If you think this is a bug, please report it at https://github.com/dotnet/cli/issues" } - } -} - -function Get-Version-Info-From-Version-Text([string]$VersionText) { - Say-Invocation $MyInvocation - - $Data = @($VersionText.Split([char[]]@(), [StringSplitOptions]::RemoveEmptyEntries)); - - $VersionInfo = @{} - $VersionInfo.CommitHash = $Data[0].Trim() - $VersionInfo.Version = $Data[1].Trim() - return $VersionInfo -} - -function Get-Latest-Version-Info([string]$AzureFeed, [string]$AzureChannel, [string]$CLIArchitecture) { - Say-Invocation $MyInvocation - - $VersionFileUrl = $null - if ($SharedRuntime) { - $VersionFileUrl = "$AzureFeed/$AzureChannel/dnvm/latest.sharedfx.win.$CLIArchitecture.version" - } - else { - $VersionFileUrl = "$AzureFeed/Sdk/$AzureChannel/latest.version" - } - - $Response = Invoke-WebRequest -UseBasicParsing $VersionFileUrl - - switch ($Response.Headers.'Content-Type'){ - { ($_ -eq "application/octet-stream") } { $VersionText = [Text.Encoding]::UTF8.GetString($Response.Content) } - { ($_ -eq "text/plain") } { $VersionText = $Response.Content } - default { throw "``$Response.Headers.'Content-Type'`` is an unknown .version file content type." } - } - - - $VersionInfo = Get-Version-Info-From-Version-Text $VersionText - - return $VersionInfo -} - -# TODO: AzureChannel and Channel should be unified -function Get-Azure-Channel-From-Channel([string]$Channel) { - Say-Invocation $MyInvocation - - # For compatibility with build scripts accept also directly Azure channels names - switch ($Channel.ToLower()) { - { ($_ -eq "future") -or ($_ -eq "dev") } { return "dev" } - { $_ -eq "production" } { throw "Production channel does not exist yet" } - default { return $_ } - } -} - -function Get-Specific-Version-From-Version([string]$AzureFeed, [string]$AzureChannel, [string]$CLIArchitecture, [string]$Version) { - Say-Invocation $MyInvocation - - switch ($Version.ToLower()) { - { $_ -eq "latest" } { - $LatestVersionInfo = Get-Latest-Version-Info -AzureFeed $AzureFeed -AzureChannel $AzureChannel -CLIArchitecture $CLIArchitecture - return $LatestVersionInfo.Version - } - { $_ -eq "lkg" } { throw "``-Version LKG`` not supported yet." } - default { return $Version } - } -} - -function Get-Download-Links([string]$AzureFeed, [string]$AzureChannel, [string]$SpecificVersion, [string]$CLIArchitecture) { - Say-Invocation $MyInvocation - - $ret = @() - - if ($SharedRuntime) { - $PayloadURL = "$AzureFeed/$AzureChannel/Binaries/$SpecificVersion/dotnet-win-$CLIArchitecture.$SpecificVersion.zip" - } - else { - $PayloadURL = "$AzureFeed/Sdk/$SpecificVersion/dotnet-dev-win-$CLIArchitecture.$SpecificVersion.zip" - } - - Say-Verbose "Constructed payload URL: $PayloadURL" - $ret += $PayloadURL - - return $ret -} - -function Get-User-Share-Path() { - Say-Invocation $MyInvocation - - $InstallRoot = $env:DOTNET_INSTALL_DIR - if (!$InstallRoot) { - $InstallRoot = "$env:LocalAppData\Microsoft\dotnet" - } - return $InstallRoot -} - -function Resolve-Installation-Path([string]$InstallDir) { - Say-Invocation $MyInvocation - - if ($InstallDir -eq "") { - return Get-User-Share-Path - } - return $InstallDir -} - -function Get-Version-Info-From-Version-File([string]$InstallRoot, [string]$RelativePathToVersionFile) { - Say-Invocation $MyInvocation - - $VersionFile = Join-Path -Path $InstallRoot -ChildPath $RelativePathToVersionFile - Say-Verbose "Local version file: $VersionFile" - - if (Test-Path $VersionFile) { - $VersionText = cat $VersionFile - Say-Verbose "Local version file text: $VersionText" - return Get-Version-Info-From-Version-Text $VersionText - } - - Say-Verbose "Local version file not found." - - return $null -} - -function Is-Dotnet-Package-Installed([string]$InstallRoot, [string]$RelativePathToPackage, [string]$SpecificVersion) { - Say-Invocation $MyInvocation - - $DotnetPackagePath = Join-Path -Path $InstallRoot -ChildPath $RelativePathToPackage | Join-Path -ChildPath $SpecificVersion - Say-Verbose "Is-Dotnet-Package-Installed: Path to a package: $DotnetPackagePath" - return Test-Path $DotnetPackagePath -PathType Container -} - -function Get-Absolute-Path([string]$RelativeOrAbsolutePath) { - # Too much spam - # Say-Invocation $MyInvocation - - return $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($RelativeOrAbsolutePath) -} - -function Get-Path-Prefix-With-Version($path) { - $match = [regex]::match($path, $VersionRegEx) - if ($match.Success) { - return $entry.FullName.Substring(0, $match.Index + $match.Length) - } - - return $null -} - -function Get-List-Of-Directories-And-Versions-To-Unpack-From-Dotnet-Package([System.IO.Compression.ZipArchive]$Zip, [string]$OutPath) { - Say-Invocation $MyInvocation - - $ret = @() - foreach ($entry in $Zip.Entries) { - $dir = Get-Path-Prefix-With-Version $entry.FullName - if ($dir -ne $null) { - $path = Get-Absolute-Path $(Join-Path -Path $OutPath -ChildPath $dir) - if (-Not (Test-Path $path -PathType Container)) { - $ret += $dir - } - } - } - - $ret = $ret | Sort-Object | Get-Unique - - $values = ($ret | foreach { "$_" }) -join ";" - Say-Verbose "Directories to unpack: $values" - - return $ret -} - -# Example zip content and extraction algorithm: -# Rule: files if extracted are always being extracted to the same relative path locally -# .\ -# a.exe # file does not exist locally, extract -# b.dll # file exists locally, override only if $OverrideFiles set -# aaa\ # same rules as for files -# ... -# abc\1.0.0\ # directory contains version and exists locally -# ... # do not extract content under versioned part -# abc\asd\ # same rules as for files -# ... -# def\ghi\1.0.1\ # directory contains version and does not exist locally -# ... # extract content -function Extract-Dotnet-Package([string]$ZipPath, [string]$OutPath) { - Say-Invocation $MyInvocation - - Add-Type -Assembly System.IO.Compression.FileSystem | Out-Null - Set-Variable -Name Zip - try { - $Zip = [System.IO.Compression.ZipFile]::OpenRead($ZipPath) - - $DirectoriesToUnpack = Get-List-Of-Directories-And-Versions-To-Unpack-From-Dotnet-Package -Zip $Zip -OutPath $OutPath - - foreach ($entry in $Zip.Entries) { - $PathWithVersion = Get-Path-Prefix-With-Version $entry.FullName - if (($PathWithVersion -eq $null) -Or ($DirectoriesToUnpack -contains $PathWithVersion)) { - $DestinationPath = Get-Absolute-Path $(Join-Path -Path $OutPath -ChildPath $entry.FullName) - $DestinationDir = Split-Path -Parent $DestinationPath - $OverrideFiles=$OverrideNonVersionedFiles -Or (-Not (Test-Path $DestinationPath)) - if ((-Not $DestinationPath.EndsWith("\")) -And $OverrideFiles) { - New-Item -ItemType Directory -Force -Path $DestinationDir | Out-Null - [System.IO.Compression.ZipFileExtensions]::ExtractToFile($entry, $DestinationPath, $OverrideNonVersionedFiles) - } - } - } - } - finally { - if ($Zip -ne $null) { - $Zip.Dispose() - } - } -} - -$AzureChannel = Get-Azure-Channel-From-Channel -Channel $Channel -$CLIArchitecture = Get-CLIArchitecture-From-Architecture $Architecture -$SpecificVersion = Get-Specific-Version-From-Version -AzureFeed $AzureFeed -AzureChannel $AzureChannel -CLIArchitecture $CLIArchitecture -Version $Version -$DownloadLinks = Get-Download-Links -AzureFeed $AzureFeed -AzureChannel $AzureChannel -SpecificVersion $SpecificVersion -CLIArchitecture $CLIArchitecture - -if ($DryRun) { - Say "Payload URLs:" - foreach ($DownloadLink in $DownloadLinks) { - Say "- $DownloadLink" - } - Say "Repeatable invocation: .\$($MyInvocation.MyCommand) -Version $SpecificVersion -Channel $Channel -Architecture $CLIArchitecture -InstallDir $InstallDir" - exit 0 -} - -$InstallRoot = Resolve-Installation-Path $InstallDir -Say-Verbose "InstallRoot: $InstallRoot" - -$IsSdkInstalled = Is-Dotnet-Package-Installed -InstallRoot $InstallRoot -RelativePathToPackage "sdk" -SpecificVersion $SpecificVersion -Say-Verbose ".NET SDK installed? $IsSdkInstalled" -if ($IsSdkInstalled) { - Say ".NET SDK version $SpecificVersion is already installed." - exit 0 -} - -New-Item -ItemType Directory -Force -Path $InstallRoot | Out-Null - -foreach ($DownloadLink in $DownloadLinks) { - $ZipPath = [System.IO.Path]::GetTempFileName() - Say "Downloading $DownloadLink" - $resp = Invoke-WebRequest -UseBasicParsing $DownloadLink -OutFile $ZipPath - - Say "Extracting zip from $DownloadLink" - Extract-Dotnet-Package -ZipPath $ZipPath -OutPath $InstallRoot - - Remove-Item $ZipPath -} - -$BinPath = Get-Absolute-Path $(Join-Path -Path $InstallRoot -ChildPath $BinFolderRelativePath) -if (-Not $NoPath) { - Say "Adding to current process PATH: `"$BinPath`". Note: This change will not be visible if PowerShell was run as a child process." - $env:path = "$BinPath;" + $env:path -} -else { - Say "Binaries of dotnet can be found in $BinPath" -} - -Say "Installation finished" -exit 0 \ No newline at end of file diff --git a/build/psake/.gitattributes b/build/psake/.gitattributes deleted file mode 100644 index d7c444c..0000000 --- a/build/psake/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -* -crlf \ No newline at end of file diff --git a/build/psake/.gitignore b/build/psake/.gitignore deleted file mode 100644 index 3bc8eba..0000000 --- a/build/psake/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -[B|b]in -*.nupkg -Thumbs.db \ No newline at end of file diff --git a/build/psake/NuGetPackageBuilder.ps1 b/build/psake/NuGetPackageBuilder.ps1 deleted file mode 100644 index ec8e2ed..0000000 --- a/build/psake/NuGetPackageBuilder.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -$scriptpath = $MyInvocation.MyCommand.Path -$dir = Split-Path $scriptpath -$manifestPath = Join-Path $dir psake.psd1 - -try -{ - $manifest = Test-ModuleManifest -Path $manifestPath -WarningAction SilentlyContinue -ErrorAction Stop - $version = $manifest.Version.ToString() -} -catch -{ - throw -} - -"Version number $version" - -$destDir = "$dir\bin" -if (Test-Path $destDir -PathType container) { - Remove-Item $destDir -Recurse -Force -} - -Copy-Item -Recurse $dir\nuget $destDir -Copy-Item -Recurse $dir\en-US $destDir\tools\en-US -Copy-Item -Recurse $dir\examples $destDir\tools\examples -@( "psake.cmd", "psake.ps1", "psake.psm1", "psake.psd1", "psake-config.ps1", "README.markdown", "license.txt") | - % { Copy-Item $dir\$_ $destDir\tools } - -.\nuget pack "$destDir\psake.nuspec" -Verbosity quiet -Version $version diff --git a/build/psake/README.markdown b/build/psake/README.markdown deleted file mode 100644 index 768ff0d..0000000 --- a/build/psake/README.markdown +++ /dev/null @@ -1,50 +0,0 @@ -Welcome to the psake project. -============================= - -[![Join the chat at https://gitter.im/psake/psake](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/psake/psake?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - -psake is a build automation tool written in PowerShell. It avoids the angle-bracket tax associated with executable XML by leveraging the PowerShell syntax in your build scripts. -psake has a syntax inspired by rake (aka make in Ruby) and bake (aka make in Boo), but is easier to script because it leverages your existing command-line knowledge. - -psake is pronounced sake – as in Japanese rice wine. It does NOT rhyme with make, bake, or rake. - -## How to get started: - -**Step 1:** Download and extract the project - -You will need to "unblock" the zip file before extracting - PowerShell by default does not run files downloaded from the internet. -Just right-click the zip and click on "properties" and click on the "unblock" button. - -**Step 2:** CD into the directory where you extracted the project (where the psake.psm1 file is) - -> Import-Module .\psake.psm1 - -If you encounter the following error "Import-Module : ...psake.psm1 cannot be loaded because the execution of scripts is disabled on this system." Please see "get-help about_signing" for more details. - -1. Run PowerShell as administrator -2. Set-ExecutionPolicy RemoteSigned - -> Get-Help Invoke-psake -Full -> - this will show you help and examples of how to use psake - -**Step 3:** Run some examples - -> CD .\examples -> -> Invoke-psake -> - This will execute the "default" task in the "default.ps1" -> -> Invoke-psake .\default.ps1 Clean -> - will execute the single task in the default.ps1 script - -## How To Contribute, Collaborate, Communicate - -If you'd like to get involved with psake, we have discussion groups over at google: **[psake-dev](http://groups.google.com/group/psake-dev)** **[psake-users](http://groups.google.com/group/psake-users)** - -Anyone can fork the main repository and submit patches, as well. And lastly, the [wiki](http://wiki.github.com/psake/psake/) and [issues list](http://github.com/psake/psake/issues) are also open for additions, edits, and discussion. - -Also check out the **[psake-contrib](http://github.com/psake/psake-contrib)** project for scripts, modules and functions to help you with a build. - -## License - -psake is released under the [MIT license](http://www.opensource.org/licenses/MIT). diff --git a/build/psake/docs/access-functions-in-another-file.md b/build/psake/docs/access-functions-in-another-file.md deleted file mode 100644 index adfb175..0000000 --- a/build/psake/docs/access-functions-in-another-file.md +++ /dev/null @@ -1,22 +0,0 @@ -

-Use the *include* function to access functions that are in another script file. - -The following is an example: -

-
-Include ".\build_utils.ps1"
-
-Task default -depends Test
-
-Task Test -depends Compile, Clean {
-}
-
-Task Compile -depends Clean {
-}
-
-Task Clean {
-}
-
-

-You can have more than 1 include file in your script if you need to include multiple script files. -

\ No newline at end of file diff --git a/build/psake/docs/build-script-resilience.md b/build/psake/docs/build-script-resilience.md deleted file mode 100644 index 8834787..0000000 --- a/build/psake/docs/build-script-resilience.md +++ /dev/null @@ -1,52 +0,0 @@ -

-The *Task* function has a switch parameter called "ContinueOnError" that you can set if you want the build to continue running if that particular task throws an exception. - -Here's an example script that uses the "ContinueOnError" switch: -

-
-Task default -Depends TaskA
-
-Task TaskA -Depends TaskB {
-	"Task - A"
-}
-
-Task TaskB -Depends TaskC -ContinueOnError {
-	"Task - B"
-	throw "I failed on purpose!"
-}
-
-Task TaskC {
-	"Task - C"
-}
-
-

-When you run the above build script, you should get this output: -

-
-Executing task: TaskC
-Task - C
-Executing task: TaskB
-Task - B
-----------------------------------------------------------------------
-Error in Task [TaskB] I failed on purpose!
-----------------------------------------------------------------------
-Executing task: TaskA
-Task - A
-
-Build Succeeded!
-
-----------------------------------------------------------------------
-Build Time Report
-----------------------------------------------------------------------
-Name   Duration
-----   --------
-TaskC  00:00:00.0053110
-TaskB  00:00:00.0256725
-TaskA  00:00:00.0350228
-Total: 00:00:00.1032888
-
-

-when psake processes a task that throws an exception (TaskB in this example) and the "ContinueOnError" is set, then psake displays a message to the console indicating that the task had an error and continues processing the rest of the build script. - -Note: The dependent tasks of the task that threw the exception still execute -

\ No newline at end of file diff --git a/build/psake/docs/conditional-task.md b/build/psake/docs/conditional-task.md deleted file mode 100644 index a7b5596..0000000 --- a/build/psake/docs/conditional-task.md +++ /dev/null @@ -1,45 +0,0 @@ -

-You can conditionally run a task by using the "precondition" parameter of the "task" function. The "precondition" parameter expects a scriptblock as its value and that scriptblock should return a $true or $false. - -The following is an example build script that uses the "precondition" parameter of the task function: -

-
-task default -depends A,B,C
-
-task A {
-  "TaskA"
-}
-
-task B -precondition { return $false } {
-  "TaskB"
-}
-
-task C -precondition { return $true } {
-  "TaskC"
-}
-
-

-The output from running the above build script looks like the following: -

-
-Executing task: A
-TaskA
-Precondition was false not executing B
-Executing task: C
-TaskC
-
-Build Succeeded!
-
-----------------------------------------------------------------------
-Build Time Report
-----------------------------------------------------------------------
-Name   Duration
-----   --------
-A      00:00:00.0231283
-B      0
-C      00:00:00.0043444
-Total: 00:00:00.1405840
-
-

-Notice how task "B" was not executed and its run-time duration was 0 secs. -

\ No newline at end of file diff --git a/build/psake/docs/cruise-control.md b/build/psake/docs/cruise-control.md deleted file mode 100644 index 22de81b..0000000 --- a/build/psake/docs/cruise-control.md +++ /dev/null @@ -1,47 +0,0 @@ -Below are some sample tasks that worked for me (fschwiet), though I'm new to cruise control. Note that using a single apostrophe in the properties was necessary, double quotes would not work. - -Note that to make this work on older versions of psake, I needed to add a line to psake.ps1. Older versions may be missing a call to "exit $lasterrorcode" as the last line. - -For this example, the source control provider has been configured to put the code at c:\build\ProjectName.git. - -``` - - - - - c:\build\ProjectName.git - powershell.exe - .\default.ps1 -properties @{ - buildDirectory = 'c:\build\ProjectName.msbuild\'; - tempPath = 'c:\build\ProjectName.TestDatabases'; - sqlConnectionString = 'Database=''MyDB'';Data Source=.\;Integrated Security=True' - } - - 0 - Run psake script - - -``` - -The build output is hard to read and I don't think any of Cruise Control's built in view templates address that. I created a minimalistic stylesheet so the result is somewhat readable: - -``` - - - - - - - - - - -
- -
- - -
\
-
-
-``` \ No newline at end of file diff --git a/build/psake/docs/debug-script.md b/build/psake/docs/debug-script.md deleted file mode 100644 index 4e42729..0000000 --- a/build/psake/docs/debug-script.md +++ /dev/null @@ -1,52 +0,0 @@ -

-You can debug your psake build script in a couple of ways: -# Using *Set-PSBreakpoint*, *Get-PSBreakpoint* and *Remove-PSBreakpoint* -# Use the *PowerShell Integrated Scripting Environment (ISE)* - -With *Set-PSBreakpoint* you need to know what line number you want to set a breakpoint on, but the syntax is pretty simple: -

-``` -Set-PSBreakpoint [-Script] [-Line] [[-Column] ] [-Action ] [] -ex. -Set-PSBreakPoint -script default.ps1 -line 25 -``` -

-Once the breakpoint is set then you call the invoke-psake function on your script as normal and you should get a prompt from the command window: -

-``` -Entering debug mode. Use h or ? for help. - -Hit Line breakpoint on 'C:\Users\Daddy\Documents\Projects\psake\default.ps1:9' - -default.ps1:9 "TaskA is executing" -[DBG]: PS C:\Users\Daddy\Documents\Projects\psake>>> -``` -

-if you type "h" you will get the following options that will allow you to debug your script: -

-``` - s, stepInto Single step (step into functions, scripts, etc.) - v, stepOver Step to next statement (step over functions, scripts, etc.) - o, stepOut Step out of the current function, script, etc. - - c, continue Continue execution - q, quit Stop execution and exit the debugger - - k, Get-PSCallStack Display call stack - - l, list List source code for the current script. - Use "list" to start from the current line, "list " - to start from line , and "list " to list - lines starting from line - - Repeat last command if it was stepInto, stepOver or list - - ?, h Displays this help message -``` -

-While debugging you are able to inspect the values of your variables by just typing them at the prompt and hitting the [Enter] key - -Once you are done debugging you can call *Remove-PSBreakpoint* to remove the breakpoints you've added, you can use *Get-PSBreakpoint* to get a list of all the current breakpoints in the current session. - -With the *PowerShell Integrated Scripting Environment* all you need to do is to load your build script and click on the left margin to set a breakpoint, then run the invoke-psake function from the command window that is within the ISE (its in the bottom pane of the ISE). Then you can use the functions keys to debug your build script (F10, F11, etc.. they are under the "Debug" menu). -

\ No newline at end of file diff --git a/build/psake/docs/dot-net-solution.md b/build/psake/docs/dot-net-solution.md deleted file mode 100644 index b467b86..0000000 --- a/build/psake/docs/dot-net-solution.md +++ /dev/null @@ -1,95 +0,0 @@ -Here's an example of a basic script you can write to build a Visual Studio.Net solution: - -
-Task Default -depends Build
-
-Task Build {
-   Exec { msbuild "helloworld.sln" }
-}
-
-

-Builds tend to be more complex than what's shown in the example above. Most builds will need to know what the current directory is relative to where the build script was executed or where to look for code, where to deploy build artifacts or svn settings, etc... - -If you haven't guessed already, I'm referring to build properties. - -Here's a script that uses properties: -

-
-#This build assumes the following directory structure
-#
-#  \Build          - This is where the project build code lives
-#  \BuildArtifacts - This folder is created if it is missing and contains output of the build
-#  \Code           - This folder contains the source code or solutions you want to build
-#
-Properties {
-	$build_dir = Split-Path $psake.build_script_file	
-	$build_artifacts_dir = "$build_dir\..\BuildArtifacts\"
-	$code_dir = "$build_dir\..\Code"
-}
-
-FormatTaskName (("-"*25) + "[{0}]" + ("-"*25))
-
-Task Default -Depends BuildHelloWorld
-
-Task BuildHelloWorld -Depends Clean, Build
-
-Task Build -Depends Clean {	
-	Write-Host "Building helloworld.sln" -ForegroundColor Green
-	Exec { msbuild "$code_dir\helloworld\helloworld.sln" /t:Build /p:Configuration=Release /v:quiet /p:OutDir=$build_artifacts_dir } 
-}
-
-Task Clean {
-	Write-Host "Creating BuildArtifacts directory" -ForegroundColor Green
-	if (Test-Path $build_artifacts_dir) 
-	{	
-		rd $build_artifacts_dir -rec -force | out-null
-	}
-	
-	mkdir $build_artifacts_dir | out-null
-	
-	Write-Host "Cleaning helloworld.sln" -ForegroundColor Green
-	Exec { msbuild "$code_dir\helloworld\helloworld.sln" /t:Clean /p:Configuration=Release /v:quiet } 
-}
-
-

-Here's a helper script "run-build.ps1" that I use to load the psake module and execute the build: -

-
-$scriptPath = Split-Path $MyInvocation.InvocationName
-Import-Module (join-path $scriptPath psake.psm1)
-invoke-psake -framework '4.0'
-
-

I run the build in powershell by just running the script:

-
-PS > .\run-build.ps1
-
-

-The output from running the above build: -

-
--------------------------[Clean]-------------------------
-Creating BuildArtifacts directory
-Cleaning helloworld.sln
-Microsoft (R) Build Engine Version 4.0.30319.1
-[Microsoft .NET Framework, Version 4.0.30319.1]
-Copyright (C) Microsoft Corporation 2007. All rights reserved.
-
--------------------------[Build]-------------------------
-Building helloworld.sln
-Microsoft (R) Build Engine Version 4.0.30319.1
-[Microsoft .NET Framework, Version 4.0.30319.1]
-Copyright (C) Microsoft Corporation 2007. All rights reserved.
-
-
-Build Succeeded!
-
-----------------------------------------------------------------------
-Build Time Report
-----------------------------------------------------------------------
-Name            Duration
-----            --------
-Clean           00:00:09.4624557
-Build           00:00:12.2191711
-BuildHelloWorld 00:00:21.6931903
-Total:          00:00:21.8308190
-
\ No newline at end of file diff --git a/build/psake/docs/getting-help.md b/build/psake/docs/getting-help.md deleted file mode 100644 index d2d7fcf..0000000 --- a/build/psake/docs/getting-help.md +++ /dev/null @@ -1,60 +0,0 @@ -You can read this faq for help on how to use psake. - -You can also use the powershell command-let get-help on the *Invoke-psake* function to get more detailed help. - -
-# First import the psake.psm1 file 
-
-Import-Module .\psake.psm1
-
-Get-Help Invoke-psake -full
-
- -To list functions available in the psake module: - -
-C:\Software\psake> Get-Command -module psake
-
-CommandType     Name                                                          Definition
------------     ----                                                          ----------
-Function        Assert                                                        ...
-Function        Exec                                                          ...
-Function        FormatTaskName                                                ...
-Function        Include                                                       ...
-Function        Invoke-psake                                                  ...
-Function        Properties                                                    ...
-Function        Task                                                          ...
-Function        TaskSetup                                                     ...
-Function        TaskTearDown                                                  ...
-
-
- -To Get example usage for individual functions in the psake powershell module, use Get-Help, For example: - -
-
-C:\Software\psake> Get-Help Assert -examples
-
-NAME
-    Assert
-
-SYNOPSIS
-    Helper function for "Design by Contract" assertion checking.
-
-    -------------------------- EXAMPLE 1 --------------------------
-
-    C:\PS>Assert $false "This always throws an exception"
-
-
-    This example always throws an exception
-
-
-
-
-    -------------------------- EXAMPLE 2 --------------------------
-
-    C:\PS>Assert ( ($i % 2) -eq 0 ) "%i is not an even number"
-
-
-    This exmaple may throw an exception if $i is not an even number
-
\ No newline at end of file diff --git a/build/psake/docs/how-does-psake-work.md b/build/psake/docs/how-does-psake-work.md deleted file mode 100644 index 94bc5a2..0000000 --- a/build/psake/docs/how-does-psake-work.md +++ /dev/null @@ -1,22 +0,0 @@ -

**psake** is a domain specific language to create builds using a dependency pattern just like Ant, NAnt, Rake or MSBuild. - -You create a build script using PowerShell that consists of _Tasks_ which are simply function calls. Each _Task_ function can define dependencies on other _Task_ functions. - -In the example script below, Task _Compile_ depends on Tasks _Clean_ and _Init_, which means that before Task _Compile_ can execute, both tasks _Clean_ and _Init_ have to execute. psake ensures that this is done. -

-
-Task Compile -Depends Init,Clean {
-   "compile"
-}
-
-Task Clean -Depends Init {
-   "clean"
-}
-
-Task Init {
-   "init"
-}
-
-

-psake reads in your build script and executes the _Task_ functions that are defined within it and enforces the dependencies between tasks. The great thing about psake is that it is written in PowerShell and that means you have the power of .NET and all the features of PowerShell at your disposal within your build script. Not to mention that you don't have to pay the *XML* bracket tax anymore. -

diff --git a/build/psake/docs/how-to-fail-a-build.md b/build/psake/docs/how-to-fail-a-build.md deleted file mode 100644 index 549da3a..0000000 --- a/build/psake/docs/how-to-fail-a-build.md +++ /dev/null @@ -1,56 +0,0 @@ -

-When you run a command-line program, you need to check the $lastexitcode PowerShell variable to determine if the command-line program failed. If the $lastexitcode is non-zero that usually indicates a failure condition and you should throw a PowerShell exception so that your build script will fail appropriately. - -Here is an example: -

-
-task default -depends TaskA
-
-task TaskA {
-  #use cmd.exe and the DOS exit() function to simulate a failed command-line execution
-  "Executing command-line program"
-  cmd /c exit (1) 
-}
-
-

-The output from the above build script: -

-
-Executing task: TaskA
-Executing command-line program
-
-Build Succeeded!
-
-----------------------------------------------------------------------
-Build Time Report
-----------------------------------------------------------------------
-Name   Duration
-----   --------
-TaskA  00:00:00.1059589
-Total: 00:00:00.2233691
-
-

-The above build script will always succeed, even though we know the build should have failed - -Here is an example that does fail correctly: -

-
-task default -depends TaskA
-
-task TaskA {
-  #use cmd.exe and the DOS exit() function to simulate a failed command-line execution
-  "Executing command-line program"
-  cmd /c exit (1) 
-  if ($lastexitcode -ne 0)
-  {
-    throw "Comand-line program failed"
-  }
-}
-
-

-A simpler option is to use the psake "exec" function to execute command-line programs - -The following is an example: -

-
-task default -depends TaskA
diff --git a/build/psake/docs/hudson.md b/build/psake/docs/hudson.md
deleted file mode 100644
index 6c7d411..0000000
--- a/build/psake/docs/hudson.md
+++ /dev/null
@@ -1,45 +0,0 @@
-

-"Hudson":http://hudson-ci.org/ is a popular continuous integration server, it can be used to run pretty much any kind of build. To have Hudson run your psake build script you just need to create a Hudson job that will launch PowerShell with a parameter that is a PowerShell helper script that will in turn load the psake.psm1 module and then call the Invoke-psake function. You can use the psake.ps1 helper script but you will need to modify it so that the $psake.use_exit_on_error is set to $true. - -Here's the modified psake.ps1 file -

-
-# Helper script for those who want to run psake without importing the module.
-# Example:
-# .\psake.ps1 "default.ps1" "BuildHelloWord" "4.0" 
-
-# Must match parameter definitions for psake.psm1/invoke-psake 
-# otherwise named parameter binding fails
-param(
-  [Parameter(Position=0,Mandatory=0)]
-  [string]$buildFile = 'default.ps1',
-  [Parameter(Position=1,Mandatory=0)]
-  [string[]]$taskList = @(),
-  [Parameter(Position=2,Mandatory=0)]
-  [string]$framework = '3.5',
-  [Parameter(Position=3,Mandatory=0)]
-  [switch]$docs = $false,
-  [Parameter(Position=4,Mandatory=0)]
-  [System.Collections.Hashtable]$parameters = @{},
-  [Parameter(Position=5, Mandatory=0)]
-  [System.Collections.Hashtable]$properties = @{}
-)
-
-try {
-  $scriptPath = Split-Path $script:MyInvocation.MyCommand.Path
-  import-module (join-path $scriptPath psake.psm1)
-  $psake.use_exit_on_error = $true
-  invoke-psake $buildFile $taskList $framework $docs $parameters $properties
-} finally {
-  remove-module psake -ea 'SilentlyContinue'
-}
-
-

-Configure Hudson to call PowerShell passing in the helper script as a parameter: -

-
-powershell.exe "& 'psake.ps1 default.ps1'"
-
-

-I've written a blog "post":http://matosjorge.spaces.live.com/blog/cns!2E0DA1D30B684DA8!710.entry that shows how to do this without using a helper script. It uses a Hudson PowerShell plug-in that allows you to enter PowerShell commands directly into the Hudson job configuration. -

\ No newline at end of file diff --git a/build/psake/docs/index.md b/build/psake/docs/index.md deleted file mode 100644 index 7d8613d..0000000 --- a/build/psake/docs/index.md +++ /dev/null @@ -1,3 +0,0 @@ -*psake* is a build automation tool written in PowerShell. It avoids the angle-bracket tax associated with executable XML by leveraging the PowerShell syntax in your build scripts. psake has a syntax inspired by rake (aka make in Ruby) and bake (aka make in Boo), but is easier to script because it leverages your existent command-line knowledge. - -psake is pronounced sake - as in Japanese rice wine. It does NOT rhyme with make, bake, or rake. diff --git a/build/psake/docs/logging-errors.md b/build/psake/docs/logging-errors.md deleted file mode 100644 index e231002..0000000 --- a/build/psake/docs/logging-errors.md +++ /dev/null @@ -1,72 +0,0 @@ -

-The latest version of *psake* no longer provides a way to log errors to a file. Most builds are executed by a continuous integration server which already logs all console output so it's redundant to provide that same functionality in psake. If an error does occur detailed error information is emitted to the console so that it will get saved by whatever CI server is running psake. - -Here is an example of an error from a psake build script: -

-
-----------------------------------------------------------------------
-4/25/2010 2:36:21 PM: An Error Occurred. See Error Details Below: 
-----------------------------------------------------------------------
-ErrorRecord
-PSMessageDetails      : 
-Exception             : System.Management.Automation.RuntimeException: This is a test
-TargetObject          : This is a test
-CategoryInfo          : OperationStopped: (This is a test:String) [], RuntimeException
-FullyQualifiedErrorId : This is a test
-ErrorDetails          : 
-InvocationInfo        : System.Management.Automation.InvocationInfo
-PipelineIterationInfo : {}
-
-ErrorRecord.InvocationInfo
-MyCommand        : 
-BoundParameters  : {}
-UnboundArguments : {}
-ScriptLineNumber : 4
-OffsetInLine     : 7
-HistoryId        : 34
-ScriptName       : C:\Users\Daddy\Documents\Projects\helloworld\Build\LogError.ps1
-Line             :     throw "This is a test"
-PositionMessage  : 
-                   At C:\Users\Daddy\Documents\Projects\helloworld\Build\LogError.ps1:4 char:7
-                   +     throw <<<<  "This is a test"
-InvocationName   : throw
-PipelineLength   : 0
-PipelinePosition : 0
-ExpectingInput   : False
-CommandOrigin    : Internal
-
-Exception
-0000000000000000000000000000000000000000000000000000000000000000000000
-ErrorRecord                 : This is a test
-StackTrace                  : 
-WasThrownFromThrowStatement : True
-Message                     : This is a test
-Data                        : {}
-InnerException              : 
-TargetSite                  : 
-HelpLink                    : 
-Source                      : 
-
-----------------------------------------------------------------------
-Script Variables
-----------------------------------------------------------------------
-
-Name                           Value                                                                                                         
-----                           -----                                                                                                         
-_                                                                                                                                            
-args                           {}                                                                                                            
-context                        {System.Collections.Hashtable}                                                                                
-Error                          {}                                                                                                            
-false                          False                                                                                                         
-input                          System.Collections.ArrayList+ArrayListEnumeratorSimple                                                        
-MaximumAliasCount              4096                                                                                                          
-MaximumDriveCount              4096                                                                                                          
-MaximumErrorCount              256                                                                                                           
-MaximumFunctionCount           4096                                                                                                          
-MaximumVariableCount           4096                                                                                                          
-MyInvocation                   System.Management.Automation.InvocationInfo                                                                   
-null                                                                                                                                         
-psake                          {build_script_file, version, default_build_file_name, use_exit_on_error...}                                   
-this                                                                                                                                         
-true                           True              
-
\ No newline at end of file diff --git a/build/psake/docs/nested-build.md b/build/psake/docs/nested-build.md deleted file mode 100644 index 040f940..0000000 --- a/build/psake/docs/nested-build.md +++ /dev/null @@ -1,24 +0,0 @@ -

-Yes, the Invoke-psake function can be called recursively from within a "task" function - -The following is an example build script that has tasks that call the invoke-psake function to run other build scripts. -

-
-Properties {
-	$x = 1
-}
-
-Task default -Depends RunNested1, RunNested2, CheckX
-
-Task RunNested1 {
-	Invoke-psake .\nested\nested1.ps1
-}
-
-Task RunNested2 {
-	Invoke-psake .\nested\nested2.ps1
-}
-
-Task CheckX{
-	Assert ($x -eq 1) '$x was not 1' 
-}
-
\ No newline at end of file diff --git a/build/psake/docs/pass-parameters.md b/build/psake/docs/pass-parameters.md deleted file mode 100644 index a3fccd6..0000000 --- a/build/psake/docs/pass-parameters.md +++ /dev/null @@ -1,20 +0,0 @@ -

You can pass parameters to your build script using the "parameters" parameter of the Invoke-psake function. The following is an example:

-
- C:\PS>Invoke-psake .\parameters.ps1 -parameters @{"p1"="v1";"p2"="v2"}
-
-

-The example above runs the build script called "parameters.ps1" and passes in parameters 'p1' and 'p2' with values 'v1' and 'v2'. The parameter value for the "parameters" parameter (say that 10 times really fast!) is a PowerShell hashtable where the name and value of each parameter is specified. Note: You don't need to use the "$" character when specifying the parameter names in the hashtable. - -The "parameters.ps1" build script looks like this: -

-
-properties {
-  $my_property = $p1 + $p2
-}
-
-task default -depends TestParams
-
-task TestParams { 
-  Assert ($my_property -ne $null) '$my_property should not be null'  
-}
-
\ No newline at end of file diff --git a/build/psake/docs/print-psake-task-name.md b/build/psake/docs/print-psake-task-name.md deleted file mode 100644 index 133a997..0000000 --- a/build/psake/docs/print-psake-task-name.md +++ /dev/null @@ -1,73 +0,0 @@ -

-Use the psake *FormatTaskName* function. This function takes either a string which represents a format string (formats using the -f format operator see "help about_operators") or it can accept a script block that has a single parameter that is the name of the task that will be executed. - -Here is an example using the format string parameter of the *FormatTaskName* parameter: -

-
-Task default -depends TaskA, TaskB, TaskC
-
-FormatTaskName "-------- {0} --------"
-
-Task TaskA {
-  "TaskA is executing"  
-}
-
-Task TaskB {
-  "TaskB is executing"  
-}
-
-Task TaskC {
-  "TaskC is executing"  
-}
-
-

-The output looks like the following: -

-
--------- TaskA --------
-TaskA is executing
--------- TaskB --------
-TaskB is executing
--------- TaskC --------
-TaskC is executing
-
-Build Succeeded!
-
-----------------------------------------------------------------------
-Build Time Report
-----------------------------------------------------------------------
-Name   Duration
-----   --------
-TaskA  00:00:00.0058887
-TaskB  00:00:00.0057582
-TaskC  00:00:00.0043072
-Total: 00:00:00.1919297
-
-

-The following example uses the scriptblock parameter of the *FormatTaskName* function: -

-
-Task default -depends TaskA, TaskB, TaskC
-
-FormatTaskName {
-   param($taskName)
-   write-host "Executing Task: $taskName" -foregroundcolor blue
-}
-
-Task TaskA {
-  "TaskA is executing"  
-}
-
-Task TaskB {
-  "TaskB is executing"  
-}
-
-Task TaskC {
-  "TaskC is executing"  
-}
-
-

-The preceding example uses the scriptblock parameter to the FormatTaskName function to render each task name in the color blue. - -Note: the $taskName parameter is arbitrary it could be named anything -

\ No newline at end of file diff --git a/build/psake/docs/property-overrides.md b/build/psake/docs/property-overrides.md deleted file mode 100644 index 20020c8..0000000 --- a/build/psake/docs/property-overrides.md +++ /dev/null @@ -1,34 +0,0 @@ -

You can override a property in your build script using the "properties" parameter of the Invoke-psake function. The following is an example:

-
-C:\PS>Invoke-psake .\properties.ps1 -properties @{"x"="1";"y"="2"}
-
-

-The example above runs the build script called "properties.ps1" and passes in parameters 'x' and 'y' with values '1' and '2'. The parameter value for the "properties" parameter is a PowerShell hashtable where the name and value of each property is specified. Note: You don't need to use the "$" character when specifying the property names in the hashtable. - -The "properties.ps1" build script looks like this: -

-
-properties {
-	$x = $null
-	$y = $null
-	$z = $null
-}
-
-task default -depends TestProperties
-
-task TestProperties { 
-  Assert ($x -ne $null) "x should not be null"
-  Assert ($y -ne $null) "y should not be null"
-  Assert ($z -eq $null) "z should be null"
-}
-
-

-The value of $x should be 1 and $y should be 2 by the time the "TestProperties" task is executed. The value of $z was not over-ridden so it should still be $null. -

-

-To summarize the differences between passing parameters and properties to the Invoke-psake function: -

-
public class DOTA2Econ : IDOTA2Econ { - private ISteamWebInterface dota2WebInterface; - private ISteamWebInterface dota2TestWebInterface; + private readonly ISteamWebInterface dota2WebInterface; + private readonly ISteamWebInterface dota2TestWebInterface; + private readonly IMapper mapper; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public DOTA2Econ(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public DOTA2Econ(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { + this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); + this.dota2WebInterface = steamWebInterface == null ? new SteamWebInterface("IEconDOTA2_570", steamWebRequest) : steamWebInterface; @@ -41,7 +44,7 @@ public DOTA2Econ(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebIn var steamWebResponse = await dota2WebInterface.GetAsync("GetGameItems", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map, ISteamWebResponse>>(steamWebResponse); + var steamWebResponseModel = mapper.Map, ISteamWebResponse>>(steamWebResponse); return steamWebResponseModel; } @@ -63,7 +66,7 @@ public DOTA2Econ(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebIn var steamWebResponse = await dota2WebInterface.GetAsync("GetHeroes", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map, ISteamWebResponse>>(steamWebResponse); + var steamWebResponseModel = mapper.Map, ISteamWebResponse>>(steamWebResponse); return steamWebResponseModel; } @@ -81,7 +84,7 @@ public DOTA2Econ(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebIn var steamWebResponse = await dota2WebInterface.GetAsync("GetRarities", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map, ISteamWebResponse>>(steamWebResponse); + var steamWebResponseModel = mapper.Map, ISteamWebResponse>>(steamWebResponse); return steamWebResponseModel; } @@ -99,7 +102,7 @@ public async Task> GetTournamentPrizePoolAsync(uint? lea var steamWebResponse = await dota2WebInterface.GetAsync("GetTournamentPrizePool", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map, ISteamWebResponse>(steamWebResponse); + var steamWebResponseModel = mapper.Map, ISteamWebResponse>(steamWebResponse); return steamWebResponseModel; } @@ -124,7 +127,7 @@ public async Task> GetItemIconPathAsync(string iconNam var steamWebResponse = await dota2TestWebInterface.GetAsync("GetItemIconPath", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map, ISteamWebResponse>(steamWebResponse); + var steamWebResponseModel = mapper.Map, ISteamWebResponse>(steamWebResponse); return steamWebResponseModel; } diff --git a/src/SteamWebAPI2/Interfaces/DOTA2Match.cs b/src/SteamWebAPI2/Interfaces/DOTA2Match.cs index 5b00136..a22a9ae 100644 --- a/src/SteamWebAPI2/Interfaces/DOTA2Match.cs +++ b/src/SteamWebAPI2/Interfaces/DOTA2Match.cs @@ -1,6 +1,8 @@ -using Steam.Models.DOTA2; +using AutoMapper; +using Steam.Models.DOTA2; using SteamWebAPI2.Models.DOTA2; using SteamWebAPI2.Utilities; +using System; using System.Collections.Generic; using System.Threading.Tasks; @@ -8,14 +10,17 @@ namespace SteamWebAPI2.Interfaces { public class DOTA2Match : IDOTA2Match { - private ISteamWebInterface steamWebInterface; + private readonly IMapper mapper; + private readonly ISteamWebInterface steamWebInterface; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public DOTA2Match(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public DOTA2Match(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { + this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); + this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("IDOTA2Match_570", steamWebRequest) : steamWebInterface; @@ -36,7 +41,7 @@ public async Task>> G var steamWebResponse = await steamWebInterface.GetAsync("GetLiveLeagueGames", 1); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map, ISteamWebResponse>>(steamWebResponse); + var steamWebResponseModel = mapper.Map, ISteamWebResponse>>(steamWebResponse); return steamWebResponseModel; } @@ -54,7 +59,7 @@ public async Task> GetMatchDetailsAsync(ulon var steamWebResponse = await steamWebInterface.GetAsync("GetMatchDetails", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map, ISteamWebResponse>(steamWebResponse); + var steamWebResponseModel = mapper.Map, ISteamWebResponse>(steamWebResponse); return steamWebResponseModel; } @@ -90,7 +95,7 @@ public async Task> GetMatchHistoryAsync(uin var steamWebResponse = await steamWebInterface.GetAsync("GetMatchHistory", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map, ISteamWebResponse>(steamWebResponse); + var steamWebResponseModel = mapper.Map, ISteamWebResponse>(steamWebResponse); return steamWebResponseModel; } @@ -110,7 +115,7 @@ public async Task> var steamWebResponse = await steamWebInterface.GetAsync("GetMatchHistoryBySequenceNum", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>>(steamWebResponse); @@ -132,7 +137,7 @@ public async Task> var steamWebResponse = await steamWebInterface.GetAsync("GetTeamInfoByTeamID", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map, ISteamWebResponse>>(steamWebResponse); + var steamWebResponseModel = mapper.Map, ISteamWebResponse>>(steamWebResponse); return steamWebResponseModel; } diff --git a/src/SteamWebAPI2/Interfaces/DOTA2Ticket.cs b/src/SteamWebAPI2/Interfaces/DOTA2Ticket.cs index 5e2140e..2e7cbfe 100644 --- a/src/SteamWebAPI2/Interfaces/DOTA2Ticket.cs +++ b/src/SteamWebAPI2/Interfaces/DOTA2Ticket.cs @@ -1,17 +1,22 @@ -using SteamWebAPI2.Utilities; +using System; +using AutoMapper; +using SteamWebAPI2.Utilities; namespace SteamWebAPI2.Interfaces { public class DOTA2Ticket : IDOTA2Ticket { - private ISteamWebInterface steamWebInterface; + private readonly IMapper mapper; + private readonly ISteamWebInterface steamWebInterface; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public DOTA2Ticket(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public DOTA2Ticket(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { + this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); + this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("IDOTA2Ticket_570", steamWebRequest) : steamWebInterface; diff --git a/src/SteamWebAPI2/Interfaces/EconItems.cs b/src/SteamWebAPI2/Interfaces/EconItems.cs index 98b8440..2a8652e 100644 --- a/src/SteamWebAPI2/Interfaces/EconItems.cs +++ b/src/SteamWebAPI2/Interfaces/EconItems.cs @@ -1,4 +1,5 @@ -using Steam.Models.GameEconomy; +using AutoMapper; +using Steam.Models.GameEconomy; using SteamWebAPI2.Models.GameEconomy; using SteamWebAPI2.Utilities; using System; @@ -9,6 +10,9 @@ namespace SteamWebAPI2.Interfaces { public class EconItems : IEconItems { + private readonly ISteamWebInterface steamWebInterface; + private readonly IMapper mapper; + private uint appId; // The API only exposes certain methods for certain App Ids in the EconItems interface @@ -18,14 +22,14 @@ public class EconItems : IEconItems private List validStoreMetaDataAppIds = new List(); private List validStoreStatusAppIds = new List(); - private ISteamWebInterface steamWebInterface; - /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public EconItems(ISteamWebRequest steamWebRequest, AppId appId, ISteamWebInterface steamWebInterface = null) + public EconItems(IMapper mapper, ISteamWebRequest steamWebRequest, AppId appId, ISteamWebInterface steamWebInterface = null) { + this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); + if (appId <= 0) { throw new ArgumentOutOfRangeException("appId"); @@ -67,7 +71,7 @@ public async Task> GetPlayerItemsAsync(ul var steamWebResponse = await steamWebInterface.GetAsync("GetPlayerItems", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map, ISteamWebResponse>(steamWebResponse); + var steamWebResponseModel = mapper.Map, ISteamWebResponse>(steamWebResponse); return steamWebResponseModel; } @@ -127,7 +131,7 @@ public async Task> GetSchemaUrlAsync() var steamWebResponse = await steamWebInterface.GetAsync("GetSchemaURL", 1); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map, ISteamWebResponse>(steamWebResponse); + var steamWebResponseModel = mapper.Map, ISteamWebResponse>(steamWebResponse); return steamWebResponseModel; } @@ -150,7 +154,7 @@ public async Task> GetStoreMetaDataAsync(s var steamWebResponse = await steamWebInterface.GetAsync("GetStoreMetaData", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map, ISteamWebResponse>(steamWebResponse); + var steamWebResponseModel = mapper.Map, ISteamWebResponse>(steamWebResponse); return steamWebResponseModel; } @@ -168,7 +172,7 @@ public async Task> GetStoreStatusAsync() var steamWebResponse = await steamWebInterface.GetAsync("GetStoreStatus", 1); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map, ISteamWebResponse>(steamWebResponse); + var steamWebResponseModel = mapper.Map, ISteamWebResponse>(steamWebResponse); return steamWebResponseModel; } diff --git a/src/SteamWebAPI2/Interfaces/EconService.cs b/src/SteamWebAPI2/Interfaces/EconService.cs index b0595ee..f3cebb3 100644 --- a/src/SteamWebAPI2/Interfaces/EconService.cs +++ b/src/SteamWebAPI2/Interfaces/EconService.cs @@ -1,4 +1,5 @@ -using Steam.Models.SteamEconomy; +using AutoMapper; +using Steam.Models.SteamEconomy; using SteamWebAPI2.Models.SteamEconomy; using SteamWebAPI2.Utilities; using System; @@ -9,14 +10,17 @@ namespace SteamWebAPI2.Interfaces { public class EconService : IEconService { - private ISteamWebInterface steamWebInterface; + private readonly ISteamWebInterface steamWebInterface; + private readonly IMapper mapper; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public EconService(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public EconService(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { + this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); + this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("IEconService", steamWebRequest) : steamWebInterface; @@ -61,7 +65,7 @@ public async Task> GetTradeHistoryAsync( var steamWebResponse = await steamWebInterface.GetAsync("GetTradeHistory", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>(steamWebResponse); @@ -107,7 +111,7 @@ public async Task> GetTradeOffersAsync var steamWebResponse = await steamWebInterface.GetAsync("GetTradeOffers", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>(steamWebResponse); @@ -133,7 +137,7 @@ public async Task> GetTradeOfferAsync( var steamWebResponse = await steamWebInterface.GetAsync("GetTradeOffer", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>(steamWebResponse); @@ -185,7 +189,7 @@ public async Task> GetTradeHold parameters.AddIfHasValue(tradeOfferAccessToken, "trade_offer_access_token"); var steamWebResponse = await steamWebInterface.GetAsync("GetTradeHoldDurations", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>(steamWebResponse); diff --git a/src/SteamWebAPI2/Interfaces/GCVersion.cs b/src/SteamWebAPI2/Interfaces/GCVersion.cs index d4e0bd1..f7f0723 100644 --- a/src/SteamWebAPI2/Interfaces/GCVersion.cs +++ b/src/SteamWebAPI2/Interfaces/GCVersion.cs @@ -1,4 +1,5 @@ -using Steam.Models; +using AutoMapper; +using Steam.Models; using SteamWebAPI2.Models; using SteamWebAPI2.Utilities; using System; @@ -9,22 +10,24 @@ namespace SteamWebAPI2.Interfaces { public class GCVersion : IGCVersion { + private readonly ISteamWebInterface steamWebInterface; + private readonly IMapper mapper; + private uint appId; // The API only exposes certain methods for certain App Ids in the EconItems interface // I'm hard coding the values for now until I come up with a better, more dynamic solution private List validClientVersionAppIds = new List(); - private List validServerVersionAppIds = new List(); - private ISteamWebInterface steamWebInterface; - /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public GCVersion(ISteamWebRequest steamWebRequest, AppId appId, ISteamWebInterface steamWebInterface = null) + public GCVersion(IMapper mapper, ISteamWebRequest steamWebRequest, AppId appId, ISteamWebInterface steamWebInterface = null) { + this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); + this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("IGCVersion_" + (uint)appId, steamWebRequest) : steamWebInterface; @@ -61,7 +64,7 @@ public async Task> GetClientVersionAsyn var steamWebResponse = await steamWebInterface.GetAsync("GetClientVersion", 1); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map, ISteamWebResponse>(steamWebResponse); + var steamWebResponseModel = mapper.Map, ISteamWebResponse>(steamWebResponse); return steamWebResponseModel; } @@ -79,7 +82,7 @@ public async Task> GetServerVersionAsyn var steamWebResponse = await steamWebInterface.GetAsync("GetServerVersion", 1); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map, ISteamWebResponse>(steamWebResponse); + var steamWebResponseModel = mapper.Map, ISteamWebResponse>(steamWebResponse); return steamWebResponseModel; } diff --git a/src/SteamWebAPI2/Interfaces/GameServersService.cs b/src/SteamWebAPI2/Interfaces/GameServersService.cs index c8bdcfc..e45bcbb 100644 --- a/src/SteamWebAPI2/Interfaces/GameServersService.cs +++ b/src/SteamWebAPI2/Interfaces/GameServersService.cs @@ -1,6 +1,8 @@ -using Steam.Models.GameServers; +using AutoMapper; +using Steam.Models.GameServers; using SteamWebAPI2.Models.GameServers; using SteamWebAPI2.Utilities; +using System; using System.Collections.Generic; using System.Threading.Tasks; @@ -8,14 +10,17 @@ namespace SteamWebAPI2.Interfaces { public class GameServersService : IGameServersService { - private ISteamWebInterface steamWebInterface; + private readonly ISteamWebInterface steamWebInterface; + private readonly IMapper mapper; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public GameServersService(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public GameServersService(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { + this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); + this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("IGameServersService", steamWebRequest) : steamWebInterface; @@ -27,7 +32,7 @@ public GameServersService(ISteamWebRequest steamWebRequest, ISteamWebInterface s public async Task> GetAccountListAsync() { var steamWebResponse = await steamWebInterface.GetAsync("GetAccountList", 1); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>(steamWebResponse); return steamWebResponseModel; @@ -46,7 +51,7 @@ public async Task> CreateAccountAsync(AppI var steamWebResponse = await steamWebInterface.PostAsync("CreateAccount", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>(steamWebResponse); @@ -77,7 +82,7 @@ public async Task> ResetLoginTokenAsync(ulong steamId) List parameters = new List(); parameters.AddIfHasValue(steamId, "steamid"); var steamWebResponse = await steamWebInterface.PostAsync("ResetLoginToken", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>(steamWebResponse); return steamWebResponseModel; @@ -103,7 +108,7 @@ public async Task> GetAccountPublicInf List parameters = new List(); parameters.AddIfHasValue(steamId, "steamid"); var steamWebResponse = await steamWebInterface.GetAsync("GetAccountPublicInfo", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>(steamWebResponse); return steamWebResponseModel; @@ -114,7 +119,7 @@ public async Task> QueryLoginTokenAsync( List parameters = new List(); parameters.AddIfHasValue(loginToken, "login_token"); var steamWebResponse = await steamWebInterface.GetAsync("QueryLoginToken", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>(steamWebResponse); return steamWebResponseModel; diff --git a/src/SteamWebAPI2/Interfaces/PlayerService.cs b/src/SteamWebAPI2/Interfaces/PlayerService.cs index 2b1071e..39bfb09 100644 --- a/src/SteamWebAPI2/Interfaces/PlayerService.cs +++ b/src/SteamWebAPI2/Interfaces/PlayerService.cs @@ -1,8 +1,10 @@ -using Newtonsoft.Json; +using AutoMapper; +using Newtonsoft.Json; using Steam.Models.SteamCommunity; using SteamWebAPI2.Models.SteamCommunity; using SteamWebAPI2.Models.SteamPlayer; using SteamWebAPI2.Utilities; +using System; using System.Collections.Generic; using System.Net; using System.Threading.Tasks; @@ -11,14 +13,17 @@ namespace SteamWebAPI2.Interfaces { public class PlayerService : IPlayerService { - private ISteamWebInterface steamWebInterface; + private readonly ISteamWebInterface steamWebInterface; + private readonly IMapper mapper; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public PlayerService(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public PlayerService(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { + this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); + this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("IPlayerService", steamWebRequest) : steamWebInterface; @@ -44,7 +49,7 @@ public PlayerService(ISteamWebRequest steamWebRequest, ISteamWebInterface steamW return null; } - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>(steamWebResponse); @@ -71,7 +76,7 @@ public async Task>> GetCo return null; } - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>>(steamWebResponse); @@ -96,7 +101,7 @@ public async Task> GetBadgesAsync(ulong ste return null; } - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>(steamWebResponse); @@ -119,7 +124,7 @@ public async Task> GetBadgesAsync(ulong ste return null; } - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>(steamWebResponse); @@ -179,7 +184,7 @@ public async Task> GetOwnedGamesAsync(u } } - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>(steamWebResponse); @@ -203,7 +208,7 @@ public async Task> GetRecently return null; } - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>(steamWebResponse); diff --git a/src/SteamWebAPI2/Interfaces/SteamApps.cs b/src/SteamWebAPI2/Interfaces/SteamApps.cs index c21269f..01daa58 100644 --- a/src/SteamWebAPI2/Interfaces/SteamApps.cs +++ b/src/SteamWebAPI2/Interfaces/SteamApps.cs @@ -1,6 +1,8 @@ -using Steam.Models; +using AutoMapper; +using Steam.Models; using SteamWebAPI2.Models; using SteamWebAPI2.Utilities; +using System; using System.Collections.Generic; using System.Threading.Tasks; @@ -8,14 +10,17 @@ namespace SteamWebAPI2.Interfaces { public class SteamApps : ISteamApps { - private ISteamWebInterface steamWebInterface; + private readonly IMapper mapper; + private readonly ISteamWebInterface steamWebInterface; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public SteamApps(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public SteamApps(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { + this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); + this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("ISteamApps", steamWebRequest) : steamWebInterface; @@ -29,7 +34,7 @@ public async Task>> GetAppL { var steamWebResponse = await steamWebInterface.GetAsync("GetAppList", 2); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>>(steamWebResponse); @@ -51,7 +56,7 @@ public async Task> UpToDateCheckAs var steamWebResponse = await steamWebInterface.GetAsync("UpToDateCheck", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>(steamWebResponse); diff --git a/src/SteamWebAPI2/Interfaces/SteamEconomy.cs b/src/SteamWebAPI2/Interfaces/SteamEconomy.cs index 50a866f..2d2077c 100644 --- a/src/SteamWebAPI2/Interfaces/SteamEconomy.cs +++ b/src/SteamWebAPI2/Interfaces/SteamEconomy.cs @@ -1,6 +1,8 @@ -using Steam.Models.SteamEconomy; +using AutoMapper; +using Steam.Models.SteamEconomy; using SteamWebAPI2.Models.SteamEconomy; using SteamWebAPI2.Utilities; +using System; using System.Collections.Generic; using System.Threading.Tasks; @@ -8,14 +10,17 @@ namespace SteamWebAPI2.Interfaces { public class SteamEconomy : ISteamEconomy { - private ISteamWebInterface steamWebInterface; + private readonly ISteamWebInterface steamWebInterface; + private readonly IMapper mapper; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public SteamEconomy(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public SteamEconomy(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { + this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); + this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("ISteamEconomy", steamWebRequest) : steamWebInterface; @@ -43,7 +48,7 @@ public async Task> GetAssetClassInf var steamWebResponse = await steamWebInterface.GetAsync("GetAssetClassInfo", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>(steamWebResponse); @@ -67,7 +72,7 @@ public async Task> GetAssetPricesAsync( var steamWebResponse = await steamWebInterface.GetAsync("GetAssetPrices", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>(steamWebResponse); diff --git a/src/SteamWebAPI2/Interfaces/SteamNews.cs b/src/SteamWebAPI2/Interfaces/SteamNews.cs index a5ed20e..ee799f6 100644 --- a/src/SteamWebAPI2/Interfaces/SteamNews.cs +++ b/src/SteamWebAPI2/Interfaces/SteamNews.cs @@ -1,4 +1,5 @@ -using Steam.Models; +using AutoMapper; +using Steam.Models; using SteamWebAPI2.Models; using SteamWebAPI2.Utilities; using System; @@ -9,14 +10,17 @@ namespace SteamWebAPI2.Interfaces { public class SteamNews : ISteamNews { - private ISteamWebInterface steamWebInterface; + private readonly ISteamWebInterface steamWebInterface; + private readonly IMapper mapper; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public SteamNews(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public SteamNews(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { + this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); + this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("ISteamNews", steamWebRequest) : steamWebInterface; @@ -48,7 +52,7 @@ public async Task> GetNewsForAppAsync(ui var steamWebResponse = await steamWebInterface.GetAsync("GetNewsForApp", 2, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>(steamWebResponse); diff --git a/src/SteamWebAPI2/Interfaces/SteamRemoteStorage.cs b/src/SteamWebAPI2/Interfaces/SteamRemoteStorage.cs index 4f13dff..5ada500 100644 --- a/src/SteamWebAPI2/Interfaces/SteamRemoteStorage.cs +++ b/src/SteamWebAPI2/Interfaces/SteamRemoteStorage.cs @@ -1,4 +1,5 @@ -using Steam.Models; +using AutoMapper; +using Steam.Models; using SteamWebAPI2.Models; using SteamWebAPI2.Utilities; using System; @@ -12,14 +13,17 @@ namespace SteamWebAPI2.Interfaces { public class SteamRemoteStorage : ISteamRemoteStorage { - private ISteamWebInterface steamWebInterface; + private readonly ISteamWebInterface steamWebInterface; + private readonly IMapper mapper; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public SteamRemoteStorage(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public SteamRemoteStorage(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { + this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); + this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("ISteamRemoteStorage", steamWebRequest) : steamWebInterface; @@ -115,7 +119,7 @@ public async Task> GetUGCFileDetailsAsync { var steamWebResponse = await steamWebInterface.GetAsync("GetUGCFileDetails", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>(steamWebResponse); @@ -139,7 +143,7 @@ private async Task> GetPublishedFileDetailsAsync { var steamWebResponse = await steamWebInterface.PostAsync("GetPublishedFileDetails", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>(steamWebResponse); diff --git a/src/SteamWebAPI2/Interfaces/SteamStore.cs b/src/SteamWebAPI2/Interfaces/SteamStore.cs index 05aa8c8..c014ee3 100644 --- a/src/SteamWebAPI2/Interfaces/SteamStore.cs +++ b/src/SteamWebAPI2/Interfaces/SteamStore.cs @@ -1,4 +1,5 @@ -using Steam.Models.SteamStore; +using AutoMapper; +using Steam.Models.SteamStore; using SteamWebAPI2.Models.SteamStore; using SteamWebAPI2.Utilities; using System.Collections.Generic; @@ -9,11 +10,11 @@ namespace SteamWebAPI2.Interfaces { public class SteamStore : SteamStoreInterface, ISteamStore { - public SteamStore() : base() + public SteamStore(IMapper mapper) : base(mapper) { } - public SteamStore(HttpClient httpClient) : base(httpClient) + public SteamStore(IMapper mapper, HttpClient httpClient) : base(mapper, httpClient) { } @@ -30,7 +31,7 @@ public async Task GetStoreAppDetailsAsync(uint appId) var appDetails = await CallMethodAsync("appdetails", parameters); - var appDetailsModel = AutoMapperConfiguration.Mapper.Map(appDetails.Data); + var appDetailsModel = mapper.Map(appDetails.Data); return appDetailsModel; } @@ -43,7 +44,7 @@ public async Task GetStoreFeaturedCategoriesAsync( { var featuredCategories = await CallMethodAsync("featuredcategories"); - var featuredCategoriesModel = AutoMapperConfiguration.Mapper.Map(featuredCategories); + var featuredCategoriesModel = mapper.Map(featuredCategories); return featuredCategoriesModel; } @@ -56,7 +57,7 @@ public async Task GetStoreFeaturedProductsAsync() { var featuredProducts = await CallMethodAsync("featured"); - var featuredProductsModel = AutoMapperConfiguration.Mapper.Map(featuredProducts); + var featuredProductsModel = mapper.Map(featuredProducts); return featuredProductsModel; } diff --git a/src/SteamWebAPI2/Interfaces/SteamUser.cs b/src/SteamWebAPI2/Interfaces/SteamUser.cs index e15c548..fb19440 100644 --- a/src/SteamWebAPI2/Interfaces/SteamUser.cs +++ b/src/SteamWebAPI2/Interfaces/SteamUser.cs @@ -1,8 +1,10 @@ -using Steam.Models.SteamCommunity; +using AutoMapper; +using Steam.Models.SteamCommunity; using SteamWebAPI2.Exceptions; using SteamWebAPI2.Models.SteamCommunity; using SteamWebAPI2.Models.SteamPlayer; using SteamWebAPI2.Utilities; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -14,14 +16,17 @@ namespace SteamWebAPI2.Interfaces { public class SteamUser : ISteamUser { - private ISteamWebInterface steamWebInterface; + private readonly ISteamWebInterface steamWebInterface; + private readonly IMapper mapper; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public SteamUser(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public SteamUser(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { + this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); + this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("ISteamUser", steamWebRequest) : steamWebInterface; @@ -48,7 +53,7 @@ public async Task> GetPlayerSummaryAsync(u return null; } - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>(steamWebResponse); @@ -73,7 +78,7 @@ public async Task>> Ge return null; } - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>>(steamWebResponse); @@ -94,7 +99,7 @@ public async Task>> GetFriend var steamWebResponse = await steamWebInterface.GetAsync("GetFriendList", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map, ISteamWebResponse>>(steamWebResponse); + var steamWebResponseModel = mapper.Map, ISteamWebResponse>>(steamWebResponse); return steamWebResponseModel; } @@ -125,7 +130,7 @@ public async Task>> GetPl var steamWebResponse = await steamWebInterface.GetAsync("GetPlayerBans", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>>(steamWebResponse); @@ -145,7 +150,7 @@ public async Task>> GetUserGroupsAs var steamWebResponse = await steamWebInterface.GetAsync("GetUserGroupList", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>>(steamWebResponse); @@ -172,7 +177,7 @@ public async Task> ResolveVanityUrlAsync(string vanityU throw new VanityUrlNotResolvedException(ErrorMessages.VanityUrlNotResolved); } - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>(steamWebResponse); @@ -191,7 +196,7 @@ public async Task GetCommunityProfileAsync(ulong ste var profile = DeserializeXML(xml); - var profileModel = AutoMapperConfiguration.Mapper.Map(profile); + var profileModel = mapper.Map(profile); return profileModel; } diff --git a/src/SteamWebAPI2/Interfaces/SteamUserAuth.cs b/src/SteamWebAPI2/Interfaces/SteamUserAuth.cs index c3f7eb5..6f143b2 100644 --- a/src/SteamWebAPI2/Interfaces/SteamUserAuth.cs +++ b/src/SteamWebAPI2/Interfaces/SteamUserAuth.cs @@ -1,4 +1,6 @@ -using SteamWebAPI2.Utilities; +using AutoMapper; +using SteamWebAPI2.Utilities; +using System; using System.Collections.Generic; using System.Threading.Tasks; @@ -6,14 +8,17 @@ namespace SteamWebAPI2.Interfaces { public class SteamUserAuth : ISteamUserAuth { + private readonly IMapper mapper; private ISteamWebInterface steamWebInterface; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public SteamUserAuth(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public SteamUserAuth(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { + this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); + this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("ISteamUserAuth", steamWebRequest) : steamWebInterface; diff --git a/src/SteamWebAPI2/Interfaces/SteamUserStats.cs b/src/SteamWebAPI2/Interfaces/SteamUserStats.cs index 0994daf..be863ac 100644 --- a/src/SteamWebAPI2/Interfaces/SteamUserStats.cs +++ b/src/SteamWebAPI2/Interfaces/SteamUserStats.cs @@ -1,4 +1,5 @@ -using Steam.Models; +using AutoMapper; +using Steam.Models; using Steam.Models.SteamCommunity; using Steam.Models.SteamPlayer; using SteamWebAPI2.Models; @@ -13,14 +14,17 @@ namespace SteamWebAPI2.Interfaces { public class SteamUserStats : ISteamUserStats { - private ISteamWebInterface steamWebInterface; + private readonly ISteamWebInterface steamWebInterface; + private readonly IMapper mapper; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public SteamUserStats(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public SteamUserStats(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { + this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); + this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("ISteamUserStats", steamWebRequest) : steamWebInterface; @@ -38,7 +42,7 @@ public async Task("GetGlobalAchievementPercentagesForApp", 2, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>>(steamWebResponse); @@ -81,7 +85,7 @@ public async Task>> GetGl var steamWebResponse = await steamWebInterface.GetAsync("GetGlobalStatsForGame", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>>(steamWebResponse); @@ -100,7 +104,7 @@ public async Task> GetNumberOfCurrentPlayersForGameAsync var steamWebResponse = await steamWebInterface.GetAsync("GetNumberOfCurrentPlayers", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>(steamWebResponse); @@ -123,7 +127,7 @@ public async Task> GetPlayerAchi var steamWebResponse = await steamWebInterface.GetAsync("GetPlayerAchievements", 1, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>(steamWebResponse); @@ -144,7 +148,7 @@ public async Task> GetSchemaForGameA var steamWebResponse = await steamWebInterface.GetAsync("GetSchemaForGame", 2, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>(steamWebResponse); @@ -165,7 +169,7 @@ public async Task> GetUserStatsFo var steamWebResponse = await steamWebInterface.GetAsync("GetUserStatsForGame", 2, parameters); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>(steamWebResponse); diff --git a/src/SteamWebAPI2/Interfaces/SteamWebAPIUtil.cs b/src/SteamWebAPI2/Interfaces/SteamWebAPIUtil.cs index 4ad59c3..37a9939 100644 --- a/src/SteamWebAPI2/Interfaces/SteamWebAPIUtil.cs +++ b/src/SteamWebAPI2/Interfaces/SteamWebAPIUtil.cs @@ -1,6 +1,8 @@ -using Steam.Models; +using AutoMapper; +using Steam.Models; using SteamWebAPI2.Models; using SteamWebAPI2.Utilities; +using System; using System.Collections.Generic; using System.Threading.Tasks; @@ -8,14 +10,17 @@ namespace SteamWebAPI2.Interfaces { public class SteamWebAPIUtil : ISteamWebAPIUtil { - private ISteamWebInterface steamWebInterface; + private readonly ISteamWebInterface steamWebInterface; + private readonly IMapper mapper; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public SteamWebAPIUtil(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public SteamWebAPIUtil(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { + this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); + this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("ISteamWebAPIUtil", steamWebRequest) : steamWebInterface; @@ -29,7 +34,7 @@ public async Task> GetServerInfoAsync() { var steamServerInfo = await steamWebInterface.GetAsync("GetServerInfo", 1); - var steamServerInfoModel = AutoMapperConfiguration.Mapper.Map< + var steamServerInfoModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>(steamServerInfo); @@ -44,7 +49,7 @@ public async Task>> G { var steamWebResponse = await steamWebInterface.GetAsync("GetSupportedAPIList", 1); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>>(steamWebResponse); diff --git a/src/SteamWebAPI2/Interfaces/TFItems.cs b/src/SteamWebAPI2/Interfaces/TFItems.cs index 55ebd17..5c13535 100644 --- a/src/SteamWebAPI2/Interfaces/TFItems.cs +++ b/src/SteamWebAPI2/Interfaces/TFItems.cs @@ -1,6 +1,8 @@ -using Steam.Models.TF2; +using AutoMapper; +using Steam.Models.TF2; using SteamWebAPI2.Models.TF2; using SteamWebAPI2.Utilities; +using System; using System.Collections.Generic; using System.Threading.Tasks; @@ -8,14 +10,17 @@ namespace SteamWebAPI2.Interfaces { public class TFItems : ITFItems { - private ISteamWebInterface steamWebInterface; + private readonly ISteamWebInterface steamWebInterface; + private readonly IMapper mapper; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public TFItems(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public TFItems(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { + this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); + this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("ITFItems_440", steamWebRequest) : steamWebInterface; @@ -29,7 +34,7 @@ public async Task>> Get { var steamWebResponse = await steamWebInterface.GetAsync("GetGoldenWrenches", 2); - var steamWebResponseModel = AutoMapperConfiguration.Mapper.Map< + var steamWebResponseModel = mapper.Map< ISteamWebResponse, ISteamWebResponse>>(steamWebResponse); diff --git a/src/SteamWebAPI2/Mappings/SteamWebResponseProfile.cs b/src/SteamWebAPI2/Mappings/SteamWebResponseProfile.cs new file mode 100644 index 0000000..ae9ef74 --- /dev/null +++ b/src/SteamWebAPI2/Mappings/SteamWebResponseProfile.cs @@ -0,0 +1,119 @@ +using System.Collections.Generic; +using AutoMapper; +using Steam.Models; +using Steam.Models.CSGO; +using Steam.Models.DOTA2; +using Steam.Models.GameEconomy; +using Steam.Models.GameServers; +using Steam.Models.SteamCommunity; +using Steam.Models.SteamEconomy; +using Steam.Models.SteamPlayer; +using Steam.Models.TF2; +using SteamWebAPI2.Models; +using SteamWebAPI2.Models.CSGO; +using SteamWebAPI2.Models.DOTA2; +using SteamWebAPI2.Models.GameEconomy; +using SteamWebAPI2.Models.GameServers; +using SteamWebAPI2.Models.SteamCommunity; +using SteamWebAPI2.Models.SteamEconomy; +using SteamWebAPI2.Models.SteamPlayer; +using SteamWebAPI2.Models.TF2; +using SteamWebAPI2.Utilities; + +namespace SteamWebAPI2.Mappings +{ + public class SteamWebResponseProfile : Profile + { + public SteamWebResponseProfile() + { + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap>(); + CreateSteamWebResponseMap>(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap>(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap>(); + CreateSteamWebResponseMap>(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap>(); + CreateSteamWebResponseMap>(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap>(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap>(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap>(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap>(); + CreateSteamWebResponseMap>(); + CreateSteamWebResponseMap>(); + CreateSteamWebResponseMap>(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap>(); + CreateSteamWebResponseMap>(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap>(); + CreateSteamWebResponseMap>(); + CreateSteamWebResponseMap>(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap(); + CreateSteamWebResponseMap(); + + } + + private SteamWebResponse ConstructSteamWebResponse(ISteamWebResponse response, ResolutionContext context) + { + if (response == null) + { + return null; + } + + var newResponse = new SteamWebResponse(); + + newResponse.ContentLength = response.ContentLength; + newResponse.ContentType = response.ContentType; + newResponse.ContentTypeCharSet = response.ContentTypeCharSet; + newResponse.Expires = response.Expires; + newResponse.LastModified = response.LastModified; + + if (response.Data != null) + { + newResponse.Data = context.Mapper.Map(response.Data); + } + + return newResponse; + } + + private void CreateSteamWebResponseMap() + { + CreateMap, ISteamWebResponse>() + .ConvertUsing((src, dest, context) => ConstructSteamWebResponse(src, context)); + } + } +} \ No newline at end of file diff --git a/src/SteamWebAPI2/Models/SteamId.cs b/src/SteamWebAPI2/Models/SteamId.cs index d2b7cbe..1e81426 100644 --- a/src/SteamWebAPI2/Models/SteamId.cs +++ b/src/SteamWebAPI2/Models/SteamId.cs @@ -66,7 +66,7 @@ public class SteamId { #region Members - private ISteamWebRequest steamWebRequest; + private ISteamUser steamUser; // Special flags for chat accounts in the high 8 bits of the Steam ID instance. Adopted from https://github.com/xPaw/SteamID.php. //private uint instanceFlagClan = 524288; // (SteamAccountInstanceMask + 1) >> 1 @@ -190,9 +190,9 @@ public SteamId(ulong steamId64) /// you have on hand. ///
/// Required in the event that the Steam Web API is needed to resolve a Profile URL to a 64-bit Steam ID. - public SteamId(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public SteamId(ISteamUser steamUser) { - this.steamWebRequest = steamWebRequest; + this.steamUser = steamUser; } /// @@ -249,8 +249,6 @@ public async Task ResolveAsync(string value) bool isUri = Uri.TryCreate(value, UriKind.Absolute, out uriResult) && (uriResult.Scheme == "http" || uriResult.Scheme == "https"); - SteamUser steamUser = new SteamUser(steamWebRequest); - try { // the caller provided a uri @@ -415,7 +413,7 @@ private uint GetAccountIdFromLegacySteamId(string authServer, string partialAcco /// /// /// - private static async Task ResolveSteamIdFromValueAsync(SteamUser steamUser, string value) + private static async Task ResolveSteamIdFromValueAsync(ISteamUser steamUser, string value) { ulong steamId64 = 0; diff --git a/src/SteamWebAPI2/SteamStoreInterface.cs b/src/SteamWebAPI2/SteamStoreInterface.cs index 66cf781..80783de 100644 --- a/src/SteamWebAPI2/SteamStoreInterface.cs +++ b/src/SteamWebAPI2/SteamStoreInterface.cs @@ -1,4 +1,6 @@ -using SteamWebAPI2.Utilities; +using AutoMapper; +using SteamWebAPI2.Utilities; +using System; using System.Collections.Generic; using System.Diagnostics; using System.Net.Http; @@ -14,25 +16,25 @@ public abstract class SteamStoreInterface private const string steamStoreApiBaseUrl = "http://store.steampowered.com/api/"; private readonly SteamStoreRequest steamStoreRequest; + protected readonly IMapper mapper; + /// /// Constructs and maps the default objects for Steam Store Web API use /// - public SteamStoreInterface() + public SteamStoreInterface(IMapper mapper) { + this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); steamStoreRequest = new SteamStoreRequest(steamStoreApiBaseUrl); - - AutoMapperConfiguration.Initialize(); } /// /// Constructs and maps based on a custom http client /// /// Client to make requests with - public SteamStoreInterface(HttpClient httpClient) + public SteamStoreInterface(IMapper mapper, HttpClient httpClient) { + this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); steamStoreRequest = new SteamStoreRequest(steamStoreApiBaseUrl, httpClient); - - AutoMapperConfiguration.Initialize(); } /// @@ -42,8 +44,6 @@ public SteamStoreInterface(HttpClient httpClient) public SteamStoreInterface(string steamStoreApiBaseUrl) { steamStoreRequest = new SteamStoreRequest(steamStoreApiBaseUrl); - - AutoMapperConfiguration.Initialize(); } /// @@ -54,8 +54,6 @@ public SteamStoreInterface(string steamStoreApiBaseUrl) public SteamStoreInterface(string steamStoreApiBaseUrl, HttpClient httpClient) { steamStoreRequest = new SteamStoreRequest(steamStoreApiBaseUrl, httpClient); - - AutoMapperConfiguration.Initialize(); } /// diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index c92b155..55667e6 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -2,7 +2,7 @@ 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. - 4.2.0 + 4.2.1 Justin Skiles SteamWebAPI2 SteamWebAPI2 @@ -16,6 +16,8 @@ + + @@ -26,7 +28,7 @@ - + diff --git a/src/SteamWebAPI2/Utilities/ISteamWebInterfaceFactory.cs b/src/SteamWebAPI2/Utilities/ISteamWebInterfaceFactory.cs new file mode 100644 index 0000000..3eae8d9 --- /dev/null +++ b/src/SteamWebAPI2/Utilities/ISteamWebInterfaceFactory.cs @@ -0,0 +1,12 @@ +using System.Net.Http; +using SteamWebAPI2.Interfaces; + +namespace SteamWebAPI2.Utilities +{ + public interface ISteamWebInterfaceFactory + { + SteamStore CreateSteamStoreInterface(HttpClient httpClient = null); + T CreateSteamWebInterface(HttpClient httpClient = null); + T CreateSteamWebInterface(AppId appId, HttpClient httpClient = null); + } +} \ No newline at end of file diff --git a/src/SteamWebAPI2/Utilities/ServiceCollectionExtensions.cs b/src/SteamWebAPI2/Utilities/ServiceCollectionExtensions.cs new file mode 100644 index 0000000..4caeba3 --- /dev/null +++ b/src/SteamWebAPI2/Utilities/ServiceCollectionExtensions.cs @@ -0,0 +1,22 @@ +using System; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection.Extensions; + +namespace SteamWebAPI2.Utilities +{ + public static class ServiceCollectionExtensions + { + public static IServiceCollection AddSteamWebInterfaceFactory(this IServiceCollection services, Action options) + { + if (services == null) + { + throw new ArgumentNullException(nameof(services)); + } + + services.TryAdd(ServiceDescriptor.Singleton()); + services.Configure(options); + + return services; + } + } +} \ No newline at end of file diff --git a/src/SteamWebAPI2/Utilities/SteamWebInterface.cs b/src/SteamWebAPI2/Utilities/SteamWebInterface.cs index fa9b1a4..688fcb2 100644 --- a/src/SteamWebAPI2/Utilities/SteamWebInterface.cs +++ b/src/SteamWebAPI2/Utilities/SteamWebInterface.cs @@ -35,8 +35,6 @@ public SteamWebInterface(string interfaceName, ISteamWebRequest steamWebRequest) this.interfaceName = interfaceName; this.steamWebRequest = steamWebRequest; - - AutoMapperConfiguration.Initialize(); } /// diff --git a/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs b/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs index 87ffbfb..cc61068 100644 --- a/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs +++ b/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs @@ -1,32 +1,82 @@ +using AutoMapper; +using Microsoft.Extensions.Options; using SteamWebAPI2.Interfaces; +using SteamWebAPI2.Mappings; using System; using System.Net.Http; namespace SteamWebAPI2.Utilities { - public class SteamWebInterfaceFactory + public class SteamWebInterfaceFactory : ISteamWebInterfaceFactory { private readonly string steamWebApiBaseUrl = "https://api.steampowered.com/"; private readonly string steamWebApiKey; + private readonly IMapper mapper; + + /// + /// Backwards compatible constructor that works with just a Steam Web API key instead of forcing + /// all consumers to use the IOptions constructor with dependency injection. + /// + /// + public SteamWebInterfaceFactory(string steamWebApiKey) + : this(Options.Create(new SteamWebInterfaceFactoryOptions() + { + SteamWebApiKey = steamWebApiKey + }) + ) { } /// /// Factory to create web interface objects to communicate with Steam Web API /// /// Unique Steam Web API key issued to you (do not share this with anyone!) /// Base URL of the Steam Web API (optional) - public SteamWebInterfaceFactory(string steamWebApiKey, string steamWebApiBaseUrl = null) + public SteamWebInterfaceFactory(IOptions options) { - if (string.IsNullOrWhiteSpace(steamWebApiKey)) + if (options == null) + { + throw new ArgumentNullException(nameof(options)); + } + + if (string.IsNullOrWhiteSpace(options.Value.SteamWebApiKey)) { - throw new ArgumentNullException(nameof(steamWebApiKey)); + throw new ArgumentNullException(nameof(options.Value.SteamWebApiKey)); } - this.steamWebApiKey = steamWebApiKey; + this.steamWebApiKey = options.Value.SteamWebApiKey; - if (!string.IsNullOrWhiteSpace(steamWebApiBaseUrl)) + var mapperConfig = new MapperConfiguration(config => { - this.steamWebApiBaseUrl = steamWebApiBaseUrl; + config.AddProfile(); + config.AddProfile(); + config.AddProfile(); + config.AddProfile(); + config.AddProfile(); + config.AddProfile(); + config.AddProfile(); + config.AddProfile(); + config.AddProfile(); + config.AddProfile(); + config.AddProfile(); + config.AddProfile(); + config.AddProfile(); + config.AddProfile(); + config.AddProfile(); + config.AddProfile(); + config.AddProfile(); + config.AddProfile(); + }); + + mapper = mapperConfig.CreateMapper(); + } + + public SteamStore CreateSteamStoreInterface(HttpClient httpClient = null) + { + if(httpClient == null) + { + return new SteamStore(mapper); } + + return new SteamStore(mapper, httpClient); } /// @@ -39,7 +89,7 @@ public SteamWebInterfaceFactory(string steamWebApiKey, string steamWebApiBaseUrl public T CreateSteamWebInterface(HttpClient httpClient = null) { var steamWebRequest = CreateSteamWebRequest(httpClient); - return (T)Activator.CreateInstance(typeof(T), steamWebRequest, null); + return (T)Activator.CreateInstance(typeof(T), mapper, steamWebRequest, null); } /// @@ -53,7 +103,7 @@ public T CreateSteamWebInterface(HttpClient httpClient = null) public T CreateSteamWebInterface(AppId appId, HttpClient httpClient = null) { var steamWebRequest = CreateSteamWebRequest(httpClient); - return (T)Activator.CreateInstance(typeof(T), steamWebRequest, appId, null); + return (T)Activator.CreateInstance(typeof(T), mapper, steamWebRequest, appId, null); } private ISteamWebRequest CreateSteamWebRequest(HttpClient httpClient) diff --git a/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactoryOptions.cs b/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactoryOptions.cs new file mode 100644 index 0000000..9c440ff --- /dev/null +++ b/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactoryOptions.cs @@ -0,0 +1,7 @@ +namespace SteamWebAPI2.Utilities +{ + public class SteamWebInterfaceFactoryOptions + { + public string SteamWebApiKey { get; set; } + } +} \ No newline at end of file From 6da2692aee037041795f34e0ee90618bce92adc9 Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Tue, 5 May 2020 20:44:01 -0400 Subject: [PATCH 062/107] Fixed compile issue with ambiguous constructor --- src/Steam.UnitTests/SteamWebInterfaceFactoryTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Steam.UnitTests/SteamWebInterfaceFactoryTests.cs b/src/Steam.UnitTests/SteamWebInterfaceFactoryTests.cs index fe6b30e..2d21d30 100644 --- a/src/Steam.UnitTests/SteamWebInterfaceFactoryTests.cs +++ b/src/Steam.UnitTests/SteamWebInterfaceFactoryTests.cs @@ -44,7 +44,7 @@ public void Constructor_Should_Fail_If_Empty_Key() [Fact] public void Constructor_Should_Fail_If_Null_Key() { - Assert.Throws(() => new SteamWebInterfaceFactory(null)); + Assert.Throws(() => new SteamWebInterfaceFactory(steamWebApiKey: null)); } [Fact] From f7cbdd40f633e4f51cdb040d5046bc90e6610339 Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Tue, 5 May 2020 20:58:33 -0400 Subject: [PATCH 063/107] Fixed issue with publishe file details and add unit test --- src/Steam.UnitTests/SteamNewsTests.cs | 7 +----- src/Steam.UnitTests/SteamRemoteTests.cs | 25 +++++++++++++++++++ .../Mappings/SteamRemoteStorageProfile.cs | 4 +-- 3 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 src/Steam.UnitTests/SteamRemoteTests.cs diff --git a/src/Steam.UnitTests/SteamNewsTests.cs b/src/Steam.UnitTests/SteamNewsTests.cs index 6ec41aa..a24d121 100644 --- a/src/Steam.UnitTests/SteamNewsTests.cs +++ b/src/Steam.UnitTests/SteamNewsTests.cs @@ -1,10 +1,5 @@ -using Microsoft.Extensions.Configuration; -using SteamWebAPI2.Interfaces; -using SteamWebAPI2.Utilities; -using System; -using System.Collections.Generic; +using SteamWebAPI2.Interfaces; using System.Net.Http; -using System.Text; using System.Threading.Tasks; using Xunit; diff --git a/src/Steam.UnitTests/SteamRemoteTests.cs b/src/Steam.UnitTests/SteamRemoteTests.cs new file mode 100644 index 0000000..b2cae98 --- /dev/null +++ b/src/Steam.UnitTests/SteamRemoteTests.cs @@ -0,0 +1,25 @@ +using SteamWebAPI2.Interfaces; +using System.Net.Http; +using System.Threading.Tasks; +using Xunit; + +namespace Steam.UnitTests +{ + public class SteamRemoteTests : BaseTest + { + private readonly SteamRemoteStorage steamInterface; + + public SteamRemoteTests() + { + steamInterface = factory.CreateSteamWebInterface(new HttpClient()); + } + + [Fact] + public async Task GetPublishedFileDetailsAsync_Should_Succeed() + { + var response = await steamInterface.GetPublishedFileDetailsAsync(1673456286); + Assert.NotNull(response); + Assert.NotNull(response.Data); + } + } +} diff --git a/src/SteamWebAPI2/Mappings/SteamRemoteStorageProfile.cs b/src/SteamWebAPI2/Mappings/SteamRemoteStorageProfile.cs index 2a5cdfc..c3a2e3c 100644 --- a/src/SteamWebAPI2/Mappings/SteamRemoteStorageProfile.cs +++ b/src/SteamWebAPI2/Mappings/SteamRemoteStorageProfile.cs @@ -17,8 +17,8 @@ public SteamRemoteStorageProfile() return (PublishedFileVisibility)src; }); CreateMap() - .ForMember(dest => dest.FileUrl, opts => opts.MapFrom(source => new Uri(source.FileUrl))) - .ForMember(dest => dest.PreviewUrl, opts => opts.MapFrom(source => new Uri(source.PreviewUrl))); + .ForMember(dest => dest.FileUrl, opts => opts.MapFrom(source => !string.IsNullOrWhiteSpace(source.FileUrl) ? new Uri(source.FileUrl) : null)) + .ForMember(dest => dest.PreviewUrl, opts => opts.MapFrom(source => !string.IsNullOrWhiteSpace(source.FileUrl) ? new Uri(source.PreviewUrl) : null)); CreateMap>() .ConvertUsing((src, dest, context) => context.Mapper.Map, IReadOnlyCollection>( From 9de9651da9548214121157d28836dcc6e2711738 Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Tue, 5 May 2020 21:07:16 -0400 Subject: [PATCH 064/107] Rolled to version 4.2.2 --- src/SteamWebAPI2/SteamWebAPI2.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index 55667e6..5fbc5b0 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -2,7 +2,7 @@ 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. - 4.2.1 + 4.2.2 Justin Skiles SteamWebAPI2 SteamWebAPI2 From dd037ac8a9522dcec07f510c8ed6a09ca82c23b0 Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Wed, 6 May 2020 11:59:45 -0400 Subject: [PATCH 065/107] Fixed typo from last commit --- src/SteamWebAPI2/Mappings/SteamRemoteStorageProfile.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SteamWebAPI2/Mappings/SteamRemoteStorageProfile.cs b/src/SteamWebAPI2/Mappings/SteamRemoteStorageProfile.cs index c3a2e3c..cd7dd7f 100644 --- a/src/SteamWebAPI2/Mappings/SteamRemoteStorageProfile.cs +++ b/src/SteamWebAPI2/Mappings/SteamRemoteStorageProfile.cs @@ -18,7 +18,7 @@ public SteamRemoteStorageProfile() }); CreateMap() .ForMember(dest => dest.FileUrl, opts => opts.MapFrom(source => !string.IsNullOrWhiteSpace(source.FileUrl) ? new Uri(source.FileUrl) : null)) - .ForMember(dest => dest.PreviewUrl, opts => opts.MapFrom(source => !string.IsNullOrWhiteSpace(source.FileUrl) ? new Uri(source.PreviewUrl) : null)); + .ForMember(dest => dest.PreviewUrl, opts => opts.MapFrom(source => !string.IsNullOrWhiteSpace(source.PreviewUrl) ? new Uri(source.PreviewUrl) : null)); CreateMap>() .ConvertUsing((src, dest, context) => context.Mapper.Map, IReadOnlyCollection>( From 39f163f98b224fcf9f31f0c5f1d07f210545301c Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Wed, 6 May 2020 14:18:16 -0400 Subject: [PATCH 066/107] Rolled to version 4.2.3. --- src/SteamWebAPI2/SteamWebAPI2.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index 5fbc5b0..d975029 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -2,7 +2,7 @@ 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. - 4.2.2 + 4.2.3 Justin Skiles SteamWebAPI2 SteamWebAPI2 From fa65bf02b07f78f0e784717fbeff8563f5227014 Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Wed, 27 May 2020 08:23:02 -0400 Subject: [PATCH 067/107] Fix issue where default visibility on published file details was incorrect. (#100) --- src/Steam.Models/PublishedFileVisibility.cs | 7 ++++--- src/Steam.Models/Steam.Models.csproj | 7 ------- src/Steam.UnitTests/Steam.UnitTests.csproj | 5 +++-- src/Steam.UnitTests/SteamRemoteTests.cs | 13 ++++++++++++- .../Models/PublishedFileDetailsResultContainer.cs | 6 +++--- src/SteamWebAPI2/SteamWebAPI2.csproj | 6 +++--- 6 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/Steam.Models/PublishedFileVisibility.cs b/src/Steam.Models/PublishedFileVisibility.cs index 109c283..623e8a8 100644 --- a/src/Steam.Models/PublishedFileVisibility.cs +++ b/src/Steam.Models/PublishedFileVisibility.cs @@ -1,9 +1,10 @@ namespace Steam.Models { - public enum PublishedFileVisibility + public enum PublishedFileVisibility : uint { Public = 0, - FreindsOnly = 1, - Private = 2 + FriendsOnly = 1, + Private = 2, + Unknown = 3 } } diff --git a/src/Steam.Models/Steam.Models.csproj b/src/Steam.Models/Steam.Models.csproj index eee0675..9f5c4f4 100644 --- a/src/Steam.Models/Steam.Models.csproj +++ b/src/Steam.Models/Steam.Models.csproj @@ -1,13 +1,6 @@ - Contains classes that are used as data transports between various application, business, and data layers for Steam related APIs. - 3.0.10 - Justin Skiles - Steam.Models - Steam.Models - https://github.com/babelshift/Steam.Models - https://raw.githubusercontent.com/babelshift/Steam.Models/master/LICENSE netstandard2.0 diff --git a/src/Steam.UnitTests/Steam.UnitTests.csproj b/src/Steam.UnitTests/Steam.UnitTests.csproj index 2d59441..2ad28b9 100644 --- a/src/Steam.UnitTests/Steam.UnitTests.csproj +++ b/src/Steam.UnitTests/Steam.UnitTests.csproj @@ -6,8 +6,9 @@ 46a53f4e-b4d4-4fad-b7c9-b777001cfe42 - - + + + diff --git a/src/Steam.UnitTests/SteamRemoteTests.cs b/src/Steam.UnitTests/SteamRemoteTests.cs index b2cae98..bf6af00 100644 --- a/src/Steam.UnitTests/SteamRemoteTests.cs +++ b/src/Steam.UnitTests/SteamRemoteTests.cs @@ -1,3 +1,4 @@ +using Steam.Models; using SteamWebAPI2.Interfaces; using System.Net.Http; using System.Threading.Tasks; @@ -15,11 +16,21 @@ public SteamRemoteTests() } [Fact] - public async Task GetPublishedFileDetailsAsync_Should_Succeed() + public async Task GetPublishedFileDetailsAsync_Public_Visibility_Should_Succeed() { var response = await steamInterface.GetPublishedFileDetailsAsync(1673456286); Assert.NotNull(response); Assert.NotNull(response.Data); + Assert.Equal(PublishedFileVisibility.Public, response.Data.Visibility); + } + + [Fact] + public async Task GetPublishedFileDetailsAsync_Unknown_Visibility_Should_Succeed() + { + var response = await steamInterface.GetPublishedFileDetailsAsync(2097579725); + Assert.NotNull(response); + Assert.NotNull(response.Data); + Assert.Equal(PublishedFileVisibility.Unknown, response.Data.Visibility); } } } diff --git a/src/SteamWebAPI2/Models/PublishedFileDetailsResultContainer.cs b/src/SteamWebAPI2/Models/PublishedFileDetailsResultContainer.cs index 83ca5f4..d77d1cd 100644 --- a/src/SteamWebAPI2/Models/PublishedFileDetailsResultContainer.cs +++ b/src/SteamWebAPI2/Models/PublishedFileDetailsResultContainer.cs @@ -1,11 +1,11 @@ using Newtonsoft.Json; using System; using System.Collections.Generic; +using Steam.Models; +using SteamWebAPI2.Utilities.JsonConverters; namespace SteamWebAPI2.Models { - using SteamWebAPI2.Utilities.JsonConverters; - internal class PublishedFileDetailsResultContainer { [JsonProperty("response")] @@ -74,7 +74,7 @@ internal class PublishedFileDetails public DateTime TimeUpdated { get; set; } [JsonProperty("visibility")] - public uint Visibility { get; set; } + public uint Visibility { get; set; } = (uint)PublishedFileVisibility.Unknown; [JsonProperty("banned")] public bool Banned { get; set; } diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index d975029..2d7b3d3 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -2,7 +2,7 @@ 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. - 4.2.3 + 4.2.4 Justin Skiles SteamWebAPI2 SteamWebAPI2 @@ -16,8 +16,8 @@ - - + + From 8544805ba3af384628011182b942bfa5beec4210 Mon Sep 17 00:00:00 2001 From: Daniel Jarski <30324210+QuantumToasted@users.noreply.github.com> Date: Fri, 10 Jul 2020 06:10:44 -0500 Subject: [PATCH 068/107] Added pagination to EconItems#GetSchemaItemsForTF2Async() (#105) * Updated Next property to be of type uint? If this is too breaking a change, a consideration for `uint` with a default value of 0 would work, but 0 is still a valid value for "start" on the request. * Updated IEconItems/EconItems#GetSchemaItemsForTF2Async. added a `uint? start = null` optional property. * Modified unit tests to take the new Next/start combination. This verifies that both a) the Next property is valid on each request, and b) that passing `start` along works as intended. This replaces the original test, but could be put alongside it instead. --- src/Steam.UnitTests/EconItemsTeamFortress2Tests.cs | 14 +++++++++++--- src/SteamWebAPI2/Interfaces/EconItems.cs | 3 ++- src/SteamWebAPI2/Interfaces/IEconItems.cs | 2 +- .../GameEconomy/SchemaItemResultContainer.cs | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/Steam.UnitTests/EconItemsTeamFortress2Tests.cs b/src/Steam.UnitTests/EconItemsTeamFortress2Tests.cs index 726fcfb..16af818 100644 --- a/src/Steam.UnitTests/EconItemsTeamFortress2Tests.cs +++ b/src/Steam.UnitTests/EconItemsTeamFortress2Tests.cs @@ -20,9 +20,17 @@ public EconItemsTeamFortress2Tests() [Fact] public async Task GetSchemaItemsForTF2Async_Should_Succeed() { - var response = await steamInterface.GetSchemaItemsForTF2Async(); - Assert.NotNull(response); - Assert.NotNull(response.Data); + uint? next = null; + + do + { + var response = await steamInterface.GetSchemaItemsForTF2Async(start: next); + Assert.NotNull(response); + Assert.NotNull(response.Data); + + next = response.Data.Result.Next; + } + while (next.HasValue); } [Fact] diff --git a/src/SteamWebAPI2/Interfaces/EconItems.cs b/src/SteamWebAPI2/Interfaces/EconItems.cs index 2a8652e..1b2b2d4 100644 --- a/src/SteamWebAPI2/Interfaces/EconItems.cs +++ b/src/SteamWebAPI2/Interfaces/EconItems.cs @@ -81,7 +81,7 @@ public async Task> GetPlayerItemsAsync(ul /// /// /// - public async Task> GetSchemaItemsForTF2Async(string language = "en_us") + public async Task> GetSchemaItemsForTF2Async(string language = "en_us", uint? start = null) { if (appId != (int)AppId.TeamFortress2) { @@ -91,6 +91,7 @@ public async Task> GetSchemaItemsF List parameters = new List(); parameters.AddIfHasValue(language, "language"); + parameters.AddIfHasValue(start, "start"); var steamWebResponse = await steamWebInterface.GetAsync("GetSchemaItems", 1, parameters); diff --git a/src/SteamWebAPI2/Interfaces/IEconItems.cs b/src/SteamWebAPI2/Interfaces/IEconItems.cs index 264612c..b1c6cef 100644 --- a/src/SteamWebAPI2/Interfaces/IEconItems.cs +++ b/src/SteamWebAPI2/Interfaces/IEconItems.cs @@ -8,7 +8,7 @@ public interface IEconItems { Task> GetPlayerItemsAsync(ulong steamId); - Task> GetSchemaItemsForTF2Async(string language = "en_us"); + Task> GetSchemaItemsForTF2Async(string language = "en_us", uint? start = null); Task> GetSchemaOverviewForTF2Async(string language = "en_us"); diff --git a/src/SteamWebAPI2/Models/GameEconomy/SchemaItemResultContainer.cs b/src/SteamWebAPI2/Models/GameEconomy/SchemaItemResultContainer.cs index 1ced99c..1be24b4 100644 --- a/src/SteamWebAPI2/Models/GameEconomy/SchemaItemResultContainer.cs +++ b/src/SteamWebAPI2/Models/GameEconomy/SchemaItemResultContainer.cs @@ -15,7 +15,7 @@ public class SchemaItemsResult public IList Items { get; set; } [JsonProperty("next")] - public uint Next { get; set; } + public uint? Next { get; set; } } public class SchemaItemsResultContainer From 95666b08ac0738f747727aad2ca1dd632ac7c664 Mon Sep 17 00:00:00 2001 From: Justin Date: Mon, 13 Jul 2020 07:08:13 -0400 Subject: [PATCH 069/107] Rolled version --- src/SteamWebAPI2/SteamWebAPI2.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index 2d7b3d3..51b3dbc 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -2,7 +2,7 @@ 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. - 4.2.4 + 4.2.5 Justin Skiles SteamWebAPI2 SteamWebAPI2 From 7f194c1cc97165c8841a8368def18bff890f9716 Mon Sep 17 00:00:00 2001 From: Eric B <6787911+CannoliSquid@users.noreply.github.com> Date: Wed, 14 Oct 2020 10:14:56 -0400 Subject: [PATCH 070/107] Bugfix/issue 108 (#109) * Accommodate Changes to Add "Feeds" and "Tags" as SteamNews Parameters Feeds is a string and Tags is a string array. The changes passed unit tests. * Adding Parameter Examples Shows that the parameters actually filter down the results. --- src/Steam.Models/NewsItemModel.cs | 2 ++ src/SteamWebAPI2/Interfaces/ISteamNews.cs | 2 +- src/SteamWebAPI2/Interfaces/SteamNews.cs | 6 +++++- src/SteamWebAPI2/Models/SteamNewsResultContainer.cs | 3 +++ src/SteamWebAPI2/Utilities/SteamWebRequest.cs | 2 ++ 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Steam.Models/NewsItemModel.cs b/src/Steam.Models/NewsItemModel.cs index 887662e..eaf7b03 100644 --- a/src/Steam.Models/NewsItemModel.cs +++ b/src/Steam.Models/NewsItemModel.cs @@ -19,5 +19,7 @@ public class NewsItemModel public ulong Date { get; set; } public string Feedname { get; set; } + + public string[] Tags { get; set; } } } \ No newline at end of file diff --git a/src/SteamWebAPI2/Interfaces/ISteamNews.cs b/src/SteamWebAPI2/Interfaces/ISteamNews.cs index b26583f..af090e0 100644 --- a/src/SteamWebAPI2/Interfaces/ISteamNews.cs +++ b/src/SteamWebAPI2/Interfaces/ISteamNews.cs @@ -7,6 +7,6 @@ namespace SteamWebAPI2.Interfaces { public interface ISteamNews { - Task> GetNewsForAppAsync(uint appId, uint? maxLength = null, DateTime? endDate = null, uint? count = null); + Task> GetNewsForAppAsync(uint appId, uint? maxLength = null, DateTime? endDate = null, uint? count = null, string feeds = null, string[] tags = null); } } \ No newline at end of file diff --git a/src/SteamWebAPI2/Interfaces/SteamNews.cs b/src/SteamWebAPI2/Interfaces/SteamNews.cs index ee799f6..4bff68c 100644 --- a/src/SteamWebAPI2/Interfaces/SteamNews.cs +++ b/src/SteamWebAPI2/Interfaces/SteamNews.cs @@ -33,8 +33,10 @@ public SteamNews(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInte /// /// /// + /// + /// /// - public async Task> GetNewsForAppAsync(uint appId, uint? maxLength = null, DateTime? endDate = null, uint? count = null) + public async Task> GetNewsForAppAsync(uint appId, uint? maxLength = null, DateTime? endDate = null, uint? count = null, string feeds = null, string[] tags = null) { ulong? endDateUnixTimeStamp = null; @@ -49,6 +51,8 @@ public async Task> GetNewsForAppAsync(ui parameters.AddIfHasValue(maxLength, "maxlength"); parameters.AddIfHasValue(endDateUnixTimeStamp, "enddate"); parameters.AddIfHasValue(count, "count"); + parameters.AddIfHasValue(feeds, "feeds"); + parameters.AddIfHasValue(tags, "tags"); var steamWebResponse = await steamWebInterface.GetAsync("GetNewsForApp", 2, parameters); diff --git a/src/SteamWebAPI2/Models/SteamNewsResultContainer.cs b/src/SteamWebAPI2/Models/SteamNewsResultContainer.cs index 61162a2..5951a22 100644 --- a/src/SteamWebAPI2/Models/SteamNewsResultContainer.cs +++ b/src/SteamWebAPI2/Models/SteamNewsResultContainer.cs @@ -31,6 +31,9 @@ internal class NewsItem [JsonProperty("feedname")] public string Feedname { get; set; } + + [JsonProperty("tags")] + public string[] Tags { get; set; } } internal class SteamNewsResult diff --git a/src/SteamWebAPI2/Utilities/SteamWebRequest.cs b/src/SteamWebAPI2/Utilities/SteamWebRequest.cs index bb80ce8..6f61e07 100644 --- a/src/SteamWebAPI2/Utilities/SteamWebRequest.cs +++ b/src/SteamWebAPI2/Utilities/SteamWebRequest.cs @@ -110,6 +110,8 @@ private async Task> SendWebRequestAsync(HttpMethod httpM } parameters.Insert(0, new SteamWebRequestParameter("key", steamWebApiKey)); + //parameters.Insert(0, new SteamWebRequestParameter("feeds", "SteamDB")); -- Demonstration of Implementing Feeds Parameter + //parameters.Insert(0, new SteamWebRequestParameter("tags", "halloween")); -- Demonstration of Implementing Tags Parameter HttpResponseMessage httpResponse = null; From 47c6ce30edb04a9ee223b5c7e48178bd292cfafc Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Wed, 14 Oct 2020 19:52:25 -0400 Subject: [PATCH 071/107] Rolled version --- src/SteamWebAPI2/SteamWebAPI2.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index 51b3dbc..8641998 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -2,7 +2,7 @@ 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. - 4.2.5 + 4.2.6 Justin Skiles SteamWebAPI2 SteamWebAPI2 From 5ea5c99d2c78514b3f3481c3171c109e827577c6 Mon Sep 17 00:00:00 2001 From: Luke Parker <10430890+Hona@users.noreply.github.com> Date: Mon, 4 Jan 2021 23:00:26 +1000 Subject: [PATCH 072/107] Convert AuthenticateUserTicket to strong typing (#111) --- src/Steam.Models/SteamUserAuth/SteamAuthError.cs | 8 ++++++++ .../SteamUserAuth/SteamAuthResponseParams.cs | 11 +++++++++++ .../SteamUserAuth/SteamUserAuthResponse.cs | 9 +++++++++ .../SteamUserAuth/SteamUserAuthResponseModel.cs | 7 +++++++ src/SteamWebAPI2/Interfaces/ISteamUserAuth.cs | 3 ++- src/SteamWebAPI2/Interfaces/SteamUserAuth.cs | 5 +++-- 6 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 src/Steam.Models/SteamUserAuth/SteamAuthError.cs create mode 100644 src/Steam.Models/SteamUserAuth/SteamAuthResponseParams.cs create mode 100644 src/Steam.Models/SteamUserAuth/SteamUserAuthResponse.cs create mode 100644 src/Steam.Models/SteamUserAuth/SteamUserAuthResponseModel.cs diff --git a/src/Steam.Models/SteamUserAuth/SteamAuthError.cs b/src/Steam.Models/SteamUserAuth/SteamAuthError.cs new file mode 100644 index 0000000..0d0b21c --- /dev/null +++ b/src/Steam.Models/SteamUserAuth/SteamAuthError.cs @@ -0,0 +1,8 @@ +namespace Steam.Models.SteamUserAuth +{ + public class SteamAuthError + { + public string ErrorCode { get; set; } + public string ErrorDesc { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamUserAuth/SteamAuthResponseParams.cs b/src/Steam.Models/SteamUserAuth/SteamAuthResponseParams.cs new file mode 100644 index 0000000..c0069be --- /dev/null +++ b/src/Steam.Models/SteamUserAuth/SteamAuthResponseParams.cs @@ -0,0 +1,11 @@ +namespace Steam.Models.SteamUserAuth +{ + public class SteamAuthResponseParams + { + public string Result { get; set; } + public string SteamId { get; set; } + public string OwnerSteamId { get; set; } + public bool VacBanned { get; set; } + public bool PublisherBanned { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamUserAuth/SteamUserAuthResponse.cs b/src/Steam.Models/SteamUserAuth/SteamUserAuthResponse.cs new file mode 100644 index 0000000..7dc0f48 --- /dev/null +++ b/src/Steam.Models/SteamUserAuth/SteamUserAuthResponse.cs @@ -0,0 +1,9 @@ +namespace Steam.Models.SteamUserAuth +{ + public class SteamUserAuthResponse + { + public SteamAuthResponseParams Params { get; set; } + public SteamAuthError Error { get; set; } + public bool Success => Error == null && Params != null; + } +} \ No newline at end of file diff --git a/src/Steam.Models/SteamUserAuth/SteamUserAuthResponseModel.cs b/src/Steam.Models/SteamUserAuth/SteamUserAuthResponseModel.cs new file mode 100644 index 0000000..5b94b9a --- /dev/null +++ b/src/Steam.Models/SteamUserAuth/SteamUserAuthResponseModel.cs @@ -0,0 +1,7 @@ +namespace Steam.Models.SteamUserAuth +{ + public class SteamUserAuthResponseModel + { + public SteamUserAuthResponse Response { get; set; } + } +} \ No newline at end of file diff --git a/src/SteamWebAPI2/Interfaces/ISteamUserAuth.cs b/src/SteamWebAPI2/Interfaces/ISteamUserAuth.cs index afc7731..318e733 100644 --- a/src/SteamWebAPI2/Interfaces/ISteamUserAuth.cs +++ b/src/SteamWebAPI2/Interfaces/ISteamUserAuth.cs @@ -1,5 +1,6 @@ using SteamWebAPI2.Utilities; using System.Threading.Tasks; +using Steam.Models.SteamUserAuth; namespace SteamWebAPI2.Interfaces { @@ -11,6 +12,6 @@ public interface ISteamUserAuth /// App ID of the game to authenticate against /// Ticket from GetAuthSessionTicket /// Results of authentication request - Task> AuthenticateUserTicket(uint appId, string ticket); + Task> AuthenticateUserTicket(uint appId, string ticket); } } \ No newline at end of file diff --git a/src/SteamWebAPI2/Interfaces/SteamUserAuth.cs b/src/SteamWebAPI2/Interfaces/SteamUserAuth.cs index 6f143b2..24fc75f 100644 --- a/src/SteamWebAPI2/Interfaces/SteamUserAuth.cs +++ b/src/SteamWebAPI2/Interfaces/SteamUserAuth.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Steam.Models.SteamUserAuth; namespace SteamWebAPI2.Interfaces { @@ -30,12 +31,12 @@ public SteamUserAuth(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWeb /// App ID of the game to authenticate against /// Ticket from GetAuthSessionTicket /// Results of authentication request - public async Task> AuthenticateUserTicket(uint appId, string ticket) + public async Task> AuthenticateUserTicket(uint appId, string ticket) { List parameters = new List(); parameters.AddIfHasValue(appId, "appid"); parameters.AddIfHasValue(ticket, "ticket"); - var playingSharedGameResult = await steamWebInterface.GetAsync("AuthenticateUserTicket", 1, parameters); + var playingSharedGameResult = await steamWebInterface.GetAsync("AuthenticateUserTicket", 1, parameters); return playingSharedGameResult; } } From 6a559d9063e6bf104d478a4f473579dcd9cbf03f Mon Sep 17 00:00:00 2001 From: Justin Date: Mon, 4 Jan 2021 08:45:18 -0500 Subject: [PATCH 073/107] Rolled version --- src/SteamWebAPI2/SteamWebAPI2.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index 8641998..b6cfa2c 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -2,7 +2,7 @@ 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. - 4.2.6 + 4.2.7 Justin Skiles SteamWebAPI2 SteamWebAPI2 From a831c563351beebb1c6fd2afc4fff89812b88a03 Mon Sep 17 00:00:00 2001 From: Luke Parker <10430890+Hona@users.noreply.github.com> Date: Mon, 1 Mar 2021 23:05:37 +1000 Subject: [PATCH 074/107] Update nuget packages (#112) --- src/Steam.UnitTests/Steam.UnitTests.csproj | 20 +++++++++++++------- src/SteamWebAPI2/SteamWebAPI2.csproj | 8 ++++---- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/Steam.UnitTests/Steam.UnitTests.csproj b/src/Steam.UnitTests/Steam.UnitTests.csproj index 2ad28b9..0e5e5b5 100644 --- a/src/Steam.UnitTests/Steam.UnitTests.csproj +++ b/src/Steam.UnitTests/Steam.UnitTests.csproj @@ -6,14 +6,20 @@ 46a53f4e-b4d4-4fad-b7c9-b777001cfe42 - - - + + + - - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index b6cfa2c..0f078a5 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -15,9 +15,9 @@ $(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage - - - + + + @@ -28,7 +28,7 @@ - + From 0fbc5b894aa29fcc15a2acc3ba440c320be69265 Mon Sep 17 00:00:00 2001 From: Justin Date: Mon, 1 Mar 2021 08:09:11 -0500 Subject: [PATCH 075/107] Rolled version --- src/SteamWebAPI2/SteamWebAPI2.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index 0f078a5..b055d65 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -2,7 +2,7 @@ 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. - 4.2.7 + 4.3.0 Justin Skiles SteamWebAPI2 SteamWebAPI2 From 9a71baf018950c36c517b00b91e5aca14c7eaae2 Mon Sep 17 00:00:00 2001 From: slinky <49608195+slinkstr@users.noreply.github.com> Date: Sat, 20 Mar 2021 09:12:18 -0700 Subject: [PATCH 076/107] Added gameserverip field to PlayerSummaryModel/PlayerSummaryResultContainer (#115) Missing property from https://developer.valvesoftware.com/wiki/Steam_Web_API#GetPlayerSummaries_.28v0002.29 --- src/Steam.Models/SteamCommunity/PlayerSummaryModel.cs | 5 +++++ .../Models/SteamCommunity/PlayerSummaryResultContainer.cs | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/src/Steam.Models/SteamCommunity/PlayerSummaryModel.cs b/src/Steam.Models/SteamCommunity/PlayerSummaryModel.cs index 1a92b44..d49adc9 100644 --- a/src/Steam.Models/SteamCommunity/PlayerSummaryModel.cs +++ b/src/Steam.Models/SteamCommunity/PlayerSummaryModel.cs @@ -100,5 +100,10 @@ public class PlayerSummaryModel /// The id of the game that the player is currently playing. This doesn't seem to be an appid, so I'm not sure how to make use of this field. /// public string PlayingGameId { get; set; } + + /// + /// The IP of the server the user is currently playing on. + /// + public string PlayingGameServerIP { get; set; } } } \ No newline at end of file diff --git a/src/SteamWebAPI2/Models/SteamCommunity/PlayerSummaryResultContainer.cs b/src/SteamWebAPI2/Models/SteamCommunity/PlayerSummaryResultContainer.cs index 1884d1b..e8c1981 100644 --- a/src/SteamWebAPI2/Models/SteamCommunity/PlayerSummaryResultContainer.cs +++ b/src/SteamWebAPI2/Models/SteamCommunity/PlayerSummaryResultContainer.cs @@ -130,6 +130,12 @@ internal class PlayerSummary /// [JsonProperty(PropertyName = "gameid")] public string PlayingGameId { get; set; } + + /// + /// The IP of the server the user is currently playing on. + /// + [JsonProperty(PropertyName = "gameserverip")] + public string PlayingGameServerIP { get; set; } } /// From 9d725ab69d42f015d4f9acea78d9b6ce2bab2a21 Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Tue, 30 Mar 2021 08:50:02 -0400 Subject: [PATCH 077/107] Add currency parameter to store app details method (#117) --- .../SteamStore/StoreAppDetailsDataModel.cs | 8 +--- src/Steam.UnitTests/Steam.UnitTests.csproj | 1 + src/Steam.UnitTests/SteamStoreTests.cs | 42 +++++++++++++++++++ src/SteamWebAPI2/Interfaces/ISteamStore.cs | 2 +- src/SteamWebAPI2/Interfaces/SteamStore.cs | 3 +- 5 files changed, 47 insertions(+), 9 deletions(-) create mode 100644 src/Steam.UnitTests/SteamStoreTests.cs diff --git a/src/Steam.Models/SteamStore/StoreAppDetailsDataModel.cs b/src/Steam.Models/SteamStore/StoreAppDetailsDataModel.cs index 6b71d19..470a6c8 100644 --- a/src/Steam.Models/SteamStore/StoreAppDetailsDataModel.cs +++ b/src/Steam.Models/SteamStore/StoreAppDetailsDataModel.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.SteamStore +namespace Steam.Models.SteamStore { public class StoreAppDetailsDataModel { diff --git a/src/Steam.UnitTests/Steam.UnitTests.csproj b/src/Steam.UnitTests/Steam.UnitTests.csproj index 0e5e5b5..8c8a359 100644 --- a/src/Steam.UnitTests/Steam.UnitTests.csproj +++ b/src/Steam.UnitTests/Steam.UnitTests.csproj @@ -6,6 +6,7 @@ 46a53f4e-b4d4-4fad-b7c9-b777001cfe42 + diff --git a/src/Steam.UnitTests/SteamStoreTests.cs b/src/Steam.UnitTests/SteamStoreTests.cs new file mode 100644 index 0000000..5b12235 --- /dev/null +++ b/src/Steam.UnitTests/SteamStoreTests.cs @@ -0,0 +1,42 @@ +using AutoMapper; +using SteamWebAPI2.Interfaces; +using SteamWebAPI2.Mappings; +using System.Threading.Tasks; +using Xunit; + +namespace Steam.UnitTests +{ + public class SteamStoreTests + { + private readonly SteamStore steamStore; + + public SteamStoreTests() + { + var mapperConfig = new MapperConfiguration(config => + { + config.AddProfile(); + }); + + var mapper = mapperConfig.CreateMapper(); + + steamStore = new SteamStore(mapper); + } + + [Fact] + public async Task GetStoreAppDetailsAsync_Should_Succeed() + { + var response = await steamStore.GetStoreAppDetailsAsync(1086940); + Assert.NotNull(response); + Assert.NotNull(response.Name); + } + + [Fact] + public async Task GetStoreAppDetailsAsync_WithCurrency_Should_Succeed() + { + var response = await steamStore.GetStoreAppDetailsAsync(1086940, "mx"); + Assert.NotNull(response); + Assert.NotNull(response.PriceOverview?.Currency); + Assert.Equal("MXN", response.PriceOverview.Currency); + } + } +} diff --git a/src/SteamWebAPI2/Interfaces/ISteamStore.cs b/src/SteamWebAPI2/Interfaces/ISteamStore.cs index db6678c..6bdf7cd 100644 --- a/src/SteamWebAPI2/Interfaces/ISteamStore.cs +++ b/src/SteamWebAPI2/Interfaces/ISteamStore.cs @@ -5,7 +5,7 @@ namespace SteamWebAPI2.Interfaces { internal interface ISteamStore { - Task GetStoreAppDetailsAsync(uint appId); + Task GetStoreAppDetailsAsync(uint appId, string cc = ""); Task GetStoreFeaturedCategoriesAsync(); diff --git a/src/SteamWebAPI2/Interfaces/SteamStore.cs b/src/SteamWebAPI2/Interfaces/SteamStore.cs index c014ee3..6c18830 100644 --- a/src/SteamWebAPI2/Interfaces/SteamStore.cs +++ b/src/SteamWebAPI2/Interfaces/SteamStore.cs @@ -23,11 +23,12 @@ public SteamStore(IMapper mapper, HttpClient httpClient) : base(mapper, httpClie /// /// /// - public async Task GetStoreAppDetailsAsync(uint appId) + public async Task GetStoreAppDetailsAsync(uint appId, string cc = "") { List parameters = new List(); parameters.AddIfHasValue(appId, "appids"); + parameters.AddIfHasValue(cc, "cc"); var appDetails = await CallMethodAsync("appdetails", parameters); From fd60bb74013595e41d306df3ca63957041280e1b Mon Sep 17 00:00:00 2001 From: Jcw87 Date: Tue, 27 Jul 2021 17:11:42 -0700 Subject: [PATCH 078/107] Add UnlockTime to PlayerAchievement (#119) --- src/Steam.Models/SteamPlayer/PlayerAchievementModel.cs | 6 +++++- src/SteamWebAPI2/Mappings/SteamUserStatsProfile.cs | 4 +++- .../Models/SteamPlayer/PlayerAchievementResultContainer.cs | 3 +++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Steam.Models/SteamPlayer/PlayerAchievementModel.cs b/src/Steam.Models/SteamPlayer/PlayerAchievementModel.cs index 07d5cb3..e95df91 100644 --- a/src/Steam.Models/SteamPlayer/PlayerAchievementModel.cs +++ b/src/Steam.Models/SteamPlayer/PlayerAchievementModel.cs @@ -1,4 +1,6 @@ -namespace Steam.Models.SteamPlayer +using System; + +namespace Steam.Models.SteamPlayer { public class PlayerAchievementModel { @@ -6,6 +8,8 @@ public class PlayerAchievementModel public uint Achieved { get; set; } + public DateTime UnlockTime { get; set; } + public string Name { get; set; } public string Description { get; set; } diff --git a/src/SteamWebAPI2/Mappings/SteamUserStatsProfile.cs b/src/SteamWebAPI2/Mappings/SteamUserStatsProfile.cs index d27473f..70870a2 100644 --- a/src/SteamWebAPI2/Mappings/SteamUserStatsProfile.cs +++ b/src/SteamWebAPI2/Mappings/SteamUserStatsProfile.cs @@ -7,6 +7,7 @@ using SteamWebAPI2.Models; using SteamWebAPI2.Models.SteamCommunity; using SteamWebAPI2.Models.SteamPlayer; +using SteamWebAPI2.Utilities; namespace SteamWebAPI2.Mappings { @@ -29,7 +30,8 @@ public SteamUserStatsProfile() src.Result != null ? src.Result.PlayerCount : default(uint) ); - CreateMap(); + CreateMap() + .ForMember(dest => dest.UnlockTime, opts => opts.MapFrom(source => source.UnlockTime.ToDateTime())); CreateMap(); CreateMap().ConvertUsing((src, dest, context) => context.Mapper.Map(src.Result) diff --git a/src/SteamWebAPI2/Models/SteamPlayer/PlayerAchievementResultContainer.cs b/src/SteamWebAPI2/Models/SteamPlayer/PlayerAchievementResultContainer.cs index a028dbe..214d56a 100644 --- a/src/SteamWebAPI2/Models/SteamPlayer/PlayerAchievementResultContainer.cs +++ b/src/SteamWebAPI2/Models/SteamPlayer/PlayerAchievementResultContainer.cs @@ -11,6 +11,9 @@ internal class PlayerAchievement [JsonProperty("achieved")] public uint Achieved { get; set; } + [JsonProperty("unlocktime")] + public ulong UnlockTime { get; set; } + public string Name { get; set; } public string Description { get; set; } } From 73e737f885a2f90b57720bf5088327a3f42e0eef Mon Sep 17 00:00:00 2001 From: Dmitriy-ksm <57687769+Dmitriy-ksm@users.noreply.github.com> Date: Wed, 28 Jul 2021 03:12:18 +0300 Subject: [PATCH 079/107] Upgrading the model for a new response (#118) --- src/Steam.Models/DOTA2/MatchDetailModel.cs | 6 ++++ src/Steam.Models/DOTA2/MatchPlayerModel.cs | 16 +++++++++- .../DOTA2/MatchDetailResultContainer.cs | 30 +++++++++++++++++++ 3 files changed, 51 insertions(+), 1 deletion(-) diff --git a/src/Steam.Models/DOTA2/MatchDetailModel.cs b/src/Steam.Models/DOTA2/MatchDetailModel.cs index e0b460c..384c62c 100644 --- a/src/Steam.Models/DOTA2/MatchDetailModel.cs +++ b/src/Steam.Models/DOTA2/MatchDetailModel.cs @@ -9,6 +9,8 @@ public class MatchDetailModel public bool RadiantWin { get; set; } + public uint PreGameDuration { get; set; } + public uint Duration { get; set; } public DateTime StartTime { get; set; } @@ -71,6 +73,10 @@ public class MatchDetailModel public uint DireCaptain { get; set; } + public uint RadiantScore { get; set; } + + public uint DireScore { get; set; } + public IReadOnlyCollection PicksAndBans { get; set; } } } \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/MatchPlayerModel.cs b/src/Steam.Models/DOTA2/MatchPlayerModel.cs index 263e749..6d42e5b 100644 --- a/src/Steam.Models/DOTA2/MatchPlayerModel.cs +++ b/src/Steam.Models/DOTA2/MatchPlayerModel.cs @@ -22,10 +22,18 @@ public class MatchPlayerModel public uint Item5 { get; set; } + public uint Backpack0 { get; set; } + + public uint Backpack1 { get; set; } + + public uint Backpack2 { get; set; } + + public uint ItemNeutral { get; set; } + public uint Kills { get; set; } public uint Deaths { get; set; } - + public uint Assists { get; set; } public uint LeaverStatus { get; set; } @@ -44,6 +52,12 @@ public class MatchPlayerModel public uint HeroDamage { get; set; } + public uint ScaledHeroDamage { get; set; } + + public uint ScaledTowerDamage { get; set; } + + public uint ScaledHeroHealing { get; set; } + public uint TowerDamage { get; set; } public uint HeroHealing { get; set; } diff --git a/src/SteamWebAPI2/Models/DOTA2/MatchDetailResultContainer.cs b/src/SteamWebAPI2/Models/DOTA2/MatchDetailResultContainer.cs index 17f8ef4..7a9f23d 100644 --- a/src/SteamWebAPI2/Models/DOTA2/MatchDetailResultContainer.cs +++ b/src/SteamWebAPI2/Models/DOTA2/MatchDetailResultContainer.cs @@ -39,6 +39,18 @@ internal class MatchPlayer [JsonProperty(PropertyName = "item_5")] public uint Item5 { get; set; } + [JsonProperty(PropertyName = "backpack_0")] + public uint Backpack0 { get; set; } + + [JsonProperty(PropertyName = "backpack_1")] + public uint Backpack1 { get; set; } + + [JsonProperty(PropertyName = "backpack_2")] + public uint Backpack2 { get; set; } + + [JsonProperty(PropertyName = "item_neutral")] + public uint ItemNeutral { get; set; } + public uint Kills { get; set; } public uint Deaths { get; set; } public uint Assists { get; set; } @@ -71,6 +83,15 @@ internal class MatchPlayer [JsonProperty(PropertyName = "hero_healing")] public uint HeroHealing { get; set; } + [JsonProperty(PropertyName = "scaled_hero_damage")] + public uint ScaledHeroDamage { get; set; } + + [JsonProperty(PropertyName = "scaled_tower_damage")] + public uint ScaledTowerDamage { get; set; } + + [JsonProperty(PropertyName = "scaled_hero_healing")] + public uint ScaledHeroHealing { get; set; } + public uint Level { get; set; } [JsonProperty(PropertyName = "ability_upgrades")] @@ -96,6 +117,9 @@ internal class MatchDetailResult [JsonProperty(PropertyName = "radiant_win")] public bool RadiantWin { get; set; } + [JsonProperty(PropertyName = "pre_game_duration")] + public uint PreGameDuration { get; set; } + public uint Duration { get; set; } [JsonProperty(PropertyName = "start_time")] @@ -174,6 +198,12 @@ internal class MatchDetailResult [JsonProperty(PropertyName = "dire_captain")] public uint DireCaptain { get; set; } + [JsonProperty(PropertyName = "radiant_score")] + public uint RadiantScore { get; set; } + + [JsonProperty(PropertyName = "dire_score")] + public uint DireScore { get; set; } + [JsonProperty(PropertyName = "picks_bans")] public IList PicksAndBans { get; set; } } From 61be5e1a96d62316da05b7541466cddf94f8a80f Mon Sep 17 00:00:00 2001 From: Justin Date: Tue, 27 Jul 2021 20:18:18 -0400 Subject: [PATCH 080/107] Rolled version --- src/SteamWebAPI2/SteamWebAPI2.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index b055d65..b8e6403 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -2,7 +2,7 @@ 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. - 4.3.0 + 4.3.1 Justin Skiles SteamWebAPI2 SteamWebAPI2 From bb93e294c48ef88900b67647cc3ba730fcc2c616 Mon Sep 17 00:00:00 2001 From: Dmitriy-ksm <57687769+Dmitriy-ksm@users.noreply.github.com> Date: Mon, 1 Nov 2021 15:11:32 +0300 Subject: [PATCH 081/107] Update DOTA2/MatchPlayer & Test (#121) --- .../DOTA2/MatchPlayerAdditionalUnitModel.cs | 27 ++++++++++ src/Steam.Models/DOTA2/MatchPlayerModel.cs | 10 ++++ src/Steam.UnitTests/DOTA2MatchTests.cs | 11 +++-- src/Steam.UnitTests/SteamUserTests.cs | 5 +- .../Mappings/DOTA2MatchProfile.cs | 1 + .../DOTA2/MatchDetailResultContainer.cs | 49 +++++++++++++++++++ 6 files changed, 99 insertions(+), 4 deletions(-) create mode 100644 src/Steam.Models/DOTA2/MatchPlayerAdditionalUnitModel.cs diff --git a/src/Steam.Models/DOTA2/MatchPlayerAdditionalUnitModel.cs b/src/Steam.Models/DOTA2/MatchPlayerAdditionalUnitModel.cs new file mode 100644 index 0000000..be1630e --- /dev/null +++ b/src/Steam.Models/DOTA2/MatchPlayerAdditionalUnitModel.cs @@ -0,0 +1,27 @@ +namespace Steam.Models.DOTA2 +{ + public class MatchPlayerAdditionalUnitModel + { + public string Unitname { get; set; } + + public uint Item0 { get; set; } + + public uint Item1 { get; set; } + + public uint Item2 { get; set; } + + public uint Item3 { get; set; } + + public uint Item4 { get; set; } + + public uint Item5 { get; set; } + + public uint Backpack0 { get; set; } + + public uint Backpack1 { get; set; } + + public uint Backpack2 { get; set; } + + public uint ItemNeutral { get; set; } + } +} \ No newline at end of file diff --git a/src/Steam.Models/DOTA2/MatchPlayerModel.cs b/src/Steam.Models/DOTA2/MatchPlayerModel.cs index 6d42e5b..f3e07da 100644 --- a/src/Steam.Models/DOTA2/MatchPlayerModel.cs +++ b/src/Steam.Models/DOTA2/MatchPlayerModel.cs @@ -50,6 +50,14 @@ public class MatchPlayerModel public uint GoldSpent { get; set; } + public uint NetWorth { get; set; } + + public uint AghanimsScepter { get; set; } + + public uint AghanimsShard { get; set; } + + public uint Moonshard { get; set; } + public uint HeroDamage { get; set; } public uint ScaledHeroDamage { get; set; } @@ -65,5 +73,7 @@ public class MatchPlayerModel public uint Level { get; set; } public IReadOnlyCollection AbilityUpgrades { get; set; } + + public IReadOnlyCollection AdditionalUnits { get; set; } } } \ No newline at end of file diff --git a/src/Steam.UnitTests/DOTA2MatchTests.cs b/src/Steam.UnitTests/DOTA2MatchTests.cs index 122a4ed..43c0a99 100644 --- a/src/Steam.UnitTests/DOTA2MatchTests.cs +++ b/src/Steam.UnitTests/DOTA2MatchTests.cs @@ -30,9 +30,14 @@ public async Task GetLiveLeagueGamesAsync_Should_Succeed() [Fact] public async Task GetMatchDetailsAsync_Should_Succeed() { - var response = await steamInterface.GetMatchDetailsAsync(5327512468); - Assert.NotNull(response); - Assert.NotNull(response.Data); + //Old game without some params + var responseOld = await steamInterface.GetMatchDetailsAsync(5327512468); + //game played - 31.10.2021 + var responseNew = await steamInterface.GetMatchDetailsAsync(6249820594); + Assert.NotNull(responseOld); + Assert.NotNull(responseOld.Data); + Assert.NotNull(responseNew); + Assert.NotNull(responseNew.Data); } [Fact] diff --git a/src/Steam.UnitTests/SteamUserTests.cs b/src/Steam.UnitTests/SteamUserTests.cs index 3967112..f0e1c14 100644 --- a/src/Steam.UnitTests/SteamUserTests.cs +++ b/src/Steam.UnitTests/SteamUserTests.cs @@ -3,6 +3,7 @@ using SteamWebAPI2.Utilities; using System; using System.Collections.Generic; +using System.Globalization; using System.Net.Http; using System.Text; using System.Threading.Tasks; @@ -80,7 +81,9 @@ public async Task ResolveVanityUrlAsync_Should_Succeed() [Fact] public async Task GetCommunityProfileAsync_Should_Succeed() { - var response = await steamInterface.GetCommunityProfileAsync(76561198050013009); + //for other cultures (for example ru) automaper will not be able to convert floating point numbers and will throw an error + CultureInfo.DefaultThreadCurrentCulture = CultureInfo.CreateSpecificCulture("en"); + var response = await steamInterface.GetCommunityProfileAsync(76561198064401017); Assert.NotNull(response); } } diff --git a/src/SteamWebAPI2/Mappings/DOTA2MatchProfile.cs b/src/SteamWebAPI2/Mappings/DOTA2MatchProfile.cs index 34179cc..7fb55a4 100644 --- a/src/SteamWebAPI2/Mappings/DOTA2MatchProfile.cs +++ b/src/SteamWebAPI2/Mappings/DOTA2MatchProfile.cs @@ -40,6 +40,7 @@ public DOTA2MatchProfile() CreateMap() .ForMember(dest => dest.StartTime, opts => opts.MapFrom(src => src.StartTime.ToDateTime())); CreateMap(); + CreateMap(); CreateMap(); CreateMap(); CreateMap().ConvertUsing((src, dest, context) => diff --git a/src/SteamWebAPI2/Models/DOTA2/MatchDetailResultContainer.cs b/src/SteamWebAPI2/Models/DOTA2/MatchDetailResultContainer.cs index 7a9f23d..e2d0fa9 100644 --- a/src/SteamWebAPI2/Models/DOTA2/MatchDetailResultContainer.cs +++ b/src/SteamWebAPI2/Models/DOTA2/MatchDetailResultContainer.cs @@ -10,6 +10,41 @@ internal class MatchPlayerAbilityUpgrade public uint Level { get; set; } } + internal class MatchPlayerAdditionalUnit + { + public string Unitname { get; set; } + + [JsonProperty(PropertyName = "item_0")] + public uint Item0 { get; set; } + + [JsonProperty(PropertyName = "item_1")] + public uint Item1 { get; set; } + + [JsonProperty(PropertyName = "item_2")] + public uint Item2 { get; set; } + + [JsonProperty(PropertyName = "item_3")] + public uint Item3 { get; set; } + + [JsonProperty(PropertyName = "item_4")] + public uint Item4 { get; set; } + + [JsonProperty(PropertyName = "item_5")] + public uint Item5 { get; set; } + + [JsonProperty(PropertyName = "backpack_0")] + public uint Backpack0 { get; set; } + + [JsonProperty(PropertyName = "backpack_1")] + public uint Backpack1 { get; set; } + + [JsonProperty(PropertyName = "backpack_2")] + public uint Backpack2 { get; set; } + + [JsonProperty(PropertyName = "item_neutral")] + public uint ItemNeutral { get; set; } + } + internal class MatchPlayer { [JsonProperty(PropertyName = "account_id")] @@ -74,6 +109,17 @@ internal class MatchPlayer [JsonProperty(PropertyName = "gold_spent")] public uint GoldSpent { get; set; } + [JsonProperty(PropertyName = "net_worth")] + public uint NetWorth { get; set; } + + [JsonProperty(PropertyName = "aghanims_scepter")] + public uint AghanimsScepter { get; set; } + + [JsonProperty(PropertyName = "aghanims_shard")] + public uint AghanimsShard { get; set; } + + public uint Moonshard { get; set; } + [JsonProperty(PropertyName = "hero_damage")] public uint HeroDamage { get; set; } @@ -96,6 +142,9 @@ internal class MatchPlayer [JsonProperty(PropertyName = "ability_upgrades")] public IList AbilityUpgrades { get; set; } + + [JsonProperty(PropertyName = "additional_units")] + public IList AdditionalUnits { get; set; } } internal class MatchPickBan From 7ccee33dd6079397b2d48334a263568f2946dccb Mon Sep 17 00:00:00 2001 From: Andrey Kornev Date: Sat, 20 Nov 2021 17:10:40 +0300 Subject: [PATCH 082/107] support for custom SteamWebApiBaseUrl (#122) --- src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs | 5 +++++ .../Utilities/SteamWebInterfaceFactoryOptions.cs | 1 + 2 files changed, 6 insertions(+) diff --git a/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs b/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs index cc61068..a3c1c1e 100644 --- a/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs +++ b/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs @@ -44,6 +44,11 @@ public SteamWebInterfaceFactory(IOptions option this.steamWebApiKey = options.Value.SteamWebApiKey; + if (!string.IsNullOrWhiteSpace(options.Value.SteamWebApiBaseUrl)) + { + this.steamWebApiBaseUrl = options.Value.SteamWebApiBaseUrl; + } + var mapperConfig = new MapperConfiguration(config => { config.AddProfile(); diff --git a/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactoryOptions.cs b/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactoryOptions.cs index 9c440ff..c11605b 100644 --- a/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactoryOptions.cs +++ b/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactoryOptions.cs @@ -3,5 +3,6 @@ namespace SteamWebAPI2.Utilities public class SteamWebInterfaceFactoryOptions { public string SteamWebApiKey { get; set; } + public string SteamWebApiBaseUrl { get; set; } } } \ No newline at end of file From 57f064ea3d7247aae749c0d89c504bd88a970304 Mon Sep 17 00:00:00 2001 From: Justin Date: Sat, 20 Nov 2021 09:11:11 -0500 Subject: [PATCH 083/107] Roll version --- src/SteamWebAPI2/SteamWebAPI2.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index b8e6403..05a0c81 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -2,7 +2,7 @@ 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. - 4.3.1 + 4.3.2 Justin Skiles SteamWebAPI2 SteamWebAPI2 From 84c24b6a04d6bdaa3e91105cd60ef3239b6debd9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 6 Aug 2022 07:20:13 -0400 Subject: [PATCH 084/107] Bump newtonsoft.json from 12.0.3 to 13.0.1 in /src/SteamWebAPI2 (#125) Bumps [newtonsoft.json](https://github.com/JamesNK/Newtonsoft.Json) from 12.0.3 to 13.0.1. - [Release notes](https://github.com/JamesNK/Newtonsoft.Json/releases) - [Commits](https://github.com/JamesNK/Newtonsoft.Json/compare/12.0.3...13.0.1) --- updated-dependencies: - dependency-name: newtonsoft.json dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/SteamWebAPI2/SteamWebAPI2.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index 05a0c81..9d8a075 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -18,7 +18,7 @@ - + From 1e0f1fde1c3f401591d47baaf7c3d4c626560293 Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Sat, 6 Aug 2022 07:45:11 -0400 Subject: [PATCH 085/107] Updating dependencies and multi target NET Standard (#128) Co-authored-by: Justin Skiles --- src/Steam.Models/Steam.Models.csproj | 2 +- src/Steam.UnitTests/Steam.UnitTests.csproj | 19 ++++++++++--------- src/SteamWebAPI2/SteamWebAPI2.csproj | 9 +++++---- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/Steam.Models/Steam.Models.csproj b/src/Steam.Models/Steam.Models.csproj index 9f5c4f4..1d041a6 100644 --- a/src/Steam.Models/Steam.Models.csproj +++ b/src/Steam.Models/Steam.Models.csproj @@ -1,7 +1,7 @@ - netstandard2.0 + netstandard2.0;netstandard2.1 diff --git a/src/Steam.UnitTests/Steam.UnitTests.csproj b/src/Steam.UnitTests/Steam.UnitTests.csproj index 8c8a359..8e3f5cd 100644 --- a/src/Steam.UnitTests/Steam.UnitTests.csproj +++ b/src/Steam.UnitTests/Steam.UnitTests.csproj @@ -1,23 +1,24 @@  - netcoreapp3.1 + net6.0 false 46a53f4e-b4d4-4fad-b7c9-b777001cfe42 - - - - + + + + + - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index 9d8a075..93f40fb 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -8,16 +8,17 @@ SteamWebAPI2 https://github.com/babelshift/SteamWebAPI2 MIT - netstandard2.0 + netstandard2.0;netstandard2.1 $(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage - - - + + + + From ce94bf69ce8e8f92541b4ca4259fa86e5d59ca34 Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Sat, 6 Aug 2022 07:46:41 -0400 Subject: [PATCH 086/107] Bump version --- src/SteamWebAPI2/SteamWebAPI2.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index 93f40fb..dfe8449 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -2,7 +2,7 @@ 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. - 4.3.2 + 4.4.0 Justin Skiles SteamWebAPI2 SteamWebAPI2 From 3d1340c7c485ff164bb4de96a35fa0e14e155255 Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Sat, 6 Aug 2022 07:57:13 -0400 Subject: [PATCH 087/107] Fix superfluous nuget pack error --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ee5a81c..9d98f7a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -76,7 +76,7 @@ steps: push $(Build.ArtifactStagingDirectory)/**.nupkg -s $(NuGetSourceServerUrl) -k $(NuGetSourceServerApiKey) - -n true + -n --skip-duplicate # Deploy release to GitHub From 3af4a2c4f98720e72dd286238e0d35971fb871f5 Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Sat, 6 Aug 2022 08:13:49 -0400 Subject: [PATCH 088/107] Added language parameter to store app details. Removed obsolete method/endpoint. --- src/Steam.UnitTests/PlayerServiceTests.cs | 8 ----- src/Steam.UnitTests/SteamStoreTests.cs | 8 +++++ src/SteamWebAPI2/Interfaces/IPlayerService.cs | 2 -- src/SteamWebAPI2/Interfaces/ISteamStore.cs | 2 +- src/SteamWebAPI2/Interfaces/PlayerService.cs | 29 +------------------ src/SteamWebAPI2/Interfaces/SteamStore.cs | 3 +- 6 files changed, 12 insertions(+), 40 deletions(-) diff --git a/src/Steam.UnitTests/PlayerServiceTests.cs b/src/Steam.UnitTests/PlayerServiceTests.cs index 3db7b18..98f3709 100644 --- a/src/Steam.UnitTests/PlayerServiceTests.cs +++ b/src/Steam.UnitTests/PlayerServiceTests.cs @@ -19,14 +19,6 @@ public PlayerServiceTests() steamInterface = factory.CreateSteamWebInterface(new HttpClient()); } - [Fact] - public async Task IsPlayingSharedGameAsync_Should_Succeed() - { - var response = await steamInterface.IsPlayingSharedGameAsync(76561198050013009, 440); - Assert.NotNull(response); - Assert.NotNull(response.Data); - } - [Fact] public async Task GetCommunityBadgeProgressAsync_Should_Succeed() { diff --git a/src/Steam.UnitTests/SteamStoreTests.cs b/src/Steam.UnitTests/SteamStoreTests.cs index 5b12235..dbda5c5 100644 --- a/src/Steam.UnitTests/SteamStoreTests.cs +++ b/src/Steam.UnitTests/SteamStoreTests.cs @@ -38,5 +38,13 @@ public async Task GetStoreAppDetailsAsync_WithCurrency_Should_Succeed() Assert.NotNull(response.PriceOverview?.Currency); Assert.Equal("MXN", response.PriceOverview.Currency); } + + [Fact] + public async Task GetStoreAppDetailsAsync_WithLanguage_Should_Succeed() + { + var response = await steamStore.GetStoreAppDetailsAsync(1086940, "german"); + Assert.NotNull(response); + Assert.NotNull(response.Name); + } } } diff --git a/src/SteamWebAPI2/Interfaces/IPlayerService.cs b/src/SteamWebAPI2/Interfaces/IPlayerService.cs index c6dc0f1..963768b 100644 --- a/src/SteamWebAPI2/Interfaces/IPlayerService.cs +++ b/src/SteamWebAPI2/Interfaces/IPlayerService.cs @@ -16,7 +16,5 @@ public interface IPlayerService Task> GetRecentlyPlayedGamesAsync(ulong steamId); Task> GetSteamLevelAsync(ulong steamId); - - Task> IsPlayingSharedGameAsync(ulong steamId, uint appId); } } \ No newline at end of file diff --git a/src/SteamWebAPI2/Interfaces/ISteamStore.cs b/src/SteamWebAPI2/Interfaces/ISteamStore.cs index 6bdf7cd..3fcbd3c 100644 --- a/src/SteamWebAPI2/Interfaces/ISteamStore.cs +++ b/src/SteamWebAPI2/Interfaces/ISteamStore.cs @@ -5,7 +5,7 @@ namespace SteamWebAPI2.Interfaces { internal interface ISteamStore { - Task GetStoreAppDetailsAsync(uint appId, string cc = ""); + Task GetStoreAppDetailsAsync(uint appId, string cc = "", string language = ""); Task GetStoreFeaturedCategoriesAsync(); diff --git a/src/SteamWebAPI2/Interfaces/PlayerService.cs b/src/SteamWebAPI2/Interfaces/PlayerService.cs index 39bfb09..6a64124 100644 --- a/src/SteamWebAPI2/Interfaces/PlayerService.cs +++ b/src/SteamWebAPI2/Interfaces/PlayerService.cs @@ -28,34 +28,7 @@ public PlayerService(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWeb ? new SteamWebInterface("IPlayerService", steamWebRequest) : steamWebInterface; } - - /// - /// Returns a message which indicates if a player is playing a shared game (from their shared Steam library). - /// - /// - /// - /// - public async Task> IsPlayingSharedGameAsync(ulong steamId, uint appId) - { - List parameters = new List(); - - parameters.AddIfHasValue(steamId, "steamid"); - parameters.AddIfHasValue(appId, "appid_playing"); - - var steamWebResponse = await steamWebInterface.GetAsync("IsPlayingSharedGame", 1, parameters); - - if (steamWebResponse == null) - { - return null; - } - - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>(steamWebResponse); - - return steamWebResponseModel; - } - + /// /// Returns a collection of badge meta data which indicates the progress towards a badge for a specific user. /// diff --git a/src/SteamWebAPI2/Interfaces/SteamStore.cs b/src/SteamWebAPI2/Interfaces/SteamStore.cs index 6c18830..23640b8 100644 --- a/src/SteamWebAPI2/Interfaces/SteamStore.cs +++ b/src/SteamWebAPI2/Interfaces/SteamStore.cs @@ -23,12 +23,13 @@ public SteamStore(IMapper mapper, HttpClient httpClient) : base(mapper, httpClie /// /// /// - public async Task GetStoreAppDetailsAsync(uint appId, string cc = "") + public async Task GetStoreAppDetailsAsync(uint appId, string cc = "", string language = "") { List parameters = new List(); parameters.AddIfHasValue(appId, "appids"); parameters.AddIfHasValue(cc, "cc"); + parameters.AddIfHasValue(language, "l"); var appDetails = await CallMethodAsync("appdetails", parameters); From 80a8b6b320f3465d0eef7a8dac42f6ce276065f8 Mon Sep 17 00:00:00 2001 From: Jan <27929801+hoppel@users.noreply.github.com> Date: Wed, 12 Apr 2023 13:55:47 +0200 Subject: [PATCH 089/107] Bump AutoMapper version (#133) * Updated AutoMapper to 12.0.0 Fixes #132 * Bump version --- src/SteamWebAPI2/SteamWebAPI2.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index dfe8449..ad4ad18 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -2,7 +2,7 @@ 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. - 4.4.0 + 4.4.1 Justin Skiles SteamWebAPI2 SteamWebAPI2 @@ -15,7 +15,7 @@ $(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage - + From 4c12b4c4d7c2ef2fa4c72807f4f1542e1277be7a Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Wed, 12 Apr 2023 08:11:08 -0400 Subject: [PATCH 090/107] Removed method which binds to non-existent endpoint after Valve removed it. Fixed issue with GetLiveLeagueGames deserialization. --- .../DOTA2/LiveLeagueGamePlayerDetailModel.cs | 12 ++++++------ src/Steam.UnitTests/DOTA2EconTests.cs | 8 -------- src/SteamWebAPI2/Interfaces/DOTA2Econ.cs | 18 ------------------ src/SteamWebAPI2/Interfaces/IDOTA2Econ.cs | 2 -- .../DOTA2/LiveLeagueGameResultContainer.cs | 12 ++++++------ 5 files changed, 12 insertions(+), 40 deletions(-) diff --git a/src/Steam.Models/DOTA2/LiveLeagueGamePlayerDetailModel.cs b/src/Steam.Models/DOTA2/LiveLeagueGamePlayerDetailModel.cs index 50a123e..27a5c48 100644 --- a/src/Steam.Models/DOTA2/LiveLeagueGamePlayerDetailModel.cs +++ b/src/Steam.Models/DOTA2/LiveLeagueGamePlayerDetailModel.cs @@ -16,12 +16,12 @@ public class LiveLeagueGamePlayerDetailModel public uint ExperiencePerMinute { get; set; } public uint UltimateState { get; set; } public uint UltimateCooldown { get; set; } - public uint Item0 { get; set; } - public uint Item1 { get; set; } - public uint Item2 { get; set; } - public uint Item3 { get; set; } - public uint Item4 { get; set; } - public uint Item5 { get; set; } + public int Item0 { get; set; } + public int Item1 { get; set; } + public int Item2 { get; set; } + public int Item3 { get; set; } + public int Item4 { get; set; } + public int Item5 { get; set; } public uint RespawnTimer { get; set; } public double PositionX { get; set; } public double PositionY { get; set; } diff --git a/src/Steam.UnitTests/DOTA2EconTests.cs b/src/Steam.UnitTests/DOTA2EconTests.cs index 14d856c..8808b92 100644 --- a/src/Steam.UnitTests/DOTA2EconTests.cs +++ b/src/Steam.UnitTests/DOTA2EconTests.cs @@ -19,14 +19,6 @@ public DOTA2EconTests() steamInterface = factory.CreateSteamWebInterface(new HttpClient()); } - [Fact] - public async Task GetGameItemsAsync_Should_Succeed() - { - var response = await steamInterface.GetGameItemsAsync(); - Assert.NotNull(response); - Assert.NotNull(response.Data); - } - [Fact] public async Task GetHeroesAsync_Should_Succeed() { diff --git a/src/SteamWebAPI2/Interfaces/DOTA2Econ.cs b/src/SteamWebAPI2/Interfaces/DOTA2Econ.cs index 9e69861..0128fe2 100644 --- a/src/SteamWebAPI2/Interfaces/DOTA2Econ.cs +++ b/src/SteamWebAPI2/Interfaces/DOTA2Econ.cs @@ -31,24 +31,6 @@ public DOTA2Econ(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInte this.dota2TestWebInterface = new SteamWebInterface("IEconDOTA2_205790", steamWebRequest); } - /// - /// Returns a collection of in game Dota 2 items. Example: blink dagger. - /// - /// - /// - public async Task>> GetGameItemsAsync(string language = "en_us") - { - List parameters = new List(); - - parameters.AddIfHasValue(language, "language"); - - var steamWebResponse = await dota2WebInterface.GetAsync("GetGameItems", 1, parameters); - - var steamWebResponseModel = mapper.Map, ISteamWebResponse>>(steamWebResponse); - - return steamWebResponseModel; - } - /// /// Returns a collection of heroes and basic hero data. /// diff --git a/src/SteamWebAPI2/Interfaces/IDOTA2Econ.cs b/src/SteamWebAPI2/Interfaces/IDOTA2Econ.cs index 115d794..7e895f9 100644 --- a/src/SteamWebAPI2/Interfaces/IDOTA2Econ.cs +++ b/src/SteamWebAPI2/Interfaces/IDOTA2Econ.cs @@ -7,8 +7,6 @@ namespace SteamWebAPI2.Interfaces { public interface IDOTA2Econ { - Task>> GetGameItemsAsync(string language = ""); - Task>> GetHeroesAsync(string language = "", bool itemizedOnly = false); Task>> GetRaritiesAsync(string language = ""); diff --git a/src/SteamWebAPI2/Models/DOTA2/LiveLeagueGameResultContainer.cs b/src/SteamWebAPI2/Models/DOTA2/LiveLeagueGameResultContainer.cs index 399bb02..2dbda09 100644 --- a/src/SteamWebAPI2/Models/DOTA2/LiveLeagueGameResultContainer.cs +++ b/src/SteamWebAPI2/Models/DOTA2/LiveLeagueGameResultContainer.cs @@ -192,12 +192,12 @@ internal class LiveLeagueGamePlayerDetail [JsonProperty(PropertyName = "ultimate_cooldown")] public uint UltimateCooldown { get; set; } - public uint Item0 { get; set; } - public uint Item1 { get; set; } - public uint Item2 { get; set; } - public uint Item3 { get; set; } - public uint Item4 { get; set; } - public uint Item5 { get; set; } + public int Item0 { get; set; } + public int Item1 { get; set; } + public int Item2 { get; set; } + public int Item3 { get; set; } + public int Item4 { get; set; } + public int Item5 { get; set; } [JsonProperty(PropertyName = "respawn_timer")] public uint RespawnTimer { get; set; } From a94eb47dc383a9e33590b6475b80b2f286505b37 Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Wed, 12 Nov 2025 16:56:50 -0500 Subject: [PATCH 091/107] Remove AutoMapper (#141) * Remove AutoMapper * Removed AutoMapper. Part 2. --- .../MatchHistoryBySequenceNumberMatchModel.cs | 39 +- ...nceNumberMatchPlayerAbilityUpgradeModel.cs | 12 +- ...HistoryBySequenceNumberMatchPlayerModel.cs | 52 ++- .../GameEconomy/StoreFilterAllElementModel.cs | 2 +- .../GameEconomy/StoreFilterElementModel.cs | 2 +- .../GameEconomy/StorePrefabModel.cs | 2 +- .../GameEconomy/StoreTabChildModel.cs | 2 +- .../GameServers/AccountListModel.cs | 2 +- .../GameServers/AccountServerModel.cs | 2 +- src/Steam.Models/PublishedFileDetailsModel.cs | 2 +- src/Steam.Models/SteamInterfaceModel.cs | 4 +- src/Steam.Models/SteamMethodModel.cs | 4 +- .../SteamStore/StoreCategoryModel.cs | 10 +- .../SteamStore/StoreComingSoonModel.cs | 12 +- .../StoreFeaturedCategoriesModel.cs | 20 +- .../StoreFeaturedCategoryGenreModel.cs | 10 +- .../SteamStore/StoreFeaturedLinuxModel.cs | 38 +- .../SteamStore/StoreFeaturedMacModel.cs | 38 +- .../SteamStore/StoreFeaturedProductsModel.cs | 18 +- .../SteamStore/StoreFeaturedWinModel.cs | 40 +-- .../SteamStore/StoreGenreModel.cs | 10 +- src/Steam.Models/SteamStore/StoreItemModel.cs | 42 +-- .../SteamStore/StoreLargeCapsuleModel.cs | 42 +-- .../SteamStore/StoreMetacriticModel.cs | 10 +- .../SteamStore/StoreMovieModel.cs | 16 +- .../SteamStore/StoreNewReleasesModel.cs | 12 +- .../SteamStore/StorePackageGroupModel.cs | 22 +- .../SteamStore/StorePlatformsModel.cs | 12 +- .../SteamStore/StoreRecommendationsModel.cs | 8 +- .../SteamStore/StoreReleaseDateModel.cs | 10 +- .../SteamStore/StoreScreenshotModel.cs | 12 +- .../SteamStore/StoreSpecialsModel.cs | 12 +- src/Steam.Models/SteamStore/StoreSubModel.cs | 22 +- .../SteamStore/StoreSupportInfoModel.cs | 10 +- .../SteamStore/StoreTopSellersModel.cs | 12 +- .../SteamStore/StoreTrailerSlideshowModel.cs | 10 +- src/Steam.Models/SteamStore/StoreWebmModel.cs | 10 +- .../SchemaAdditionalHiddenBodygroupsModel.cs | 12 +- ...ttributeControlledAttachedParticleModel.cs | 16 +- src/Steam.Models/TF2/SchemaAttributeModel.cs | 22 +- .../TF2/SchemaCapabilitiesModel.cs | 46 ++- .../TF2/SchemaItemAttributeModel.cs | 12 +- src/Steam.Models/TF2/SchemaItemLevelModel.cs | 8 +- src/Steam.Models/TF2/SchemaItemModel.cs | 56 ++- .../TF2/SchemaItemSetAttributeModel.cs | 12 +- src/Steam.Models/TF2/SchemaItemSetModel.cs | 14 +- .../TF2/SchemaKillEaterScoreTypeModel.cs | 12 +- src/Steam.Models/TF2/SchemaLevelModel.cs | 12 +- src/Steam.Models/TF2/SchemaModel.cs | 26 +- src/Steam.Models/TF2/SchemaOriginNameModel.cs | 10 +- .../TF2/SchemaPerClassLoadoutSlotsModel.cs | 16 +- src/Steam.Models/TF2/SchemaQualitiesModel.cs | 10 +- .../TF2/SchemaStringLookupModel.cs | 8 +- src/Steam.Models/TF2/SchemaStringModel.cs | 10 +- src/Steam.Models/TF2/SchemaStyleModel.cs | 10 +- src/Steam.Models/TF2/SchemaToolModel.cs | 14 +- .../TF2/SchemaUsageCapabilitiesModel.cs | 32 +- src/Steam.UnitTests/BaseTest.cs | 3 +- src/Steam.UnitTests/CSGOServersTests.cs | 20 +- src/Steam.UnitTests/DOTA2EconTests.cs | 24 +- src/Steam.UnitTests/DOTA2MatchTests.cs | 56 ++- src/Steam.UnitTests/DOTA2TicketTests.cs | 9 +- .../EconItemsTeamFortress2Tests.cs | 33 +- src/Steam.UnitTests/EconServiceTests.cs | 26 +- src/Steam.UnitTests/GCVersionTests.cs | 87 +++-- src/Steam.UnitTests/PlayerServiceTests.cs | 53 ++- src/Steam.UnitTests/Steam.UnitTests.csproj | 26 +- src/Steam.UnitTests/SteamAppsTests.cs | 33 +- src/Steam.UnitTests/SteamEconomyTests.cs | 23 +- src/Steam.UnitTests/SteamNewsTests.cs | 13 +- src/Steam.UnitTests/SteamRemoteTests.cs | 22 +- src/Steam.UnitTests/SteamStoreTests.cs | 36 +- src/Steam.UnitTests/SteamUserStatsTests.cs | 49 ++- src/Steam.UnitTests/SteamUserTests.cs | 53 ++- src/Steam.UnitTests/SteamWebAPIUtilTests.cs | 20 +- .../SteamWebInterfaceFactoryTests.cs | 87 ++--- src/Steam.UnitTests/TFItemsTests.cs | 14 +- src/SteamWebAPI2/Interfaces/CSGOServers.cs | 76 +++- src/SteamWebAPI2/Interfaces/DOTA2Econ.cs | 75 +++- src/SteamWebAPI2/Interfaces/DOTA2Match.cs | 333 +++++++++++++++++- src/SteamWebAPI2/Interfaces/DOTA2Ticket.cs | 9 +- src/SteamWebAPI2/Interfaces/EconItems.cs | 194 ++++++++-- src/SteamWebAPI2/Interfaces/EconService.cs | 199 +++++++++-- src/SteamWebAPI2/Interfaces/GCVersion.cs | 48 ++- .../Interfaces/GameServersService.cs | 111 ++++-- .../Interfaces/ISteamRemoteStorage.cs | 2 +- src/SteamWebAPI2/Interfaces/PlayerService.cs | 128 +++++-- src/SteamWebAPI2/Interfaces/SteamApps.cs | 46 ++- src/SteamWebAPI2/Interfaces/SteamEconomy.cs | 164 ++++++++- src/SteamWebAPI2/Interfaces/SteamNews.cs | 40 ++- .../Interfaces/SteamRemoteStorage.cs | 77 ++-- src/SteamWebAPI2/Interfaces/SteamStore.cs | 296 +++++++++++++++- src/SteamWebAPI2/Interfaces/SteamUser.cs | 196 +++++++++-- src/SteamWebAPI2/Interfaces/SteamUserAuth.cs | 8 +- src/SteamWebAPI2/Interfaces/SteamUserStats.cs | 140 ++++++-- .../Interfaces/SteamWebAPIUtil.cs | 54 ++- src/SteamWebAPI2/Interfaces/TFItems.cs | 31 +- src/SteamWebAPI2/Mappings/DOTA2EconProfile.cs | 68 ---- .../Mappings/DOTA2FantasyProfile.cs | 21 -- .../Mappings/DOTA2MatchProfile.cs | 71 ---- .../Mappings/EconServiceProfile.cs | 50 --- src/SteamWebAPI2/Mappings/GCVersionProfile.cs | 17 - .../Mappings/GameServersProfile.cs | 45 --- .../Mappings/PlayerServiceProfile.cs | 60 ---- src/SteamWebAPI2/Mappings/SteamAppsProfile.cs | 23 -- .../Mappings/SteamEconomyProfile.cs | 99 ------ src/SteamWebAPI2/Mappings/SteamNewsProfile.cs | 18 - .../Mappings/SteamProfileProfile.cs | 52 --- .../Mappings/SteamRemoteStorageProfile.cs | 41 --- .../Mappings/SteamStoreProfile.cs | 46 --- src/SteamWebAPI2/Mappings/SteamUserProfile.cs | 40 --- .../Mappings/SteamUserStatsProfile.cs | 56 --- .../Mappings/SteamWebAPIUtilProfile.cs | 23 -- .../Mappings/SteamWebResponseProfile.cs | 119 ------- src/SteamWebAPI2/Mappings/TFItemsProfile.cs | 19 - .../PublishedFileDetailsResultContainer.cs | 2 +- .../SteamCommunity/BadgesResultContainer.cs | 2 +- .../SteamCommunity/SteamCommunityProfile.cs | 4 +- src/SteamWebAPI2/Models/SteamId.cs | 1 - .../Models/SteamNewsResultContainer.cs | 2 +- .../SteamStore/FeaturedProductsContainer.cs | 2 +- .../Models/TF2/GoldenWrenchResultContainer.cs | 2 +- src/SteamWebAPI2/SteamStoreInterface.cs | 18 +- src/SteamWebAPI2/SteamWebAPI2.csproj | 10 +- .../Utilities/ISteamWebResponse.cs | 1 + .../Utilities/SteamWebInterface.cs | 9 +- .../Utilities/SteamWebInterfaceFactory.cs | 38 +- src/SteamWebAPI2/Utilities/SteamWebRequest.cs | 1 - .../Utilities/SteamWebResponse.cs | 21 ++ 129 files changed, 2557 insertions(+), 2279 deletions(-) delete mode 100644 src/SteamWebAPI2/Mappings/DOTA2EconProfile.cs delete mode 100644 src/SteamWebAPI2/Mappings/DOTA2FantasyProfile.cs delete mode 100644 src/SteamWebAPI2/Mappings/DOTA2MatchProfile.cs delete mode 100644 src/SteamWebAPI2/Mappings/EconServiceProfile.cs delete mode 100644 src/SteamWebAPI2/Mappings/GCVersionProfile.cs delete mode 100644 src/SteamWebAPI2/Mappings/GameServersProfile.cs delete mode 100644 src/SteamWebAPI2/Mappings/PlayerServiceProfile.cs delete mode 100644 src/SteamWebAPI2/Mappings/SteamAppsProfile.cs delete mode 100644 src/SteamWebAPI2/Mappings/SteamEconomyProfile.cs delete mode 100644 src/SteamWebAPI2/Mappings/SteamNewsProfile.cs delete mode 100644 src/SteamWebAPI2/Mappings/SteamProfileProfile.cs delete mode 100644 src/SteamWebAPI2/Mappings/SteamRemoteStorageProfile.cs delete mode 100644 src/SteamWebAPI2/Mappings/SteamStoreProfile.cs delete mode 100644 src/SteamWebAPI2/Mappings/SteamUserProfile.cs delete mode 100644 src/SteamWebAPI2/Mappings/SteamUserStatsProfile.cs delete mode 100644 src/SteamWebAPI2/Mappings/SteamWebAPIUtilProfile.cs delete mode 100644 src/SteamWebAPI2/Mappings/SteamWebResponseProfile.cs delete mode 100644 src/SteamWebAPI2/Mappings/TFItemsProfile.cs diff --git a/src/Steam.Models/DOTA2/MatchHistoryBySequenceNumberMatchModel.cs b/src/Steam.Models/DOTA2/MatchHistoryBySequenceNumberMatchModel.cs index 03fee9a..702d32f 100644 --- a/src/Steam.Models/DOTA2/MatchHistoryBySequenceNumberMatchModel.cs +++ b/src/Steam.Models/DOTA2/MatchHistoryBySequenceNumberMatchModel.cs @@ -1,27 +1,24 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Steam.Models.DOTA2 { public class MatchHistoryBySequenceNumberMatchModel { public IList Players { get; set; } - + public bool RadiantWin { get; set; } - + public uint Duration { get; set; } - + public DateTime StartTime { get; set; } - + public ulong MatchId { get; set; } - + public ulong MatchSequenceNumber { get; set; } public TowerState TowerStatesRadiant { get { return new TowerState(TowerStatusRadiant); } } - + public uint TowerStatusRadiant { get; set; } public TowerState TowerStatesDire { get { return new TowerState(TowerStatusRadiant); } } @@ -35,29 +32,29 @@ public class MatchHistoryBySequenceNumberMatchModel public BarracksState BarracksStatesDire { get { return new BarracksState(BarracksStatusDire); } } public uint BarracksStatusDire { get; set; } - + public uint Cluster { get; set; } - + public DateTime FirstBloodTime { get; set; } - + public uint LobbyType { get; set; } - + public uint HumanPlayers { get; set; } - + public uint LeagueId { get; set; } - + public uint PositiveVotes { get; set; } - + public uint NegativeVotes { get; set; } - + public uint GameMode { get; set; } - + public uint Flags { get; set; } - + public uint Engine { get; set; } - + public uint RadiantScore { get; set; } - + public uint DireScore { get; set; } } } diff --git a/src/Steam.Models/DOTA2/MatchHistoryBySequenceNumberMatchPlayerAbilityUpgradeModel.cs b/src/Steam.Models/DOTA2/MatchHistoryBySequenceNumberMatchPlayerAbilityUpgradeModel.cs index bb445a3..22bd03e 100644 --- a/src/Steam.Models/DOTA2/MatchHistoryBySequenceNumberMatchPlayerAbilityUpgradeModel.cs +++ b/src/Steam.Models/DOTA2/MatchHistoryBySequenceNumberMatchPlayerAbilityUpgradeModel.cs @@ -1,17 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.DOTA2 +namespace Steam.Models.DOTA2 { public class MatchHistoryBySequenceNumberMatchPlayerAbilityUpgradeModel { public uint Ability { get; set; } - + public uint Time { get; set; } - + public uint Level { get; set; } } } diff --git a/src/Steam.Models/DOTA2/MatchHistoryBySequenceNumberMatchPlayerModel.cs b/src/Steam.Models/DOTA2/MatchHistoryBySequenceNumberMatchPlayerModel.cs index a1194d4..d07bba3 100644 --- a/src/Steam.Models/DOTA2/MatchHistoryBySequenceNumberMatchPlayerModel.cs +++ b/src/Steam.Models/DOTA2/MatchHistoryBySequenceNumberMatchPlayerModel.cs @@ -1,59 +1,55 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; namespace Steam.Models.DOTA2 { public class MatchHistoryBySequenceNumberMatchPlayerModel { public IList AbilityUpgrades { get; set; } - + public ulong AccountId { get; set; } - + public uint PlayerSlot { get; set; } - + public uint HeroId { get; set; } - + public uint Item0 { get; set; } - + public uint Item1 { get; set; } - + public uint Item2 { get; set; } - + public uint Item3 { get; set; } - + public uint Item4 { get; set; } - + public uint Item5 { get; set; } - + public uint Kills { get; set; } - + public uint Deaths { get; set; } - + public uint Assists { get; set; } - + public uint LeaverStatus { get; set; } - + public uint LastHits { get; set; } - + public uint Denies { get; set; } - + public uint GoldPerMin { get; set; } - + public uint XpPerMin { get; set; } - + public uint Level { get; set; } - + public uint Gold { get; set; } - + public uint GoldSpent { get; set; } - + public uint HeroDamage { get; set; } - + public uint TowerDamage { get; set; } - + public uint HeroHealing { get; set; } } } diff --git a/src/Steam.Models/GameEconomy/StoreFilterAllElementModel.cs b/src/Steam.Models/GameEconomy/StoreFilterAllElementModel.cs index c898b41..9a820bf 100644 --- a/src/Steam.Models/GameEconomy/StoreFilterAllElementModel.cs +++ b/src/Steam.Models/GameEconomy/StoreFilterAllElementModel.cs @@ -2,7 +2,7 @@ { public class StoreFilterAllElementModel { - public uint Id { get; set; } + public ulong Id { get; set; } public string LocalizedText { get; set; } } diff --git a/src/Steam.Models/GameEconomy/StoreFilterElementModel.cs b/src/Steam.Models/GameEconomy/StoreFilterElementModel.cs index 3600dc0..342ee49 100644 --- a/src/Steam.Models/GameEconomy/StoreFilterElementModel.cs +++ b/src/Steam.Models/GameEconomy/StoreFilterElementModel.cs @@ -6,6 +6,6 @@ public class StoreFilterElementModel public string LocalizedText { get; set; } - public uint Id { get; set; } + public ulong Id { get; set; } } } \ No newline at end of file diff --git a/src/Steam.Models/GameEconomy/StorePrefabModel.cs b/src/Steam.Models/GameEconomy/StorePrefabModel.cs index 0cab3a2..e68b3cb 100644 --- a/src/Steam.Models/GameEconomy/StorePrefabModel.cs +++ b/src/Steam.Models/GameEconomy/StorePrefabModel.cs @@ -4,7 +4,7 @@ namespace Steam.Models.GameEconomy { public class StorePrefabModel { - public uint Id { get; set; } + public ulong Id { get; set; } public string Name { get; set; } diff --git a/src/Steam.Models/GameEconomy/StoreTabChildModel.cs b/src/Steam.Models/GameEconomy/StoreTabChildModel.cs index 7dcf604..ce1c944 100644 --- a/src/Steam.Models/GameEconomy/StoreTabChildModel.cs +++ b/src/Steam.Models/GameEconomy/StoreTabChildModel.cs @@ -4,6 +4,6 @@ public class StoreTabChildModel { public string Name { get; set; } - public string Id { get; set; } + public uint Id { get; set; } } } \ No newline at end of file diff --git a/src/Steam.Models/GameServers/AccountListModel.cs b/src/Steam.Models/GameServers/AccountListModel.cs index d26feae..9f4a8f0 100644 --- a/src/Steam.Models/GameServers/AccountListModel.cs +++ b/src/Steam.Models/GameServers/AccountListModel.cs @@ -21,6 +21,6 @@ public class AccountListModel /// Not sure what this indicates. After creating a game server account, /// I expected to see a time stamp here, but it returns 0 instead. /// - public DateTime? LastActionTime { get; set; } + public DateTime LastActionTime { get; set; } } } \ No newline at end of file diff --git a/src/Steam.Models/GameServers/AccountServerModel.cs b/src/Steam.Models/GameServers/AccountServerModel.cs index 65a2d11..51c78b1 100644 --- a/src/Steam.Models/GameServers/AccountServerModel.cs +++ b/src/Steam.Models/GameServers/AccountServerModel.cs @@ -20,6 +20,6 @@ public class AccountServerModel public bool IsExpired { get; set; } - public DateTime? RtLastLogon { get; set; } + public DateTime RtLastLogon { get; set; } } } \ No newline at end of file diff --git a/src/Steam.Models/PublishedFileDetailsModel.cs b/src/Steam.Models/PublishedFileDetailsModel.cs index 733b434..670ef7e 100644 --- a/src/Steam.Models/PublishedFileDetailsModel.cs +++ b/src/Steam.Models/PublishedFileDetailsModel.cs @@ -17,7 +17,7 @@ public class PublishedFileDetailsModel public string FileName { get; set; } - public uint FileSize { get; set; } + public ulong FileSize { get; set; } public Uri FileUrl { get; set; } diff --git a/src/Steam.Models/SteamInterfaceModel.cs b/src/Steam.Models/SteamInterfaceModel.cs index f85997f..ae02e0e 100644 --- a/src/Steam.Models/SteamInterfaceModel.cs +++ b/src/Steam.Models/SteamInterfaceModel.cs @@ -5,7 +5,7 @@ namespace Steam.Models public class SteamInterfaceModel { public string Name { get; set; } - - public IReadOnlyCollection Methods { get; private set; } + + public IReadOnlyCollection Methods { get; set; } } } \ No newline at end of file diff --git a/src/Steam.Models/SteamMethodModel.cs b/src/Steam.Models/SteamMethodModel.cs index dc3d953..68c7135 100644 --- a/src/Steam.Models/SteamMethodModel.cs +++ b/src/Steam.Models/SteamMethodModel.cs @@ -5,13 +5,13 @@ namespace Steam.Models public class SteamMethodModel { public string Name { get; set; } - + public uint Version { get; set; } public string HttpMethod { get; set; } public string Description { get; set; } - public IReadOnlyCollection Parameters { get; private set; } + public IReadOnlyCollection Parameters { get; set; } } } \ No newline at end of file diff --git a/src/Steam.Models/SteamStore/StoreCategoryModel.cs b/src/Steam.Models/SteamStore/StoreCategoryModel.cs index 788c128..63c3500 100644 --- a/src/Steam.Models/SteamStore/StoreCategoryModel.cs +++ b/src/Steam.Models/SteamStore/StoreCategoryModel.cs @@ -1,15 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.SteamStore +namespace Steam.Models.SteamStore { public class StoreCategoryModel { public uint Id { get; set; } - + public string Description { get; set; } } } diff --git a/src/Steam.Models/SteamStore/StoreComingSoonModel.cs b/src/Steam.Models/SteamStore/StoreComingSoonModel.cs index eccaf74..921084a 100644 --- a/src/Steam.Models/SteamStore/StoreComingSoonModel.cs +++ b/src/Steam.Models/SteamStore/StoreComingSoonModel.cs @@ -1,17 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.SteamStore +namespace Steam.Models.SteamStore { public class StoreComingSoonModel { public uint Id { get; set; } - + public string Name { get; set; } - + public StoreItemModel[] Items { get; set; } } } diff --git a/src/Steam.Models/SteamStore/StoreFeaturedCategoriesModel.cs b/src/Steam.Models/SteamStore/StoreFeaturedCategoriesModel.cs index 1866c0c..f161908 100644 --- a/src/Steam.Models/SteamStore/StoreFeaturedCategoriesModel.cs +++ b/src/Steam.Models/SteamStore/StoreFeaturedCategoriesModel.cs @@ -1,25 +1,19 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.SteamStore +namespace Steam.Models.SteamStore { public class StoreFeaturedCategoriesModel { public StoreSpecialsModel Specials { get; set; } - + public StoreComingSoonModel ComingSoon { get; set; } - + public StoreTopSellersModel TopSellers { get; set; } - + public StoreNewReleasesModel NewReleases { get; set; } - + public StoreFeaturedCategoryGenreModel Genres { get; set; } - + public StoreTrailerSlideshowModel Trailerslideshow { get; set; } - + public uint Status { get; set; } } } diff --git a/src/Steam.Models/SteamStore/StoreFeaturedCategoryGenreModel.cs b/src/Steam.Models/SteamStore/StoreFeaturedCategoryGenreModel.cs index f38fe09..ee4cd66 100644 --- a/src/Steam.Models/SteamStore/StoreFeaturedCategoryGenreModel.cs +++ b/src/Steam.Models/SteamStore/StoreFeaturedCategoryGenreModel.cs @@ -1,15 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.SteamStore +namespace Steam.Models.SteamStore { public class StoreFeaturedCategoryGenreModel { public uint Id { get; set; } - + public string Name { get; set; } } } diff --git a/src/Steam.Models/SteamStore/StoreFeaturedLinuxModel.cs b/src/Steam.Models/SteamStore/StoreFeaturedLinuxModel.cs index 4b6c78a..7d66a96 100644 --- a/src/Steam.Models/SteamStore/StoreFeaturedLinuxModel.cs +++ b/src/Steam.Models/SteamStore/StoreFeaturedLinuxModel.cs @@ -1,43 +1,37 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.SteamStore +namespace Steam.Models.SteamStore { public class StoreFeaturedLinuxModel { public uint Id { get; set; } - + public uint Type { get; set; } - + public string Name { get; set; } - + public bool Discounted { get; set; } - + public uint DiscountPercent { get; set; } - + public uint? OriginalPrice { get; set; } - + public uint FinalPrice { get; set; } - + public string Currency { get; set; } - + public string LargeCapsuleImage { get; set; } - + public string SmallCapsuleImage { get; set; } - + public bool WindowsAvailable { get; set; } - + public bool MacAvailable { get; set; } - + public bool LinuxAvailable { get; set; } - + public bool StreamingvideoAvailable { get; set; } - + public string HeaderImage { get; set; } - + public string ControllerSupport { get; set; } } } diff --git a/src/Steam.Models/SteamStore/StoreFeaturedMacModel.cs b/src/Steam.Models/SteamStore/StoreFeaturedMacModel.cs index aa3133c..acd2c8d 100644 --- a/src/Steam.Models/SteamStore/StoreFeaturedMacModel.cs +++ b/src/Steam.Models/SteamStore/StoreFeaturedMacModel.cs @@ -1,43 +1,37 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.SteamStore +namespace Steam.Models.SteamStore { public class StoreFeaturedMacModel { public uint Id { get; set; } - + public uint Type { get; set; } - + public string Name { get; set; } - + public bool Discounted { get; set; } - + public uint DiscountPercent { get; set; } - + public uint? OriginalPrice { get; set; } - + public uint FinalPrice { get; set; } - + public string Currency { get; set; } - + public string LargeCapsuleImage { get; set; } - + public string SmallCapsuleImage { get; set; } - + public bool WindowsAvailable { get; set; } - + public bool MacAvailable { get; set; } - + public bool LinuxAvailable { get; set; } - + public bool StreamingvideoAvailable { get; set; } - + public string HeaderImage { get; set; } - + public string ControllerSupport { get; set; } } } diff --git a/src/Steam.Models/SteamStore/StoreFeaturedProductsModel.cs b/src/Steam.Models/SteamStore/StoreFeaturedProductsModel.cs index 0aad776..4a38ee9 100644 --- a/src/Steam.Models/SteamStore/StoreFeaturedProductsModel.cs +++ b/src/Steam.Models/SteamStore/StoreFeaturedProductsModel.cs @@ -1,23 +1,17 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.SteamStore +namespace Steam.Models.SteamStore { public class StoreFeaturedProductsModel { public StoreLargeCapsuleModel[] LargeCapsules { get; set; } - + public StoreFeaturedWinModel[] FeaturedWin { get; set; } - + public StoreFeaturedMacModel[] FeaturedMac { get; set; } - + public StoreFeaturedLinuxModel[] FeaturedLinux { get; set; } - + public string Layout { get; set; } - + public uint Status { get; set; } } } diff --git a/src/Steam.Models/SteamStore/StoreFeaturedWinModel.cs b/src/Steam.Models/SteamStore/StoreFeaturedWinModel.cs index 1a385c4..880b25c 100644 --- a/src/Steam.Models/SteamStore/StoreFeaturedWinModel.cs +++ b/src/Steam.Models/SteamStore/StoreFeaturedWinModel.cs @@ -1,45 +1,39 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.SteamStore +namespace Steam.Models.SteamStore { public class StoreFeaturedWinModel { public uint Id { get; set; } - + public uint Type { get; set; } - + public string Name { get; set; } - + public bool Discounted { get; set; } - + public uint DiscountPercent { get; set; } - + public uint? OriginalPrice { get; set; } - + public uint FinalPrice { get; set; } - + public string Currency { get; set; } - + public string LargeCapsuleImage { get; set; } - + public string SmallCapsuleImage { get; set; } - + public bool WindowsAvailable { get; set; } - + public bool MacAvailable { get; set; } - + public bool LinuxAvailable { get; set; } - + public bool StreamingvideoAvailable { get; set; } - + public string HeaderImage { get; set; } - + public string ControllerSupport { get; set; } - + public uint? DiscountExpiration { get; set; } } } diff --git a/src/Steam.Models/SteamStore/StoreGenreModel.cs b/src/Steam.Models/SteamStore/StoreGenreModel.cs index 22b7998..d59ab91 100644 --- a/src/Steam.Models/SteamStore/StoreGenreModel.cs +++ b/src/Steam.Models/SteamStore/StoreGenreModel.cs @@ -1,15 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.SteamStore +namespace Steam.Models.SteamStore { public class StoreGenreModel { public uint Id { get; set; } - + public string Description { get; set; } } } diff --git a/src/Steam.Models/SteamStore/StoreItemModel.cs b/src/Steam.Models/SteamStore/StoreItemModel.cs index 82e12c2..9c176a5 100644 --- a/src/Steam.Models/SteamStore/StoreItemModel.cs +++ b/src/Steam.Models/SteamStore/StoreItemModel.cs @@ -1,47 +1,41 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.SteamStore +namespace Steam.Models.SteamStore { public class StoreItemModel { public uint Id { get; set; } - + public uint Type { get; set; } - + public string Name { get; set; } - + public bool Discounted { get; set; } - + public uint DiscountPercent { get; set; } - + public uint? OriginalPrice { get; set; } - + public uint FinalPrice { get; set; } - + public string Currency { get; set; } - + public string LargeCapsuleImage { get; set; } - + public string SmallCapsuleImage { get; set; } - + public bool WindowsAvailable { get; set; } - + public bool MacAvailable { get; set; } - + public bool LinuxAvailable { get; set; } - + public bool StreamingvideoAvailable { get; set; } - + public uint DiscountExpiration { get; set; } - + public string HeaderImage { get; set; } - + public string Body { get; set; } - + public string Url { get; set; } } } diff --git a/src/Steam.Models/SteamStore/StoreLargeCapsuleModel.cs b/src/Steam.Models/SteamStore/StoreLargeCapsuleModel.cs index 4e1658d..e9b0190 100644 --- a/src/Steam.Models/SteamStore/StoreLargeCapsuleModel.cs +++ b/src/Steam.Models/SteamStore/StoreLargeCapsuleModel.cs @@ -1,45 +1,39 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.SteamStore +namespace Steam.Models.SteamStore { public class StoreLargeCapsuleModel { public uint Id { get; set; } - + public uint Type { get; set; } - + public string Name { get; set; } - + public bool Discounted { get; set; } - + public uint DiscountPercent { get; set; } - - public uint OriginalPrice { get; set; } - + + public uint? OriginalPrice { get; set; } + public uint FinalPrice { get; set; } - + public string Currency { get; set; } - + public string LargeCapsuleImage { get; set; } - + public string SmallCapsuleImage { get; set; } - + public bool WindowsAvailable { get; set; } - + public bool MacAvailable { get; set; } - + public bool LinuxAvailable { get; set; } - + public bool StreamingvideoAvailable { get; set; } - + public string HeaderImage { get; set; } - + public string ControllerSupport { get; set; } - + public string Headline { get; set; } } } diff --git a/src/Steam.Models/SteamStore/StoreMetacriticModel.cs b/src/Steam.Models/SteamStore/StoreMetacriticModel.cs index 1b1f66a..724cd6e 100644 --- a/src/Steam.Models/SteamStore/StoreMetacriticModel.cs +++ b/src/Steam.Models/SteamStore/StoreMetacriticModel.cs @@ -1,15 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.SteamStore +namespace Steam.Models.SteamStore { public class StoreMetacriticModel { public uint Score { get; set; } - + public string Url { get; set; } } } diff --git a/src/Steam.Models/SteamStore/StoreMovieModel.cs b/src/Steam.Models/SteamStore/StoreMovieModel.cs index b8dcbf0..6937422 100644 --- a/src/Steam.Models/SteamStore/StoreMovieModel.cs +++ b/src/Steam.Models/SteamStore/StoreMovieModel.cs @@ -1,21 +1,15 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.SteamStore +namespace Steam.Models.SteamStore { public class StoreMovieModel { public uint Id { get; set; } - + public string Name { get; set; } - + public string Thumbnail { get; set; } - + public StoreWebmModel Webm { get; set; } - + public bool Highlight { get; set; } } } diff --git a/src/Steam.Models/SteamStore/StoreNewReleasesModel.cs b/src/Steam.Models/SteamStore/StoreNewReleasesModel.cs index d5d5e60..920f283 100644 --- a/src/Steam.Models/SteamStore/StoreNewReleasesModel.cs +++ b/src/Steam.Models/SteamStore/StoreNewReleasesModel.cs @@ -1,17 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.SteamStore +namespace Steam.Models.SteamStore { public class StoreNewReleasesModel { public uint Id { get; set; } - + public string Name { get; set; } - + public StoreItemModel[] Items { get; set; } } } diff --git a/src/Steam.Models/SteamStore/StorePackageGroupModel.cs b/src/Steam.Models/SteamStore/StorePackageGroupModel.cs index 2690bb6..fb14814 100644 --- a/src/Steam.Models/SteamStore/StorePackageGroupModel.cs +++ b/src/Steam.Models/SteamStore/StorePackageGroupModel.cs @@ -1,27 +1,21 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.SteamStore +namespace Steam.Models.SteamStore { public class StorePackageGroupModel { public string Name { get; set; } - + public string Title { get; set; } - + public string Description { get; set; } - + public string SelectionText { get; set; } - + public string SaveText { get; set; } - + public uint DisplayType { get; set; } - + public string IsRecurringSubscription { get; set; } - + public StoreSubModel[] Subs { get; set; } } } diff --git a/src/Steam.Models/SteamStore/StorePlatformsModel.cs b/src/Steam.Models/SteamStore/StorePlatformsModel.cs index 74154c1..b732926 100644 --- a/src/Steam.Models/SteamStore/StorePlatformsModel.cs +++ b/src/Steam.Models/SteamStore/StorePlatformsModel.cs @@ -1,17 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.SteamStore +namespace Steam.Models.SteamStore { public class StorePlatformsModel { public bool Windows { get; set; } - + public bool Mac { get; set; } - + public bool Linux { get; set; } } } diff --git a/src/Steam.Models/SteamStore/StoreRecommendationsModel.cs b/src/Steam.Models/SteamStore/StoreRecommendationsModel.cs index 79ed90b..c03435c 100644 --- a/src/Steam.Models/SteamStore/StoreRecommendationsModel.cs +++ b/src/Steam.Models/SteamStore/StoreRecommendationsModel.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.SteamStore +namespace Steam.Models.SteamStore { public class StoreRecommendationsModel { diff --git a/src/Steam.Models/SteamStore/StoreReleaseDateModel.cs b/src/Steam.Models/SteamStore/StoreReleaseDateModel.cs index 86bc9d2..ae9348f 100644 --- a/src/Steam.Models/SteamStore/StoreReleaseDateModel.cs +++ b/src/Steam.Models/SteamStore/StoreReleaseDateModel.cs @@ -1,15 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.SteamStore +namespace Steam.Models.SteamStore { public class StoreReleaseDateModel { public bool ComingSoon { get; set; } - + public string Date { get; set; } } } diff --git a/src/Steam.Models/SteamStore/StoreScreenshotModel.cs b/src/Steam.Models/SteamStore/StoreScreenshotModel.cs index 3e9674e..f8eaa78 100644 --- a/src/Steam.Models/SteamStore/StoreScreenshotModel.cs +++ b/src/Steam.Models/SteamStore/StoreScreenshotModel.cs @@ -1,17 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.SteamStore +namespace Steam.Models.SteamStore { public class StoreScreenshotModel { public uint Id { get; set; } - + public string PathThumbnail { get; set; } - + public string PathFull { get; set; } } } diff --git a/src/Steam.Models/SteamStore/StoreSpecialsModel.cs b/src/Steam.Models/SteamStore/StoreSpecialsModel.cs index 07f2925..0b3a748 100644 --- a/src/Steam.Models/SteamStore/StoreSpecialsModel.cs +++ b/src/Steam.Models/SteamStore/StoreSpecialsModel.cs @@ -1,17 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.SteamStore +namespace Steam.Models.SteamStore { public class StoreSpecialsModel { public uint Id { get; set; } - + public string Name { get; set; } - + public StoreItemModel[] Items { get; set; } } } diff --git a/src/Steam.Models/SteamStore/StoreSubModel.cs b/src/Steam.Models/SteamStore/StoreSubModel.cs index 56e7651..57da535 100644 --- a/src/Steam.Models/SteamStore/StoreSubModel.cs +++ b/src/Steam.Models/SteamStore/StoreSubModel.cs @@ -1,27 +1,21 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.SteamStore +namespace Steam.Models.SteamStore { public class StoreSubModel { public uint PackageId { get; set; } - + public string PercentSavingsText { get; set; } - + public uint PercentSavings { get; set; } - + public string OptionText { get; set; } - + public string OptionDescription { get; set; } - + public string CanGetFreeLicense { get; set; } - + public bool IsFreeLicense { get; set; } - + public uint PriceInCentsWithDiscount { get; set; } } } diff --git a/src/Steam.Models/SteamStore/StoreSupportInfoModel.cs b/src/Steam.Models/SteamStore/StoreSupportInfoModel.cs index d87532b..ba165f0 100644 --- a/src/Steam.Models/SteamStore/StoreSupportInfoModel.cs +++ b/src/Steam.Models/SteamStore/StoreSupportInfoModel.cs @@ -1,15 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.SteamStore +namespace Steam.Models.SteamStore { public class StoreSupportInfoModel { public string Url { get; set; } - + public string Email { get; set; } } } diff --git a/src/Steam.Models/SteamStore/StoreTopSellersModel.cs b/src/Steam.Models/SteamStore/StoreTopSellersModel.cs index 6d030d0..10544d3 100644 --- a/src/Steam.Models/SteamStore/StoreTopSellersModel.cs +++ b/src/Steam.Models/SteamStore/StoreTopSellersModel.cs @@ -1,17 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.SteamStore +namespace Steam.Models.SteamStore { public class StoreTopSellersModel { public uint Id { get; set; } - + public string Name { get; set; } - + public StoreItemModel[] Items { get; set; } } } diff --git a/src/Steam.Models/SteamStore/StoreTrailerSlideshowModel.cs b/src/Steam.Models/SteamStore/StoreTrailerSlideshowModel.cs index 6998364..447d7a9 100644 --- a/src/Steam.Models/SteamStore/StoreTrailerSlideshowModel.cs +++ b/src/Steam.Models/SteamStore/StoreTrailerSlideshowModel.cs @@ -1,15 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.SteamStore +namespace Steam.Models.SteamStore { public class StoreTrailerSlideshowModel { public uint Id { get; set; } - + public string Name { get; set; } } } diff --git a/src/Steam.Models/SteamStore/StoreWebmModel.cs b/src/Steam.Models/SteamStore/StoreWebmModel.cs index efe4f0a..e9bbcd7 100644 --- a/src/Steam.Models/SteamStore/StoreWebmModel.cs +++ b/src/Steam.Models/SteamStore/StoreWebmModel.cs @@ -1,15 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.SteamStore +namespace Steam.Models.SteamStore { public class StoreWebmModel { public string Resolution480 { get; set; } - + public string Max { get; set; } } } diff --git a/src/Steam.Models/TF2/SchemaAdditionalHiddenBodygroupsModel.cs b/src/Steam.Models/TF2/SchemaAdditionalHiddenBodygroupsModel.cs index fa2a030..8748ee2 100644 --- a/src/Steam.Models/TF2/SchemaAdditionalHiddenBodygroupsModel.cs +++ b/src/Steam.Models/TF2/SchemaAdditionalHiddenBodygroupsModel.cs @@ -1,17 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.TF2 +namespace Steam.Models.TF2 { public class SchemaAdditionalHiddenBodygroupsModel { public uint Hat { get; set; } - + public uint Headphones { get; set; } - + public uint? Head { get; set; } } } diff --git a/src/Steam.Models/TF2/SchemaAttributeControlledAttachedParticleModel.cs b/src/Steam.Models/TF2/SchemaAttributeControlledAttachedParticleModel.cs index 654908d..e8d0e62 100644 --- a/src/Steam.Models/TF2/SchemaAttributeControlledAttachedParticleModel.cs +++ b/src/Steam.Models/TF2/SchemaAttributeControlledAttachedParticleModel.cs @@ -1,21 +1,15 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.TF2 +namespace Steam.Models.TF2 { public class SchemaAttributeControlledAttachedParticleModel { public string System { get; set; } - + public uint Id { get; set; } - + public bool AttachToRootbone { get; set; } - + public string Name { get; set; } - + public string Attachment { get; set; } } } diff --git a/src/Steam.Models/TF2/SchemaAttributeModel.cs b/src/Steam.Models/TF2/SchemaAttributeModel.cs index 6cf309c..4c4abff 100644 --- a/src/Steam.Models/TF2/SchemaAttributeModel.cs +++ b/src/Steam.Models/TF2/SchemaAttributeModel.cs @@ -1,27 +1,21 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.TF2 +namespace Steam.Models.TF2 { public class SchemaAttributeModel { public string Name { get; set; } - + public uint Defindex { get; set; } - + public string AttributeClass { get; set; } - + public string DescriptionString { get; set; } - + public string DescriptionFormat { get; set; } - + public string EffectType { get; set; } - + public bool Hidden { get; set; } - + public bool StoredAsInteger { get; set; } } } diff --git a/src/Steam.Models/TF2/SchemaCapabilitiesModel.cs b/src/Steam.Models/TF2/SchemaCapabilitiesModel.cs index df30575..f8e44c1 100644 --- a/src/Steam.Models/TF2/SchemaCapabilitiesModel.cs +++ b/src/Steam.Models/TF2/SchemaCapabilitiesModel.cs @@ -1,51 +1,45 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.TF2 +namespace Steam.Models.TF2 { public class SchemaCapabilitiesModel { public bool Nameable { get; set; } - + public bool CanCraftMark { get; set; } - + public bool CanBeRestored { get; set; } - + public bool StrangeParts { get; set; } - + public bool CanCardUpgrade { get; set; } - + public bool CanStrangify { get; set; } - + public bool CanKillstreakify { get; set; } - + public bool CanConsume { get; set; } - + public bool? CanGiftWrap { get; set; } - + public bool? CanCollect { get; set; } - + public bool? Paintable { get; set; } - + public bool? CanCraftIfPurchased { get; set; } - + public bool? CanCraftCount { get; set; } - + public bool? UsableGc { get; set; } - + public bool? Usable { get; set; } - + public bool? CanCustomizeTexture { get; set; } - + public bool? UsableOutOfGame { get; set; } - + public bool? CanSpellPage { get; set; } - + public bool? DuckUpgradable { get; set; } - + public bool? Decodable { get; set; } } } diff --git a/src/Steam.Models/TF2/SchemaItemAttributeModel.cs b/src/Steam.Models/TF2/SchemaItemAttributeModel.cs index 642af7b..44b9af8 100644 --- a/src/Steam.Models/TF2/SchemaItemAttributeModel.cs +++ b/src/Steam.Models/TF2/SchemaItemAttributeModel.cs @@ -1,17 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.TF2 +namespace Steam.Models.TF2 { public class SchemaItemAttributeModel { public string Name { get; set; } - + public string Class { get; set; } - + public double Value { get; set; } } } diff --git a/src/Steam.Models/TF2/SchemaItemLevelModel.cs b/src/Steam.Models/TF2/SchemaItemLevelModel.cs index ec80742..0b5efb1 100644 --- a/src/Steam.Models/TF2/SchemaItemLevelModel.cs +++ b/src/Steam.Models/TF2/SchemaItemLevelModel.cs @@ -1,15 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; namespace Steam.Models.TF2 { public class SchemaItemLevelModel { public string Name { get; set; } - + public IList Levels { get; set; } } } diff --git a/src/Steam.Models/TF2/SchemaItemModel.cs b/src/Steam.Models/TF2/SchemaItemModel.cs index 6be0d08..d1d8745 100644 --- a/src/Steam.Models/TF2/SchemaItemModel.cs +++ b/src/Steam.Models/TF2/SchemaItemModel.cs @@ -1,65 +1,61 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; namespace Steam.Models.TF2 { public class SchemaItemModel { public uint DefIndex { get; set; } - + public string Name { get; set; } - + public string ItemTypeName { get; set; } - + public string ItemName { get; set; } - + public string ItemDescription { get; set; } - + public string ImageInventoryPath { get; set; } - + public string ItemClass { get; set; } - + public bool ProperName { get; set; } - + public string ItemSlot { get; set; } - + public string ModelPlayer { get; set; } - + public uint ItemQuality { get; set; } - + public uint MinIlevel { get; set; } - + public uint MaxIlevel { get; set; } - + public string ImageUrl { get; set; } - + public string ImageUrlLarge { get; set; } - + public string CraftClass { get; set; } - + public string CraftMaterialType { get; set; } public string ItemLogName { get; set; } - + public SchemaCapabilitiesModel Capabilities { get; set; } - + public IList UsedByClasses { get; set; } - + public IList Styles { get; set; } - + public IList Attributes { get; set; } - + public string DropType { get; set; } - + public string ItemSet { get; set; } - + public string HolidayRestriction { get; set; } - + public SchemaPerClassLoadoutSlotsModel PerClassLoadoutSlots { get; set; } - + public SchemaToolModel Tool { get; set; } } } diff --git a/src/Steam.Models/TF2/SchemaItemSetAttributeModel.cs b/src/Steam.Models/TF2/SchemaItemSetAttributeModel.cs index df84ab9..c66e1f4 100644 --- a/src/Steam.Models/TF2/SchemaItemSetAttributeModel.cs +++ b/src/Steam.Models/TF2/SchemaItemSetAttributeModel.cs @@ -1,17 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.TF2 +namespace Steam.Models.TF2 { public class SchemaItemSetAttributeModel { public string Name { get; set; } - + public string Class { get; set; } - + public double Value { get; set; } } } diff --git a/src/Steam.Models/TF2/SchemaItemSetModel.cs b/src/Steam.Models/TF2/SchemaItemSetModel.cs index 1c0ab8d..1d62eeb 100644 --- a/src/Steam.Models/TF2/SchemaItemSetModel.cs +++ b/src/Steam.Models/TF2/SchemaItemSetModel.cs @@ -1,21 +1,17 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; namespace Steam.Models.TF2 { public class SchemaItemSetModel { public string ItemSet { get; set; } - + public string Name { get; set; } - + public IList Items { get; set; } - + public IList Attributes { get; set; } - + public string StoreBundleName { get; set; } } } diff --git a/src/Steam.Models/TF2/SchemaKillEaterScoreTypeModel.cs b/src/Steam.Models/TF2/SchemaKillEaterScoreTypeModel.cs index 66e9a0a..43207c1 100644 --- a/src/Steam.Models/TF2/SchemaKillEaterScoreTypeModel.cs +++ b/src/Steam.Models/TF2/SchemaKillEaterScoreTypeModel.cs @@ -1,17 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.TF2 +namespace Steam.Models.TF2 { public class SchemaKillEaterScoreTypeModel { public uint Type { get; set; } - + public string TypeName { get; set; } - + public string LevelData { get; set; } } } diff --git a/src/Steam.Models/TF2/SchemaLevelModel.cs b/src/Steam.Models/TF2/SchemaLevelModel.cs index 7acf7a3..d5c5635 100644 --- a/src/Steam.Models/TF2/SchemaLevelModel.cs +++ b/src/Steam.Models/TF2/SchemaLevelModel.cs @@ -1,17 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.TF2 +namespace Steam.Models.TF2 { public class SchemaLevelModel { public uint Level { get; set; } - + public uint RequiredScore { get; set; } - + public string Name { get; set; } } } diff --git a/src/Steam.Models/TF2/SchemaModel.cs b/src/Steam.Models/TF2/SchemaModel.cs index a45eda4..3624209 100644 --- a/src/Steam.Models/TF2/SchemaModel.cs +++ b/src/Steam.Models/TF2/SchemaModel.cs @@ -1,31 +1,27 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; namespace Steam.Models.TF2 { public class SchemaModel - { + { public string ItemsGameUrl { get; set; } - + public SchemaQualitiesModel Qualities { get; set; } - + public IList OriginNames { get; set; } - + public IList Items { get; set; } - + public IList Attributes { get; set; } - + public IList ItemSets { get; set; } - + public IList AttributeControlledAttachedParticles { get; set; } - + public IList ItemLevels { get; set; } - + public IList KillEaterScoreTypes { get; set; } - + public IList StringLookups { get; set; } } } diff --git a/src/Steam.Models/TF2/SchemaOriginNameModel.cs b/src/Steam.Models/TF2/SchemaOriginNameModel.cs index 2c42f63..a70d9d9 100644 --- a/src/Steam.Models/TF2/SchemaOriginNameModel.cs +++ b/src/Steam.Models/TF2/SchemaOriginNameModel.cs @@ -1,15 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.TF2 +namespace Steam.Models.TF2 { public class SchemaOriginNameModel { public uint Origin { get; set; } - + public string Name { get; set; } } } diff --git a/src/Steam.Models/TF2/SchemaPerClassLoadoutSlotsModel.cs b/src/Steam.Models/TF2/SchemaPerClassLoadoutSlotsModel.cs index c42f65f..139cf73 100644 --- a/src/Steam.Models/TF2/SchemaPerClassLoadoutSlotsModel.cs +++ b/src/Steam.Models/TF2/SchemaPerClassLoadoutSlotsModel.cs @@ -1,21 +1,15 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.TF2 +namespace Steam.Models.TF2 { public class SchemaPerClassLoadoutSlotsModel { public string Soldier { get; set; } - + public string Heavy { get; set; } - + public string Pyro { get; set; } - + public string Engineer { get; set; } - + public string Demoman { get; set; } } } diff --git a/src/Steam.Models/TF2/SchemaQualitiesModel.cs b/src/Steam.Models/TF2/SchemaQualitiesModel.cs index c9527f6..382f4b5 100644 --- a/src/Steam.Models/TF2/SchemaQualitiesModel.cs +++ b/src/Steam.Models/TF2/SchemaQualitiesModel.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.TF2 +namespace Steam.Models.TF2 { public class SchemaQualitiesModel { @@ -82,7 +76,7 @@ public class SchemaQualitiesModel /// Collector's item: https://wiki.teamfortress.com/wiki/Collector%27s /// public uint Collectors { get; set; } - + public uint PaintKitWeapon { get; set; } } } diff --git a/src/Steam.Models/TF2/SchemaStringLookupModel.cs b/src/Steam.Models/TF2/SchemaStringLookupModel.cs index 71dd6b3..1989833 100644 --- a/src/Steam.Models/TF2/SchemaStringLookupModel.cs +++ b/src/Steam.Models/TF2/SchemaStringLookupModel.cs @@ -1,15 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; namespace Steam.Models.TF2 { public class SchemaStringLookupModel { public string TableName { get; set; } - + public IList Strings { get; set; } } } diff --git a/src/Steam.Models/TF2/SchemaStringModel.cs b/src/Steam.Models/TF2/SchemaStringModel.cs index bff15bc..5ce3318 100644 --- a/src/Steam.Models/TF2/SchemaStringModel.cs +++ b/src/Steam.Models/TF2/SchemaStringModel.cs @@ -1,15 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.TF2 +namespace Steam.Models.TF2 { public class SchemaStringModel { public uint Index { get; set; } - + public string String { get; set; } } } diff --git a/src/Steam.Models/TF2/SchemaStyleModel.cs b/src/Steam.Models/TF2/SchemaStyleModel.cs index f90a16c..6325f1e 100644 --- a/src/Steam.Models/TF2/SchemaStyleModel.cs +++ b/src/Steam.Models/TF2/SchemaStyleModel.cs @@ -1,15 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.TF2 +namespace Steam.Models.TF2 { public class SchemaStyleModel { public string Name { get; set; } - + public SchemaAdditionalHiddenBodygroupsModel AdditionalHiddenBodygroups { get; set; } } } diff --git a/src/Steam.Models/TF2/SchemaToolModel.cs b/src/Steam.Models/TF2/SchemaToolModel.cs index e1ad0a2..c26a665 100644 --- a/src/Steam.Models/TF2/SchemaToolModel.cs +++ b/src/Steam.Models/TF2/SchemaToolModel.cs @@ -1,19 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.TF2 +namespace Steam.Models.TF2 { public class SchemaToolModel { public string Type { get; set; } - + public SchemaUsageCapabilitiesModel UsageCapabilities { get; set; } - + public string UseString { get; set; } - + public string Restriction { get; set; } } } diff --git a/src/Steam.Models/TF2/SchemaUsageCapabilitiesModel.cs b/src/Steam.Models/TF2/SchemaUsageCapabilitiesModel.cs index c19204d..59f5850 100644 --- a/src/Steam.Models/TF2/SchemaUsageCapabilitiesModel.cs +++ b/src/Steam.Models/TF2/SchemaUsageCapabilitiesModel.cs @@ -1,37 +1,31 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Steam.Models.TF2 +namespace Steam.Models.TF2 { public class SchemaUsageCapabilitiesModel { public bool Nameable { get; set; } - + public bool? Decodable { get; set; } - + public bool? Paintable { get; set; } - + public bool? CanCustomizeTexture { get; set; } - + public bool? CanGiftWrap { get; set; } - + public bool? PaintableTeamColors { get; set; } - + public bool? CanStrangify { get; set; } - + public bool? CanKillstreakify { get; set; } - + public bool? DuckUpgradable { get; set; } - + public bool? StrangeParts { get; set; } - + public bool? CanCardUpgrade { get; set; } - + public bool? CanSpellPage { get; set; } - + public bool? CanConsume { get; set; } } } diff --git a/src/Steam.UnitTests/BaseTest.cs b/src/Steam.UnitTests/BaseTest.cs index 93560d6..c1ad4f4 100644 --- a/src/Steam.UnitTests/BaseTest.cs +++ b/src/Steam.UnitTests/BaseTest.cs @@ -12,8 +12,7 @@ public class BaseTest public BaseTest() { var builder = new ConfigurationBuilder() - .AddJsonFile("appsettings.json") - .AddUserSecrets(); + .AddJsonFile("appsettings.json"); configuration = builder.Build(); var factoryOptions = new SteamWebInterfaceFactoryOptions() diff --git a/src/Steam.UnitTests/CSGOServersTests.cs b/src/Steam.UnitTests/CSGOServersTests.cs index 814e8c0..3cc8697 100644 --- a/src/Steam.UnitTests/CSGOServersTests.cs +++ b/src/Steam.UnitTests/CSGOServersTests.cs @@ -1,34 +1,34 @@ -using Microsoft.Extensions.Configuration; +using Microsoft.VisualStudio.TestTools.UnitTesting; using Steam.Models.CSGO; using SteamWebAPI2.Interfaces; using System.Net.Http; using System.Threading.Tasks; -using Xunit; namespace Steam.UnitTests { + [TestClass] public class CSGOServersTests : BaseTest { - [Fact] + [TestMethod] public async Task GetGameMapsPlaytimeAsync_Should_Succeed() { var steamInterface = factory.CreateSteamWebInterface(new HttpClient()); var response = await steamInterface.GetGameMapsPlaytimeAsync( - GameMapsPlaytimeInterval.Week, - GameMapsPlaytimeGameMode.Competitive, + GameMapsPlaytimeInterval.Week, + GameMapsPlaytimeGameMode.Competitive, GameMapsPlaytimeMapGroup.Operation ); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - [Fact] + [TestMethod] public async Task GetGameServerStatusAsync_Should_Succeed() { var steamInterface = factory.CreateSteamWebInterface(new HttpClient()); var response = await steamInterface.GetGameServerStatusAsync(); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } } } diff --git a/src/Steam.UnitTests/DOTA2EconTests.cs b/src/Steam.UnitTests/DOTA2EconTests.cs index 8808b92..322d72e 100644 --- a/src/Steam.UnitTests/DOTA2EconTests.cs +++ b/src/Steam.UnitTests/DOTA2EconTests.cs @@ -1,15 +1,11 @@ -using Microsoft.Extensions.Configuration; +using Microsoft.VisualStudio.TestTools.UnitTesting; using SteamWebAPI2.Interfaces; -using SteamWebAPI2.Utilities; -using System; -using System.Collections.Generic; using System.Net.Http; -using System.Text; using System.Threading.Tasks; -using Xunit; namespace Steam.UnitTests { + [TestClass] public class DOTA2EconTests : BaseTest { private readonly DOTA2Econ steamInterface; @@ -19,27 +15,27 @@ public DOTA2EconTests() steamInterface = factory.CreateSteamWebInterface(new HttpClient()); } - [Fact] + [TestMethod] public async Task GetHeroesAsync_Should_Succeed() { var response = await steamInterface.GetHeroesAsync(); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - [Fact] + [TestMethod] public async Task GetRaritiesAsync_Should_Succeed() { var response = await steamInterface.GetRaritiesAsync(); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - [Fact] + [TestMethod] public async Task GetTournamentPrizePoolAsync_Should_Succeed() { var response = await steamInterface.GetTournamentPrizePoolAsync(); - Assert.NotNull(response); + Assert.IsNotNull(response); } } } diff --git a/src/Steam.UnitTests/DOTA2MatchTests.cs b/src/Steam.UnitTests/DOTA2MatchTests.cs index 43c0a99..2aa685f 100644 --- a/src/Steam.UnitTests/DOTA2MatchTests.cs +++ b/src/Steam.UnitTests/DOTA2MatchTests.cs @@ -1,15 +1,11 @@ -using Microsoft.Extensions.Configuration; +using Microsoft.VisualStudio.TestTools.UnitTesting; using SteamWebAPI2.Interfaces; -using SteamWebAPI2.Utilities; -using System; -using System.Collections.Generic; using System.Net.Http; -using System.Text; using System.Threading.Tasks; -using Xunit; namespace Steam.UnitTests { + [TestClass] public class DOTA2MatchTests : BaseTest { private readonly DOTA2Match steamInterface; @@ -19,49 +15,45 @@ public DOTA2MatchTests() steamInterface = factory.CreateSteamWebInterface(new HttpClient()); } - [Fact] + [TestMethod] public async Task GetLiveLeagueGamesAsync_Should_Succeed() { var response = await steamInterface.GetLiveLeagueGamesAsync(); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - [Fact] - public async Task GetMatchDetailsAsync_Should_Succeed() - { - //Old game without some params - var responseOld = await steamInterface.GetMatchDetailsAsync(5327512468); - //game played - 31.10.2021 - var responseNew = await steamInterface.GetMatchDetailsAsync(6249820594); - Assert.NotNull(responseOld); - Assert.NotNull(responseOld.Data); - Assert.NotNull(responseNew); - Assert.NotNull(responseNew.Data); - } + // This endpoint seems to be broken on Valve's end as of last year. Commenting for now. + // [TestMethod] + // public async Task GetMatchDetailsAsync_Should_Succeed() + // { + // var response = await steamInterface.GetMatchDetailsAsync(8555615768); + // Assert.IsNotNull(response); + // Assert.IsNotNull(response.Data); + // } - [Fact] + [TestMethod] public async Task GetMatchHistoryAsync_Should_Succeed() { var response = await steamInterface.GetMatchHistoryAsync(); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - - [Fact] + + [TestMethod] public async Task GetMatchHistoryBySequenceNumberAsync_Should_Succeed() { var response = await steamInterface.GetMatchHistoryBySequenceNumberAsync(); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - - [Fact] + + [TestMethod] public async Task GetTeamInfoByTeamIdAsync_Should_Succeed() { var response = await steamInterface.GetTeamInfoByTeamIdAsync(); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } } } diff --git a/src/Steam.UnitTests/DOTA2TicketTests.cs b/src/Steam.UnitTests/DOTA2TicketTests.cs index f87a0ce..60ea855 100644 --- a/src/Steam.UnitTests/DOTA2TicketTests.cs +++ b/src/Steam.UnitTests/DOTA2TicketTests.cs @@ -1,15 +1,10 @@ -using Microsoft.Extensions.Configuration; +using Microsoft.VisualStudio.TestTools.UnitTesting; using SteamWebAPI2.Interfaces; -using SteamWebAPI2.Utilities; -using System; -using System.Collections.Generic; using System.Net.Http; -using System.Text; -using System.Threading.Tasks; -using Xunit; namespace Steam.UnitTests { + [TestClass] public class DOTA2TicketTests : BaseTest { private readonly DOTA2Ticket steamInterface; diff --git a/src/Steam.UnitTests/EconItemsTeamFortress2Tests.cs b/src/Steam.UnitTests/EconItemsTeamFortress2Tests.cs index 16af818..e8994a8 100644 --- a/src/Steam.UnitTests/EconItemsTeamFortress2Tests.cs +++ b/src/Steam.UnitTests/EconItemsTeamFortress2Tests.cs @@ -1,10 +1,11 @@ -using SteamWebAPI2.Interfaces; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using SteamWebAPI2.Interfaces; using System.Net.Http; using System.Threading.Tasks; -using Xunit; namespace Steam.UnitTests { + [TestClass] public class EconItemsTeamFortress2Tests : BaseTest { private readonly EconItems steamInterface; @@ -17,7 +18,7 @@ public EconItemsTeamFortress2Tests() ); } - [Fact] + [TestMethod] public async Task GetSchemaItemsForTF2Async_Should_Succeed() { uint? next = null; @@ -25,43 +26,43 @@ public async Task GetSchemaItemsForTF2Async_Should_Succeed() do { var response = await steamInterface.GetSchemaItemsForTF2Async(start: next); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); next = response.Data.Result.Next; } while (next.HasValue); } - [Fact] + [TestMethod] public async Task GetSchemaOverviewForTF2Async_Should_Succeed() { var response = await steamInterface.GetSchemaOverviewForTF2Async(); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - [Fact] + [TestMethod] public async Task GetSchemaUrlAsync_Should_Succeed() { var response = await steamInterface.GetSchemaUrlAsync(); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - [Fact] + [TestMethod] public async Task GetStoreMetaDataAsync_Should_Succeed() { var response = await steamInterface.GetStoreMetaDataAsync(); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - [Fact] + [TestMethod] public async Task GetStoreStatusAsync_Should_Succeed() { var response = await steamInterface.GetStoreStatusAsync(); - Assert.NotNull(response); + Assert.IsNotNull(response); } } } diff --git a/src/Steam.UnitTests/EconServiceTests.cs b/src/Steam.UnitTests/EconServiceTests.cs index 4e035e7..a556a49 100644 --- a/src/Steam.UnitTests/EconServiceTests.cs +++ b/src/Steam.UnitTests/EconServiceTests.cs @@ -1,15 +1,11 @@ -using Microsoft.Extensions.Configuration; +using Microsoft.VisualStudio.TestTools.UnitTesting; using SteamWebAPI2.Interfaces; -using SteamWebAPI2.Utilities; -using System; -using System.Collections.Generic; using System.Net.Http; -using System.Text; using System.Threading.Tasks; -using Xunit; namespace Steam.UnitTests { + [TestClass] public class EconServiceTests : BaseTest { private readonly EconService steamInterface; @@ -19,29 +15,29 @@ public EconServiceTests() steamInterface = factory.CreateSteamWebInterface(new HttpClient()); } - [Fact] + [TestMethod] public async Task GetPlayerItemsAsync_Should_Succeed() { var response = await steamInterface.GetTradeHistoryAsync(10); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - [Fact] + [TestMethod] public async Task GetTradeOffersAsync_Should_Succeed() { var response = await steamInterface.GetTradeOffersAsync(true, true); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } // TODO: Figure out how to get a Trade Offer ID? From History? - // [Fact] + // [TestMethod] // public async Task GetTradeOfferAsync_Should_Succeed() // { // var response = await steamInterface.GetTradeOfferAsync(); - // Assert.NotNull(response); - // Assert.NotNull(response.Data); + // Assert.IsNotNull(response); + // Assert.IsNotNull(response.Data); // } } } diff --git a/src/Steam.UnitTests/GCVersionTests.cs b/src/Steam.UnitTests/GCVersionTests.cs index d4c9e5d..b568e30 100644 --- a/src/Steam.UnitTests/GCVersionTests.cs +++ b/src/Steam.UnitTests/GCVersionTests.cs @@ -1,15 +1,12 @@ -using Microsoft.Extensions.Configuration; +using Microsoft.VisualStudio.TestTools.UnitTesting; using SteamWebAPI2.Interfaces; -using SteamWebAPI2.Utilities; using System; -using System.Collections.Generic; using System.Net.Http; -using System.Text; using System.Threading.Tasks; -using Xunit; namespace Steam.UnitTests { + [TestClass] public class GCVersionTests : BaseTest { private readonly GCVersion steamInterfaceTeamFortress2; @@ -26,106 +23,106 @@ public GCVersionTests() AppId.TeamFortress2, httpClient ); - - steamInterfaceCounterStrikeGO= factory.CreateSteamWebInterface( + + steamInterfaceCounterStrikeGO = factory.CreateSteamWebInterface( AppId.CounterStrikeGO, httpClient ); - + steamInterfaceDota2 = factory.CreateSteamWebInterface( AppId.Dota2, httpClient ); - + steamInterfaceArtifact = factory.CreateSteamWebInterface( AppId.Artifact, httpClient ); - + steamInterfaceDotaUnderlords = factory.CreateSteamWebInterface( AppId.DotaUnderlords, httpClient ); } - - [Fact] + + [TestMethod] public async Task GetClientVersionTeamFortress2Async_Should_Succeed() { var response = await steamInterfaceTeamFortress2.GetClientVersionAsync(); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - - [Fact] + + [TestMethod] public async Task GetServerVersionTeamFortress2Async_Should_Succeed() { var response = await steamInterfaceTeamFortress2.GetServerVersionAsync(); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - [Fact] + [TestMethod] public async Task GetClientVersionCounterStrikeGOAsync_Should_Fail() { - await Assert.ThrowsAsync(() => + await Assert.ThrowsExceptionAsync(() => steamInterfaceCounterStrikeGO.GetClientVersionAsync() ); } - - [Fact] + + [TestMethod] public async Task GetServerVersionCounterStrikeGOAsync_Should_Succeed() { var response = await steamInterfaceCounterStrikeGO.GetServerVersionAsync(); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - [Fact] + [TestMethod] public async Task GetClientVersionDota2Async_Should_Succeed() { var response = await steamInterfaceDota2.GetClientVersionAsync(); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - - [Fact] + + [TestMethod] public async Task GetServerVersionDota2Async_Should_Succeed() { var response = await steamInterfaceDota2.GetServerVersionAsync(); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - [Fact] + [TestMethod] public async Task GetClientVersionArtifactAsync_Should_Succeed() { var response = await steamInterfaceArtifact.GetClientVersionAsync(); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - - [Fact] + + [TestMethod] public async Task GetServerVersionArtifactAsync_Should_Succeed() { var response = await steamInterfaceArtifact.GetServerVersionAsync(); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - [Fact] + [TestMethod] public async Task GetClientVersionDotaUnderlordsAsync_Should_Succeed() { var response = await steamInterfaceDotaUnderlords.GetClientVersionAsync(); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - - [Fact] + + [TestMethod] public async Task GetServerVersionDotaUnderlordsAsync_Should_Succeed() { var response = await steamInterfaceDotaUnderlords.GetServerVersionAsync(); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } } } diff --git a/src/Steam.UnitTests/PlayerServiceTests.cs b/src/Steam.UnitTests/PlayerServiceTests.cs index 98f3709..ad98efc 100644 --- a/src/Steam.UnitTests/PlayerServiceTests.cs +++ b/src/Steam.UnitTests/PlayerServiceTests.cs @@ -1,15 +1,11 @@ -using Microsoft.Extensions.Configuration; +using Microsoft.VisualStudio.TestTools.UnitTesting; using SteamWebAPI2.Interfaces; -using SteamWebAPI2.Utilities; -using System; -using System.Collections.Generic; using System.Net.Http; -using System.Text; using System.Threading.Tasks; -using Xunit; namespace Steam.UnitTests { + [TestClass] public class PlayerServiceTests : BaseTest { private readonly PlayerService steamInterface; @@ -18,45 +14,46 @@ public PlayerServiceTests() { steamInterface = factory.CreateSteamWebInterface(new HttpClient()); } - - [Fact] - public async Task GetCommunityBadgeProgressAsync_Should_Succeed() - { - var response = await steamInterface.GetCommunityBadgeProgressAsync(76561198050013009); - Assert.NotNull(response); - Assert.NotNull(response.Data); - } - - [Fact] + + // Commented out until I can figure out how to get a valid response from this endpoint. + // [TestMethod] + // public async Task GetCommunityBadgeProgressAsync_Should_Succeed() + // { + // var response = await steamInterface.GetCommunityBadgeProgressAsync(76561198050013009); + // Assert.IsNotNull(response); + // Assert.IsNotNull(response.Data); + // } + + [TestMethod] public async Task GetBadgesAsync_Should_Succeed() { var response = await steamInterface.GetBadgesAsync(76561198050013009); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - - [Fact] + + [TestMethod] public async Task GetSteamLevelAsync_Should_Succeed() { var response = await steamInterface.GetSteamLevelAsync(76561198050013009); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - [Fact] + [TestMethod] public async Task GetOwnedGamesAsync_Should_Succeed() { var response = await steamInterface.GetOwnedGamesAsync(76561198050013009); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - [Fact] + [TestMethod] public async Task GetRecentlyPlayedGames_Should_Succeed() { var response = await steamInterface.GetRecentlyPlayedGamesAsync(76561198050013009); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } } } diff --git a/src/Steam.UnitTests/Steam.UnitTests.csproj b/src/Steam.UnitTests/Steam.UnitTests.csproj index 8e3f5cd..c906841 100644 --- a/src/Steam.UnitTests/Steam.UnitTests.csproj +++ b/src/Steam.UnitTests/Steam.UnitTests.csproj @@ -1,27 +1,19 @@  - net6.0 + net8.0 false 46a53f4e-b4d4-4fad-b7c9-b777001cfe42 - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + + + + + + + + diff --git a/src/Steam.UnitTests/SteamAppsTests.cs b/src/Steam.UnitTests/SteamAppsTests.cs index aa95554..a953233 100644 --- a/src/Steam.UnitTests/SteamAppsTests.cs +++ b/src/Steam.UnitTests/SteamAppsTests.cs @@ -1,15 +1,11 @@ -using Microsoft.Extensions.Configuration; +using Microsoft.VisualStudio.TestTools.UnitTesting; using SteamWebAPI2.Interfaces; -using SteamWebAPI2.Utilities; -using System; -using System.Collections.Generic; using System.Net.Http; -using System.Text; using System.Threading.Tasks; -using Xunit; namespace Steam.UnitTests { + [TestClass] public class SteamAppsTests : BaseTest { private readonly SteamApps steamInterface; @@ -18,21 +14,22 @@ public SteamAppsTests() { steamInterface = factory.CreateSteamWebInterface(new HttpClient()); } - - [Fact] - public async Task GetAppListAsync_Should_Succeed() - { - var response = await steamInterface.GetAppListAsync(); - Assert.NotNull(response); - Assert.NotNull(response.Data); - } - - [Fact] + + // Always returning 503 on Valve's end. Commenting for now. + // [TestMethod] + // public async Task GetAppListAsync_Should_Succeed() + // { + // var response = await steamInterface.GetAppListAsync(); + // Assert.IsNotNull(response); + // Assert.IsNotNull(response.Data); + // } + + [TestMethod] public async Task UpToDateCheckAsync_Should_Succeed() { var response = await steamInterface.UpToDateCheckAsync(440, 1); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } } } diff --git a/src/Steam.UnitTests/SteamEconomyTests.cs b/src/Steam.UnitTests/SteamEconomyTests.cs index 29394f6..5607f2b 100644 --- a/src/Steam.UnitTests/SteamEconomyTests.cs +++ b/src/Steam.UnitTests/SteamEconomyTests.cs @@ -1,15 +1,12 @@ -using Microsoft.Extensions.Configuration; +using Microsoft.VisualStudio.TestTools.UnitTesting; using SteamWebAPI2.Interfaces; -using SteamWebAPI2.Utilities; -using System; using System.Collections.Generic; using System.Net.Http; -using System.Text; using System.Threading.Tasks; -using Xunit; namespace Steam.UnitTests { + [TestClass] public class SteamEconomyTests : BaseTest { private readonly SteamEconomy steamInterface; @@ -18,22 +15,22 @@ public SteamEconomyTests() { steamInterface = factory.CreateSteamWebInterface(new HttpClient()); } - - [Fact] + + [TestMethod] public async Task GetAssetClassInfoAsync_Should_Succeed() { List classes = new List() { 211447708 }; var response = await steamInterface.GetAssetClassInfoAsync(440, classes); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - - [Fact] + + [TestMethod] public async Task GetAssetPricesAsync_Should_Succeed() { var response = await steamInterface.GetAssetPricesAsync(440); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } } } diff --git a/src/Steam.UnitTests/SteamNewsTests.cs b/src/Steam.UnitTests/SteamNewsTests.cs index a24d121..e1a0b2f 100644 --- a/src/Steam.UnitTests/SteamNewsTests.cs +++ b/src/Steam.UnitTests/SteamNewsTests.cs @@ -1,10 +1,11 @@ -using SteamWebAPI2.Interfaces; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using SteamWebAPI2.Interfaces; using System.Net.Http; using System.Threading.Tasks; -using Xunit; namespace Steam.UnitTests { + [TestClass] public class SteamNewsTests : BaseTest { private readonly SteamNews steamInterface; @@ -13,13 +14,13 @@ public SteamNewsTests() { steamInterface = factory.CreateSteamWebInterface(new HttpClient()); } - - [Fact] + + [TestMethod] public async Task GetNewsForAppAsync_Should_Succeed() { var response = await steamInterface.GetNewsForAppAsync(440); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } } } diff --git a/src/Steam.UnitTests/SteamRemoteTests.cs b/src/Steam.UnitTests/SteamRemoteTests.cs index bf6af00..f931388 100644 --- a/src/Steam.UnitTests/SteamRemoteTests.cs +++ b/src/Steam.UnitTests/SteamRemoteTests.cs @@ -1,11 +1,13 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; using Steam.Models; using SteamWebAPI2.Interfaces; +using System.Linq; using System.Net.Http; using System.Threading.Tasks; -using Xunit; namespace Steam.UnitTests { + [TestClass] public class SteamRemoteTests : BaseTest { private readonly SteamRemoteStorage steamInterface; @@ -14,23 +16,23 @@ public SteamRemoteTests() { steamInterface = factory.CreateSteamWebInterface(new HttpClient()); } - - [Fact] + + [TestMethod] public async Task GetPublishedFileDetailsAsync_Public_Visibility_Should_Succeed() { var response = await steamInterface.GetPublishedFileDetailsAsync(1673456286); - Assert.NotNull(response); - Assert.NotNull(response.Data); - Assert.Equal(PublishedFileVisibility.Public, response.Data.Visibility); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); + Assert.AreEqual(PublishedFileVisibility.Public, response.Data.FirstOrDefault()?.Visibility); } - [Fact] + [TestMethod] public async Task GetPublishedFileDetailsAsync_Unknown_Visibility_Should_Succeed() { var response = await steamInterface.GetPublishedFileDetailsAsync(2097579725); - Assert.NotNull(response); - Assert.NotNull(response.Data); - Assert.Equal(PublishedFileVisibility.Unknown, response.Data.Visibility); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); + Assert.AreEqual(PublishedFileVisibility.Unknown, response.Data.FirstOrDefault()?.Visibility); } } } diff --git a/src/Steam.UnitTests/SteamStoreTests.cs b/src/Steam.UnitTests/SteamStoreTests.cs index dbda5c5..e8bc5cb 100644 --- a/src/Steam.UnitTests/SteamStoreTests.cs +++ b/src/Steam.UnitTests/SteamStoreTests.cs @@ -1,50 +1,42 @@ -using AutoMapper; +using Microsoft.VisualStudio.TestTools.UnitTesting; using SteamWebAPI2.Interfaces; -using SteamWebAPI2.Mappings; using System.Threading.Tasks; -using Xunit; namespace Steam.UnitTests { + [TestClass] public class SteamStoreTests { private readonly SteamStore steamStore; public SteamStoreTests() { - var mapperConfig = new MapperConfiguration(config => - { - config.AddProfile(); - }); - - var mapper = mapperConfig.CreateMapper(); - - steamStore = new SteamStore(mapper); + steamStore = new SteamStore(null); } - - [Fact] + + [TestMethod] public async Task GetStoreAppDetailsAsync_Should_Succeed() { var response = await steamStore.GetStoreAppDetailsAsync(1086940); - Assert.NotNull(response); - Assert.NotNull(response.Name); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Name); } - [Fact] + [TestMethod] public async Task GetStoreAppDetailsAsync_WithCurrency_Should_Succeed() { var response = await steamStore.GetStoreAppDetailsAsync(1086940, "mx"); - Assert.NotNull(response); - Assert.NotNull(response.PriceOverview?.Currency); - Assert.Equal("MXN", response.PriceOverview.Currency); + Assert.IsNotNull(response); + Assert.IsNotNull(response.PriceOverview?.Currency); + Assert.AreEqual("MXN", response.PriceOverview.Currency); } - [Fact] + [TestMethod] public async Task GetStoreAppDetailsAsync_WithLanguage_Should_Succeed() { var response = await steamStore.GetStoreAppDetailsAsync(1086940, "german"); - Assert.NotNull(response); - Assert.NotNull(response.Name); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Name); } } } diff --git a/src/Steam.UnitTests/SteamUserStatsTests.cs b/src/Steam.UnitTests/SteamUserStatsTests.cs index c63bb25..e63d905 100644 --- a/src/Steam.UnitTests/SteamUserStatsTests.cs +++ b/src/Steam.UnitTests/SteamUserStatsTests.cs @@ -1,15 +1,12 @@ -using Microsoft.Extensions.Configuration; +using Microsoft.VisualStudio.TestTools.UnitTesting; using SteamWebAPI2.Interfaces; -using SteamWebAPI2.Utilities; -using System; using System.Collections.Generic; using System.Net.Http; -using System.Text; using System.Threading.Tasks; -using Xunit; namespace Steam.UnitTests { + [TestClass] public class SteamUserStatsTests : BaseTest { private readonly SteamUserStats steamInterface; @@ -19,52 +16,52 @@ public SteamUserStatsTests() steamInterface = factory.CreateSteamWebInterface(new HttpClient()); } - [Fact] + [TestMethod] public async Task GetGlobalAchievementPercentagesForAppAsync_Should_Succeed() { var response = await steamInterface.GetGlobalAchievementPercentagesForAppAsync(440); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - [Fact] + [TestMethod] public async Task GetGlobalStatsForGameAsync_Should_Succeed() { List statNames = new List() { "crimefest_challenge_dallas_1" }; var response = await steamInterface.GetGlobalStatsForGameAsync(218620, statNames.AsReadOnly()); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - - [Fact] + + [TestMethod] public async Task GetNumberOfCurrentPlayersForGameAsync_Should_Succeed() { var response = await steamInterface.GetNumberOfCurrentPlayersForGameAsync(440); - Assert.NotNull(response); + Assert.IsNotNull(response); } - - [Fact] + + [TestMethod] public async Task GetPlayerAchievementsAsync_Should_Succeed() { var response = await steamInterface.GetPlayerAchievementsAsync(440, 76561198050013009); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - - [Fact] + + [TestMethod] public async Task GetSchemaForGameAsync_Should_Succeed() { var response = await steamInterface.GetSchemaForGameAsync(440); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - - [Fact] + + [TestMethod] public async Task GetUserStatsForGameAsync_Should_Succeed() { var response = await steamInterface.GetUserStatsForGameAsync(76561198050013009, 440); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } } } diff --git a/src/Steam.UnitTests/SteamUserTests.cs b/src/Steam.UnitTests/SteamUserTests.cs index f0e1c14..4596979 100644 --- a/src/Steam.UnitTests/SteamUserTests.cs +++ b/src/Steam.UnitTests/SteamUserTests.cs @@ -1,16 +1,13 @@ -using Microsoft.Extensions.Configuration; +using Microsoft.VisualStudio.TestTools.UnitTesting; using SteamWebAPI2.Interfaces; -using SteamWebAPI2.Utilities; -using System; using System.Collections.Generic; using System.Globalization; using System.Net.Http; -using System.Text; using System.Threading.Tasks; -using Xunit; namespace Steam.UnitTests { + [TestClass] public class SteamUserTests : BaseTest { private readonly SteamUser steamInterface; @@ -20,71 +17,71 @@ public SteamUserTests() steamInterface = factory.CreateSteamWebInterface(new HttpClient()); } - [Fact] + [TestMethod] public async Task GetPlayerSummaryAsync_Should_Succeed() { var response = await steamInterface.GetPlayerSummaryAsync(76561198050013009); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - [Fact] + [TestMethod] public async Task GetPlayerSummariesAsync_Should_Succeed() { List steamIds = new List() { 76561198050013009 }; var response = await steamInterface.GetPlayerSummariesAsync(steamIds.AsReadOnly()); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - [Fact] + [TestMethod] public async Task GetFriendsListAsync_Should_Succeed() { var response = await steamInterface.GetFriendsListAsync(76561198050013009); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - [Fact] + [TestMethod] public async Task GetPlayerBansAsync_Should_Succeed() { var response = await steamInterface.GetPlayerBansAsync(76561198050013009); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - [Fact] + [TestMethod] public async Task GetPlayerBansMultipleAsync_Should_Succeed() { List steamIds = new List() { 76561198050013009 }; var response = await steamInterface.GetPlayerBansAsync(steamIds.AsReadOnly()); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - [Fact] + [TestMethod] public async Task GetUserGroupsAsync_Should_Succeed() { var response = await steamInterface.GetUserGroupsAsync(76561198050013009); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - [Fact] + [TestMethod] public async Task ResolveVanityUrlAsync_Should_Succeed() { var response = await steamInterface.ResolveVanityUrlAsync("aro"); - Assert.NotNull(response); - Assert.True(response.Data > 0); + Assert.IsNotNull(response); + Assert.IsTrue(response.Data > 0); } - [Fact] + [TestMethod] public async Task GetCommunityProfileAsync_Should_Succeed() { //for other cultures (for example ru) automaper will not be able to convert floating point numbers and will throw an error CultureInfo.DefaultThreadCurrentCulture = CultureInfo.CreateSpecificCulture("en"); var response = await steamInterface.GetCommunityProfileAsync(76561198064401017); - Assert.NotNull(response); + Assert.IsNotNull(response); } } } diff --git a/src/Steam.UnitTests/SteamWebAPIUtilTests.cs b/src/Steam.UnitTests/SteamWebAPIUtilTests.cs index 9fd70de..88c54cc 100644 --- a/src/Steam.UnitTests/SteamWebAPIUtilTests.cs +++ b/src/Steam.UnitTests/SteamWebAPIUtilTests.cs @@ -1,15 +1,11 @@ -using Microsoft.Extensions.Configuration; +using Microsoft.VisualStudio.TestTools.UnitTesting; using SteamWebAPI2.Interfaces; -using SteamWebAPI2.Utilities; -using System; -using System.Collections.Generic; using System.Net.Http; -using System.Text; using System.Threading.Tasks; -using Xunit; namespace Steam.UnitTests { + [TestClass] public class SteamWebAPIUtilTests : BaseTest { private readonly SteamWebAPIUtil steamInterface; @@ -19,20 +15,20 @@ public SteamWebAPIUtilTests() steamInterface = factory.CreateSteamWebInterface(new HttpClient()); } - [Fact] + [TestMethod] public async Task GetServerInfoAsync_Should_Succeed() { var response = await steamInterface.GetServerInfoAsync(); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } - [Fact] + [TestMethod] public async Task GetSupportedAPIListAsync_Should_Succeed() { var response = await steamInterface.GetSupportedAPIListAsync(); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } } } diff --git a/src/Steam.UnitTests/SteamWebInterfaceFactoryTests.cs b/src/Steam.UnitTests/SteamWebInterfaceFactoryTests.cs index 2d21d30..bfcde04 100644 --- a/src/Steam.UnitTests/SteamWebInterfaceFactoryTests.cs +++ b/src/Steam.UnitTests/SteamWebInterfaceFactoryTests.cs @@ -1,12 +1,13 @@ using Microsoft.Extensions.Options; +using Microsoft.VisualStudio.TestTools.UnitTesting; using SteamWebAPI2.Interfaces; using SteamWebAPI2.Utilities; using System; using System.Net.Http; -using Xunit; namespace Steam.UnitTests { + [TestClass] public class SteamWebInterfaceFactoryTests { private readonly SteamWebInterfaceFactory factory; @@ -20,7 +21,7 @@ public SteamWebInterfaceFactoryTests() factory = new SteamWebInterfaceFactory(Options.Create(factoryOptions)); } - [Fact] + [TestMethod] public void Constructor_Should_Succeed() { var factoryOptions = new SteamWebInterfaceFactoryOptions() @@ -28,149 +29,149 @@ public void Constructor_Should_Succeed() SteamWebApiKey = "ABC123" }; var factory = new SteamWebInterfaceFactory(Options.Create(factoryOptions)); - Assert.NotNull(factory); + Assert.IsNotNull(factory); } - [Fact] + [TestMethod] public void Constructor_Should_Fail_If_Empty_Key() { var factoryOptions = new SteamWebInterfaceFactoryOptions() { SteamWebApiKey = "" }; - Assert.Throws(() => new SteamWebInterfaceFactory(Options.Create(factoryOptions))); + Assert.ThrowsException(() => new SteamWebInterfaceFactory(Options.Create(factoryOptions))); } - [Fact] + [TestMethod] public void Constructor_Should_Fail_If_Null_Key() { - Assert.Throws(() => new SteamWebInterfaceFactory(steamWebApiKey: null)); + Assert.ThrowsException(() => new SteamWebInterfaceFactory(steamWebApiKey: null)); } - [Fact] + [TestMethod] public void Create_SteamUser_Interface_Should_Succeed() { var steamInterface = factory.CreateSteamWebInterface(new HttpClient()); - Assert.NotNull(steamInterface); + Assert.IsNotNull(steamInterface); } - [Fact] + [TestMethod] public void Create_CSGOServers_Interface_Should_Succeed() { var steamInterface = factory.CreateSteamWebInterface(new HttpClient()); - Assert.NotNull(steamInterface); + Assert.IsNotNull(steamInterface); } - [Fact] + [TestMethod] public void Create_DOTA2Econ_Interface_Should_Succeed() { var steamInterface = factory.CreateSteamWebInterface(new HttpClient()); - Assert.NotNull(steamInterface); + Assert.IsNotNull(steamInterface); } - [Fact] + [TestMethod] public void Create_DOTA2Match_Interface_Should_Succeed() { var steamInterface = factory.CreateSteamWebInterface(); - Assert.NotNull(steamInterface); + Assert.IsNotNull(steamInterface); } - [Fact] + [TestMethod] public void Create_DOTA2Ticket_Interface_Should_Succeed() { var steamInterface = factory.CreateSteamWebInterface(); - Assert.NotNull(steamInterface); + Assert.IsNotNull(steamInterface); } - [Fact] + [TestMethod] public void Create_EconItems_Interface_Should_Succeed() { var steamInterface = factory.CreateSteamWebInterface(AppId.TeamFortress2); - Assert.NotNull(steamInterface); + Assert.IsNotNull(steamInterface); } - [Fact] + [TestMethod] public void Create_EconService_Interface_Should_Succeed() { var steamInterface = factory.CreateSteamWebInterface(); - Assert.NotNull(steamInterface); + Assert.IsNotNull(steamInterface); } - [Fact] + [TestMethod] public void Create_GameServersService_Interface_Should_Succeed() { var steamInterface = factory.CreateSteamWebInterface(); - Assert.NotNull(steamInterface); + Assert.IsNotNull(steamInterface); } - [Fact] + [TestMethod] public void Create_GCVersion_Interface_Should_Succeed() { var steamInterface = factory.CreateSteamWebInterface(AppId.TeamFortress2); - Assert.NotNull(steamInterface); + Assert.IsNotNull(steamInterface); } - [Fact] + [TestMethod] public void Create_PlayerService_Interface_Should_Succeed() { var steamInterface = factory.CreateSteamWebInterface(); - Assert.NotNull(steamInterface); + Assert.IsNotNull(steamInterface); } - [Fact] + [TestMethod] public void Create_SteamApps_Interface_Should_Succeed() { var steamInterface = factory.CreateSteamWebInterface(); - Assert.NotNull(steamInterface); + Assert.IsNotNull(steamInterface); } - [Fact] + [TestMethod] public void Create_SteamEconomy_Interface_Should_Succeed() { var steamInterface = factory.CreateSteamWebInterface(); - Assert.NotNull(steamInterface); + Assert.IsNotNull(steamInterface); } - [Fact] + [TestMethod] public void Create_SteamNews_Interface_Should_Succeed() { var steamInterface = factory.CreateSteamWebInterface(); - Assert.NotNull(steamInterface); + Assert.IsNotNull(steamInterface); } - [Fact] + [TestMethod] public void Create_SteamRemoteStorage_Interface_Should_Succeed() { var steamInterface = factory.CreateSteamWebInterface(); - Assert.NotNull(steamInterface); + Assert.IsNotNull(steamInterface); } - [Fact] + [TestMethod] public void Create_SteamStore_Interface_Should_Succeed() { var steamInterface = factory.CreateSteamStoreInterface(); - Assert.NotNull(steamInterface); + Assert.IsNotNull(steamInterface); } - [Fact] + [TestMethod] public void Create_SteamUserAuth_Interface_Should_Succeed() { var steamInterface = factory.CreateSteamWebInterface(); - Assert.NotNull(steamInterface); + Assert.IsNotNull(steamInterface); } - [Fact] + [TestMethod] public void Create_SteamUserStats_Interface_Should_Succeed() { var steamInterface = factory.CreateSteamWebInterface(); - Assert.NotNull(steamInterface); + Assert.IsNotNull(steamInterface); } - [Fact] + [TestMethod] public void Create_SteamWebAPIUtil_Interface_Should_Succeed() { var steamInterface = factory.CreateSteamWebInterface(); - Assert.NotNull(steamInterface); + Assert.IsNotNull(steamInterface); } } } \ No newline at end of file diff --git a/src/Steam.UnitTests/TFItemsTests.cs b/src/Steam.UnitTests/TFItemsTests.cs index 65f18d6..93c375b 100644 --- a/src/Steam.UnitTests/TFItemsTests.cs +++ b/src/Steam.UnitTests/TFItemsTests.cs @@ -1,15 +1,11 @@ -using Microsoft.Extensions.Configuration; +using Microsoft.VisualStudio.TestTools.UnitTesting; using SteamWebAPI2.Interfaces; -using SteamWebAPI2.Utilities; -using System; -using System.Collections.Generic; using System.Net.Http; -using System.Text; using System.Threading.Tasks; -using Xunit; namespace Steam.UnitTests { + [TestClass] public class TFItemsTests : BaseTest { private readonly TFItems steamInterface; @@ -19,12 +15,12 @@ public TFItemsTests() steamInterface = factory.CreateSteamWebInterface(new HttpClient()); } - [Fact] + [TestMethod] public async Task GetServerInfoAsync_Should_Succeed() { var response = await steamInterface.GetGoldenWrenchesAsync(); - Assert.NotNull(response); - Assert.NotNull(response.Data); + Assert.IsNotNull(response); + Assert.IsNotNull(response.Data); } } } diff --git a/src/SteamWebAPI2/Interfaces/CSGOServers.cs b/src/SteamWebAPI2/Interfaces/CSGOServers.cs index a862164..cb51fd8 100644 --- a/src/SteamWebAPI2/Interfaces/CSGOServers.cs +++ b/src/SteamWebAPI2/Interfaces/CSGOServers.cs @@ -1,10 +1,9 @@ -using AutoMapper; -using Steam.Models.CSGO; +using Steam.Models.CSGO; using SteamWebAPI2.Models.CSGO; using SteamWebAPI2.Utilities; -using System; using System.Collections.Generic; using System.Threading.Tasks; +using System.Linq; namespace SteamWebAPI2.Interfaces { @@ -13,17 +12,14 @@ namespace SteamWebAPI2.Interfaces /// public class CSGOServers : ICSGOServers { - private readonly IMapper mapper; private readonly ISteamWebInterface steamWebInterface; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public CSGOServers(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public CSGOServers(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { - this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); - this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("ICSGOServers_730", steamWebRequest) : steamWebInterface; @@ -34,24 +30,33 @@ public CSGOServers(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebIn /// /// public async Task>> GetGameMapsPlaytimeAsync( - GameMapsPlaytimeInterval interval, - GameMapsPlaytimeGameMode gameMode, + GameMapsPlaytimeInterval interval, + GameMapsPlaytimeGameMode gameMode, GameMapsPlaytimeMapGroup mapGroup ) { List parameters = new List(); - + parameters.AddIfHasValue(interval.ToString().ToLower(), "interval"); parameters.AddIfHasValue(gameMode.ToString().ToLower(), "gamemode"); parameters.AddIfHasValue(mapGroup.ToString().ToLower(), "mapgroup"); var steamWebResponse = await steamWebInterface.GetAsync("GetGameMapsPlaytime", 1, parameters); + return steamWebResponse.MapTo((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>>(steamWebResponse); - - return steamWebResponseModel; + return result.Playtimes.Select(x => new GameMapsPlaytimeModel + { + MapName = x.MapName, + IntervalStartTimeStamp = x.IntervalStartTimeStamp.ToDateTime(), + RelativePercentage = x.RelativePercentage + }); + }); } /// @@ -61,10 +66,45 @@ GameMapsPlaytimeMapGroup mapGroup public async Task> GetGameServerStatusAsync() { var steamWebResponse = await steamWebInterface.GetAsync("GetGameServersStatus", 1); + return steamWebResponse.MapTo((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } - var steamWebResponseModel = mapper.Map, ISteamWebResponse>(steamWebResponse); - - return steamWebResponseModel; + return new ServerStatusModel + { + App = result.App == null ? null : new ServerStatusAppModel + { + Version = result.App.Version, + Timestamp = result.App.Timestamp, + Time = result.App.Time + }, + Services = result.Services == null ? null : new ServerStatusServicesModel + { + SessionsLogon = result.Services.SessionsLogon, + SteamCommunity = result.Services.SteamCommunity, + IEconItems = result.Services.IEconItems, + Leaderboards = result.Services.Leaderboards + }, + Datacenters = result.Datacenters?.Select(d => new ServerStatusDatacenterModel + { + Name = d.Name, + Capacity = d.Capacity, + Load = d.Load + }).ToList().AsReadOnly(), + Matchmaking = result.Matchmaking == null ? null : new ServerStatusMatchmakingModel + { + Scheduler = result.Matchmaking.Scheduler, + OnlineServers = result.Matchmaking.OnlineServers, + OnlinePlayers = result.Matchmaking.OnlinePlayers, + SearchingPlayers = result.Matchmaking.SearchingPlayers, + SearchSecondsAverage = result.Matchmaking.SearchSecondsAverage + } + }; + }); } } } \ No newline at end of file diff --git a/src/SteamWebAPI2/Interfaces/DOTA2Econ.cs b/src/SteamWebAPI2/Interfaces/DOTA2Econ.cs index 0128fe2..6bf5d6d 100644 --- a/src/SteamWebAPI2/Interfaces/DOTA2Econ.cs +++ b/src/SteamWebAPI2/Interfaces/DOTA2Econ.cs @@ -1,9 +1,9 @@ -using AutoMapper; -using SteamWebAPI2.Models.DOTA2; +using SteamWebAPI2.Models.DOTA2; using SteamWebAPI2.Utilities; using System; using System.Collections.Generic; using System.Threading.Tasks; +using System.Linq; namespace SteamWebAPI2.Interfaces { @@ -14,16 +14,13 @@ public class DOTA2Econ : IDOTA2Econ { private readonly ISteamWebInterface dota2WebInterface; private readonly ISteamWebInterface dota2TestWebInterface; - private readonly IMapper mapper; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public DOTA2Econ(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public DOTA2Econ(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { - this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); - this.dota2WebInterface = steamWebInterface == null ? new SteamWebInterface("IEconDOTA2_570", steamWebRequest) : steamWebInterface; @@ -48,9 +45,22 @@ public DOTA2Econ(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInte var steamWebResponse = await dota2WebInterface.GetAsync("GetHeroes", 1, parameters); - var steamWebResponseModel = mapper.Map, ISteamWebResponse>>(steamWebResponse); - - return steamWebResponseModel; + return steamWebResponse.MapTo>((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } + + return result.Heroes.Select(x => new Steam.Models.DOTA2.Hero + { + Id = x.Id, + LocalizedName = x.LocalizedName, + Name = x.Name + }).ToList() + .AsReadOnly(); + }); } /// @@ -66,9 +76,24 @@ public DOTA2Econ(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInte var steamWebResponse = await dota2WebInterface.GetAsync("GetRarities", 1, parameters); - var steamWebResponseModel = mapper.Map, ISteamWebResponse>>(steamWebResponse); - - return steamWebResponseModel; + return steamWebResponse.MapTo>((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } + + return result.Rarities.Select(x => new Steam.Models.DOTA2.Rarity + { + Id = x.Id, + LocalizedName = x.LocalizedName, + Name = x.Name, + Color = x.Color, + Order = x.Order + }).ToList() + .AsReadOnly(); + }); } /// @@ -84,9 +109,16 @@ public async Task> GetTournamentPrizePoolAsync(uint? lea var steamWebResponse = await dota2WebInterface.GetAsync("GetTournamentPrizePool", 1, parameters); - var steamWebResponseModel = mapper.Map, ISteamWebResponse>(steamWebResponse); - - return steamWebResponseModel; + return steamWebResponse.MapTo((from) => + { + var result = from?.Result; + if (result == null) + { + return 0; + } + + return result.PrizePool; + }); } /// @@ -109,9 +141,16 @@ public async Task> GetItemIconPathAsync(string iconNam var steamWebResponse = await dota2TestWebInterface.GetAsync("GetItemIconPath", 1, parameters); - var steamWebResponseModel = mapper.Map, ISteamWebResponse>(steamWebResponse); - - return steamWebResponseModel; + return steamWebResponse.MapTo((from) => + { + var result = from?.Result; + if (result == null) + { + return string.Empty; + } + + return result.Path; + }); } } } \ No newline at end of file diff --git a/src/SteamWebAPI2/Interfaces/DOTA2Match.cs b/src/SteamWebAPI2/Interfaces/DOTA2Match.cs index a22a9ae..90db03d 100644 --- a/src/SteamWebAPI2/Interfaces/DOTA2Match.cs +++ b/src/SteamWebAPI2/Interfaces/DOTA2Match.cs @@ -1,26 +1,22 @@ -using AutoMapper; -using Steam.Models.DOTA2; +using Steam.Models.DOTA2; using SteamWebAPI2.Models.DOTA2; using SteamWebAPI2.Utilities; -using System; using System.Collections.Generic; using System.Threading.Tasks; +using System.Linq; namespace SteamWebAPI2.Interfaces { public class DOTA2Match : IDOTA2Match { - private readonly IMapper mapper; private readonly ISteamWebInterface steamWebInterface; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public DOTA2Match(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public DOTA2Match(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { - this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); - this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("IDOTA2Match_570", steamWebRequest) : steamWebInterface; @@ -41,9 +37,104 @@ public async Task>> G var steamWebResponse = await steamWebInterface.GetAsync("GetLiveLeagueGames", 1); - var steamWebResponseModel = mapper.Map, ISteamWebResponse>>(steamWebResponse); + return steamWebResponse.MapTo>((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } - return steamWebResponseModel; + return result.Games?.Select(x => new LiveLeagueGameModel + { + Players = x.Players?.Select(p => new LiveLeagueGamePlayerInfoModel + { + AccountId = p.AccountId, + HeroId = p.HeroId, + Name = p.Name, + Team = p.Team + }).ToList().AsReadOnly(), + RadiantTeam = x.RadiantTeam == null ? null : new LiveLeagueGameTeamRadiantInfoModel + { + TeamId = x.RadiantTeam.TeamId, + TeamName = x.RadiantTeam.TeamName, + TeamLogo = x.RadiantTeam.TeamLogo, + Complete = x.RadiantTeam.Complete + }, + DireTeam = x.DireTeam == null ? null : new LiveLeagueGameTeamDireInfoModel + { + TeamId = x.DireTeam.TeamId, + TeamName = x.DireTeam.TeamName, + TeamLogo = x.DireTeam.TeamLogo, + Complete = x.DireTeam.Complete + }, + LobbyId = x.LobbyId, + DireSeriesWins = x.DireSeriesWins, + RadiantSeriesWins = x.RadiantSeriesWins, + LeagueId = x.LeagueId, + MatchId = x.MatchId, + Spectators = x.Spectators, + GameNumber = x.GameNumber, + LeagueGameId = x.LeagueGameId, + LeagueSeriesId = x.LeagueSeriesId, + StreamDelaySeconds = x.StreamDelaySeconds, + LeagueTier = x.LeagueTier, + Scoreboard = x.Scoreboard == null ? null : new LiveLeagueGameScoreboardModel + { + Dire = x.Scoreboard.Dire == null ? null : new LiveLeagueGameTeamDireDetailModel + { + Abilities = x.Scoreboard.Dire.Abilities?.Select(a => new LiveLeagueGameAbilityModel + { + AbilityId = a.AbilityId, + AbilityLevel = a.AbilityLevel + }).ToList().AsReadOnly(), + Bans = x.Scoreboard.Dire.Bans?.Select(b => new LiveLeagueGameBanModel + { + HeroId = b.HeroId + }).ToList().AsReadOnly(), + BarracksState = x.Scoreboard.Dire?.BarracksState ?? 0, + Picks = x.Scoreboard.Dire.Picks?.Select(p => new LiveLeagueGamePickModel + { + HeroId = p.HeroId, + }).ToList().AsReadOnly(), + Players = x.Scoreboard.Dire.Players? + .Select(p => MapToLiveLeagueGamePlayerDetail(p)) + .ToList() + .AsReadOnly(), + Score = x.Scoreboard.Dire.Score, + TowerState = x.Scoreboard.Dire.TowerState + }, + Radiant = x.Scoreboard.Radiant == null ? null : new LiveLeagueGameTeamRadiantDetailModel + { + Abilities = x.Scoreboard.Radiant.Abilities?.Select(a => new LiveLeagueGameAbilityModel + { + AbilityId = a.AbilityId, + AbilityLevel = a.AbilityLevel + }).ToList().AsReadOnly(), + Bans = x.Scoreboard.Radiant.Bans?.Select(b => new LiveLeagueGameBanModel + { + HeroId = b.HeroId + }).ToList().AsReadOnly(), + BarracksState = x.Scoreboard.Radiant?.BarracksState ?? 0, + Picks = x.Scoreboard.Radiant.Picks?.Select(p => new LiveLeagueGamePickModel + { + HeroId = p.HeroId, + }).ToList().AsReadOnly(), + Players = x.Scoreboard.Radiant.Players? + .Select(p => MapToLiveLeagueGamePlayerDetail(p)) + .ToList() + .AsReadOnly(), + Score = x.Scoreboard.Radiant.Score, + TowerState = x.Scoreboard.Radiant.TowerState + }, + Duration = x.Scoreboard.Duration, + RoshanRespawnTimer = x.Scoreboard.RoshanRespawnTimer + }, + SeriesId = x.SeriesId, + SeriesType = x.SeriesType, + StageName = x.StageName + }).ToList().AsReadOnly(); + }); } /// @@ -59,9 +150,113 @@ public async Task> GetMatchDetailsAsync(ulon var steamWebResponse = await steamWebInterface.GetAsync("GetMatchDetails", 1, parameters); - var steamWebResponseModel = mapper.Map, ISteamWebResponse>(steamWebResponse); + return steamWebResponse.MapTo((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } - return steamWebResponseModel; + return new MatchDetailModel + { + Players = result.Players?.Select(p => new MatchPlayerModel + { + AccountId = p.AccountId, + PlayerSlot = p.PlayerSlot, + HeroId = p.HeroId, + Item0 = p.Item0, + Item1 = p.Item1, + Item2 = p.Item2, + Item3 = p.Item3, + Item4 = p.Item4, + Item5 = p.Item5, + Backpack0 = p.Backpack0, + Backpack1 = p.Backpack1, + Backpack2 = p.Backpack2, + ItemNeutral = p.ItemNeutral, + Kills = p.Kills, + Deaths = p.Deaths, + Assists = p.Assists, + LeaverStatus = p.LeaverStatus, + Gold = p.Gold, + LastHits = p.LastHits, + Denies = p.Denies, + GoldPerMinute = p.GoldPerMinute, + ExperiencePerMinute = p.ExperiencePerMinute, + GoldSpent = p.GoldSpent, + NetWorth = p.NetWorth, + AghanimsScepter = p.AghanimsScepter, + AghanimsShard = p.AghanimsShard, + Moonshard = p.Moonshard, + HeroDamage = p.HeroDamage, + TowerDamage = p.TowerDamage, + HeroHealing = p.HeroHealing, + ScaledHeroDamage = p.ScaledHeroDamage, + ScaledTowerDamage = p.ScaledTowerDamage, + ScaledHeroHealing = p.ScaledHeroHealing, + Level = p.Level, + AbilityUpgrades = p.AbilityUpgrades?.Select(a => new MatchPlayerAbilityUpgradeModel + { + Ability = a.Ability, + Time = a.Time, + Level = a.Level + }).ToList().AsReadOnly(), + AdditionalUnits = p.AdditionalUnits?.Select(u => new MatchPlayerAdditionalUnitModel + { + Unitname = u.Unitname, + Item0 = u.Item0, + Item1 = u.Item1, + Item2 = u.Item2, + Item3 = u.Item3, + Item4 = u.Item4, + Item5 = u.Item5, + Backpack0 = u.Backpack0, + Backpack1 = u.Backpack1, + Backpack2 = u.Backpack2, + ItemNeutral = u.ItemNeutral + }).ToList().AsReadOnly() + }).ToList().AsReadOnly(), + RadiantWin = result.RadiantWin, + PreGameDuration = result.PreGameDuration, + Duration = result.Duration, + StartTime = result.StartTime.ToDateTime(), + MatchId = result.MatchId, + MatchSequenceNumber = result.MatchSequenceNumber, + TowerStatusRadiant = result.TowerStatusRadiant, + TowerStatusDire = result.TowerStatusDire, + BarracksStatusRadiant = result.BarracksStatusRadiant, + BarracksStatusDire = result.BarracksStatusDire, + Cluster = result.Cluster, + FirstBloodTime = result.FirstBloodTime, + LobbyType = result.LobbyType, + HumanPlayers = result.HumanPlayers, + LeagueId = result.LeagueId, + PositiveVotes = result.PositiveVotes, + NegativeVotes = result.NegativeVotes, + GameMode = result.GameMode, + Engine = result.Engine, + RadiantTeamId = result.RadiantTeamId, + RadiantName = result.RadiantName, + RadiantLogo = result.RadiantLogo, + RadiantTeamComplete = result.RadiantTeamComplete, + DireTeamId = result.DireTeamId, + DireName = result.DireName, + DireLogo = result.DireLogo, + DireTeamComplete = result.DireTeamComplete, + RadiantCaptain = result.RadiantCaptain, + DireCaptain = result.DireCaptain, + RadiantScore = result.RadiantScore, + DireScore = result.DireScore, + PicksAndBans = result.PicksAndBans?.Select(pb => new MatchPickBanModel + { + IsPick = pb.IsPick, + HeroId = pb.HeroId, + Team = pb.Team, + Order = pb.Order + }).ToList().AsReadOnly() + }; + }); } /// @@ -95,9 +290,37 @@ public async Task> GetMatchHistoryAsync(uin var steamWebResponse = await steamWebInterface.GetAsync("GetMatchHistory", 1, parameters); - var steamWebResponseModel = mapper.Map, ISteamWebResponse>(steamWebResponse); + return steamWebResponse.MapTo((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } - return steamWebResponseModel; + return new MatchHistoryModel + { + Matches = result.Matches?.Select(m => new MatchHistoryMatchModel + { + DireTeamId = m.DireTeamId, + LobbyType = m.LobbyType, + MatchId = m.MatchId, + MatchSequenceNumber = m.MatchSequenceNumber, + Players = m.Players?.Select(p => new MatchHistoryPlayerModel + { + AccountId = p.AccountId, + PlayerSlot = p.PlayerSlot, + HeroId = p.HeroId, + }).ToList().AsReadOnly(), + RadiantTeamId = m.RadiantTeamId, + StartTime = m.StartTime + }).ToList().AsReadOnly(), + NumResults = result.NumResults, + ResultsRemaining = result.ResultsRemaining, + Status = result.Status, + TotalResults = result.TotalResults + }; + }); } /// @@ -115,11 +338,30 @@ public async Task> var steamWebResponse = await steamWebInterface.GetAsync("GetMatchHistoryBySequenceNum", 1, parameters); - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>>(steamWebResponse); + return steamWebResponse.MapTo>((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } - return steamWebResponseModel; + return result.Matches?.Select(m => new MatchHistoryMatchModel + { + DireTeamId = m.DireTeamId, + LobbyType = m.LobbyType, + MatchId = m.MatchId, + MatchSequenceNumber = m.MatchSequenceNumber, + Players = m.Players?.Select(p => new MatchHistoryPlayerModel + { + AccountId = p.AccountId, + PlayerSlot = p.PlayerSlot, + HeroId = p.HeroId + }).ToList().AsReadOnly(), + RadiantTeamId = m.RadiantTeamId, + StartTime = m.StartTime + }).ToList().AsReadOnly(); + }); } /// @@ -137,9 +379,62 @@ public async Task> var steamWebResponse = await steamWebInterface.GetAsync("GetTeamInfoByTeamID", 1, parameters); - var steamWebResponseModel = mapper.Map, ISteamWebResponse>>(steamWebResponse); + return steamWebResponse.MapTo>((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } - return steamWebResponseModel; + return result.Teams?.Select(t => new Steam.Models.DOTA2.TeamInfo + { + TeamId = t.TeamId, + Name = t.Name, + Tag = t.Tag, + TimeCreated = t.TimeCreated, + Rating = t.Rating, + CountryCode = t.CountryCode, + AdminAccountId = t.AdminAccountId, + Logo = t.Logo, + LogoSponsor = t.LogoSponsor, + Url = t.Url, + GamesPlayedWithCurrentRoster = t.GamesPlayedWithCurrentRoster, + PlayerIds = t.PlayerIds?.ToList().AsReadOnly(), + LeagueIds = t.LeagueIds?.ToList().AsReadOnly() + }).ToList().AsReadOnly(); + }); + } + + private LiveLeagueGamePlayerDetailModel MapToLiveLeagueGamePlayerDetail(LiveLeagueGamePlayerDetail p) + { + return new LiveLeagueGamePlayerDetailModel + { + AccountId = p.AccountId, + Assists = p.Assists, + Deaths = p.Deaths, + Denies = p.Denies, + Gold = p.Gold, + HeroId = p.HeroId, + ExperiencePerMinute = p.ExperiencePerMinute, + GoldPerMinute = p.GoldPerMinute, + Item0 = p.Item0, + Item1 = p.Item1, + Item2 = p.Item2, + Item3 = p.Item3, + Item4 = p.Item4, + Item5 = p.Item5, + Kills = p.Kills, + LastHits = p.LastHits, + Level = p.Level, + NetWorth = p.NetWorth, + PlayerSlot = p.PlayerSlot, + PositionX = p.PositionX, + PositionY = p.PositionY, + RespawnTimer = p.RespawnTimer, + UltimateCooldown = p.UltimateCooldown, + UltimateState = p.UltimateState + }; } } } \ No newline at end of file diff --git a/src/SteamWebAPI2/Interfaces/DOTA2Ticket.cs b/src/SteamWebAPI2/Interfaces/DOTA2Ticket.cs index 2e7cbfe..87508c6 100644 --- a/src/SteamWebAPI2/Interfaces/DOTA2Ticket.cs +++ b/src/SteamWebAPI2/Interfaces/DOTA2Ticket.cs @@ -1,22 +1,17 @@ -using System; -using AutoMapper; -using SteamWebAPI2.Utilities; +using SteamWebAPI2.Utilities; namespace SteamWebAPI2.Interfaces { public class DOTA2Ticket : IDOTA2Ticket { - private readonly IMapper mapper; private readonly ISteamWebInterface steamWebInterface; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public DOTA2Ticket(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public DOTA2Ticket(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { - this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); - this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("IDOTA2Ticket_570", steamWebRequest) : steamWebInterface; diff --git a/src/SteamWebAPI2/Interfaces/EconItems.cs b/src/SteamWebAPI2/Interfaces/EconItems.cs index 1b2b2d4..2be5233 100644 --- a/src/SteamWebAPI2/Interfaces/EconItems.cs +++ b/src/SteamWebAPI2/Interfaces/EconItems.cs @@ -1,17 +1,16 @@ -using AutoMapper; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; using Steam.Models.GameEconomy; using SteamWebAPI2.Models.GameEconomy; using SteamWebAPI2.Utilities; -using System; -using System.Collections.Generic; -using System.Threading.Tasks; namespace SteamWebAPI2.Interfaces { public class EconItems : IEconItems { private readonly ISteamWebInterface steamWebInterface; - private readonly IMapper mapper; private uint appId; @@ -26,10 +25,8 @@ public class EconItems : IEconItems /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public EconItems(IMapper mapper, ISteamWebRequest steamWebRequest, AppId appId, ISteamWebInterface steamWebInterface = null) + public EconItems(ISteamWebRequest steamWebRequest, AppId appId, ISteamWebInterface steamWebInterface = null) { - this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); - if (appId <= 0) { throw new ArgumentOutOfRangeException("appId"); @@ -71,9 +68,50 @@ public async Task> GetPlayerItemsAsync(ul var steamWebResponse = await steamWebInterface.GetAsync("GetPlayerItems", 1, parameters); - var steamWebResponseModel = mapper.Map, ISteamWebResponse>(steamWebResponse); - - return steamWebResponseModel; + return steamWebResponse.MapTo((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } + + return new EconItemResultModel + { + Status = result.Status, + NumBackpackSlots = result.NumBackpackSlots, + Items = result.Items?.Select(i => new EconItemModel + { + Id = i.Id, + OriginalId = i.OriginalId, + DefIndex = i.DefIndex, + Level = i.Level, + Quality = i.Quality, + Inventory = i.Inventory, + Quantity = i.Quantity, + Origin = i.Origin, + Equipped = i.Equipped?.Select(e => new EconItemEquippedModel + { + ClassId = e.ClassId, + Slot = e.Slot + }).ToList().AsReadOnly(), + Style = i.Style, + Attributes = i.Attributes?.Select(a => new EconItemAttributeModel + { + DefIndex = a.DefIndex, + Value = a.Value, + FloatValue = a.FloatValue, + AccountInfo = a.AccountInfo == null ? null : new EconItemAttributeAccountInfoModel + { + SteamId = a.AccountInfo.SteamId, + PersonaName = a.AccountInfo.PersonaName + } + }).ToList().AsReadOnly(), + FlagCannotTrade = i.FlagCannotTrade, + FlagCannotCraft = i.FlagCannotCraft + }).ToList().AsReadOnly() + }; + }); } /// @@ -132,9 +170,10 @@ public async Task> GetSchemaUrlAsync() var steamWebResponse = await steamWebInterface.GetAsync("GetSchemaURL", 1); - var steamWebResponseModel = mapper.Map, ISteamWebResponse>(steamWebResponse); - - return steamWebResponseModel; + return steamWebResponse.MapTo((from) => + { + return from?.Result?.ItemsGameUrl; + }); } /// @@ -155,9 +194,123 @@ public async Task> GetStoreMetaDataAsync(s var steamWebResponse = await steamWebInterface.GetAsync("GetStoreMetaData", 1, parameters); - var steamWebResponseModel = mapper.Map, ISteamWebResponse>(steamWebResponse); - - return steamWebResponseModel; + return steamWebResponse.MapTo((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } + + return new StoreMetaDataModel + { + CarouselData = result.CarouselData == null ? null : new StoreCarouselDataModel + { + Banners = result.CarouselData.Banners?.Select(b => new StoreBannerModel + { + BaseFileName = b.BaseFileName, + Action = b.Action, + Placement = b.Placement, + ActionParam = b.ActionParam + }).ToList().AsReadOnly(), + MaxDisplayBanners = result.CarouselData.MaxDisplayBanners + }, + Tabs = result.Tabs?.Select(t => new StoreTabModel + { + Children = t.Children?.Select(c => new StoreTabChildModel + { + Name = t.ParentName, + Id = t.Id, + }).ToList().AsReadOnly(), + Default = t.Default, + Home = t.Home, + DropdownPrefabId = t.DropdownPrefabId, + Id = t.Id, + Label = t.Label, + ParentId = t.ParentId, + ParentName = t.ParentName, + UseLargeCells = t.UseLargeCells + }).ToList().AsReadOnly(), + DropdownData = result.DropdownData == null ? null : new StoreDropdownDataModel + { + Dropdowns = result.DropdownData.Dropdowns?.Select(d => new StoreDropdownModel + { + Id = d.Id, + Name = d.Name, + LabelText = d.LabelText, + Type = d.Type, + UrlHistoryParamName = d.UrlHistoryParamName + }).ToList().AsReadOnly(), + Prefabs = result.DropdownData.Prefabs.Select(p => new StorePrefabModel + { + Id = p.Id, + Name = p.Name, + Config = p.Config?.Select(c => new StoreConfigModel + { + DefaultSelectionId = c.DefaultSelectionId, + DropdownId = c.DropdownId, + Enabled = c.Enabled, + Name = c.Name + }).ToList().AsReadOnly() + }).ToList().AsReadOnly() + }, + Filters = result.Filters?.Select(f => new StoreFilterModel + { + Id = f.Id, + Name = f.Name, + UrlHistoryParamName = f.UrlHistoryParamName, + Count = f.Count, + AllElement = f.AllElement == null ? null : new StoreFilterAllElementModel + { + Id = f.AllElement.Id, + LocalizedText = f.AllElement.LocalizedText + }, + Elements = f.Elements?.Select(e => new StoreFilterElementModel + { + Id = e.Id, + LocalizedText = e.LocalizedText, + Name = e.Name + }).ToList().AsReadOnly() + }).ToList().AsReadOnly(), + HomePageData = result.HomePageData == null ? null : new StoreHomePageDataModel + { + HomeCategoryId = result.HomePageData.HomeCategoryId, + PopularItems = result.HomePageData.PopularItems?.Select(i => new StorePopularItemModel + { + DefIndex = i.DefIndex, + Order = i.Order, + }).ToList().AsReadOnly() + }, + PlayerClassData = result.PlayerClassData?.Select(pc => new StorePlayerClassDataModel + { + BaseName = pc.BaseName, + Id = pc.Id, + LocalizedText = pc.LocalizedText + }).ToList().AsReadOnly(), + Sorting = result.Sorting == null ? null : new StoreSortingModel + { + Sorters = result.Sorting.Sorters?.Select(s => new StoreSorterModel + { + Id = s.Id, + Name = s.Name, + DataType = s.DataType, + LocalizedText = s.LocalizedText, + SortField = s.SortField, + SortReversed = s.SortReversed + }).ToList().AsReadOnly(), + SortingPrefabs = result.Sorting.SortingPrefabs?.Select(sp => new StoreSortingPrefabModel + { + Id = sp.Id, + Name = sp.Name, + UrlHistoryParamName = sp.UrlHistoryParamName, + SorterIds = sp.SorterIds?.Select(si => new StoreSorterIdModel + { + Id = si.Id + }).ToList().AsReadOnly() + }).ToList().AsReadOnly() + } + }; + }); } /// @@ -173,9 +326,10 @@ public async Task> GetStoreStatusAsync() var steamWebResponse = await steamWebInterface.GetAsync("GetStoreStatus", 1); - var steamWebResponseModel = mapper.Map, ISteamWebResponse>(steamWebResponse); - - return steamWebResponseModel; + return steamWebResponse.MapTo((from) => + { + return from?.Result?.StoreStatus ?? 0; + }); } } } \ No newline at end of file diff --git a/src/SteamWebAPI2/Interfaces/EconService.cs b/src/SteamWebAPI2/Interfaces/EconService.cs index f3cebb3..4d86b08 100644 --- a/src/SteamWebAPI2/Interfaces/EconService.cs +++ b/src/SteamWebAPI2/Interfaces/EconService.cs @@ -1,26 +1,23 @@ -using AutoMapper; -using Steam.Models.SteamEconomy; +using Steam.Models.SteamEconomy; using SteamWebAPI2.Models.SteamEconomy; using SteamWebAPI2.Utilities; using System; using System.Collections.Generic; using System.Threading.Tasks; +using System.Linq; namespace SteamWebAPI2.Interfaces { public class EconService : IEconService { private readonly ISteamWebInterface steamWebInterface; - private readonly IMapper mapper; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public EconService(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public EconService(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { - this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); - this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("IEconService", steamWebRequest) : steamWebInterface; @@ -50,8 +47,8 @@ public async Task> GetTradeHistoryAsync( { List parameters = new List(); - ulong? startAfterTimeUnix = startAfterTime.HasValue - ? startAfterTime.Value.ToUnixTimeStamp() + ulong? startAfterTimeUnix = startAfterTime.HasValue + ? startAfterTime.Value.ToUnixTimeStamp() : (ulong?)null; parameters.AddIfHasValue(maxTrades, "max_trades"); @@ -65,11 +62,33 @@ public async Task> GetTradeHistoryAsync( var steamWebResponse = await steamWebInterface.GetAsync("GetTradeHistory", 1, parameters); - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>(steamWebResponse); + return steamWebResponse.MapTo((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } - return steamWebResponseModel; + return new TradeHistoryModel + { + TotalTradeCount = result.TotalTradeCount, + AreMoreAvailable = result.AreMoreAvailable, + Trades = result.Trades?.Select(t => new TradeModel + { + TradeId = t.TradeId, + TradeParterSteamId = t.TradeParterSteamId, + TimeTradeStarted = t.TimeTradeStarted.ToDateTime(), + TimeEscrowEnds = t.TimeEscrowEnds.ToDateTime(), + TradeStatus = (Steam.Models.SteamEconomy.TradeStatus)t.TradeStatus, + AssetsReceived = t.AssetsReceived?.Select(a => MapToTradedAssetModel(a)).ToList(), + AssetsGiven = t.AssetsGiven?.Select(a => MapToTradedAssetModel(a)).ToList(), + CurrencyReceived = t.CurrencyReceived?.Select(a => MapToTradedCurrencyModel(a)).ToList(), + CurrencyGiven = t.CurrencyGiven?.Select(a => MapToTradedCurrencyModel(a)).ToList() + }).ToList(), + Descriptions = result.Descriptions?.ToList() + }; + }); } /// @@ -97,8 +116,8 @@ public async Task> GetTradeOffersAsync int getSentOffersBit = getSentOffers ? 1 : 0; int getReceivedOffersBit = getReceivedOffers ? 1 : 0; - ulong? timeHistoricalCutoffUnix = timeHistoricalCutoff.HasValue - ? timeHistoricalCutoff.Value.ToUnixTimeStamp() + ulong? timeHistoricalCutoffUnix = timeHistoricalCutoff.HasValue + ? timeHistoricalCutoff.Value.ToUnixTimeStamp() : (ulong?)null; parameters.AddIfHasValue(getSentOffersBit, "get_sent_offers"); @@ -111,11 +130,21 @@ public async Task> GetTradeOffersAsync var steamWebResponse = await steamWebInterface.GetAsync("GetTradeOffers", 1, parameters); - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>(steamWebResponse); + return steamWebResponse.MapTo((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } - return steamWebResponseModel; + return new TradeOffersResultModel + { + TradeOffersSent = result.TradeOffersSent?.Select(tos => MapToTradeOfferModel(tos)).ToList(), + TradeOffersReceived = result.TradeOffersReceived?.Select(tos => MapToTradeOfferModel(tos)).ToList(), + Descriptions = result.Descriptions == null ? null : result.Descriptions.ToList() + }; + }); } /// @@ -137,11 +166,35 @@ public async Task> GetTradeOfferAsync( var steamWebResponse = await steamWebInterface.GetAsync("GetTradeOffer", 1, parameters); - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>(steamWebResponse); + return steamWebResponse.MapTo((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } - return steamWebResponseModel; + return new TradeOfferResultModel + { + TradeOffer = result.TradeOffer == null ? null : new TradeOfferModel + { + TradeOfferId = result.TradeOffer.TradeOfferId, + TradePartnerSteamId = result.TradeOffer.TradePartnerSteamId, + Message = result.TradeOffer.Message, + TimeExpiration = result.TradeOffer.TimeExpiration.ToDateTime(), + TradeOfferState = (Steam.Models.SteamEconomy.TradeOfferState)result.TradeOffer.TradeOfferState, + ItemsYouWillGive = result.TradeOffer.ItemsYouWillGive?.Select(i => MapToTradeAssetModel(i)).ToList(), + ItemsYouWillReceive = result.TradeOffer.ItemsYouWillReceive?.Select(i => MapToTradeAssetModel(i)).ToList(), + IsOfferYouCreated = result.TradeOffer.IsOfferYouCreated, + TimeCreated = result.TradeOffer.TimeCreated.ToDateTime(), + TimeUpdated = result.TradeOffer.TimeUpdated.ToDateTime(), + WasCreatedFromRealTimeTrade = result.TradeOffer.WasCreatedFromRealTimeTrade, + ConfirmationMethod = (Steam.Models.SteamEconomy.TradeOfferConfirmationMethod)result.TradeOffer.ConfirmationMethod, + TimeEscrowEnds = result.TradeOffer.TimeEscrowEnds.ToDateTime() + }, + Descriptions = result.Descriptions == null ? null : result.Descriptions.ToList() + }; + }); } public async Task> GetTradeStatusAsync(ulong tradeId, bool getDescriptions, string language) @@ -156,8 +209,8 @@ public async Task> GetTradeStatusAsync(ulong tradeId, public async Task> GetTradeOffersSummaryAsync(DateTime? timeLastVisit = null) { - ulong? timeLastVisitUnix = timeLastVisit.HasValue - ? timeLastVisit.Value.ToUnixTimeStamp() + ulong? timeLastVisitUnix = timeLastVisit.HasValue + ? timeLastVisit.Value.ToUnixTimeStamp() : (ulong?)null; List parameters = new List(); @@ -188,12 +241,100 @@ public async Task> GetTradeHold parameters.AddIfHasValue(steamIdTarget, "steamid_target"); parameters.AddIfHasValue(tradeOfferAccessToken, "trade_offer_access_token"); var steamWebResponse = await steamWebInterface.GetAsync("GetTradeHoldDurations", 1, parameters); - - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>(steamWebResponse); - return steamWebResponseModel; + return steamWebResponse.MapTo((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } + + return new TradeHoldDurationsResultModel + { + MyEscrow = MapToTradeHoldDurationsModel(result.MyEscrow), + TheirEscrow = MapToTradeHoldDurationsModel(result.TheirEscrow), + BothEscrow = MapToTradeHoldDurationsModel(result.BothEscrow) + }; + }); + } + + private static TradedAssetModel MapToTradedAssetModel(TradedAsset ta) + { + return new TradedAssetModel + { + AppId = ta.AppId, + ContextId = ta.ContextId, + AssetId = ta.AssetId, + AmountTraded = ta.AmountTraded, + ClassId = ta.ClassId, + InstanceId = ta.InstanceId, + AssetIdAfterTrade = ta.AssetIdAfterTrade, + ContextIdAfterTrade = ta.ContextIdAfterTrade, + AssetIdAfterRollback = ta.AssetIdAfterRollback, + ContextIdAfterRollback = ta.ContextIdAfterRollback + }; + } + + private static TradedCurrencyModel MapToTradedCurrencyModel(TradedCurrency tc) + { + return new TradedCurrencyModel + { + AppId = tc.AppId, + ContextId = tc.ContextId, + CurrencyId = tc.CurrencyId, + AmountTraded = tc.AmountTraded, + ClassId = tc.ClassId, + CurrencyIdAfterTrade = tc.CurrencyIdAfterTrade, + ContextIdAfterTrade = tc.ContextIdAfterTrade, + CurrencyIdAfterRollback = tc.CurrencyIdAfterRollback, + ContextIdAfterRollback = tc.ContextIdAfterRollback + }; + } + + private static TradeOfferModel MapToTradeOfferModel(TradeOffer to) + { + return new TradeOfferModel + { + TradeOfferId = to.TradeOfferId, + TradePartnerSteamId = to.TradePartnerSteamId, + Message = to.Message, + TimeExpiration = to.TimeExpiration.ToDateTime(), + TradeOfferState = (Steam.Models.SteamEconomy.TradeOfferState)to.TradeOfferState, + ItemsYouWillGive = to.ItemsYouWillGive?.Select(i => MapToTradeAssetModel(i)).ToList(), + ItemsYouWillReceive = to.ItemsYouWillReceive?.Select(i => MapToTradeAssetModel(i)).ToList(), + IsOfferYouCreated = to.IsOfferYouCreated, + TimeCreated = to.TimeCreated.ToDateTime(), + TimeUpdated = to.TimeUpdated.ToDateTime(), + WasCreatedFromRealTimeTrade = to.WasCreatedFromRealTimeTrade, + ConfirmationMethod = (Steam.Models.SteamEconomy.TradeOfferConfirmationMethod)to.ConfirmationMethod, + TimeEscrowEnds = to.TimeEscrowEnds.ToDateTime() + }; + } + + private static TradeAssetModel MapToTradeAssetModel(TradeAsset ta) + { + return new TradeAssetModel + { + AppId = ta.AppId, + ContextId = ta.ContextId, + AssetId = ta.AssetId, + AmountOffered = ta.AmountOffered, + ClassId = ta.ClassId, + InstanceId = ta.InstanceId, + CurrencyId = ta.CurrencyId, + IsMissing = ta.IsMissing + }; } + + private static TradeHoldDurationsModel MapToTradeHoldDurationsModel(TradeHoldDurations d) + { + return new TradeHoldDurationsModel + { + EscrowEndDuration = TimeSpan.FromSeconds(d.EscrowEndDurationSeconds), + EscrowEndDate = d.EscrowEndDateRfc3339, + }; + } + } } \ No newline at end of file diff --git a/src/SteamWebAPI2/Interfaces/GCVersion.cs b/src/SteamWebAPI2/Interfaces/GCVersion.cs index f7f0723..b993b54 100644 --- a/src/SteamWebAPI2/Interfaces/GCVersion.cs +++ b/src/SteamWebAPI2/Interfaces/GCVersion.cs @@ -1,17 +1,15 @@ -using AutoMapper; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; using Steam.Models; using SteamWebAPI2.Models; using SteamWebAPI2.Utilities; -using System; -using System.Collections.Generic; -using System.Threading.Tasks; namespace SteamWebAPI2.Interfaces { public class GCVersion : IGCVersion { private readonly ISteamWebInterface steamWebInterface; - private readonly IMapper mapper; private uint appId; @@ -24,10 +22,8 @@ public class GCVersion : IGCVersion /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public GCVersion(IMapper mapper, ISteamWebRequest steamWebRequest, AppId appId, ISteamWebInterface steamWebInterface = null) + public GCVersion(ISteamWebRequest steamWebRequest, AppId appId, ISteamWebInterface steamWebInterface = null) { - this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); - this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("IGCVersion_" + (uint)appId, steamWebRequest) : steamWebInterface; @@ -64,9 +60,21 @@ public async Task> GetClientVersionAsyn var steamWebResponse = await steamWebInterface.GetAsync("GetClientVersion", 1); - var steamWebResponseModel = mapper.Map, ISteamWebResponse>(steamWebResponse); - - return steamWebResponseModel; + return steamWebResponse.MapTo((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } + + return new GameClientResultModel + { + Success = result.Success, + DeployVersion = result.DeployVersion, + ActiveVersion = result.ActiveVersion + }; + }); } /// @@ -82,9 +90,21 @@ public async Task> GetServerVersionAsyn var steamWebResponse = await steamWebInterface.GetAsync("GetServerVersion", 1); - var steamWebResponseModel = mapper.Map, ISteamWebResponse>(steamWebResponse); - - return steamWebResponseModel; + return steamWebResponse.MapTo((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } + + return new GameClientResultModel + { + Success = result.Success, + DeployVersion = result.DeployVersion, + ActiveVersion = result.ActiveVersion + }; + }); } } } \ No newline at end of file diff --git a/src/SteamWebAPI2/Interfaces/GameServersService.cs b/src/SteamWebAPI2/Interfaces/GameServersService.cs index e45bcbb..5ce78a0 100644 --- a/src/SteamWebAPI2/Interfaces/GameServersService.cs +++ b/src/SteamWebAPI2/Interfaces/GameServersService.cs @@ -1,26 +1,22 @@ -using AutoMapper; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; using Steam.Models.GameServers; using SteamWebAPI2.Models.GameServers; using SteamWebAPI2.Utilities; -using System; -using System.Collections.Generic; -using System.Threading.Tasks; namespace SteamWebAPI2.Interfaces { public class GameServersService : IGameServersService { private readonly ISteamWebInterface steamWebInterface; - private readonly IMapper mapper; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public GameServersService(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public GameServersService(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { - this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); - this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("IGameServersService", steamWebRequest) : steamWebInterface; @@ -32,10 +28,32 @@ public GameServersService(IMapper mapper, ISteamWebRequest steamWebRequest, ISte public async Task> GetAccountListAsync() { var steamWebResponse = await steamWebInterface.GetAsync("GetAccountList", 1); - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>(steamWebResponse); - return steamWebResponseModel; + return steamWebResponse.MapTo((from) => + { + var result = from?.Response; + if (result == null) + { + return null; + } + + return new AccountListModel + { + Servers = result.Servers?.Select(s => new AccountServerModel + { + SteamId = s.SteamId, + LoginToken = s.LoginToken, + Memo = s.Memo, + AppId = s.AppId, + IsDeleted = s.IsDeleted, + IsExpired = s.IsExpired, + RtLastLogon = s.RtLastLogon.ToDateTime() + }).ToList(), + IsBanned = result.IsBanned, + Expires = result.Expires, + Actor = result.Actor, + LastActionTime = result.LastActionTime.ToDateTime() + }; + }); } /// Creates a persistent game server account. @@ -51,11 +69,20 @@ public async Task> CreateAccountAsync(AppI var steamWebResponse = await steamWebInterface.PostAsync("CreateAccount", 1, parameters); - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>(steamWebResponse); + return steamWebResponse.MapTo((from) => + { + var result = from?.Response; + if (result == null) + { + return null; + } - return steamWebResponseModel; + return new CreateAccountModel + { + SteamId = result.SteamId, + LoginToken = result.LoginToken + }; + }); } /// This method changes the memo associated with the game server account. @@ -82,10 +109,16 @@ public async Task> ResetLoginTokenAsync(ulong steamId) List parameters = new List(); parameters.AddIfHasValue(steamId, "steamid"); var steamWebResponse = await steamWebInterface.PostAsync("ResetLoginToken", 1, parameters); - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>(steamWebResponse); - return steamWebResponseModel; + return steamWebResponse.MapTo((from) => + { + var result = from?.Response; + if (result == null) + { + return null; + } + + return result.LoginToken; + }); } /// Deletes a persistent game server account @@ -108,10 +141,21 @@ public async Task> GetAccountPublicInf List parameters = new List(); parameters.AddIfHasValue(steamId, "steamid"); var steamWebResponse = await steamWebInterface.GetAsync("GetAccountPublicInfo", 1, parameters); - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>(steamWebResponse); - return steamWebResponseModel; + + return steamWebResponse.MapTo((from) => + { + var result = from?.Response; + if (result == null) + { + return null; + } + + return new AccountPublicInfoModel + { + SteamId = result.SteamId, + AppId = result.AppId + }; + }); } public async Task> QueryLoginTokenAsync(string loginToken) @@ -119,10 +163,21 @@ public async Task> QueryLoginTokenAsync( List parameters = new List(); parameters.AddIfHasValue(loginToken, "login_token"); var steamWebResponse = await steamWebInterface.GetAsync("QueryLoginToken", 1, parameters); - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>(steamWebResponse); - return steamWebResponseModel; + return steamWebResponse.MapTo((from) => + { + var result = from?.Response; + if (result == null) + { + return null; + } + + return new QueryLoginTokenModel + { + IsBanned = result.IsBanned, + Expires = result.Expires, + SteamId = result.SteamId + }; + }); } public async Task> GetServerSteamIDsByIPAsync(IReadOnlyCollection serverIPs) diff --git a/src/SteamWebAPI2/Interfaces/ISteamRemoteStorage.cs b/src/SteamWebAPI2/Interfaces/ISteamRemoteStorage.cs index f951876..053caa9 100644 --- a/src/SteamWebAPI2/Interfaces/ISteamRemoteStorage.cs +++ b/src/SteamWebAPI2/Interfaces/ISteamRemoteStorage.cs @@ -12,7 +12,7 @@ public interface ISteamRemoteStorage Task>> GetPublishedFileDetailsAsync(IList publishedFileIds); - Task> GetPublishedFileDetailsAsync(ulong publishedFileId); + Task>> GetPublishedFileDetailsAsync(ulong publishedFileId); Task> GetUGCFileDetailsAsync(ulong ugcId, uint appId, ulong? steamId = null); } diff --git a/src/SteamWebAPI2/Interfaces/PlayerService.cs b/src/SteamWebAPI2/Interfaces/PlayerService.cs index 6a64124..a9ea6ad 100644 --- a/src/SteamWebAPI2/Interfaces/PlayerService.cs +++ b/src/SteamWebAPI2/Interfaces/PlayerService.cs @@ -1,34 +1,31 @@ -using AutoMapper; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Threading.Tasks; using Newtonsoft.Json; using Steam.Models.SteamCommunity; using SteamWebAPI2.Models.SteamCommunity; using SteamWebAPI2.Models.SteamPlayer; using SteamWebAPI2.Utilities; -using System; -using System.Collections.Generic; -using System.Net; -using System.Threading.Tasks; namespace SteamWebAPI2.Interfaces { public class PlayerService : IPlayerService { private readonly ISteamWebInterface steamWebInterface; - private readonly IMapper mapper; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public PlayerService(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public PlayerService(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { - this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); - this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("IPlayerService", steamWebRequest) : steamWebInterface; } - + /// /// Returns a collection of badge meta data which indicates the progress towards a badge for a specific user. /// @@ -49,11 +46,20 @@ public async Task>> GetCo return null; } - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>>(steamWebResponse); + return steamWebResponse.MapTo>((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } - return steamWebResponseModel; + return result.Quests?.Select(q => new BadgeQuestModel + { + QuestId = q.QuestId, + Completed = q.Completed + }).ToList().AsReadOnly(); + }); } /// @@ -74,11 +80,33 @@ public async Task> GetBadgesAsync(ulong ste return null; } - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>(steamWebResponse); + return steamWebResponse.MapTo((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } - return steamWebResponseModel; + return new BadgesResultModel + { + Badges = result.Badges?.Select(b => new BadgeModel + { + BadgeId = b.BadgeId, + Level = b.Level, + CompletionTime = b.CompletionTime, + AppId = b.AppId, + BorderColor = b.BorderColor, + CommunityItemId = b.CommunityItemId, + Scarcity = b.Scarcity, + Xp = b.Xp + }).ToList().AsReadOnly(), + PlayerXp = result.PlayerXp, + PlayerLevel = result.PlayerLevel, + PlayerXpNeededToLevelUp = result.PlayerXpNeededToLevelUp, + PlayerXpNeededCurrentLevel = result.PlayerXpNeededCurrentLevel + }; + }); } /// @@ -97,11 +125,10 @@ public async Task> GetBadgesAsync(ulong ste return null; } - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>(steamWebResponse); - - return steamWebResponseModel; + return steamWebResponse.MapTo((from) => + { + return from?.Result?.PlayerLevel; + }); } /// @@ -146,7 +173,7 @@ public async Task> GetOwnedGamesAsync(u } // for some reason, some games have trailing spaces in the result so let's get rid of them - if (steamWebResponse.Data != null && steamWebResponse.Data.Result != null && steamWebResponse.Data.Result.OwnedGames != null) + if (steamWebResponse.Data?.Result?.OwnedGames != null) { foreach (var ownedGame in steamWebResponse.Data.Result.OwnedGames) { @@ -157,11 +184,31 @@ public async Task> GetOwnedGamesAsync(u } } - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>(steamWebResponse); + return steamWebResponse.MapTo((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } - return steamWebResponseModel; + return new OwnedGamesResultModel + { + GameCount = result.GameCount, + OwnedGames = result.OwnedGames?.Select(g => new OwnedGameModel + { + AppId = g.AppId, + Name = g.Name, + PlaytimeForever = TimeSpan.FromMinutes(g.PlaytimeForever), + ImgIconUrl = g.ImgIconUrl, + ImgLogoUrl = g.ImgLogoUrl, + HasCommunityVisibleStats = g.HasCommunityVisibleStats, + PlaytimeLastTwoWeeks = g.Playtime2weeks.HasValue + ? TimeSpan.FromMinutes(g.Playtime2weeks.Value) + : (TimeSpan?)null + }).ToList().AsReadOnly() + }; + }); } /// @@ -181,11 +228,28 @@ public async Task> GetRecently return null; } - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>(steamWebResponse); + return steamWebResponse.MapTo((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } - return steamWebResponseModel; + return new RecentlyPlayedGamesResultModel + { + TotalCount = result.TotalCount, + RecentlyPlayedGames = result.RecentlyPlayedGames?.Select(g => new RecentlyPlayedGameModel + { + AppId = g.AppId, + Name = g.Name, + Playtime2Weeks = g.Playtime2Weeks, + PlaytimeForever = g.PlaytimeForever, + ImgIconUrl = g.ImgIconUrl, + ImgLogoUrl = g.ImgLogoUrl + }).ToList().AsReadOnly() + }; + }); } } } \ No newline at end of file diff --git a/src/SteamWebAPI2/Interfaces/SteamApps.cs b/src/SteamWebAPI2/Interfaces/SteamApps.cs index 01daa58..db41c77 100644 --- a/src/SteamWebAPI2/Interfaces/SteamApps.cs +++ b/src/SteamWebAPI2/Interfaces/SteamApps.cs @@ -1,26 +1,23 @@ -using AutoMapper; + using Steam.Models; using SteamWebAPI2.Models; using SteamWebAPI2.Utilities; -using System; using System.Collections.Generic; using System.Threading.Tasks; +using System.Linq; namespace SteamWebAPI2.Interfaces { public class SteamApps : ISteamApps { - private readonly IMapper mapper; private readonly ISteamWebInterface steamWebInterface; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public SteamApps(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public SteamApps(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { - this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); - this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("ISteamApps", steamWebRequest) : steamWebInterface; @@ -34,11 +31,20 @@ public async Task>> GetAppL { var steamWebResponse = await steamWebInterface.GetAsync("GetAppList", 2); - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>>(steamWebResponse); + return steamWebResponse.MapTo>((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } - return steamWebResponseModel; + return result.Apps?.Select(a => new SteamAppModel + { + AppId = a.AppId, + Name = a.Name + }).ToList().AsReadOnly(); + }); } /// @@ -56,11 +62,23 @@ public async Task> UpToDateCheckAs var steamWebResponse = await steamWebInterface.GetAsync("UpToDateCheck", 1, parameters); - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>(steamWebResponse); + return steamWebResponse.MapTo((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } - return steamWebResponseModel; + return new SteamAppUpToDateCheckModel + { + Success = result.Success, + UpToDate = result.UpToDate, + VersionIsListable = result.VersionIsListable, + RequiredVersion = result.RequiredVersion, + Message = result.Message + }; + }); } } } \ No newline at end of file diff --git a/src/SteamWebAPI2/Interfaces/SteamEconomy.cs b/src/SteamWebAPI2/Interfaces/SteamEconomy.cs index 2d2077c..1e888be 100644 --- a/src/SteamWebAPI2/Interfaces/SteamEconomy.cs +++ b/src/SteamWebAPI2/Interfaces/SteamEconomy.cs @@ -1,26 +1,23 @@ -using AutoMapper; + using Steam.Models.SteamEconomy; using SteamWebAPI2.Models.SteamEconomy; using SteamWebAPI2.Utilities; -using System; using System.Collections.Generic; using System.Threading.Tasks; +using System.Linq; namespace SteamWebAPI2.Interfaces { public class SteamEconomy : ISteamEconomy { private readonly ISteamWebInterface steamWebInterface; - private readonly IMapper mapper; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public SteamEconomy(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public SteamEconomy(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { - this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); - this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("ISteamEconomy", steamWebRequest) : steamWebInterface; @@ -48,11 +45,75 @@ public async Task> GetAssetClassInf var steamWebResponse = await steamWebInterface.GetAsync("GetAssetClassInfo", 1, parameters); - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>(steamWebResponse); + return steamWebResponse.MapTo((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } - return steamWebResponseModel; + return new AssetClassInfoResultModel + { + Success = result.Success, + AssetClasses = result.AssetClasses?.Select(ac => new AssetClassInfoModel + { + ClassId = ac.ClassId, + Name = ac.Name, + MarketName = ac.MarketName, + Type = ac.Type, + MarketHashName = ac.MarketHashName, + Descriptions = ac.Descriptions?.Select(d => new AssetClassDescriptionModel + { + Value = d.Value, + Color = d.Color, + Type = d.Type, + AppData = d.AppData + }).ToList().AsReadOnly(), + Tradable = ac.Tradable, + Marketable = ac.Marketable, + Tags = ac.Tags?.Select(t => new AssetClassTagModel + { + Category = t.Category, + InternalName = t.InternalName, + Name = t.Name, + Color = t.Color, + CategoryName = t.CategoryName + }).ToList().AsReadOnly(), + Actions = ac.Actions?.Select(a => new AssetClassActionModel + { + Name = a.Name, + Link = a.Link + }).ToList().AsReadOnly(), + MarketActions = ac.MarketActions?.Select(ma => new AssetClassMarketActionModel + { + Name = ma.Name, + Link = ma.Link + }).ToList().AsReadOnly(), + Commodity = ac.Commodity, + BackgroundColor = ac.BackgroundColor, + IconUrl = ac.IconUrl, + IconUrlLarge = ac.IconUrlLarge, + FraudWarnings = ac.FraudWarnings, + AppData = ac.AppData == null ? null : new AssetClassAppDataModel + { + DefIndex = ac.AppData.DefIndex, + FilterData = ac.AppData.FilterData?.Select(fd => new AssetClassAppDataFilterModel + { + ElementIds = fd.ElementIds?.ToList().AsReadOnly(), + }).ToList().AsReadOnly(), + HighlightColor = ac.AppData.HighlightColor, + PlayerClassIds = ac.AppData.PlayerClassIds?.ToList().AsReadOnly(), + Quality = ac.AppData.Quality, + Slot = ac.AppData.Slot + }, + IconDragUrl = ac.IconDragUrl, + MarketMarketableRestriction = ac.MarketMarketableRestriction, + MarketTradableRestriction = ac.MarketTradableRestriction, + NameColor = ac.NameColor + }).ToList().AsReadOnly() + }; + }); } /// @@ -72,11 +133,86 @@ public async Task> GetAssetPricesAsync( var steamWebResponse = await steamWebInterface.GetAsync("GetAssetPrices", 1, parameters); - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>(steamWebResponse); + return steamWebResponse.MapTo((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } - return steamWebResponseModel; + return new AssetPriceResultModel + { + Success = result.Success, + Assets = result.Assets?.Select(a => new AssetModel + { + Class = a.Class?.Select(c => new AssetClassModel + { + Name = c.Name, + Value = c.Value + }).ToList().AsReadOnly(), + ClassId = a.ClassId, + Date = a.Date, + Name = a.Name, + Prices = a.Prices == null ? null : new AssetPricesModel + { + USD = a.Prices.USD, + GBP = a.Prices.GBP, + EUR = a.Prices.EUR, + RUB = a.Prices.RUB, + CNY = a.Prices.CNY, + JPY = a.Prices.JPY, + KRW = a.Prices.KRW, + AUD = a.Prices.AUD, + CAD = a.Prices.CAD, + NZD = a.Prices.NZD, + MXN = a.Prices.MXN, + BRL = a.Prices.BRL, + SGD = a.Prices.SGD, + THB = a.Prices.THB, + VND = a.Prices.VND, + IDR = a.Prices.IDR, + MYR = a.Prices.MYR, + PHP = a.Prices.PHP, + NOK = a.Prices.NOK, + TRY = a.Prices.TRY, + UAH = a.Prices.UAH, + AED = a.Prices.AED, + SAR = a.Prices.SAR, + ZAR = a.Prices.ZAR, + HKD = a.Prices.HKD, + INR = a.Prices.INR, + TWD = a.Prices.TWD + }, + TagIds = a.TagIds.ToList().AsReadOnly(), + Tags = a.Tags.ToList().AsReadOnly() + }).ToList().AsReadOnly(), + TagIds = result.TagIds == null ? null : new AssetTagIdsModel + { + Tag0 = result.TagIds.Tag0, + Tag1 = result.TagIds.Tag1, + Tag2 = result.TagIds.Tag2, + Tag3 = result.TagIds.Tag3, + Tag4 = result.TagIds.Tag4, + Tag5 = result.TagIds.Tag5, + Tag6 = result.TagIds.Tag6, + Tag7 = result.TagIds.Tag7, + Tag8 = result.TagIds.Tag8 + }, + Tags = result.Tags == null ? null : new AssetTagsModel + { + Cosmetics = result.Tags.Cosmetics, + Bundles = result.Tags.Bundles, + Halloween = result.Tags.Halloween, + Limited = result.Tags.Limited, + Maps = result.Tags.Maps, + New = result.Tags.New, + Taunts = result.Tags.Taunts, + Tools = result.Tags.Tools, + Weapons = result.Tags.Weapons + } + }; + }); } } } \ No newline at end of file diff --git a/src/SteamWebAPI2/Interfaces/SteamNews.cs b/src/SteamWebAPI2/Interfaces/SteamNews.cs index 4bff68c..f56b71f 100644 --- a/src/SteamWebAPI2/Interfaces/SteamNews.cs +++ b/src/SteamWebAPI2/Interfaces/SteamNews.cs @@ -1,26 +1,23 @@ -using AutoMapper; -using Steam.Models; +using Steam.Models; using SteamWebAPI2.Models; using SteamWebAPI2.Utilities; using System; using System.Collections.Generic; using System.Threading.Tasks; +using System.Linq; namespace SteamWebAPI2.Interfaces { public class SteamNews : ISteamNews { private readonly ISteamWebInterface steamWebInterface; - private readonly IMapper mapper; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public SteamNews(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public SteamNews(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { - this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); - this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("ISteamNews", steamWebRequest) : steamWebInterface; @@ -52,15 +49,36 @@ public async Task> GetNewsForAppAsync(ui parameters.AddIfHasValue(endDateUnixTimeStamp, "enddate"); parameters.AddIfHasValue(count, "count"); parameters.AddIfHasValue(feeds, "feeds"); - parameters.AddIfHasValue(tags, "tags"); + parameters.AddIfHasValue(tags, "tags"); var steamWebResponse = await steamWebInterface.GetAsync("GetNewsForApp", 2, parameters); - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>(steamWebResponse); + return steamWebResponse.MapTo((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } - return steamWebResponseModel; + return new SteamNewsResultModel + { + AppId = result.AppId, + NewsItems = result.NewsItems?.Select(n => new NewsItemModel + { + Gid = n.Gid, + Title = n.Title, + Url = n.Url, + IsExternalUrl = n.IsExternalUrl, + Author = n.Author, + Contents = n.Contents, + FeedLabel = n.FeedLabel, + Date = n.Date, + Feedname = n.Feedname, + Tags = n.Tags + }).ToList().AsReadOnly() + }; + }); } } } \ No newline at end of file diff --git a/src/SteamWebAPI2/Interfaces/SteamRemoteStorage.cs b/src/SteamWebAPI2/Interfaces/SteamRemoteStorage.cs index 5ada500..55fa2fd 100644 --- a/src/SteamWebAPI2/Interfaces/SteamRemoteStorage.cs +++ b/src/SteamWebAPI2/Interfaces/SteamRemoteStorage.cs @@ -1,4 +1,4 @@ -using AutoMapper; + using Steam.Models; using SteamWebAPI2.Models; using SteamWebAPI2.Utilities; @@ -14,16 +14,13 @@ namespace SteamWebAPI2.Interfaces public class SteamRemoteStorage : ISteamRemoteStorage { private readonly ISteamWebInterface steamWebInterface; - private readonly IMapper mapper; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public SteamRemoteStorage(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public SteamRemoteStorage(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { - this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); - this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("ISteamRemoteStorage", steamWebRequest) : steamWebInterface; @@ -63,7 +60,7 @@ public async Task>(parameters); + return await GetPublishedFileDetailsAsync(parameters); } /// @@ -88,14 +85,14 @@ public async Task /// The ID of the file for which to retrieve details. /// The details of the file or null if the request failed. - public async Task> GetPublishedFileDetailsAsync(ulong publishedFileId) + public async Task>> GetPublishedFileDetailsAsync(ulong publishedFileId) { List parameters = new List(); parameters.AddIfHasValue(1, "itemcount"); parameters.AddIfHasValue(publishedFileId, "publishedfileids[0]"); - return await GetPublishedFileDetailsAsync(parameters); + return await GetPublishedFileDetailsAsync(parameters); } /// @@ -119,11 +116,21 @@ public async Task> GetUGCFileDetailsAsync { var steamWebResponse = await steamWebInterface.GetAsync("GetUGCFileDetails", 1, parameters); - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>(steamWebResponse); - - return steamWebResponseModel; + return steamWebResponse.MapTo((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } + + return new UGCFileDetailsModel + { + FileName = result.FileName, + Size = result.Size, + URL = result.URL + }; + }); } catch (HttpRequestException) { @@ -137,17 +144,47 @@ public async Task> GetUGCFileDetailsAsync /// The type to which to map the data of the response. /// The parameters of the request. /// The response of the request to the API or null if the request failed. - private async Task> GetPublishedFileDetailsAsync(IList parameters) + private async Task>> GetPublishedFileDetailsAsync(IList parameters) { try { var steamWebResponse = await steamWebInterface.PostAsync("GetPublishedFileDetails", 1, parameters); - - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>(steamWebResponse); - - return steamWebResponseModel; + return steamWebResponse.MapTo>((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } + + return result.Details?.Select(d => new PublishedFileDetailsModel + { + PublishedFileId = d.PublishedFileId, + Result = d.Result, + Title = d.Title, + Description = d.Description, + FileUrl = !string.IsNullOrWhiteSpace(d.FileUrl) ? new Uri(d.FileUrl) : null, + PreviewUrl = !string.IsNullOrWhiteSpace(d.PreviewUrl) ? new Uri(d.PreviewUrl) : null, + ConsumerAppId = d.ConsumerAppId, + CreatorAppId = d.CreatorAppId, + TimeCreated = d.TimeCreated, + TimeUpdated = d.TimeUpdated, + Visibility = (PublishedFileVisibility)d.Visibility, + Tags = d.Tags?.ToList().AsReadOnly(), + FileSize = d.FileSize, + Banned = d.Banned, + BanReason = d.BanReason, + Creator = d.Creator, + Favorited = d.Favorited, + FileContentHandle = d.FileContentHandle, + FileName = d.FileName, + LifetimeFavorited = d.LifetimeFavorited, + LifetimeSubscriptions = d.LifetimeSubscriptions, + PreviewContentHandle = d.PreviewContentHandle, + Subscriptions = d.Subscriptions, + Views = d.Views + }).ToList().AsReadOnly(); + }); } catch (HttpRequestException) { diff --git a/src/SteamWebAPI2/Interfaces/SteamStore.cs b/src/SteamWebAPI2/Interfaces/SteamStore.cs index 23640b8..0e13928 100644 --- a/src/SteamWebAPI2/Interfaces/SteamStore.cs +++ b/src/SteamWebAPI2/Interfaces/SteamStore.cs @@ -1,8 +1,8 @@ -using AutoMapper; -using Steam.Models.SteamStore; +using Steam.Models.SteamStore; using SteamWebAPI2.Models.SteamStore; using SteamWebAPI2.Utilities; using System.Collections.Generic; +using System.Linq; using System.Net.Http; using System.Threading.Tasks; @@ -10,11 +10,7 @@ namespace SteamWebAPI2.Interfaces { public class SteamStore : SteamStoreInterface, ISteamStore { - public SteamStore(IMapper mapper) : base(mapper) - { - } - - public SteamStore(IMapper mapper, HttpClient httpClient) : base(mapper, httpClient) + public SteamStore(HttpClient httpClient) : base(httpClient) { } @@ -32,10 +28,132 @@ public async Task GetStoreAppDetailsAsync(uint appId, parameters.AddIfHasValue(language, "l"); var appDetails = await CallMethodAsync("appdetails", parameters); + var appDetailsData = appDetails?.Data; + if (appDetailsData == null) + { + return null; + } - var appDetailsModel = mapper.Map(appDetails.Data); - - return appDetailsModel; + return new StoreAppDetailsDataModel + { + Type = appDetailsData.Type, + Name = appDetailsData.Name, + SteamAppId = appDetailsData.SteamAppid, + RequiredAge = appDetailsData.RequiredAge, + ControllerSupport = appDetailsData.ControllerSupport, + IsFree = appDetailsData.IsFree, + Dlc = appDetailsData.Dlc, + DetailedDescription = appDetailsData.DetailedDescription, + AboutTheGame = appDetailsData.AboutTheGame, + ShortDescription = appDetailsData.ShortDescription, + SupportedLanguages = appDetailsData.SupportedLanguages, + HeaderImage = appDetailsData.HeaderImage, + Website = appDetailsData.Website, + PcRequirements = appDetailsData.PcRequirements, + MacRequirements = appDetailsData.MacRequirements, + LinuxRequirements = appDetailsData.LinuxRequirements, + Developers = appDetailsData.Developers, + Publishers = appDetailsData.Publishers, + PriceOverview = appDetailsData.PriceOverview == null ? null : new StorePriceOverview + { + Currency = appDetailsData.PriceOverview.Currency, + Initial = appDetailsData.PriceOverview.Initial, + Final = appDetailsData.PriceOverview.Final, + DiscountPercent = appDetailsData.PriceOverview.DiscountPercent, + InitialFormatted = appDetailsData.PriceOverview.InitialFormatted, + FinalFormatted = appDetailsData.PriceOverview.FinalFormatted + }, + Packages = appDetailsData.Packages, + PackageGroups = appDetailsData.PackageGroups?.Select(pg => new StorePackageGroupModel + { + Name = pg.Name, + Title = pg.Title, + Description = pg.Description, + SelectionText = pg.SelectionText, + SaveText = pg.SaveText, + DisplayType = pg.DisplayType, + IsRecurringSubscription = pg.IsRecurringSubscription, + Subs = pg.Subs?.Select(s => new StoreSubModel + { + PackageId = uint.Parse(s.Packageid), + PercentSavingsText = s.PercentSavingsText, + PercentSavings = s.PercentSavings, + OptionText = s.OptionText, + OptionDescription = s.OptionDescription, + CanGetFreeLicense = s.CanGetFreeLicense, + IsFreeLicense = s.IsFreeLicense, + PriceInCentsWithDiscount = s.PriceInCentsWithDiscount + }).ToArray() + }).ToArray(), + Platforms = appDetailsData.Platforms == null ? null : new StorePlatformsModel + { + Windows = appDetailsData.Platforms.Windows, + Mac = appDetailsData.Platforms.Mac, + Linux = appDetailsData.Platforms.Linux + }, + Metacritic = appDetailsData.Metacritic == null ? null : new StoreMetacriticModel + { + Score = appDetailsData.Metacritic.Score, + Url = appDetailsData.Metacritic.Url + }, + Categories = appDetailsData.Categories?.Select(c => new StoreCategoryModel + { + Id = c.Id, + Description = c.Description + }).ToArray(), + Genres = appDetailsData.Genres?.Select(g => new StoreGenreModel + { + Id = g.Id, + Description = g.Description + }).ToArray(), + Screenshots = appDetailsData.Screenshots?.Select(s => new StoreScreenshotModel + { + Id = s.Id, + PathThumbnail = s.PathThumbnail, + PathFull = s.PathFull + }).ToArray(), + Movies = appDetailsData.Movies?.Select(m => new StoreMovieModel + { + Id = m.Id, + Name = m.Name, + Thumbnail = m.Thumbnail, + Webm = m.Webm == null ? null : new StoreWebmModel + { + Resolution480 = m.Webm.Resolution480, + Max = m.Webm.Max + }, + Highlight = m.Highlight + }).ToArray(), + Recommendations = appDetailsData.Recommendations == null ? null : new StoreRecommendationsModel + { + Total = appDetailsData.Recommendations.Total + }, + Achievements = appDetailsData.Achievements == null ? null : new StoreAchievement + { + Total = appDetailsData.Achievements.Total, + Highlighted = appDetailsData.Achievements.Highlighted?.Select(h => new StoreHighlighted + { + Name = h.Name, + Path = h.Path + }).ToArray() + }, + ReleaseDate = appDetailsData.ReleaseDate == null ? null : new StoreReleaseDateModel + { + ComingSoon = appDetailsData.ReleaseDate.ComingSoon, + Date = appDetailsData.ReleaseDate.Date + }, + SupportInfo = appDetailsData.SupportInfo == null ? null : new StoreSupportInfoModel + { + Url = appDetailsData.SupportInfo.Url, + Email = appDetailsData.SupportInfo.Email + }, + Background = appDetailsData.Background, + ContentDescriptors = appDetailsData.ContentDescriptors == null ? null : new StoreContentDescriptor + { + Ids = appDetailsData.ContentDescriptors.Ids, + Notes = appDetailsData.ContentDescriptors.Notes + } + }; } /// @@ -45,10 +163,49 @@ public async Task GetStoreAppDetailsAsync(uint appId, public async Task GetStoreFeaturedCategoriesAsync() { var featuredCategories = await CallMethodAsync("featuredcategories"); + if (featuredCategories == null) + { + return null; + } - var featuredCategoriesModel = mapper.Map(featuredCategories); - - return featuredCategoriesModel; + return new StoreFeaturedCategoriesModel + { + Specials = featuredCategories.Specials == null ? null : new StoreSpecialsModel + { + Id = uint.Parse(featuredCategories.Specials.Id), + Name = featuredCategories.Specials.Name, + Items = MapStoreItemModels(featuredCategories.Specials.Items) + }, + ComingSoon = featuredCategories.ComingSoon == null ? null : new StoreComingSoonModel + { + Id = uint.Parse(featuredCategories.ComingSoon.Id), + Name = featuredCategories.ComingSoon.Name, + Items = MapStoreItemModels(featuredCategories.ComingSoon.Items) + }, + TopSellers = featuredCategories.TopSellers == null ? null : new StoreTopSellersModel + { + Id = uint.Parse(featuredCategories.TopSellers.Id), + Name = featuredCategories.TopSellers.Name, + Items = MapStoreItemModels(featuredCategories.TopSellers.Items) + }, + NewReleases = featuredCategories.NewReleases == null ? null : new StoreNewReleasesModel + { + Id = uint.Parse(featuredCategories.NewReleases.Id), + Name = featuredCategories.NewReleases.Name, + Items = MapStoreItemModels(featuredCategories.NewReleases.Items) + }, + Genres = featuredCategories.Genres == null ? null : new StoreFeaturedCategoryGenreModel + { + Id = uint.Parse(featuredCategories.Genres.Id), + Name = featuredCategories.Genres.Name + }, + Trailerslideshow = featuredCategories.TrailerSlideshow == null ? null : new StoreTrailerSlideshowModel + { + Id = uint.Parse(featuredCategories.TrailerSlideshow.Id), + Name = featuredCategories.TrailerSlideshow.Name + }, + Status = featuredCategories.Status + }; } /// @@ -58,10 +215,119 @@ public async Task GetStoreFeaturedCategoriesAsync( public async Task GetStoreFeaturedProductsAsync() { var featuredProducts = await CallMethodAsync("featured"); + if(featuredProducts == null) + { + return null; + } - var featuredProductsModel = mapper.Map(featuredProducts); + return new StoreFeaturedProductsModel + { + FeaturedLinux = featuredProducts.FeaturedLinux.Select(x => new StoreFeaturedLinuxModel + { + Id = x.Id, + Type = x.Type, + Name = x.Name, + Discounted = x.Discounted, + DiscountPercent = x.DiscountPercent, + OriginalPrice = x.OriginalPrice, + FinalPrice = x.FinalPrice, + Currency = x.Currency, + LargeCapsuleImage = x.LargeCapsuleImage, + SmallCapsuleImage = x.SmallCapsuleImage, + WindowsAvailable = x.WindowsAvailable, + MacAvailable = x.MacAvailable, + LinuxAvailable = x.LinuxAvailable, + StreamingvideoAvailable = x.StreamingvideoAvailable, + HeaderImage = x.HeaderImage, + ControllerSupport = x.ControllerSupport + }).ToArray(), + FeaturedMac = featuredProducts.FeaturedMac.Select(x => new StoreFeaturedMacModel + { + Id = x.Id, + Type = x.Type, + Name = x.Name, + Discounted = x.Discounted, + DiscountPercent = x.DiscountPercent, + OriginalPrice = x.OriginalPrice, + FinalPrice = x.FinalPrice, + Currency = x.Currency, + LargeCapsuleImage = x.LargeCapsuleImage, + SmallCapsuleImage = x.SmallCapsuleImage, + WindowsAvailable = x.WindowsAvailable, + MacAvailable = x.MacAvailable, + LinuxAvailable = x.LinuxAvailable, + StreamingvideoAvailable = x.StreamingvideoAvailable, + HeaderImage = x.HeaderImage, + ControllerSupport = x.ControllerSupport + }).ToArray(), + FeaturedWin = featuredProducts.FeaturedWin.Select(x => new StoreFeaturedWinModel + { + Id = x.Id, + Type = x.Type, + Name = x.Name, + Discounted = x.Discounted, + DiscountPercent = x.DiscountPercent, + OriginalPrice = x.OriginalPrice, + FinalPrice = x.FinalPrice, + Currency = x.Currency, + LargeCapsuleImage = x.LargeCapsuleImage, + SmallCapsuleImage = x.SmallCapsuleImage, + WindowsAvailable = x.WindowsAvailable, + MacAvailable = x.MacAvailable, + LinuxAvailable = x.LinuxAvailable, + StreamingvideoAvailable = x.StreamingvideoAvailable, + HeaderImage = x.HeaderImage, + ControllerSupport = x.ControllerSupport, + DiscountExpiration = x.DiscountExpiration + }).ToArray(), + LargeCapsules = featuredProducts.LargeCapsules.Select(x => new StoreLargeCapsuleModel + { + Id = x.Id, + Type = x.Type, + Name = x.Name, + Discounted = x.Discounted, + DiscountPercent = x.DiscountPercent, + OriginalPrice = x.OriginalPrice, + FinalPrice = x.FinalPrice, + Currency = x.Currency, + LargeCapsuleImage = x.LargeCapsuleImage, + SmallCapsuleImage = x.SmallCapsuleImage, + WindowsAvailable = x.WindowsAvailable, + MacAvailable = x.MacAvailable, + LinuxAvailable = x.LinuxAvailable, + StreamingvideoAvailable = x.StreamingvideoAvailable, + HeaderImage = x.HeaderImage, + ControllerSupport = x.ControllerSupport, + Headline = x.Headline + }).ToArray(), + Layout = featuredProducts.Layout, + Status = featuredProducts.Status + }; + } - return featuredProductsModel; + private StoreItemModel[] MapStoreItemModels(Item[] items) + { + return items?.Select(i => new StoreItemModel + { + Id = i.Id, + Type = i.Type, + Name = i.Name, + Discounted = i.Discounted, + DiscountPercent = i.DiscountPercent, + OriginalPrice = i.OriginalPrice, + FinalPrice = i.FinalPrice, + Currency = i.Currency, + LargeCapsuleImage = i.LargeCapsuleImage, + SmallCapsuleImage = i.SmallCapsuleImage, + WindowsAvailable = i.WindowsAvailable, + MacAvailable = i.MacAvailable, + LinuxAvailable = i.LinuxAvailable, + StreamingvideoAvailable = i.StreamingvideoAvailable, + DiscountExpiration = i.DiscountExpiration, + HeaderImage = i.HeaderImage, + Body = i.Body, + Url = i.Url + }).ToArray(); } } } \ No newline at end of file diff --git a/src/SteamWebAPI2/Interfaces/SteamUser.cs b/src/SteamWebAPI2/Interfaces/SteamUser.cs index fb19440..ed15abe 100644 --- a/src/SteamWebAPI2/Interfaces/SteamUser.cs +++ b/src/SteamWebAPI2/Interfaces/SteamUser.cs @@ -1,4 +1,4 @@ -using AutoMapper; + using Steam.Models.SteamCommunity; using SteamWebAPI2.Exceptions; using SteamWebAPI2.Models.SteamCommunity; @@ -17,16 +17,13 @@ namespace SteamWebAPI2.Interfaces public class SteamUser : ISteamUser { private readonly ISteamWebInterface steamWebInterface; - private readonly IMapper mapper; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public SteamUser(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public SteamUser(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { - this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); - this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("ISteamUser", steamWebRequest) : steamWebInterface; @@ -53,11 +50,40 @@ public async Task> GetPlayerSummaryAsync(u return null; } - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>(steamWebResponse); - - return steamWebResponseModel; + return steamWebResponse.MapTo((from) => + { + var players = from?.Result?.Players; + if (players == null || players.Count == 0) + { + return null; + } + + var p = players[0]; + + return new PlayerSummaryModel + { + SteamId = p.SteamId, + ProfileVisibility = p.ProfileVisibility, + ProfileState = p.ProfileState, + Nickname = p.Nickname, + LastLoggedOffDate = p.LastLoggedOffDate, + CommentPermission = p.CommentPermission, + ProfileUrl = p.ProfileUrl, + AvatarUrl = p.AvatarUrl, + AvatarMediumUrl = p.AvatarMediumUrl, + AvatarFullUrl = p.AvatarFullUrl, + UserStatus = p.UserStatus, + RealName = p.RealName, + PrimaryGroupId = p.PrimaryGroupId, + AccountCreatedDate = p.AccountCreatedDate, + CountryCode = p.CountryCode, + StateCode = p.StateCode, + CityCode = p.CityCode, + PlayingGameName = p.PlayingGameName, + PlayingGameId = p.PlayingGameId, + PlayingGameServerIP = p.PlayingGameServerIP + }; + }); } public async Task>> GetPlayerSummariesAsync(IReadOnlyCollection steamIds) @@ -78,11 +104,38 @@ public async Task>> Ge return null; } - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>>(steamWebResponse); - - return steamWebResponseModel; + return steamWebResponse.MapTo>((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } + + return result.Players?.Select(p => new PlayerSummaryModel + { + SteamId = p.SteamId, + ProfileVisibility = p.ProfileVisibility, + ProfileState = p.ProfileState, + Nickname = p.Nickname, + LastLoggedOffDate = p.LastLoggedOffDate, + CommentPermission = p.CommentPermission, + ProfileUrl = p.ProfileUrl, + AvatarUrl = p.AvatarUrl, + AvatarMediumUrl = p.AvatarMediumUrl, + AvatarFullUrl = p.AvatarFullUrl, + UserStatus = p.UserStatus, + RealName = p.RealName, + PrimaryGroupId = p.PrimaryGroupId, + AccountCreatedDate = p.AccountCreatedDate, + CountryCode = p.CountryCode, + StateCode = p.StateCode, + CityCode = p.CityCode, + PlayingGameName = p.PlayingGameName, + PlayingGameId = p.PlayingGameId, + PlayingGameServerIP = p.PlayingGameServerIP + }).ToList().AsReadOnly(); + }); } /// @@ -99,9 +152,21 @@ public async Task>> GetFriend var steamWebResponse = await steamWebInterface.GetAsync("GetFriendList", 1, parameters); - var steamWebResponseModel = mapper.Map, ISteamWebResponse>>(steamWebResponse); - - return steamWebResponseModel; + return steamWebResponse.MapTo>((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } + + return result.Friends?.Select(p => new FriendModel + { + SteamId = p.SteamId, + FriendSince = p.FriendSince, + Relationship = p.Relationship + }).ToList().AsReadOnly(); + }); } /// @@ -130,11 +195,25 @@ public async Task>> GetPl var steamWebResponse = await steamWebInterface.GetAsync("GetPlayerBans", 1, parameters); - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>>(steamWebResponse); - - return steamWebResponseModel; + return steamWebResponse.MapTo>((from) => + { + var result = from?.PlayerBans; + if (result == null) + { + return null; + } + + return result?.Select(p => new PlayerBansModel + { + CommunityBanned = p.CommunityBanned, + DaysSinceLastBan = p.DaysSinceLastBan, + EconomyBan = p.EconomyBan, + NumberOfVACBans = p.NumberOfVACBans, + SteamId = p.SteamId, + NumberOfGameBans = p.NumberOfGameBans, + VACBanned = p.VACBanned + }).ToList().AsReadOnly(); + }); } /// @@ -150,11 +229,19 @@ public async Task>> GetUserGroupsAs var steamWebResponse = await steamWebInterface.GetAsync("GetUserGroupList", 1, parameters); - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>>(steamWebResponse); - - return steamWebResponseModel; + return steamWebResponse.MapTo>((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } + + return result?.Groups? + .Select(p => p.Gid) + .ToList() + .AsReadOnly(); + }); } /// @@ -177,11 +264,10 @@ public async Task> ResolveVanityUrlAsync(string vanityU throw new VanityUrlNotResolvedException(ErrorMessages.VanityUrlNotResolved); } - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>(steamWebResponse); - - return steamWebResponseModel; + return steamWebResponse.MapTo((from) => + { + return from?.Result?.SteamId ?? 0; + }); } /// @@ -196,9 +282,47 @@ public async Task GetCommunityProfileAsync(ulong ste var profile = DeserializeXML(xml); - var profileModel = mapper.Map(profile); - - return profileModel; + return new SteamCommunityProfileModel + { + AvatarFull = new Uri(profile.AvatarFull), + Avatar = new Uri(profile.AvatarIcon), + AvatarMedium = new Uri(profile.AvatarMedium), + CustomURL = profile.CustomURL, + MostPlayedGames = profile.MostPlayedGames?.Select(mpg => new SteamCommunityProfileMostPlayedGameModel + { + HoursOnRecord = !string.IsNullOrEmpty(mpg.HoursOnRecord) ? double.Parse(mpg.HoursOnRecord) : 0d, + HoursPlayed = !string.IsNullOrEmpty(mpg.HoursPlayed) ? double.Parse(mpg.HoursPlayed) : 0d, + Icon = new Uri(mpg.GameIcon), + Link = new Uri(mpg.GameLink), + Logo = new Uri(mpg.GameLogo), + LogoSmall = new Uri(mpg.GameLogoSmall), + Name = mpg.GameName, + StatsName = mpg.StatsName + }).ToList().AsReadOnly(), + Headline = profile.Headline, + HoursPlayedLastTwoWeeks = !string.IsNullOrEmpty(profile.HoursPlayed2Wk) ? double.Parse(profile.HoursPlayed2Wk) : 0d, + InGameInfo = profile.InGameInfo == null ? null : new InGameInfoModel + { + GameIcon = profile.InGameInfo.GameIcon, + GameLink = profile.InGameInfo.GameLink, + GameLogo = profile.InGameInfo.GameLogo, + GameLogoSmall = profile.InGameInfo.GameLogoSmall, + GameName = profile.InGameInfo.GameName + }, + IsLimitedAccount = profile.IsLimitedAccount == 1 ? true : false, + Location = profile.Location, + MemberSince = profile.MemberSince, + State = profile.OnlineState, + StateMessage = profile.StateMessage, + SteamID = profile.SteamID64, + SteamRating = !string.IsNullOrEmpty(profile.SteamRating) ? double.Parse(profile.SteamRating) : 0d, + Summary = profile.Summary, + TradeBanState = profile.TradeBanState, + IsVacBanned = profile.VacBanned == 1 ? true : false, + VisibilityState = profile.VisibilityState, + InGameServerIP = profile.InGameServerIP, + RealName = profile.RealName + }; } private static T DeserializeXML(string xml) diff --git a/src/SteamWebAPI2/Interfaces/SteamUserAuth.cs b/src/SteamWebAPI2/Interfaces/SteamUserAuth.cs index 24fc75f..3a82986 100644 --- a/src/SteamWebAPI2/Interfaces/SteamUserAuth.cs +++ b/src/SteamWebAPI2/Interfaces/SteamUserAuth.cs @@ -1,6 +1,5 @@ -using AutoMapper; + using SteamWebAPI2.Utilities; -using System; using System.Collections.Generic; using System.Threading.Tasks; using Steam.Models.SteamUserAuth; @@ -9,17 +8,14 @@ namespace SteamWebAPI2.Interfaces { public class SteamUserAuth : ISteamUserAuth { - private readonly IMapper mapper; private ISteamWebInterface steamWebInterface; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public SteamUserAuth(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public SteamUserAuth(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { - this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); - this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("ISteamUserAuth", steamWebRequest) : steamWebInterface; diff --git a/src/SteamWebAPI2/Interfaces/SteamUserStats.cs b/src/SteamWebAPI2/Interfaces/SteamUserStats.cs index be863ac..7e3dd14 100644 --- a/src/SteamWebAPI2/Interfaces/SteamUserStats.cs +++ b/src/SteamWebAPI2/Interfaces/SteamUserStats.cs @@ -1,4 +1,4 @@ -using AutoMapper; + using Steam.Models; using Steam.Models.SteamCommunity; using Steam.Models.SteamPlayer; @@ -9,22 +9,20 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using System.Linq; namespace SteamWebAPI2.Interfaces { public class SteamUserStats : ISteamUserStats { private readonly ISteamWebInterface steamWebInterface; - private readonly IMapper mapper; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public SteamUserStats(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public SteamUserStats(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { - this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); - this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("ISteamUserStats", steamWebRequest) : steamWebInterface; @@ -42,11 +40,20 @@ public async Task("GetGlobalAchievementPercentagesForApp", 2, parameters); - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>>(steamWebResponse); + return steamWebResponse.MapTo>((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } - return steamWebResponseModel; + return result.AchievementPercentages?.Select(ap => new GlobalAchievementPercentageModel + { + Name = ap.Name, + Percent = ap.Percent + }).ToList().AsReadOnly(); + }); } /// @@ -85,11 +92,20 @@ public async Task>> GetGl var steamWebResponse = await steamWebInterface.GetAsync("GetGlobalStatsForGame", 1, parameters); - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>>(steamWebResponse); + return steamWebResponse.MapTo>((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } - return steamWebResponseModel; + return result.GlobalStats?.Select(ap => new GlobalStatModel + { + Name = ap.Name, + Total = ap.Total + }).ToList().AsReadOnly(); + }); } /// @@ -104,11 +120,10 @@ public async Task> GetNumberOfCurrentPlayersForGameAsync var steamWebResponse = await steamWebInterface.GetAsync("GetNumberOfCurrentPlayers", 1, parameters); - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>(steamWebResponse); - - return steamWebResponseModel; + return steamWebResponse.MapTo((from) => + { + return from?.Result.PlayerCount ?? 0; + }); } /// @@ -127,11 +142,29 @@ public async Task> GetPlayerAchi var steamWebResponse = await steamWebInterface.GetAsync("GetPlayerAchievements", 1, parameters); - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>(steamWebResponse); + return steamWebResponse.MapTo((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } - return steamWebResponseModel; + return new PlayerAchievementResultModel + { + Success = result.Success, + SteamId = result.SteamId, + GameName = result.GameName, + Achievements = result.Achievements?.Select(a => new PlayerAchievementModel + { + Achieved = a.Achieved, + UnlockTime = a.UnlockTime.ToDateTime(), + Name = a.Name, + Description = a.Description, + APIName = a.APIName + }).ToList().AsReadOnly() + }; + }); } /// @@ -148,11 +181,39 @@ public async Task> GetSchemaForGameA var steamWebResponse = await steamWebInterface.GetAsync("GetSchemaForGame", 2, parameters); - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>(steamWebResponse); + return steamWebResponse.MapTo((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } - return steamWebResponseModel; + return new SchemaForGameResultModel + { + GameName = result.GameName, + GameVersion = result.GameVersion, + AvailableGameStats = result.AvailableGameStats == null ? null : new AvailableGameStatsModel + { + Achievements = result.AvailableGameStats.Achievements?.Select(a => new SchemaGameAchievementModel + { + Name = a.Name, + DefaultValue = a.DefaultValue, + DisplayName = a.DisplayName, + Hidden = a.Hidden, + Description = a.Description, + Icon = a.Icon, + Icongray = a.Icongray + }).ToList().AsReadOnly(), + Stats = result.AvailableGameStats.Stats?.Select(s => new SchemaGameStatModel + { + Name = s.Name, + DefaultValue = s.DefaultValue, + DisplayName = s.DisplayName + }).ToList().AsReadOnly() + } + }; + }); } /// @@ -169,11 +230,30 @@ public async Task> GetUserStatsFo var steamWebResponse = await steamWebInterface.GetAsync("GetUserStatsForGame", 2, parameters); - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>(steamWebResponse); + return steamWebResponse.MapTo((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } - return steamWebResponseModel; + return new UserStatsForGameResultModel + { + GameName = result.GameName, + SteamId = ulong.Parse(result.SteamId), + Achievements = result.Achievements?.Select(a => new UserStatAchievementModel + { + Name = a.Name, + Achieved = a.Achieved, + }).ToList().AsReadOnly(), + Stats = result.Stats?.Select(s => new UserStatModel + { + Name = s.Name, + Value = s.Value + }).ToList().AsReadOnly() + }; + }); } } } \ No newline at end of file diff --git a/src/SteamWebAPI2/Interfaces/SteamWebAPIUtil.cs b/src/SteamWebAPI2/Interfaces/SteamWebAPIUtil.cs index 37a9939..b7bae2e 100644 --- a/src/SteamWebAPI2/Interfaces/SteamWebAPIUtil.cs +++ b/src/SteamWebAPI2/Interfaces/SteamWebAPIUtil.cs @@ -1,26 +1,23 @@ -using AutoMapper; + using Steam.Models; using SteamWebAPI2.Models; using SteamWebAPI2.Utilities; -using System; using System.Collections.Generic; using System.Threading.Tasks; +using System.Linq; namespace SteamWebAPI2.Interfaces { public class SteamWebAPIUtil : ISteamWebAPIUtil { private readonly ISteamWebInterface steamWebInterface; - private readonly IMapper mapper; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public SteamWebAPIUtil(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public SteamWebAPIUtil(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { - this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); - this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("ISteamWebAPIUtil", steamWebRequest) : steamWebInterface; @@ -32,13 +29,16 @@ public SteamWebAPIUtil(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamW /// public async Task> GetServerInfoAsync() { - var steamServerInfo = await steamWebInterface.GetAsync("GetServerInfo", 1); + var steamWebResponse = await steamWebInterface.GetAsync("GetServerInfo", 1); - var steamServerInfoModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>(steamServerInfo); - - return steamServerInfoModel; + return steamWebResponse.MapTo((from) => + { + return new SteamServerInfoModel + { + ServerTime = from?.ServerTime ?? 0, + ServerTimeString = from?.ServerTimeString + }; + }); } /// @@ -49,11 +49,33 @@ public async Task>> G { var steamWebResponse = await steamWebInterface.GetAsync("GetSupportedAPIList", 1); - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>>(steamWebResponse); + return steamWebResponse.MapTo>((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } - return steamWebResponseModel; + return result.Interfaces?.Select(i => new SteamInterfaceModel + { + Name = i.Name, + Methods = i.Methods?.Select(m => new SteamMethodModel + { + Description = m.Description, + HttpMethod = m.HttpMethod, + Name = m.Name, + Version = m.Version, + Parameters = m.Parameters?.Select(p => new SteamParameterModel + { + Name = p.Name, + Type = p.Type, + Description = p.Description, + IsOptional = p.IsOptional + }).ToList().AsReadOnly() + }).ToList().AsReadOnly() + }).ToList().AsReadOnly(); + }); } } } \ No newline at end of file diff --git a/src/SteamWebAPI2/Interfaces/TFItems.cs b/src/SteamWebAPI2/Interfaces/TFItems.cs index 5c13535..293098c 100644 --- a/src/SteamWebAPI2/Interfaces/TFItems.cs +++ b/src/SteamWebAPI2/Interfaces/TFItems.cs @@ -1,26 +1,22 @@ -using AutoMapper; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; using Steam.Models.TF2; using SteamWebAPI2.Models.TF2; using SteamWebAPI2.Utilities; -using System; -using System.Collections.Generic; -using System.Threading.Tasks; namespace SteamWebAPI2.Interfaces { public class TFItems : ITFItems { private readonly ISteamWebInterface steamWebInterface; - private readonly IMapper mapper; /// /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// /// - public TFItems(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) + public TFItems(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { - this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); - this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("ITFItems_440", steamWebRequest) : steamWebInterface; @@ -34,11 +30,22 @@ public async Task>> Get { var steamWebResponse = await steamWebInterface.GetAsync("GetGoldenWrenches", 2); - var steamWebResponseModel = mapper.Map< - ISteamWebResponse, - ISteamWebResponse>>(steamWebResponse); + return steamWebResponse.MapTo>((from) => + { + var result = from?.Result; + if (result == null) + { + return null; + } - return steamWebResponseModel; + return result.GoldenWrenches?.Select(i => new GoldenWrenchModel + { + ItemId = i.ItemId, + SteamId = i.SteamId, + WrenchNumber = i.WrenchNumber, + Timestamp = i.Timestamp + }).ToList().AsReadOnly(); + }); } } } \ No newline at end of file diff --git a/src/SteamWebAPI2/Mappings/DOTA2EconProfile.cs b/src/SteamWebAPI2/Mappings/DOTA2EconProfile.cs deleted file mode 100644 index 33a7406..0000000 --- a/src/SteamWebAPI2/Mappings/DOTA2EconProfile.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System.Collections.Generic; -using AutoMapper; -using Steam.Models.DOTA2; -using SteamWebAPI2.Models.DOTA2; -using SteamWebAPI2.Models.GameEconomy; - -namespace SteamWebAPI2.Mappings -{ - public class DOTA2EconProfile : Profile - { - public DOTA2EconProfile() - { - CreateMap(); - CreateMap>().ConvertUsing((src, dest, context) => - context.Mapper.Map, IReadOnlyCollection>(src.Result != null ? src.Result.Heroes : null) - ); - - CreateMap(); - CreateMap>().ConvertUsing((src, dest, context) => - context.Mapper.Map, IReadOnlyCollection>(src.Result != null ? src.Result.Items : null) - ); - - CreateMap().ConvertUsing(src => src.Result != null ? src.Result.Path : null); - - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - - // TODO: Rework the way Schema models are used for different games (TF2 / DOTA2) - //CreateMap() - // .ForMember(dest => dest.Name, opts => opts.Ignore()) - // .ForMember(dest => dest.Value, opts => opts.Ignore()) - // .ForMember(dest => dest.HexColor, opts => opts.Ignore()); - //CreateMap() - // .ForMember(dest => dest.GameInfo, opts => opts.Ignore()) - // .ForMember(dest => dest.Rarities, opts => opts.Ignore()) - // .ForMember(dest => dest.Colors, opts => opts.Ignore()) - // .ForMember(dest => dest.Prefabs, opts => opts.Ignore()) - // .ForMember(dest => dest.ItemAutographs, opts => opts.Ignore()); - //CreateMap().ConvertUsing( - // src => Mapper.Map(src.Result) - //); - - CreateMap(); - CreateMap>().ConvertUsing((src, dest, context) => - context.Mapper.Map, IReadOnlyCollection>(src.Result != null ? src.Result.Rarities : null) - ); - - CreateMap().ConvertUsing(src => src.Result != null ? src.Result.PrizePool : default(uint)); - } - } -} \ No newline at end of file diff --git a/src/SteamWebAPI2/Mappings/DOTA2FantasyProfile.cs b/src/SteamWebAPI2/Mappings/DOTA2FantasyProfile.cs deleted file mode 100644 index 9cebef9..0000000 --- a/src/SteamWebAPI2/Mappings/DOTA2FantasyProfile.cs +++ /dev/null @@ -1,21 +0,0 @@ -using AutoMapper; -using Steam.Models.DOTA2; -using SteamWebAPI2.Models.DOTA2; - -namespace SteamWebAPI2.Mappings -{ - public class DOTA2FantasyProfile : Profile - { - public DOTA2FantasyProfile() - { - CreateMap(); - CreateMap().ConvertUsing((src, dest, context) => - context.Mapper.Map(src.Result) - ); - - CreateMap(); - CreateMap(); - CreateMap(); - } - } -} \ No newline at end of file diff --git a/src/SteamWebAPI2/Mappings/DOTA2MatchProfile.cs b/src/SteamWebAPI2/Mappings/DOTA2MatchProfile.cs deleted file mode 100644 index 7fb55a4..0000000 --- a/src/SteamWebAPI2/Mappings/DOTA2MatchProfile.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System.Collections.Generic; -using AutoMapper; -using Steam.Models.DOTA2; -using SteamWebAPI2.Models.DOTA2; -using SteamWebAPI2.Utilities; - -namespace SteamWebAPI2.Mappings -{ - public class DOTA2MatchProfile : Profile - { - public DOTA2MatchProfile() - { - CreateMap() - .ForMember(dest => dest.ImageInventoryPath, opts => opts.Ignore()) - .ForMember(dest => dest.ImageBannerPath, opts => opts.Ignore()) - .ForMember(dest => dest.NameLocalized, opts => opts.Ignore()) - .ForMember(dest => dest.DescriptionLocalized, opts => opts.Ignore()) - .ForMember(dest => dest.TypeName, opts => opts.Ignore()) - .ForMember(dest => dest.Tier, opts => opts.Ignore()) - .ForMember(dest => dest.Location, opts => opts.Ignore()); - CreateMap>().ConvertUsing((src, dest, context) => - context.Mapper.Map, IReadOnlyCollection>(src.Result != null ? src.Result.Leagues : null) - ); - - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap>().ConvertUsing((src, dest, context) => - context.Mapper.Map, IReadOnlyCollection>(src.Result != null ? src.Result.Games : null) - ); - - CreateMap() - .ForMember(dest => dest.StartTime, opts => opts.MapFrom(src => src.StartTime.ToDateTime())); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap().ConvertUsing((src, dest, context) => - context.Mapper.Map(src.Result) - ); - - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap().ConvertUsing((src, dest, context) => - context.Mapper.Map(src.Result) - ); - - CreateMap() - .ForMember(dest => dest.NumResults, opts => opts.Ignore()) - .ForMember(dest => dest.TotalResults, opts => opts.Ignore()) - .ForMember(dest => dest.ResultsRemaining, opts => opts.Ignore()); - CreateMap>().ConvertUsing((src, dest, context) => - context.Mapper.Map, IReadOnlyCollection>(src.Result != null ? src.Result.Matches : null) - ); - - CreateMap(); - CreateMap>().ConvertUsing((src, dest, context) => - context.Mapper.Map, IReadOnlyCollection>(src.Result != null ? src.Result.Teams : null) - ); - } - } -} \ No newline at end of file diff --git a/src/SteamWebAPI2/Mappings/EconServiceProfile.cs b/src/SteamWebAPI2/Mappings/EconServiceProfile.cs deleted file mode 100644 index c693e6d..0000000 --- a/src/SteamWebAPI2/Mappings/EconServiceProfile.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using AutoMapper; -using Steam.Models.SteamEconomy; -using SteamWebAPI2.Models.SteamEconomy; -using SteamWebAPI2.Utilities; - -namespace SteamWebAPI2.Mappings -{ - public class EconServiceProfile : Profile - { - public EconServiceProfile() - { - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap() - .ForMember(dest => dest.TimeTradeStarted, opts => opts.MapFrom(source => source.TimeTradeStarted.ToDateTime())) - .ForMember(dest => dest.TimeEscrowEnds, opts => opts.MapFrom(source => source.TimeEscrowEnds.ToDateTime())); - CreateMap() - .ForMember(dest => dest.TimeCreated, opts => opts.MapFrom(source => source.TimeCreated.ToDateTime())) - .ForMember(dest => dest.TimeEscrowEnds, opts => opts.MapFrom(source => source.TimeEscrowEnds.ToDateTime())) - .ForMember(dest => dest.TimeExpiration, opts => opts.MapFrom(source => source.TimeExpiration.ToDateTime())) - .ForMember(dest => dest.TimeUpdated, opts => opts.MapFrom(source => source.TimeUpdated.ToDateTime())); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap().ConvertUsing((src, dest, context) => - context.Mapper.Map(src.Result) - ); - CreateMap().ConvertUsing((src, dest, context) => - context.Mapper.Map(src.Result) - ); - CreateMap().ConvertUsing((src, dest, context) => - context.Mapper.Map(src.Result) - ); - CreateMap().ConvertUsing((src, dest, context) => - context.Mapper.Map(src.Result) - ); - CreateMap(); - CreateMap() - .ForMember(dest => dest.EscrowEndDate, - opts => opts.MapFrom(src => src.EscrowEndDateRfc3339)) - .ForMember(dest => dest.EscrowEndDuration, - opts => opts.MapFrom(src => TimeSpan.FromSeconds(src.EscrowEndDurationSeconds))); - } - } -} \ No newline at end of file diff --git a/src/SteamWebAPI2/Mappings/GCVersionProfile.cs b/src/SteamWebAPI2/Mappings/GCVersionProfile.cs deleted file mode 100644 index 35453cb..0000000 --- a/src/SteamWebAPI2/Mappings/GCVersionProfile.cs +++ /dev/null @@ -1,17 +0,0 @@ -using AutoMapper; -using Steam.Models; -using SteamWebAPI2.Models; - -namespace SteamWebAPI2.Mappings -{ - public class GCVersionProfile : Profile - { - public GCVersionProfile() - { - CreateMap(); - CreateMap().ConvertUsing((src, dest, context) => - context.Mapper.Map(src.Result) - ); - } - } -} \ No newline at end of file diff --git a/src/SteamWebAPI2/Mappings/GameServersProfile.cs b/src/SteamWebAPI2/Mappings/GameServersProfile.cs deleted file mode 100644 index 2a0e538..0000000 --- a/src/SteamWebAPI2/Mappings/GameServersProfile.cs +++ /dev/null @@ -1,45 +0,0 @@ -using AutoMapper; -using Steam.Models.GameServers; -using SteamWebAPI2.Models.GameServers; -using SteamWebAPI2.Utilities; - -namespace SteamWebAPI2.Mappings -{ - public class GameServersProfile : Profile - { - public GameServersProfile() - { - CreateMap().ConvertUsing((src, dest, context) => - context.Mapper.Map(src.Response) - ); - - CreateMap() - .ForMember(dest => dest.LastActionTime, opts => opts.MapFrom(src => src.LastActionTime.ToDateTime())); - - CreateMap() - .ForMember(dest => dest.RtLastLogon, opts => opts.MapFrom(src => src.RtLastLogon.ToDateTime())); - - CreateMap().ConvertUsing((src, dest, context) => - context.Mapper.Map(src.Response) - ); - - CreateMap(); - - CreateMap().ConvertUsing( - src => src.Response.LoginToken - ); - - CreateMap().ConvertUsing((src, dest, context) => - context.Mapper.Map(src.Response) - ); - - CreateMap(); - - CreateMap().ConvertUsing((src, dest, context) => - context.Mapper.Map(src.Response) - ); - - CreateMap(); - } - } -} \ No newline at end of file diff --git a/src/SteamWebAPI2/Mappings/PlayerServiceProfile.cs b/src/SteamWebAPI2/Mappings/PlayerServiceProfile.cs deleted file mode 100644 index fe66982..0000000 --- a/src/SteamWebAPI2/Mappings/PlayerServiceProfile.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using System.Collections.Generic; -using AutoMapper; -using Steam.Models.SteamCommunity; -using SteamWebAPI2.Models.SteamCommunity; -using SteamWebAPI2.Models.SteamPlayer; - -namespace SteamWebAPI2.Mappings -{ - public class PlayerServiceProfile : Profile - { - public PlayerServiceProfile() - { - - CreateMap() - .ConvertUsing(src => src.Result != null ? src.Result.LenderSteamId : null); - - CreateMap>().ConvertUsing((src, dest, context) => - context.Mapper.Map, IReadOnlyCollection>(src.Result?.Quests) - ); - - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap().ConvertUsing((src, dest, context) => - context.Mapper.Map(src.Result) - ); - - CreateMap().ConvertUsing((src, dest) => - { - if (src.Result == null) { return null; } - else { return src.Result.PlayerLevel; } - }); - - CreateMap() - .ForMember(dest => dest.PlaytimeLastTwoWeeks, opts => opts.MapFrom((src, dest) => - { - if (!src.Playtime2weeks.HasValue) - { - return (TimeSpan?)null; - } - return TimeSpan.FromMinutes(src.Playtime2weeks.Value); - })) - .ForMember(dest => dest.PlaytimeForever, opts => opts.MapFrom((src, dest) => - { - return TimeSpan.FromMinutes(src.PlaytimeForever); - })); - CreateMap(); - CreateMap().ConvertUsing((src, dest, context) => - context.Mapper.Map(src.Result) - ); - - CreateMap(); - CreateMap(); - CreateMap().ConvertUsing((src, dest, context) => - context.Mapper.Map(src.Result) - ); - } - } -} \ No newline at end of file diff --git a/src/SteamWebAPI2/Mappings/SteamAppsProfile.cs b/src/SteamWebAPI2/Mappings/SteamAppsProfile.cs deleted file mode 100644 index 3b81cbf..0000000 --- a/src/SteamWebAPI2/Mappings/SteamAppsProfile.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Collections.Generic; -using AutoMapper; -using Steam.Models; -using SteamWebAPI2.Models; - -namespace SteamWebAPI2.Mappings -{ - public class SteamAppsProfile : Profile - { - public SteamAppsProfile() - { - CreateMap(); - CreateMap>().ConvertUsing((src, dest, context) => - context.Mapper.Map, IReadOnlyCollection>(src.Result != null ? src.Result.Apps : null) - ); - - CreateMap(); - CreateMap().ConvertUsing((src, dest, context) => - context.Mapper.Map(src.Result) - ); - } - } -} \ No newline at end of file diff --git a/src/SteamWebAPI2/Mappings/SteamEconomyProfile.cs b/src/SteamWebAPI2/Mappings/SteamEconomyProfile.cs deleted file mode 100644 index bf7117b..0000000 --- a/src/SteamWebAPI2/Mappings/SteamEconomyProfile.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System.Collections.Generic; -using AutoMapper; -using Steam.Models.CSGO; -using Steam.Models.GameEconomy; -using Steam.Models.SteamEconomy; -using SteamWebAPI2.Models.CSGO; -using SteamWebAPI2.Models.GameEconomy; -using SteamWebAPI2.Models.SteamEconomy; -using SteamWebAPI2.Utilities; - -namespace SteamWebAPI2.Mappings -{ - public class SteamEconomyProfile : Profile - { - public SteamEconomyProfile() - { - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap().ConvertUsing((src, dest, context) => - context.Mapper.Map(src.Result) - ); - - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap().ConvertUsing((src, dest, context) => - context.Mapper.Map(src.Result) - ); - - // Everything below this needs to be organized and moved to separate profiles - - CreateMap().ConvertUsing(src - => src.Result != null ? src.Result.ItemsGameUrl : null); - - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap().ConvertUsing((src, dest, context) => - context.Mapper.Map(src.Result) - ); - - CreateMap().ConvertUsing(src => - src.Result != null ? src.Result.StoreStatus : default(uint) - ); - - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap().ConvertUsing((src, dest, context) => - context.Mapper.Map(src.Result) - ); - - CreateMap>().ConvertUsing((src, dest, context) => - context.Mapper.Map, IEnumerable>(src.Result.Playtimes) - ); - CreateMap() - .ForMember(dest => dest.IntervalStartTimeStamp, opts => opts.MapFrom(source => - source.IntervalStartTimeStamp.ToDateTime() - ) - ); - - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap().ConvertUsing((src, dest, context) => - context.Mapper.Map(src.Result) - ); - } - } -} \ No newline at end of file diff --git a/src/SteamWebAPI2/Mappings/SteamNewsProfile.cs b/src/SteamWebAPI2/Mappings/SteamNewsProfile.cs deleted file mode 100644 index fb0552f..0000000 --- a/src/SteamWebAPI2/Mappings/SteamNewsProfile.cs +++ /dev/null @@ -1,18 +0,0 @@ -using AutoMapper; -using Steam.Models; -using SteamWebAPI2.Models; - -namespace SteamWebAPI2.Mappings -{ - public class SteamNewsProfile : Profile - { - public SteamNewsProfile() - { - CreateMap(); - CreateMap(); - CreateMap().ConvertUsing((src, dest, context) => - context.Mapper.Map(src.Result) - ); - } - } -} \ No newline at end of file diff --git a/src/SteamWebAPI2/Mappings/SteamProfileProfile.cs b/src/SteamWebAPI2/Mappings/SteamProfileProfile.cs deleted file mode 100644 index c19db7c..0000000 --- a/src/SteamWebAPI2/Mappings/SteamProfileProfile.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using AutoMapper; -using Steam.Models.SteamCommunity; -using SteamWebAPI2.Models.SteamCommunity; - -namespace SteamWebAPI2.Mappings -{ - public class SteamProfileProfile : Profile - { - public SteamProfileProfile() - { - CreateMap() - .ForMember(dest => dest.GameIcon, opts => opts.MapFrom(source => source.GameIcon)) - .ForMember(dest => dest.GameLink, opts => opts.MapFrom(source => source.GameLink)) - .ForMember(dest => dest.GameLogo, opts => opts.MapFrom(source => source.GameLogo)) - .ForMember(dest => dest.GameLogoSmall, opts => opts.MapFrom(source => source.GameLogoSmall)) - .ForMember(dest => dest.GameName, opts => opts.MapFrom(source => source.GameName)); - - CreateMap() - .ForMember(dest => dest.Link, opts => opts.MapFrom(source => new Uri(source.GameLink))) - .ForMember(dest => dest.Icon, opts => opts.MapFrom(source => new Uri(source.GameIcon))) - .ForMember(dest => dest.Logo, opts => opts.MapFrom(source => new Uri(source.GameLogo))) - .ForMember(dest => dest.LogoSmall, opts => opts.MapFrom(source => new Uri(source.GameLogoSmall))) - .ForMember(dest => dest.Name, opts => opts.MapFrom(source => source.GameName)) - .ForMember(dest => dest.HoursOnRecord, opts => opts.MapFrom(source => !string.IsNullOrEmpty(source.HoursOnRecord) ? double.Parse(source.HoursOnRecord) : 0d)) - .ForMember(dest => dest.HoursPlayed, opts => opts.MapFrom(source => (double)source.HoursPlayed)) - .ForMember(dest => dest.StatsName, opts => opts.MapFrom(source => source.StatsName)); - - CreateMap() - .ForMember(dest => dest.AvatarFull, opts => opts.MapFrom(source => new Uri(source.AvatarFull))) - .ForMember(dest => dest.Avatar, opts => opts.MapFrom(source => new Uri(source.AvatarIcon))) - .ForMember(dest => dest.AvatarMedium, opts => opts.MapFrom(source => new Uri(source.AvatarMedium))) - .ForMember(dest => dest.CustomURL, opts => opts.MapFrom(source => source.CustomURL)) - .ForMember(dest => dest.MostPlayedGames, opts => opts.MapFrom(source => source.MostPlayedGames)) - .ForMember(dest => dest.Headline, opts => opts.MapFrom(source => source.Headline)) - .ForMember(dest => dest.HoursPlayedLastTwoWeeks, opts => opts.MapFrom(source => source.HoursPlayed2Wk)) - .ForMember(dest => dest.IsLimitedAccount, opts => opts.MapFrom(source => source.IsLimitedAccount == 1 ? true : false)) - .ForMember(dest => dest.Location, opts => opts.MapFrom(source => source.Location)) - .ForMember(dest => dest.MemberSince, opts => opts.MapFrom(source => source.MemberSince)) - .ForMember(dest => dest.State, opts => opts.MapFrom(source => source.OnlineState)) - .ForMember(dest => dest.StateMessage, opts => opts.MapFrom(source => source.StateMessage)) - .ForMember(dest => dest.SteamID, opts => opts.MapFrom(source => source.SteamID64)) - .ForMember(dest => dest.SteamRating, opts => opts.MapFrom(source => !string.IsNullOrEmpty(source.SteamRating) ? double.Parse(source.SteamRating) : 0d)) - .ForMember(dest => dest.Summary, opts => opts.MapFrom(source => source.Summary)) - .ForMember(dest => dest.TradeBanState, opts => opts.MapFrom(source => source.TradeBanState)) - .ForMember(dest => dest.IsVacBanned, opts => opts.MapFrom(source => source.VacBanned == 1 ? true : false)) - .ForMember(dest => dest.VisibilityState, opts => opts.MapFrom(source => source.VisibilityState)) - .ForMember(dest => dest.InGameServerIP, opts => opts.MapFrom(source => source.InGameServerIP)) - .ForMember(dest => dest.InGameInfo, opts => opts.MapFrom(source => source.InGameInfo)); - } - } -} \ No newline at end of file diff --git a/src/SteamWebAPI2/Mappings/SteamRemoteStorageProfile.cs b/src/SteamWebAPI2/Mappings/SteamRemoteStorageProfile.cs deleted file mode 100644 index cd7dd7f..0000000 --- a/src/SteamWebAPI2/Mappings/SteamRemoteStorageProfile.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System.Collections.Generic; -using AutoMapper; -using Steam.Models; -using SteamWebAPI2.Models; -using System.Linq; -using System; - -namespace SteamWebAPI2.Mappings -{ - public class SteamRemoteStorageProfile : Profile - { - public SteamRemoteStorageProfile() - { - CreateMap() - .ConvertUsing((src, dest) => - { - return (PublishedFileVisibility)src; - }); - CreateMap() - .ForMember(dest => dest.FileUrl, opts => opts.MapFrom(source => !string.IsNullOrWhiteSpace(source.FileUrl) ? new Uri(source.FileUrl) : null)) - .ForMember(dest => dest.PreviewUrl, opts => opts.MapFrom(source => !string.IsNullOrWhiteSpace(source.PreviewUrl) ? new Uri(source.PreviewUrl) : null)); - CreateMap>() - .ConvertUsing((src, dest, context) => - context.Mapper.Map, IReadOnlyCollection>( - src.Result?.Result == 1 ? src.Result.Details : null - ) - ); - CreateMap() - .ConvertUsing((src, dest, context) => - context.Mapper.Map( - src.Result?.Result == 1 ? src.Result.Details?.SingleOrDefault() : null - ) - ); - - CreateMap(); - CreateMap().ConvertUsing((src, dest, context) => - context.Mapper.Map(src.Result) - ); - } - } -} \ No newline at end of file diff --git a/src/SteamWebAPI2/Mappings/SteamStoreProfile.cs b/src/SteamWebAPI2/Mappings/SteamStoreProfile.cs deleted file mode 100644 index 3a35139..0000000 --- a/src/SteamWebAPI2/Mappings/SteamStoreProfile.cs +++ /dev/null @@ -1,46 +0,0 @@ - -using AutoMapper; -using Steam.Models.SteamStore; -using SteamWebAPI2.Models.SteamStore; - -namespace SteamWebAPI2.Mappings -{ - public class SteamStoreProfile : Profile - { - public SteamStoreProfile() - { - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - } - } -} \ No newline at end of file diff --git a/src/SteamWebAPI2/Mappings/SteamUserProfile.cs b/src/SteamWebAPI2/Mappings/SteamUserProfile.cs deleted file mode 100644 index b92be26..0000000 --- a/src/SteamWebAPI2/Mappings/SteamUserProfile.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Collections.Generic; -using AutoMapper; -using Steam.Models.SteamCommunity; -using SteamWebAPI2.Models.SteamCommunity; -using SteamWebAPI2.Models.SteamPlayer; - -namespace SteamWebAPI2.Mappings -{ - public class SteamUserProfile : Profile - { - public SteamUserProfile() - { - CreateMap(); - CreateMap().ConvertUsing((src, dest, context) => - context.Mapper.Map(src.Result != null ? src.Result.Players[0] : null) - ); - CreateMap>().ConvertUsing((src, dest, context) => - context.Mapper.Map, IReadOnlyCollection>(src.Result != null ? src.Result.Players : null) - ); - - CreateMap(); - CreateMap>().ConvertUsing((src, dest, context) => - context.Mapper.Map, IReadOnlyCollection>(src.Result != null ? src.Result.Friends : null) - ); - - CreateMap(); - CreateMap>().ConvertUsing((src, dest, context) => - context.Mapper.Map, IReadOnlyCollection>(src.PlayerBans) - ); - - CreateMap().ConvertUsing(src => src.Gid); - - CreateMap>().ConvertUsing((src, dest, context) => - context.Mapper.Map, IReadOnlyCollection>(src.Result != null ? src.Result.Groups : null) - ); - - CreateMap().ConvertUsing(src => src.Result != null ? src.Result.SteamId : default(ulong)); - } - } -} \ No newline at end of file diff --git a/src/SteamWebAPI2/Mappings/SteamUserStatsProfile.cs b/src/SteamWebAPI2/Mappings/SteamUserStatsProfile.cs deleted file mode 100644 index 70870a2..0000000 --- a/src/SteamWebAPI2/Mappings/SteamUserStatsProfile.cs +++ /dev/null @@ -1,56 +0,0 @@ - -using System.Collections.Generic; -using AutoMapper; -using Steam.Models; -using Steam.Models.SteamCommunity; -using Steam.Models.SteamPlayer; -using SteamWebAPI2.Models; -using SteamWebAPI2.Models.SteamCommunity; -using SteamWebAPI2.Models.SteamPlayer; -using SteamWebAPI2.Utilities; - -namespace SteamWebAPI2.Mappings -{ - public class SteamUserStatsProfile : Profile - { - public SteamUserStatsProfile() - { - CreateMap(); - CreateMap>().ConvertUsing((src, dest, context) => - context.Mapper.Map, IReadOnlyCollection>(src.Result != null ? src.Result.AchievementPercentages : null) - ); - - CreateMap(); - - CreateMap>().ConvertUsing((src, dest, context) => - context.Mapper.Map, IReadOnlyCollection>(src.Result != null ? src.Result.GlobalStats : null) - ); - - CreateMap().ConvertUsing(src => - src.Result != null ? src.Result.PlayerCount : default(uint) - ); - - CreateMap() - .ForMember(dest => dest.UnlockTime, opts => opts.MapFrom(source => source.UnlockTime.ToDateTime())); - CreateMap(); - CreateMap().ConvertUsing((src, dest, context) => - context.Mapper.Map(src.Result) - ); - - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap().ConvertUsing((src, dest, context) => - context.Mapper.Map(src.Result) - ); - - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap().ConvertUsing((src, dest, context) => - context.Mapper.Map(src.Result) - ); - } - } -} \ No newline at end of file diff --git a/src/SteamWebAPI2/Mappings/SteamWebAPIUtilProfile.cs b/src/SteamWebAPI2/Mappings/SteamWebAPIUtilProfile.cs deleted file mode 100644 index 4da959b..0000000 --- a/src/SteamWebAPI2/Mappings/SteamWebAPIUtilProfile.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Collections.Generic; -using AutoMapper; -using Steam.Models; -using SteamWebAPI2.Models; - -namespace SteamWebAPI2.Mappings -{ - public class SteamWebAPIUtilProfile : Profile - { - public SteamWebAPIUtilProfile() - { - CreateMap(); - - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap>().ConvertUsing((src, dest, context) => - context.Mapper.Map, IReadOnlyCollection>(src.Result != null ? src.Result.Interfaces : null) - ); - - } - } -} \ No newline at end of file diff --git a/src/SteamWebAPI2/Mappings/SteamWebResponseProfile.cs b/src/SteamWebAPI2/Mappings/SteamWebResponseProfile.cs deleted file mode 100644 index ae9ef74..0000000 --- a/src/SteamWebAPI2/Mappings/SteamWebResponseProfile.cs +++ /dev/null @@ -1,119 +0,0 @@ -using System.Collections.Generic; -using AutoMapper; -using Steam.Models; -using Steam.Models.CSGO; -using Steam.Models.DOTA2; -using Steam.Models.GameEconomy; -using Steam.Models.GameServers; -using Steam.Models.SteamCommunity; -using Steam.Models.SteamEconomy; -using Steam.Models.SteamPlayer; -using Steam.Models.TF2; -using SteamWebAPI2.Models; -using SteamWebAPI2.Models.CSGO; -using SteamWebAPI2.Models.DOTA2; -using SteamWebAPI2.Models.GameEconomy; -using SteamWebAPI2.Models.GameServers; -using SteamWebAPI2.Models.SteamCommunity; -using SteamWebAPI2.Models.SteamEconomy; -using SteamWebAPI2.Models.SteamPlayer; -using SteamWebAPI2.Models.TF2; -using SteamWebAPI2.Utilities; - -namespace SteamWebAPI2.Mappings -{ - public class SteamWebResponseProfile : Profile - { - public SteamWebResponseProfile() - { - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap>(); - CreateSteamWebResponseMap>(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap>(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap>(); - CreateSteamWebResponseMap>(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap>(); - CreateSteamWebResponseMap>(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap>(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap>(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap>(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap>(); - CreateSteamWebResponseMap>(); - CreateSteamWebResponseMap>(); - CreateSteamWebResponseMap>(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap>(); - CreateSteamWebResponseMap>(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap>(); - CreateSteamWebResponseMap>(); - CreateSteamWebResponseMap>(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap(); - CreateSteamWebResponseMap(); - - } - - private SteamWebResponse ConstructSteamWebResponse(ISteamWebResponse response, ResolutionContext context) - { - if (response == null) - { - return null; - } - - var newResponse = new SteamWebResponse(); - - newResponse.ContentLength = response.ContentLength; - newResponse.ContentType = response.ContentType; - newResponse.ContentTypeCharSet = response.ContentTypeCharSet; - newResponse.Expires = response.Expires; - newResponse.LastModified = response.LastModified; - - if (response.Data != null) - { - newResponse.Data = context.Mapper.Map(response.Data); - } - - return newResponse; - } - - private void CreateSteamWebResponseMap() - { - CreateMap, ISteamWebResponse>() - .ConvertUsing((src, dest, context) => ConstructSteamWebResponse(src, context)); - } - } -} \ No newline at end of file diff --git a/src/SteamWebAPI2/Mappings/TFItemsProfile.cs b/src/SteamWebAPI2/Mappings/TFItemsProfile.cs deleted file mode 100644 index 311960e..0000000 --- a/src/SteamWebAPI2/Mappings/TFItemsProfile.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections.Generic; -using AutoMapper; -using Steam.Models.TF2; -using SteamWebAPI2.Models.TF2; - -namespace SteamWebAPI2.Mappings -{ - public class TFItemsProfile : Profile - { - public TFItemsProfile() - { - CreateMap(); - CreateMap>().ConvertUsing((src, dest, context) => - context.Mapper.Map, IReadOnlyCollection>(src.Result != null ? src.Result.GoldenWrenches : null) - ); - - } - } -} \ No newline at end of file diff --git a/src/SteamWebAPI2/Models/PublishedFileDetailsResultContainer.cs b/src/SteamWebAPI2/Models/PublishedFileDetailsResultContainer.cs index d77d1cd..bdf829a 100644 --- a/src/SteamWebAPI2/Models/PublishedFileDetailsResultContainer.cs +++ b/src/SteamWebAPI2/Models/PublishedFileDetailsResultContainer.cs @@ -45,7 +45,7 @@ internal class PublishedFileDetails public string FileName { get; set; } [JsonProperty("file_size")] - public uint FileSize { get; set; } + public ulong FileSize { get; set; } [JsonProperty("file_url")] public string FileUrl { get; set; } diff --git a/src/SteamWebAPI2/Models/SteamCommunity/BadgesResultContainer.cs b/src/SteamWebAPI2/Models/SteamCommunity/BadgesResultContainer.cs index a55c2ff..15bd852 100644 --- a/src/SteamWebAPI2/Models/SteamCommunity/BadgesResultContainer.cs +++ b/src/SteamWebAPI2/Models/SteamCommunity/BadgesResultContainer.cs @@ -27,7 +27,7 @@ internal class Badge public string CommunityItemId { get; set; } [JsonProperty("border_color")] - public int? BorderColor { get; set; } + public uint? BorderColor { get; set; } } internal class BadgesResult diff --git a/src/SteamWebAPI2/Models/SteamCommunity/SteamCommunityProfile.cs b/src/SteamWebAPI2/Models/SteamCommunity/SteamCommunityProfile.cs index 9885ad1..cae248b 100644 --- a/src/SteamWebAPI2/Models/SteamCommunity/SteamCommunityProfile.cs +++ b/src/SteamWebAPI2/Models/SteamCommunity/SteamCommunityProfile.cs @@ -58,7 +58,7 @@ internal class SteamCommunityProfile public string SteamRating { get; set; } [DataMember(Name = "hoursPlayed2Wk", Order = 17)] - public decimal HoursPlayed2Wk { get; set; } + public string HoursPlayed2Wk { get; set; } [DataMember(Name = "headline", Order = 18)] public string Headline { get; set; } @@ -117,7 +117,7 @@ internal class ProfileMostPlayedGame public string GameLogoSmall { get; set; } [DataMember(Name = "hoursPlayed", Order = 5)] - public decimal HoursPlayed { get; set; } + public string HoursPlayed { get; set; } [DataMember(Name = "hoursOnRecord", Order = 6)] public string HoursOnRecord { get; set; } diff --git a/src/SteamWebAPI2/Models/SteamId.cs b/src/SteamWebAPI2/Models/SteamId.cs index 1e81426..62eeac3 100644 --- a/src/SteamWebAPI2/Models/SteamId.cs +++ b/src/SteamWebAPI2/Models/SteamId.cs @@ -1,6 +1,5 @@ using SteamWebAPI2.Exceptions; using SteamWebAPI2.Interfaces; -using SteamWebAPI2.Utilities; using System; using System.Runtime.ExceptionServices; using System.Text.RegularExpressions; diff --git a/src/SteamWebAPI2/Models/SteamNewsResultContainer.cs b/src/SteamWebAPI2/Models/SteamNewsResultContainer.cs index 5951a22..6ed3bc5 100644 --- a/src/SteamWebAPI2/Models/SteamNewsResultContainer.cs +++ b/src/SteamWebAPI2/Models/SteamNewsResultContainer.cs @@ -27,7 +27,7 @@ internal class NewsItem public string FeedLabel { get; set; } [JsonProperty("date")] - public uint Date { get; set; } + public ulong Date { get; set; } [JsonProperty("feedname")] public string Feedname { get; set; } diff --git a/src/SteamWebAPI2/Models/SteamStore/FeaturedProductsContainer.cs b/src/SteamWebAPI2/Models/SteamStore/FeaturedProductsContainer.cs index fe67b90..b2ee7af 100644 --- a/src/SteamWebAPI2/Models/SteamStore/FeaturedProductsContainer.cs +++ b/src/SteamWebAPI2/Models/SteamStore/FeaturedProductsContainer.cs @@ -107,7 +107,7 @@ internal class FeaturedWin public string ControllerSupport { get; set; } [JsonProperty("discount_expiration")] - public int? DiscountExpiration { get; set; } + public uint? DiscountExpiration { get; set; } } internal class FeaturedMac diff --git a/src/SteamWebAPI2/Models/TF2/GoldenWrenchResultContainer.cs b/src/SteamWebAPI2/Models/TF2/GoldenWrenchResultContainer.cs index bc8bdf9..5043048 100644 --- a/src/SteamWebAPI2/Models/TF2/GoldenWrenchResultContainer.cs +++ b/src/SteamWebAPI2/Models/TF2/GoldenWrenchResultContainer.cs @@ -8,7 +8,7 @@ namespace SteamWebAPI2.Models.TF2 internal class GoldenWrench { [JsonProperty("steamID")] - public object SteamId { get; set; } + public ulong SteamId { get; set; } [JsonConverter(typeof(UnixTimeJsonConverter))] [JsonProperty("timestamp")] diff --git a/src/SteamWebAPI2/SteamStoreInterface.cs b/src/SteamWebAPI2/SteamStoreInterface.cs index 80783de..0473188 100644 --- a/src/SteamWebAPI2/SteamStoreInterface.cs +++ b/src/SteamWebAPI2/SteamStoreInterface.cs @@ -1,6 +1,4 @@ -using AutoMapper; -using SteamWebAPI2.Utilities; -using System; +using SteamWebAPI2.Utilities; using System.Collections.Generic; using System.Diagnostics; using System.Net.Http; @@ -16,24 +14,12 @@ public abstract class SteamStoreInterface private const string steamStoreApiBaseUrl = "http://store.steampowered.com/api/"; private readonly SteamStoreRequest steamStoreRequest; - protected readonly IMapper mapper; - - /// - /// Constructs and maps the default objects for Steam Store Web API use - /// - public SteamStoreInterface(IMapper mapper) - { - this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); - steamStoreRequest = new SteamStoreRequest(steamStoreApiBaseUrl); - } - /// /// Constructs and maps based on a custom http client /// /// Client to make requests with - public SteamStoreInterface(IMapper mapper, HttpClient httpClient) + public SteamStoreInterface(HttpClient httpClient) { - this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); steamStoreRequest = new SteamStoreRequest(steamStoreApiBaseUrl, httpClient); } diff --git a/src/SteamWebAPI2/SteamWebAPI2.csproj b/src/SteamWebAPI2/SteamWebAPI2.csproj index ad4ad18..6592bbb 100644 --- a/src/SteamWebAPI2/SteamWebAPI2.csproj +++ b/src/SteamWebAPI2/SteamWebAPI2.csproj @@ -2,7 +2,7 @@ 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. - 4.4.1 + 5.0.0 Justin Skiles SteamWebAPI2 SteamWebAPI2 @@ -15,11 +15,9 @@ $(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage - - - - - + + + diff --git a/src/SteamWebAPI2/Utilities/ISteamWebResponse.cs b/src/SteamWebAPI2/Utilities/ISteamWebResponse.cs index 4ae0cfe..95f7055 100644 --- a/src/SteamWebAPI2/Utilities/ISteamWebResponse.cs +++ b/src/SteamWebAPI2/Utilities/ISteamWebResponse.cs @@ -16,5 +16,6 @@ public interface ISteamWebResponse DateTimeOffset? Expires { get; set; } // Last modified header from the HTTP response DateTimeOffset? LastModified { get; set; } + SteamWebResponse MapTo(Func mapFunction); } } \ No newline at end of file diff --git a/src/SteamWebAPI2/Utilities/SteamWebInterface.cs b/src/SteamWebAPI2/Utilities/SteamWebInterface.cs index 688fcb2..11e0584 100644 --- a/src/SteamWebAPI2/Utilities/SteamWebInterface.cs +++ b/src/SteamWebAPI2/Utilities/SteamWebInterface.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Threading.Tasks; namespace SteamWebAPI2.Utilities @@ -65,12 +64,12 @@ public SteamWebInterface(string steamWebApiBaseUrl, string interfaceName, ISteam /// public async Task> GetAsync(string methodName, int version, IList parameters = null) { - if(string.IsNullOrWhiteSpace(methodName)) + if (string.IsNullOrWhiteSpace(methodName)) { throw new ArgumentNullException(nameof(methodName)); } - if(version <= 0) + if (version <= 0) { throw new ArgumentOutOfRangeException(nameof(version)); } @@ -88,12 +87,12 @@ public async Task> GetAsync(string methodName, int versi /// public async Task> PostAsync(string methodName, int version, IList parameters = null) { - if(string.IsNullOrWhiteSpace(methodName)) + if (string.IsNullOrWhiteSpace(methodName)) { throw new ArgumentNullException(nameof(methodName)); } - if(version <= 0) + if (version <= 0) { throw new ArgumentOutOfRangeException(nameof(version)); } diff --git a/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs b/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs index a3c1c1e..a05175b 100644 --- a/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs +++ b/src/SteamWebAPI2/Utilities/SteamWebInterfaceFactory.cs @@ -1,7 +1,5 @@ -using AutoMapper; using Microsoft.Extensions.Options; using SteamWebAPI2.Interfaces; -using SteamWebAPI2.Mappings; using System; using System.Net.Http; @@ -11,7 +9,6 @@ public class SteamWebInterfaceFactory : ISteamWebInterfaceFactory { private readonly string steamWebApiBaseUrl = "https://api.steampowered.com/"; private readonly string steamWebApiKey; - private readonly IMapper mapper; /// /// Backwards compatible constructor that works with just a Steam Web API key instead of forcing @@ -48,40 +45,11 @@ public SteamWebInterfaceFactory(IOptions option { this.steamWebApiBaseUrl = options.Value.SteamWebApiBaseUrl; } - - var mapperConfig = new MapperConfiguration(config => - { - config.AddProfile(); - config.AddProfile(); - config.AddProfile(); - config.AddProfile(); - config.AddProfile(); - config.AddProfile(); - config.AddProfile(); - config.AddProfile(); - config.AddProfile(); - config.AddProfile(); - config.AddProfile(); - config.AddProfile(); - config.AddProfile(); - config.AddProfile(); - config.AddProfile(); - config.AddProfile(); - config.AddProfile(); - config.AddProfile(); - }); - - mapper = mapperConfig.CreateMapper(); } public SteamStore CreateSteamStoreInterface(HttpClient httpClient = null) { - if(httpClient == null) - { - return new SteamStore(mapper); - } - - return new SteamStore(mapper, httpClient); + return new SteamStore(httpClient); } /// @@ -94,7 +62,7 @@ public SteamStore CreateSteamStoreInterface(HttpClient httpClient = null) public T CreateSteamWebInterface(HttpClient httpClient = null) { var steamWebRequest = CreateSteamWebRequest(httpClient); - return (T)Activator.CreateInstance(typeof(T), mapper, steamWebRequest, null); + return (T)Activator.CreateInstance(typeof(T), steamWebRequest, null); } /// @@ -108,7 +76,7 @@ public T CreateSteamWebInterface(HttpClient httpClient = null) public T CreateSteamWebInterface(AppId appId, HttpClient httpClient = null) { var steamWebRequest = CreateSteamWebRequest(httpClient); - return (T)Activator.CreateInstance(typeof(T), mapper, steamWebRequest, appId, null); + return (T)Activator.CreateInstance(typeof(T), steamWebRequest, appId, null); } private ISteamWebRequest CreateSteamWebRequest(HttpClient httpClient) diff --git a/src/SteamWebAPI2/Utilities/SteamWebRequest.cs b/src/SteamWebAPI2/Utilities/SteamWebRequest.cs index 6f61e07..d7ff24c 100644 --- a/src/SteamWebAPI2/Utilities/SteamWebRequest.cs +++ b/src/SteamWebAPI2/Utilities/SteamWebRequest.cs @@ -1,7 +1,6 @@ using Newtonsoft.Json; using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using System.Net; using System.Net.Http; diff --git a/src/SteamWebAPI2/Utilities/SteamWebResponse.cs b/src/SteamWebAPI2/Utilities/SteamWebResponse.cs index 841c7f3..9c6112d 100644 --- a/src/SteamWebAPI2/Utilities/SteamWebResponse.cs +++ b/src/SteamWebAPI2/Utilities/SteamWebResponse.cs @@ -10,5 +10,26 @@ public class SteamWebResponse : ISteamWebResponse public string ContentTypeCharSet { get; set; } public DateTimeOffset? Expires { get; set; } public DateTimeOffset? LastModified { get; set; } + + public SteamWebResponse MapTo(Func mapFunction) + { + var mappedTo = new SteamWebResponse + { + ContentLength = this.ContentLength, + ContentType = this.ContentType, + ContentTypeCharSet = this.ContentTypeCharSet, + Expires = this.Expires, + LastModified = this.LastModified + }; + + if (this.Data == null) + { + return mappedTo; + } + + mappedTo.Data = mapFunction(this.Data); + + return mappedTo; + } } } \ No newline at end of file From abf604f2ccd0a4dba7aa3d93008d71b814ce5419 Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Wed, 12 Nov 2025 17:16:46 -0500 Subject: [PATCH 092/107] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9d98f7a..ac267ec 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -85,7 +85,7 @@ steps: displayName: Push GitHub Release (if tagged) condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/') inputs: - gitHubConnection: 'GitHub.com OAuth - Babelshift' + gitHubConnection: 'github.com_babelshift' repositoryName: 'babelshift/SteamWebAPI2' action: 'create' target: '$(Build.SourceVersion)' From be8e2095351cc0e5c78d194d3c6f9b315edfab94 Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Thu, 13 Nov 2025 08:46:55 -0500 Subject: [PATCH 093/107] Add GitHub Actions workflow for .NET project This workflow automates the build process for a .NET project, including steps for restoring dependencies, building the project, and running tests. --- .github/workflows/dotnet.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/dotnet.yml diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml new file mode 100644 index 0000000..c62b908 --- /dev/null +++ b/.github/workflows/dotnet.yml @@ -0,0 +1,28 @@ +# This workflow will build a .NET project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net + +name: .NET + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore + - name: Test + run: dotnet test --no-build --verbosity normal From bc66cc528ad6f2aba6212d69c319efc642535261 Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Thu, 13 Nov 2025 09:33:05 -0500 Subject: [PATCH 094/107] Rename workflow to 'Build & Test .NET' --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index c62b908..4670f3c 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -1,7 +1,7 @@ # This workflow will build a .NET project # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net -name: .NET +name: Build & Test .NET on: push: From 57e6f651b0bd26cdb09823ee8ac13a480a10367a Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Thu, 13 Nov 2025 10:04:54 -0500 Subject: [PATCH 095/107] Setting up GitHub Actions --- .../{dotnet.yml => dotnet-build.yml} | 4 +-- .github/workflows/dotnet-publish.yml | 31 +++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) rename .github/workflows/{dotnet.yml => dotnet-build.yml} (82%) create mode 100644 .github/workflows/dotnet-publish.yml diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet-build.yml similarity index 82% rename from .github/workflows/dotnet.yml rename to .github/workflows/dotnet-build.yml index 4670f3c..d2075ee 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet-build.yml @@ -23,6 +23,6 @@ jobs: - name: Restore dependencies run: dotnet restore - name: Build - run: dotnet build --no-restore + run: dotnet build ./src/SteamWebAPI2.sln --no-restore - name: Test - run: dotnet test --no-build --verbosity normal + run: dotnet test ./src --no-build --verbosity normal diff --git a/.github/workflows/dotnet-publish.yml b/.github/workflows/dotnet-publish.yml new file mode 100644 index 0000000..ce4b184 --- /dev/null +++ b/.github/workflows/dotnet-publish.yml @@ -0,0 +1,31 @@ +# This workflow will build a .NET project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net + +name: Build, Test, and Publish .NET + +on: + push: + branches: [ "master" ] + tags: [ "*" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build ./src/SteamWebAPI2.sln -c Release --no-restore + - name: Test + run: dotnet test ./src -c Release --no-build --verbosity normal + - name: Pack + run: dotnet pack ./src/SteamWebAPI2/SteamWebAPI2.csproj -c Release --no-build --output . + - name: Publish + run: dotnet nuget push "*.nupkg" -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json -n --skip-duplicate \ No newline at end of file From 8205bc92e4317232a4f1ff170f9a3c21e7620ec4 Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Thu, 13 Nov 2025 10:09:31 -0500 Subject: [PATCH 096/107] GitHub Actions --- .github/workflows/dotnet-build.yml | 2 +- .github/workflows/dotnet-publish.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet-build.yml b/.github/workflows/dotnet-build.yml index d2075ee..292e16e 100644 --- a/.github/workflows/dotnet-build.yml +++ b/.github/workflows/dotnet-build.yml @@ -21,7 +21,7 @@ jobs: with: dotnet-version: 8.0.x - name: Restore dependencies - run: dotnet restore + run: dotnet restore ./src/SteamWebAPI2.sln - name: Build run: dotnet build ./src/SteamWebAPI2.sln --no-restore - name: Test diff --git a/.github/workflows/dotnet-publish.yml b/.github/workflows/dotnet-publish.yml index ce4b184..8642e58 100644 --- a/.github/workflows/dotnet-publish.yml +++ b/.github/workflows/dotnet-publish.yml @@ -20,7 +20,7 @@ jobs: with: dotnet-version: 8.0.x - name: Restore dependencies - run: dotnet restore + run: dotnet restore ./src/SteamWebAPI2.sln - name: Build run: dotnet build ./src/SteamWebAPI2.sln -c Release --no-restore - name: Test From b6c6a6c78fca9b44ae61ffa6bde67f4bf2badb33 Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Thu, 13 Nov 2025 10:23:16 -0500 Subject: [PATCH 097/107] GitHub Actions --- .github/workflows/dotnet-build.yml | 4 ++++ .github/workflows/dotnet-publish.yml | 5 +---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dotnet-build.yml b/.github/workflows/dotnet-build.yml index 292e16e..25a2e2a 100644 --- a/.github/workflows/dotnet-build.yml +++ b/.github/workflows/dotnet-build.yml @@ -24,5 +24,9 @@ jobs: run: dotnet restore ./src/SteamWebAPI2.sln - name: Build run: dotnet build ./src/SteamWebAPI2.sln --no-restore + - name: App Settings Variable Substitution + uses: microsoft/variable-substitution@v1 + with: + files: ./src/Steam.UnitTests/appsettings.json - name: Test run: dotnet test ./src --no-build --verbosity normal diff --git a/.github/workflows/dotnet-publish.yml b/.github/workflows/dotnet-publish.yml index 8642e58..357cbf7 100644 --- a/.github/workflows/dotnet-publish.yml +++ b/.github/workflows/dotnet-publish.yml @@ -5,7 +5,6 @@ name: Build, Test, and Publish .NET on: push: - branches: [ "master" ] tags: [ "*" ] jobs: @@ -22,9 +21,7 @@ jobs: - name: Restore dependencies run: dotnet restore ./src/SteamWebAPI2.sln - name: Build - run: dotnet build ./src/SteamWebAPI2.sln -c Release --no-restore - - name: Test - run: dotnet test ./src -c Release --no-build --verbosity normal + run: dotnet build ./src/SteamWebAPI2.sln -c Release --no-restore - name: Pack run: dotnet pack ./src/SteamWebAPI2/SteamWebAPI2.csproj -c Release --no-build --output . - name: Publish From 1d29fcbee1a2c6a124539c07c3c24eb2df19483a Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Thu, 13 Nov 2025 10:26:32 -0500 Subject: [PATCH 098/107] GitHub Actions --- .github/workflows/dotnet-build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/dotnet-build.yml b/.github/workflows/dotnet-build.yml index 25a2e2a..a96ee9e 100644 --- a/.github/workflows/dotnet-build.yml +++ b/.github/workflows/dotnet-build.yml @@ -28,5 +28,7 @@ jobs: uses: microsoft/variable-substitution@v1 with: files: ./src/Steam.UnitTests/appsettings.json + env: + SteamWebApiKey: ${{ secrets.STEAM_WEB_API_KEY }} - name: Test run: dotnet test ./src --no-build --verbosity normal From ab5f4601ce13848930433f18b2a77a93b792c40e Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Thu, 13 Nov 2025 11:09:23 -0500 Subject: [PATCH 099/107] GitHub Actions --- .github/workflows/dotnet-build.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/dotnet-build.yml b/.github/workflows/dotnet-build.yml index a96ee9e..820e995 100644 --- a/.github/workflows/dotnet-build.yml +++ b/.github/workflows/dotnet-build.yml @@ -24,11 +24,3 @@ jobs: run: dotnet restore ./src/SteamWebAPI2.sln - name: Build run: dotnet build ./src/SteamWebAPI2.sln --no-restore - - name: App Settings Variable Substitution - uses: microsoft/variable-substitution@v1 - with: - files: ./src/Steam.UnitTests/appsettings.json - env: - SteamWebApiKey: ${{ secrets.STEAM_WEB_API_KEY }} - - name: Test - run: dotnet test ./src --no-build --verbosity normal From 6b359d715e249e6bccf9c7c725efe0fa26ea0a3f Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Thu, 13 Nov 2025 11:21:22 -0500 Subject: [PATCH 100/107] GitHub Actions --- .github/workflows/dotnet-build.yml | 17 +++++++++++++++-- .github/workflows/dotnet-publish.yml | 28 ---------------------------- 2 files changed, 15 insertions(+), 30 deletions(-) delete mode 100644 .github/workflows/dotnet-publish.yml diff --git a/.github/workflows/dotnet-build.yml b/.github/workflows/dotnet-build.yml index 820e995..8f1d77e 100644 --- a/.github/workflows/dotnet-build.yml +++ b/.github/workflows/dotnet-build.yml @@ -11,9 +11,7 @@ on: jobs: build: - runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 - name: Setup .NET @@ -24,3 +22,18 @@ jobs: run: dotnet restore ./src/SteamWebAPI2.sln - name: Build run: dotnet build ./src/SteamWebAPI2.sln --no-restore + + publish: + if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }} + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + - name: Pack + run: dotnet pack ./src/SteamWebAPI2/SteamWebAPI2.csproj -c Release --no-build --output . + - name: Publish + run: dotnet nuget push "*.nupkg" -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json -n --skip-duplicate \ No newline at end of file diff --git a/.github/workflows/dotnet-publish.yml b/.github/workflows/dotnet-publish.yml deleted file mode 100644 index 357cbf7..0000000 --- a/.github/workflows/dotnet-publish.yml +++ /dev/null @@ -1,28 +0,0 @@ -# This workflow will build a .NET project -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net - -name: Build, Test, and Publish .NET - -on: - push: - tags: [ "*" ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.0.x - - name: Restore dependencies - run: dotnet restore ./src/SteamWebAPI2.sln - - name: Build - run: dotnet build ./src/SteamWebAPI2.sln -c Release --no-restore - - name: Pack - run: dotnet pack ./src/SteamWebAPI2/SteamWebAPI2.csproj -c Release --no-build --output . - - name: Publish - run: dotnet nuget push "*.nupkg" -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json -n --skip-duplicate \ No newline at end of file From 783b946222b491366b28e46f5094e01c621b28e6 Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Thu, 13 Nov 2025 11:23:27 -0500 Subject: [PATCH 101/107] GitHub Actions on tags --- .github/workflows/dotnet-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dotnet-build.yml b/.github/workflows/dotnet-build.yml index 8f1d77e..f058872 100644 --- a/.github/workflows/dotnet-build.yml +++ b/.github/workflows/dotnet-build.yml @@ -6,6 +6,7 @@ name: Build & Test .NET on: push: branches: [ "master" ] + tags: [ "*" ] pull_request: branches: [ "master" ] From 2a488d903ac66d4f0b0e11bc7111fd4a9fe2a0a0 Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Thu, 13 Nov 2025 11:25:37 -0500 Subject: [PATCH 102/107] GitHub Actions on tags --- .github/workflows/dotnet-build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/dotnet-build.yml b/.github/workflows/dotnet-build.yml index f058872..49e3fe2 100644 --- a/.github/workflows/dotnet-build.yml +++ b/.github/workflows/dotnet-build.yml @@ -34,6 +34,8 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x + - name: Restore dependencies + run: dotnet restore ./src/SteamWebAPI2.sln - name: Pack run: dotnet pack ./src/SteamWebAPI2/SteamWebAPI2.csproj -c Release --no-build --output . - name: Publish From 8ca16c7b5d5beb3b7eca4a32f160babc6a930acf Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Thu, 13 Nov 2025 11:30:49 -0500 Subject: [PATCH 103/107] GitHub Actions --- .github/workflows/dotnet-build.yml | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/.github/workflows/dotnet-build.yml b/.github/workflows/dotnet-build.yml index 49e3fe2..5436b00 100644 --- a/.github/workflows/dotnet-build.yml +++ b/.github/workflows/dotnet-build.yml @@ -23,20 +23,9 @@ jobs: run: dotnet restore ./src/SteamWebAPI2.sln - name: Build run: dotnet build ./src/SteamWebAPI2.sln --no-restore - - publish: - if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }} - needs: build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.0.x - - name: Restore dependencies - run: dotnet restore ./src/SteamWebAPI2.sln - name: Pack + if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }} run: dotnet pack ./src/SteamWebAPI2/SteamWebAPI2.csproj -c Release --no-build --output . - name: Publish + if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }} run: dotnet nuget push "*.nupkg" -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json -n --skip-duplicate \ No newline at end of file From 059dd727c284790e8fe08a9f6fb09ed78a30c325 Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Thu, 13 Nov 2025 11:34:42 -0500 Subject: [PATCH 104/107] GitHub Actions --- .github/workflows/dotnet-build.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dotnet-build.yml b/.github/workflows/dotnet-build.yml index 5436b00..2cbcaa3 100644 --- a/.github/workflows/dotnet-build.yml +++ b/.github/workflows/dotnet-build.yml @@ -10,6 +10,9 @@ on: pull_request: branches: [ "master" ] +env: + IS_PUSH_TAG: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }} + jobs: build: runs-on: ubuntu-latest @@ -21,11 +24,14 @@ jobs: dotnet-version: 8.0.x - name: Restore dependencies run: dotnet restore ./src/SteamWebAPI2.sln - - name: Build + - name: Build (Debug) run: dotnet build ./src/SteamWebAPI2.sln --no-restore + - name: Build (Release) + if: $IS_PUSH_TAG + run: dotnet build ./src/SteamWebAPI2.sln -c Release --no-restore - name: Pack - if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }} + if: $IS_PUSH_TAG run: dotnet pack ./src/SteamWebAPI2/SteamWebAPI2.csproj -c Release --no-build --output . - name: Publish - if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }} + if: $IS_PUSH_TAG run: dotnet nuget push "*.nupkg" -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json -n --skip-duplicate \ No newline at end of file From 9ebc838343975a58c22d9f995e953127dc8e36dc Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Thu, 13 Nov 2025 11:36:50 -0500 Subject: [PATCH 105/107] Fix environment variable usage in CI workflow --- .github/workflows/dotnet-build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dotnet-build.yml b/.github/workflows/dotnet-build.yml index 2cbcaa3..6b778b7 100644 --- a/.github/workflows/dotnet-build.yml +++ b/.github/workflows/dotnet-build.yml @@ -27,11 +27,11 @@ jobs: - name: Build (Debug) run: dotnet build ./src/SteamWebAPI2.sln --no-restore - name: Build (Release) - if: $IS_PUSH_TAG + if: env.IS_PUSH_TAG run: dotnet build ./src/SteamWebAPI2.sln -c Release --no-restore - name: Pack - if: $IS_PUSH_TAG + if: env.IS_PUSH_TAG run: dotnet pack ./src/SteamWebAPI2/SteamWebAPI2.csproj -c Release --no-build --output . - name: Publish - if: $IS_PUSH_TAG - run: dotnet nuget push "*.nupkg" -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json -n --skip-duplicate \ No newline at end of file + if: env.IS_PUSH_TAG + run: dotnet nuget push "*.nupkg" -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json -n --skip-duplicate From d843ad431458979a09e18cc1429b180cebd89e13 Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Thu, 13 Nov 2025 11:39:45 -0500 Subject: [PATCH 106/107] Update conditions for build and pack steps --- .github/workflows/dotnet-build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dotnet-build.yml b/.github/workflows/dotnet-build.yml index 6b778b7..5955383 100644 --- a/.github/workflows/dotnet-build.yml +++ b/.github/workflows/dotnet-build.yml @@ -27,11 +27,11 @@ jobs: - name: Build (Debug) run: dotnet build ./src/SteamWebAPI2.sln --no-restore - name: Build (Release) - if: env.IS_PUSH_TAG + if: ${{ env.IS_PUSH_TAG == 'true' }} run: dotnet build ./src/SteamWebAPI2.sln -c Release --no-restore - name: Pack - if: env.IS_PUSH_TAG - run: dotnet pack ./src/SteamWebAPI2/SteamWebAPI2.csproj -c Release --no-build --output . + if: ${{ env.IS_PUSH_TAG == 'true' }} + run: dotnet pack ./src/SteamWebAPI2/SteamWebAPI2.csproj -c Release --output . - name: Publish - if: env.IS_PUSH_TAG + if: ${{ env.IS_PUSH_TAG == 'true' }} run: dotnet nuget push "*.nupkg" -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json -n --skip-duplicate From 3208f100917522a6206ac56743da7ce4add2f36a Mon Sep 17 00:00:00 2001 From: Justin Skiles Date: Thu, 13 Nov 2025 11:45:20 -0500 Subject: [PATCH 107/107] Replace ADO with GHA --- LICENSE | 2 +- README.md | 4 +- azure-pipelines.yml | 94 --------------------------------------------- 3 files changed, 3 insertions(+), 97 deletions(-) delete mode 100644 azure-pipelines.yml diff --git a/LICENSE b/LICENSE index 20e6b3c..43671e8 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017 Justin Skiles +Copyright (c) 2025 Justin Skiles Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 332961e..9bcf902 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # SteamWebAPI2 -[![Build Status](https://dev.azure.com/justinskiles/justinskiles/_apis/build/status/babelshift.SteamWebAPI2?branchName=master)](https://dev.azure.com/justinskiles/justinskiles/_build/latest?definitionId=2&branchName=master) +[![Build Status](https://github.com/babelshift/SteamWebAPI2/actions/workflows/dotnet-build.yml/badge.svg?branch=master)](https://github.com/babelshift/SteamWebAPI2/actions/workflows/dotnet-build.yml) [![NuGet](https://img.shields.io/nuget/v/SteamWebAPI2.svg)](https://www.nuget.org/packages/SteamWebAPI2) [![MyGet CI](https://img.shields.io/myget/babelshift-ci/v/SteamWebAPI2.svg)](https://www.myget.org/feed/babelshift-ci/package/nuget/SteamWebAPI2) @@ -54,7 +54,7 @@ The library is structured to mirror the Steam Web API endpoint structure. For ex 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. | diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index ac267ec..0000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,94 +0,0 @@ -# .NET Desktop -# Build and run tests for .NET Desktop or Windows classic desktop solutions. -# Add steps that publish symbols, save build artifacts, and more: -# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net - -trigger: - branches: - include: - - master - tags: - include: - - '*' - -pool: - vmImage: 'windows-latest' - -variables: -- group: NuGet -- name: solution - value: '**/*.sln' -- name: buildPlatform - value: 'Any CPU' -- name: buildConfiguration - value: 'Release' - -steps: -- task: NuGetToolInstaller@1 - -- task: NuGetCommand@2 - displayName: NuGet Restore - inputs: - restoreSolution: '$(solution)' - -- task: VSBuild@1 - displayName: Build (Visual Studio) - inputs: - solution: '$(solution)' - platform: '$(buildPlatform)' - configuration: '$(buildConfiguration)' - -- task: FileTransform@2 - displayName: Replace Unit Tests appsettings.json - inputs: - folderPath: '$(System.DefaultWorkingDirectory)/src/Steam.UnitTests' - xmlTransformationRules: - jsonTargetFiles: 'appsettings.json' - -- task: DotNetCoreCLI@2 - displayName: Unit Tests - continueOnError: true - inputs: - command: 'test' - projects: '**/*.csproj' - -# Only pack if this is from a tag -- task: DotNetCoreCLI@2 - displayName: NuGet Pack (if tagged) - condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/') - inputs: - command: 'pack' - packagesToPack: 'src/SteamWebAPI2/SteamWebAPI2.csproj' - versioningScheme: 'off' - -# Deploy release to NuGet.org -# Custom nuget command has to be used to workaround issue where dotnet core doesn't support encrypted API Key publication -# -n to skip symbols -# --skip-duplicate to prevent publishing the same version more than once -# Only publish if this is from a tag -- task: DotNetCoreCLI@2 - displayName: Push NuGet Package (if tagged) - condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/') - inputs: - command: custom - custom: nuget - arguments: > - push $(Build.ArtifactStagingDirectory)/**.nupkg - -s $(NuGetSourceServerUrl) - -k $(NuGetSourceServerApiKey) - -n - --skip-duplicate - -# Deploy release to GitHub -# Only publish if this is from a tag -- task: GitHubRelease@1 - displayName: Push GitHub Release (if tagged) - condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/') - inputs: - gitHubConnection: 'github.com_babelshift' - repositoryName: 'babelshift/SteamWebAPI2' - action: 'create' - target: '$(Build.SourceVersion)' - tagSource: 'gitTag' - changeLogCompareToRelease: 'lastFullRelease' - changeLogType: 'commitBased' \ No newline at end of file