/// <summary> /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// </summary> /// <param name="steamWebRequest"></param> 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; if (appId <= 0) { throw new ArgumentOutOfRangeException("appId"); } this.appId = (uint)appId; validClientVersionAppIds.Add((int)AppId.TeamFortress2); validClientVersionAppIds.Add((int)AppId.Dota2); validClientVersionAppIds.Add((int)AppId.Artifact); validClientVersionAppIds.Add((int)AppId.DotaUnderlords); validServerVersionAppIds.Add((int)AppId.TeamFortress2); validServerVersionAppIds.Add((int)AppId.Dota2); validServerVersionAppIds.Add((int)AppId.CounterStrikeGO); validServerVersionAppIds.Add((int)AppId.Artifact); validServerVersionAppIds.Add((int)AppId.DotaUnderlords); }
/// <summary> /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// </summary> /// <param name="steamWebRequest"></param> public EconItems(ISteamWebRequest steamWebRequest, EconItemsAppId appId, ISteamWebInterface steamWebInterface = null) { if (appId <= 0) { throw new ArgumentOutOfRangeException("appId"); } this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("IEconItems_" + (uint)appId, steamWebRequest) : steamWebInterface; this.appId = (uint)appId; validSchemaAppIds.Add((uint)EconItemsAppId.TeamFortress2); validSchemaAppIds.Add((uint)EconItemsAppId.Dota2); validSchemaAppIds.Add((uint)EconItemsAppId.Portal2); validSchemaAppIds.Add((uint)EconItemsAppId.Portal2_Beta); validSchemaAppIds.Add((uint)EconItemsAppId.CounterStrikeGO); validSchemaUrlAppIds.Add((uint)EconItemsAppId.TeamFortress2); validSchemaUrlAppIds.Add((uint)EconItemsAppId.Dota2); validSchemaUrlAppIds.Add((uint)EconItemsAppId.CounterStrikeGO); validStoreMetaDataAppIds.Add((uint)EconItemsAppId.TeamFortress2); validStoreMetaDataAppIds.Add((uint)EconItemsAppId.Dota2); validStoreMetaDataAppIds.Add((uint)EconItemsAppId.CounterStrikeGO); validStoreStatusAppIds.Add((uint)EconItemsAppId.TeamFortress2); }
/// <summary> /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// </summary> /// <param name="steamWebRequest"></param> 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; }
/// <summary> /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// </summary> /// <param name="steamWebApiKey"></param> 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; }
/// <summary> /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// </summary> /// <param name="steamWebApiKey"></param> public CSGOServers(IMapper mapper, ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("ICSGOServers_730", steamWebRequest) : steamWebInterface; }
/// <summary> /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// </summary> /// <param name="steamWebRequest"></param> 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; }
/// <summary> /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// </summary> /// <param name="steamWebRequest"></param> 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; }
public SteamPartner(IMapper mapper, ISteamWebRequest steamWebRequest, AppId appId, ISteamWebInterface steamWebInterface = null) { this.mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); this.appId = appId; this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("ISteamUserStats", steamWebRequest) : steamWebInterface; }
/// <summary> /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// </summary> /// <param name="steamWebApiKey"></param> 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; this.dota2TestWebInterface = new SteamWebInterface("IEconDOTA2_205790", steamWebRequest); }
/// <summary> /// Default constructor requires a Steam Web API key (secret to each developer) and the name for this web interface (such as "IDOTA2Match_570). /// </summary> /// <param name="steamWebApiBaseUrl">Used to override the base URL of each web request. Default is 'https://api.steampowered.com/'.</param> /// <param name="steamWebApiKey">Steam Web API key (secret to each developer)</param> /// <param name="interfaceName">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.</param> public SteamWebInterface(string steamWebApiBaseUrl, string interfaceName, ISteamWebRequest steamWebRequest) : this(interfaceName, steamWebRequest) { if (String.IsNullOrWhiteSpace(steamWebApiBaseUrl)) { throw new ArgumentNullException(nameof(steamWebApiBaseUrl)); } this.steamWebApiBaseUrl = steamWebApiBaseUrl; }
/// <summary> /// Default constructor requires a Steam Web API key (secret to each developer) and the name for this web interface (such as "IDOTA2Match_570). /// </summary> /// <param name="steamWebApiKey">Steam Web API key (secret to each developer)</param> /// <param name="interfaceName">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.</param> public SteamWebInterface(string interfaceName, ISteamWebRequest steamWebRequest) { if (string.IsNullOrWhiteSpace(interfaceName)) { throw new ArgumentNullException(nameof(interfaceName)); } if (steamWebRequest == null) { throw new ArgumentNullException(nameof(steamWebRequest)); } this.interfaceName = interfaceName; this.steamWebRequest = steamWebRequest; }
/// <summary> /// Default constructor requires a Steam Web API key (secret to each developer) and the name for this web interface (such as "IDOTA2Match_570). /// </summary> /// <param name="steamWebApiKey">Steam Web API key (secret to each developer)</param> /// <param name="interfaceName">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.</param> public SteamWebInterface(string interfaceName, ISteamWebRequest steamWebRequest) { if (String.IsNullOrWhiteSpace(interfaceName)) { throw new ArgumentNullException(nameof(interfaceName)); } if (steamWebRequest == null) { throw new ArgumentNullException(nameof(steamWebRequest)); } this.interfaceName = interfaceName; this.steamWebRequest = steamWebRequest; AutoMapperConfiguration.Initialize(); }
/// <summary> /// Default constructor requires a Steam Web API key (secret to each developer) and the name for this web interface (such as "IDOTA2Match_570). /// </summary> /// <param name="steamWebApiBaseUrl">Used to override the base URL of each web request. Default is 'https://api.steampowered.com/'.</param> /// <param name="steamWebApiKey">Steam Web API key (secret to each developer)</param> /// <param name="interfaceName">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.</param> public SteamWebInterface(string steamWebApiBaseUrl, string steamWebApiKey, string interfaceName, ISteamWebRequest steamWebRequest = null) { if (String.IsNullOrWhiteSpace(steamWebApiKey)) { throw new ArgumentNullException("steamWebApiKey"); } Debug.Assert(!String.IsNullOrWhiteSpace(interfaceName)); this.interfaceName = interfaceName; this.steamWebRequest = steamWebRequest == null ? new SteamWebRequest(steamWebApiBaseUrl, steamWebApiKey) : steamWebRequest; AutoMapperConfiguration.Initialize(); }
/// <summary> /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// </summary> /// <param name="steamWebRequest"></param> public GCVersion(ISteamWebRequest steamWebRequest, GCVersionAppId appId, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("IGCVersion_" + (uint)appId, steamWebRequest) : steamWebInterface; if (appId <= 0) { throw new ArgumentOutOfRangeException("appId"); } this.appId = (uint)appId; validClientVersionAppIds.Add(440); validClientVersionAppIds.Add(570); validServerVersionAppIds.Add(440); validServerVersionAppIds.Add(570); validServerVersionAppIds.Add(730); }
/// <summary> /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// </summary> /// <param name="steamWebRequest"></param> public GameServersService(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("IGameServersService", steamWebRequest) : steamWebInterface; }
/// <summary> /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// </summary> /// <param name="steamWebApiKey"></param> public SteamEconomy(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("ISteamEconomy", steamWebRequest) : steamWebInterface; }
/// <summary> /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// </summary> /// <param name="steamWebRequest"></param> public DOTA2Ticket(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("IDOTA2Ticket_570", steamWebRequest) : steamWebInterface; }
/// <summary> /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// </summary> /// <param name="steamWebRequest"></param> public PlayerService(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("IPlayerService", steamWebRequest) : steamWebInterface; }
/// <summary> /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// </summary> /// <param name="steamWebRequest"></param> public TFItems(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("ITFItems_440", steamWebRequest) : steamWebInterface; }
/// <summary> /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// </summary> /// <param name="steamWebRequest"></param> public SteamNews(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("ISteamNews", steamWebRequest) : steamWebInterface; }
/// <summary> /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// </summary> /// <param name="steamWebRequest"></param> public SteamRemoteStorage(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("ISteamRemoteStorage", steamWebRequest) : steamWebInterface; }
/// <summary> /// 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. /// 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. /// </summary> /// <param name="value">Value to parse, can be a 64-bit Steam ID, a full Steam Community Profile URL, or the user's Steam Community Profile Name.</param> /// <param name="steamWebRequest">Required in the event that the Steam Web API is needed to resolve a Profile URL to a 64-bit Steam ID.</param> public SteamId(string value, ISteamWebRequest steamWebRequest) { if (String.IsNullOrEmpty(value)) { throw new ArgumentNullException("value"); } ulong steamId = 0; MatchCollection legacyCheckResult = null; MatchCollection modernCheckResult = null; // it's a legacy steam id in the format of STEAM_X:Y:Z if (IsLegacySteamId(value, out legacyCheckResult)) { string universe = legacyCheckResult[0].Groups[1].Value; string authServer = legacyCheckResult[0].Groups[2].Value; string accountId = legacyCheckResult[0].Groups[3].Value; ConstructFromLegacySteamId(universe, authServer, accountId); ResolvedFrom = SteamIdResolvedFrom.LegacySteamId; } // it's a modern steam id in the format of [A:B:C:D] else if (IsModernSteamId(value, out modernCheckResult)) { 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; if (modernCheckResult[0].Groups.Count == 5) { instance = modernCheckResult[0].Groups[4].Value; } ConstructFromModernSteamId(accountTypeCharacter, instance, universe, accountId); ResolvedFrom = SteamIdResolvedFrom.ModernSteamId; } // it's a 64-bit steam id else if (ulong.TryParse(value, out steamId)) { ConstructFromSteamId64(steamId); ResolvedFrom = SteamIdResolvedFrom.SteamId64; } // it's some other type of string, let's find out what it is else { // check if the caller entered a valid uri Uri uriResult; bool isUri = Uri.TryCreate(value, UriKind.Absolute, out uriResult) && (uriResult.Scheme == "http" || uriResult.Scheme == "https"); SteamUser steamUser = new SteamUser(steamWebRequest); try { Task.Run(async() => { // the caller provided a uri if (isUri) { // 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); // 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); } 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; } }).Wait(); } catch (AggregateException ex) { foreach (var innerEx in ex.InnerExceptions) { // throw the first specific exception that we expect if (innerEx is VanityUrlNotResolvedException || innerEx is InvalidSteamCommunityUriException) { ExceptionDispatchInfo.Capture(innerEx).Throw(); } } // otherwise just throw the Aggregate and let the caller handle it throw; } } }
/// <summary> /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// </summary> /// <param name="steamWebApiKey"></param> public DOTA2Econ(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("IEconDOTA2_570", steamWebRequest) : steamWebInterface; }
/// <summary> /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// </summary> /// <param name="steamWebRequest"></param> public SteamUserAuth(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("ISteamUserAuth", steamWebRequest) : steamWebInterface; }
/// <summary> /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// </summary> /// <param name="steamWebApiKey"></param> public DOTA2Fantasy(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("IDOTA2Fantasy_570", steamWebRequest) : steamWebInterface; }
/// <summary> /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// </summary> /// <param name="steamWebRequest"></param> public SteamWebAPIUtil(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("ISteamWebAPIUtil", steamWebRequest) : steamWebInterface; }
/// <summary> /// Default constructor established the Steam Web API key and initializes for subsequent method calls /// </summary> /// <param name="steamWebApiKey"></param> public CSGOServers(ISteamWebRequest steamWebRequest, ISteamWebInterface steamWebInterface = null) { this.steamWebInterface = steamWebInterface == null ? new SteamWebInterface("ICSGOServers_730", steamWebRequest) : steamWebInterface; }