From ef2fb26911b9c1bb07cff1b0efe41c7ae36b184b Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Fri, 11 Nov 2016 16:00:10 +0000 Subject: [PATCH] IWorkshopService.GetItemDailyRevenue --- .../Facepunch.Steamworks.Test.csproj | 1 + .../Web/IWorkshopService.cs | 40 + .../SteamNative/SteamApi.Response.cs | 34 + .../SteamNative/SteamApi.Utility.cs | 33 + Facepunch.Steamworks/SteamNative/SteamApi.cs | 2347 ++++++++++------- Facepunch.Steamworks/Utility.cs | 8 + 6 files changed, 1560 insertions(+), 903 deletions(-) create mode 100644 Facepunch.Steamworks.Test/Web/IWorkshopService.cs diff --git a/Facepunch.Steamworks.Test/Facepunch.Steamworks.Test.csproj b/Facepunch.Steamworks.Test/Facepunch.Steamworks.Test.csproj index f0f5550..e4070f9 100644 --- a/Facepunch.Steamworks.Test/Facepunch.Steamworks.Test.csproj +++ b/Facepunch.Steamworks.Test/Facepunch.Steamworks.Test.csproj @@ -100,6 +100,7 @@ + diff --git a/Facepunch.Steamworks.Test/Web/IWorkshopService.cs b/Facepunch.Steamworks.Test/Web/IWorkshopService.cs new file mode 100644 index 0000000..1c5882f --- /dev/null +++ b/Facepunch.Steamworks.Test/Web/IWorkshopService.cs @@ -0,0 +1,40 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Facepunch.Steamworks.Test +{ + [TestClass] + public partial class IWorkshopService + { + [TestInitialize] + public void Init() + { + // + // For the sake of tests, we store our Key in an environment variable + // (so we don't end up shipping it to github and exposing it to everyone) + // + Facepunch.SteamApi.Config.Key = Environment.GetEnvironmentVariable( "SteamWebApi", EnvironmentVariableTarget.User ); + + // + // We're going to be using Newtonsoft to deserialize our json + // + Facepunch.SteamApi.Config.DeserializeJson = ( str, type ) => + { + return Newtonsoft.Json.JsonConvert.DeserializeObject( str, type ); + }; + } + + [TestMethod] + public void GetItemDailyRevenue() + { + var response = Facepunch.SteamApi.IWorkshopService.GetItemDailyRevenue( 252490, 20006, DateTime.UtcNow.Subtract( TimeSpan.FromDays( 30 ) ), DateTime.UtcNow.AddDays( 30 ) ); + + Console.WriteLine( "Item Sold " + response.TotalUnitsSold + " worldwide" ); + Console.WriteLine( "Item Generated $" + response.TotalRevenue + " worldwide" ); + } + + } +} diff --git a/Facepunch.Steamworks/SteamNative/SteamApi.Response.cs b/Facepunch.Steamworks/SteamNative/SteamApi.Response.cs index 8b7c98b..77de9f8 100644 --- a/Facepunch.Steamworks/SteamNative/SteamApi.Response.cs +++ b/Facepunch.Steamworks/SteamNative/SteamApi.Response.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Runtime.InteropServices; using System.Xml; using System.Xml.Serialization; @@ -82,4 +83,37 @@ namespace Facepunch.SteamApi } + public partial class IWorkshopService + { + public class GetItemDailyRevenueResponse + { + public class Country + { + public string country_code; + public uint date; + + /// + /// Appears to be the dollar amount multiplied by 10000 + /// Use Revenue to get the real value as a double + /// + public double revenue_usd; + + /// + /// Total dollar revenue, normalised + /// + public double Revenue { get { return revenue_usd / 10000.0; } } + + /// + /// Number of units sold + /// + public long Units; + } + + public Country[] country_revenue; + + public long TotalUnitsSold { get { return country_revenue.Sum( x => x.Units ); } } + public double TotalRevenue { get { return country_revenue.Sum( x => x.Revenue ); } } + } + } + } diff --git a/Facepunch.Steamworks/SteamNative/SteamApi.Utility.cs b/Facepunch.Steamworks/SteamNative/SteamApi.Utility.cs index 25f764b..8117eeb 100644 --- a/Facepunch.Steamworks/SteamNative/SteamApi.Utility.cs +++ b/Facepunch.Steamworks/SteamNative/SteamApi.Utility.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Collections.Specialized; using System.Runtime.InteropServices; using System.Xml; using System.Xml.Serialization; @@ -27,6 +28,38 @@ namespace Facepunch.SteamApi return response.Response; } + public static T WebPost( string url, System.Collections.Generic.Dictionary variables ) + { + var www = new System.Net.WebClient(); + + var nvc = new NameValueCollection(); + + if ( Config.Key != null ) + variables.Add( "key", Config.Key ); + + foreach ( var v in variables ) + { + nvc.Add( v.Key, v.Value.ToString() ); + } + + var bytes = www.UploadValues( url, "POST", nvc ); + var data = System.Text.Encoding.UTF8.GetString( bytes ); + + www.Dispose(); + + if ( typeof( T ) == typeof( string ) ) + return (T)(object)data; + + var response = DeserializeJson>( data ); + + if ( response.Response == null ) + return response.Result; + + return response.Response; + } + + + private static T DeserializeJson( string data ) { return (T)Facepunch.SteamApi.Config.DeserializeJson( data, typeof( T ) ); diff --git a/Facepunch.Steamworks/SteamNative/SteamApi.cs b/Facepunch.Steamworks/SteamNative/SteamApi.cs index 50269b1..1169739 100644 --- a/Facepunch.Steamworks/SteamNative/SteamApi.cs +++ b/Facepunch.Steamworks/SteamNative/SteamApi.cs @@ -10,45 +10,49 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/IGameInventory/"; - /// appid of game - /// The steam ID of the account to operate on - /// The command to run on that asset - /// The context to fetch history for - /// The arguments that were provided with the command in the first place + /// (uint32)appid of game + /// (uint64)The steam ID of the account to operate on + /// (string)The command to run on that asset + /// (uint64)The context to fetch history for + /// (string)The arguments that were provided with the command in the first place public static string GetHistoryCommandDetails(uint appid, ulong steamid, string command, ulong contextid, string arguments) { - string url = $"{Url}GetHistoryCommandDetails/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&steamid={steamid}&command={command}&contextid={contextid}&arguments={arguments}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetHistoryCommandDetails/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&steamid={steamid}&command={command}&contextid={contextid}&arguments={arguments}" ); } - /// appid of game - /// The Steam ID to fetch history for - /// The context to fetch history for - /// Start time of the history range to collect - /// End time of the history range to collect + /// (uint32)appid of game + /// (uint64)The Steam ID to fetch history for + /// (uint64)The context to fetch history for + /// (uint32)Start time of the history range to collect + /// (uint32)End time of the history range to collect public static string GetUserHistory(uint appid, ulong steamid, ulong contextid, uint starttime, uint endtime) { - string url = $"{Url}GetUserHistory/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&steamid={steamid}&contextid={contextid}&starttime={starttime}&endtime={endtime}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetUserHistory/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&steamid={steamid}&contextid={contextid}&starttime={starttime}&endtime={endtime}" ); } - /// appid of game - /// The asset ID to operate on - /// The context to fetch history for - /// A unique 32 bit ID for the support person executing the command + /// (uint32)appid of game + /// (uint64)The asset ID to operate on + /// (uint64)The context to fetch history for + /// (uint32)A unique 32 bit ID for the support person executing the command public static string HistoryExecuteCommands(uint appid, ulong steamid, ulong contextid, uint actorid) { - string url = $"{Url}/HistoryExecuteCommands/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "appid", appid }, + { "steamid", steamid }, + { "contextid", contextid }, + { "actorid", actorid }, + }; + + return Utility.WebPost( $"{Url}/HistoryExecuteCommands/v0001/", headers ); } - /// appid of game - /// The asset ID to operate on - /// The context to fetch history for + /// (uint32)appid of game + /// (uint64)The asset ID to operate on + /// (uint64)The context to fetch history for public static string SupportGetAssetHistory(uint appid, ulong assetid, ulong contextid) { - string url = $"{Url}SupportGetAssetHistory/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&assetid={assetid}&contextid={contextid}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}SupportGetAssetHistory/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&assetid={assetid}&contextid={contextid}" ); } } @@ -60,84 +64,82 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/ISteamApps/"; - /// AppID of game + /// (uint32)AppID of game public static GetAppBetasResponse GetAppBetas(uint appid) { - string url = $"{Url}GetAppBetas/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetAppBetas/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}" ); } - /// AppID of game - /// # of builds to retrieve (default 10) + /// (uint32)AppID of game + /// (uint32)# of builds to retrieve (default 10) public static GetAppBuildsResponse GetAppBuilds(uint appid, uint count) { - string url = $"{Url}GetAppBuilds/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&count={count}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetAppBuilds/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&count={count}" ); } - /// AppID of depot + /// (uint32)AppID of depot public static string GetAppDepotVersions(uint appid) { - string url = $"{Url}GetAppDepotVersions/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetAppDepotVersions/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}" ); } public static string GetAppList() { - string url = $"{Url}GetAppList/v0002/?key={Facepunch.SteamApi.Config.Key}&format=json&"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetAppList/v0002/?key={Facepunch.SteamApi.Config.Key}&format=json&" ); } - /// AppID of game - /// Time range begin - /// Time range end - /// include reports that were not bans - /// include reports that were bans - /// minimum report id + /// (uint32)AppID of game + /// (uint32)Time range begin + /// (uint32)Time range end + /// (bool)include reports that were not bans + /// (bool)include reports that were bans + /// (uint64)minimum report id public static string GetCheatingReports(uint appid, uint timebegin, uint timeend, bool includereports, bool includebans, ulong reportidmin) { - string url = $"{Url}GetCheatingReports/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&timebegin={timebegin}&timeend={timeend}&includereports={includereports}&includebans={includebans}&reportidmin={reportidmin}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetCheatingReports/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&timebegin={timebegin}&timeend={timeend}&includereports={includereports}&includebans={includebans}&reportidmin={reportidmin}" ); } - /// AppID of game + /// (uint32)AppID of game public static string GetPlayersBanned(uint appid) { - string url = $"{Url}GetPlayersBanned/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetPlayersBanned/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}" ); } - /// Query filter string - /// Limit number of servers in the response + /// (string)Query filter string + /// (uint32)Limit number of servers in the response public static string GetServerList(string filter, uint limit) { - string url = $"{Url}GetServerList/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&filter={filter}&limit={limit}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetServerList/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&filter={filter}&limit={limit}" ); } - /// IP or IP:queryport to list + /// (string)IP or IP:queryport to list public static string GetServersAtAddress(string addr) { - string url = $"{Url}GetServersAtAddress/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&addr={addr}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetServersAtAddress/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&addr={addr}" ); } - /// AppID of game - /// BuildID - /// beta key, required. Use public for default branch - /// optional description for this build + /// (uint32)AppID of game + /// (uint32)BuildID + /// (string)beta key, required. Use public for default branch + /// (string)optional description for this build public static string SetAppBuildLive(uint appid, uint buildid, string betakey, string description) { - string url = $"{Url}/SetAppBuildLive/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "appid", appid }, + { "buildid", buildid }, + { "betakey", betakey }, + { "description", description }, + }; + + return Utility.WebPost( $"{Url}/SetAppBuildLive/v0001/", headers ); } - /// AppID of game - /// The installed version of the game + /// (uint32)AppID of game + /// (uint32)The installed version of the game public static string UpToDateCheck(uint appid, uint version) { - string url = $"{Url}UpToDateCheck/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&version={version}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}UpToDateCheck/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&version={version}" ); } } @@ -151,8 +153,11 @@ namespace Facepunch.SteamApi public static string BitPayPaymentNotification() { - string url = $"{Url}/BitPayPaymentNotification/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + }; + + return Utility.WebPost( $"{Url}/BitPayPaymentNotification/v0001/", headers ); } } @@ -164,25 +169,40 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/ISteamCDN/"; - /// Steam name of CDN property - /// comma-separated list of allowed IP address blocks in CIDR format - blank for not used - /// comma-separated list of allowed client network AS numbers - blank for not used - /// comma-separated list of allowed client IP country codes in ISO 3166-1 format - blank for not used + /// (string)Steam name of CDN property + /// (string)comma-separated list of allowed IP address blocks in CIDR format - blank for not used + /// (string)comma-separated list of allowed client network AS numbers - blank for not used + /// (string)comma-separated list of allowed client IP country codes in ISO 3166-1 format - blank for not used public static string SetClientFilters(string cdnname, string allowedipblocks, string allowedasns, string allowedipcountries) { - string url = $"{Url}/SetClientFilters/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "cdnname", cdnname }, + { "allowedipblocks", allowedipblocks }, + { "allowedasns", allowedasns }, + { "allowedipcountries", allowedipcountries }, + }; + + return Utility.WebPost( $"{Url}/SetClientFilters/v0001/", headers ); } - /// Steam name of CDN property - /// Outgoing network traffic in Mbps - /// Incoming network traffic in Mbps - /// Percent CPU load - /// Percent cache hits + /// (string)Steam name of CDN property + /// (uint32)Outgoing network traffic in Mbps + /// (uint32)Incoming network traffic in Mbps + /// (uint32)Percent CPU load + /// (uint32)Percent cache hits public static string SetPerformanceStats(string cdnname, uint mbps_sent, uint mbps_recv, uint cpu_percent, uint cache_hit_percent) { - string url = $"{Url}/SetPerformanceStats/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "cdnname", cdnname }, + { "mbps_sent", mbps_sent }, + { "mbps_recv", mbps_recv }, + { "cpu_percent", cpu_percent }, + { "cache_hit_percent", cache_hit_percent }, + }; + + return Utility.WebPost( $"{Url}/SetPerformanceStats/v0001/", headers ); } } @@ -194,17 +214,27 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/ISteamCommunity/"; - /// SteamID of user doing the reporting - /// SteamID of the entity being accused of abuse - /// AppID to check for ownership - /// Abuse type code (see EAbuseReportType enum) - /// Content type code (see ECommunityContentType enum) - /// Narrative from user - /// GID of related record (depends on content type) + /// (uint64)SteamID of user doing the reporting + /// (uint64)SteamID of the entity being accused of abuse + /// (uint32)AppID to check for ownership + /// (uint32)Abuse type code (see EAbuseReportType enum) + /// (uint32)Content type code (see ECommunityContentType enum) + /// (string)Narrative from user + /// (uint64)GID of related record (depends on content type) public static string ReportAbuse(ulong steamidActor, ulong steamidTarget, uint appid, uint abuseType, uint contentType, string description, ulong gid) { - string url = $"{Url}/ReportAbuse/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamidActor", steamidActor }, + { "steamidTarget", steamidTarget }, + { "appid", appid }, + { "abuseType", abuseType }, + { "contentType", contentType }, + { "description", description }, + { "gid", gid }, + }; + + return Utility.WebPost( $"{Url}/ReportAbuse/v0001/", headers ); } } @@ -216,12 +246,11 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/ISteamDirectory/"; - /// Client's Steam cell ID - /// Max number of servers to return + /// (uint32)Client's Steam cell ID + /// (uint32)Max number of servers to return public static string GetCMList(uint cellid, uint maxcount) { - string url = $"{Url}GetCMList/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&cellid={cellid}&maxcount={maxcount}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetCMList/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&cellid={cellid}&maxcount={maxcount}" ); } } @@ -233,83 +262,96 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/ISteamEconomy/"; - /// That the key is associated with. Must be a steam economy app. - /// SteamID of user attempting to initiate a trade - /// SteamID of user that is the target of the trade invitation + /// (uint32)That the key is associated with. Must be a steam economy app. + /// (uint64)SteamID of user attempting to initiate a trade + /// (uint64)SteamID of user that is the target of the trade invitation public static string CanTrade(uint appid, ulong steamid, ulong targetid) { - string url = $"{Url}CanTrade/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&steamid={steamid}&targetid={targetid}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}CanTrade/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&steamid={steamid}&targetid={targetid}" ); } - /// The app ID the user is buying assets for - /// SteamID of the user making a purchase - /// The transaction ID - /// The local language for the user + /// (uint32)The app ID the user is buying assets for + /// (uint64)SteamID of the user making a purchase + /// (string)The transaction ID + /// (string)The local language for the user public static string FinalizeAssetTransaction(uint appid, ulong steamid, string txnid, string language) { - string url = $"{Url}/FinalizeAssetTransaction/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "appid", appid }, + { "steamid", steamid }, + { "txnid", txnid }, + { "language", language }, + }; + + return Utility.WebPost( $"{Url}/FinalizeAssetTransaction/v0001/", headers ); } - /// Must be a steam economy app. - /// The user's local language - /// Number of classes requested. Must be at least one. - /// Class ID of the nth class. - /// Instance ID of the nth class. + /// (uint32)Must be a steam economy app. + /// (string)The user's local language + /// (uint32)Number of classes requested. Must be at least one. + /// (uint64)Class ID of the nth class. + /// (uint64)Instance ID of the nth class. public static string GetAssetClassInfo(uint appid, string language, uint class_count, ulong classid0, ulong instanceid0) { - string url = $"{Url}GetAssetClassInfo/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&language={language}&class_count={class_count}&classid0={classid0}&instanceid0={instanceid0}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetAssetClassInfo/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&language={language}&class_count={class_count}&classid0={classid0}&instanceid0={instanceid0}" ); } - /// Must be a steam economy app. - /// The currency to filter for - /// The user's local language + /// (uint32)Must be a steam economy app. + /// (string)The currency to filter for + /// (string)The user's local language public static string GetAssetPrices(uint appid, string currency, string language) { - string url = $"{Url}GetAssetPrices/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}¤cy={currency}&language={language}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetAssetPrices/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}¤cy={currency}&language={language}" ); } - /// SteamID of user - /// The app to get exported items from. - /// The context in the app to get exported items from. + /// (uint64)SteamID of user + /// (uint32)The app to get exported items from. + /// (uint64)The context in the app to get exported items from. public static string GetExportedAssetsForUser(ulong steamid, uint appid, ulong contextid) { - string url = $"{Url}GetExportedAssetsForUser/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&appid={appid}&contextid={contextid}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetExportedAssetsForUser/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&appid={appid}&contextid={contextid}" ); } - /// Must be a steam economy app. + /// (uint32)Must be a steam economy app. public static GetMarketPricesResponse GetMarketPrices(uint appid) { - string url = $"{Url}GetMarketPrices/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetMarketPrices/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}" ); } - /// The app ID the user is buying assets for - /// SteamID of user making a purchase - /// The ID of the first asset the user is buying - there must be at least one - /// The quantity of assetid0's the the user is buying - /// The local currency for the user - /// The local language for the user - /// The user's IP address - /// The referring URL - /// If true (default is false), the authorization will appear in the user's steam client overlay, rather than as a web page - useful for stores that are embedded in products. + /// (uint32)The app ID the user is buying assets for + /// (uint64)SteamID of user making a purchase + /// (string)The ID of the first asset the user is buying - there must be at least one + /// (uint32)The quantity of assetid0's the the user is buying + /// (string)The local currency for the user + /// (string)The local language for the user + /// (string)The user's IP address + /// (string)The referring URL + /// (bool)If true (default is false), the authorization will appear in the user's steam client overlay, rather than as a web page - useful for stores that are embedded in products. public static string StartAssetTransaction(uint appid, ulong steamid, string assetid0, uint assetquantity0, string currency, string language, string ipaddress, string referrer, bool clientauth) { - string url = $"{Url}/StartAssetTransaction/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "appid", appid }, + { "steamid", steamid }, + { "assetid0", assetid0 }, + { "assetquantity0", assetquantity0 }, + { "currency", currency }, + { "language", language }, + { "ipaddress", ipaddress }, + { "referrer", referrer }, + { "clientauth", clientauth }, + }; + + return Utility.WebPost( $"{Url}/StartAssetTransaction/v0001/", headers ); } - /// That the key is associated with. Must be a steam economy app. - /// SteamID of first user in the trade - /// SteamID of second user in the trade + /// (uint32)That the key is associated with. Must be a steam economy app. + /// (uint64)SteamID of first user in the trade + /// (uint64)SteamID of second user in the trade public static string StartTrade(uint appid, ulong partya, ulong partyb) { - string url = $"{Url}StartTrade/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&partya={partya}&partyb={partyb}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}StartTrade/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&partya={partya}&partyb={partyb}" ); } } @@ -323,14 +365,20 @@ namespace Facepunch.SteamApi public static string PaymentOutNotification() { - string url = $"{Url}/PaymentOutNotification/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + }; + + return Utility.WebPost( $"{Url}/PaymentOutNotification/v0001/", headers ); } public static string PaymentOutReversalNotification() { - string url = $"{Url}/PaymentOutReversalNotification/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + }; + + return Utility.WebPost( $"{Url}/PaymentOutReversalNotification/v0001/", headers ); } } @@ -342,15 +390,14 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/ISteamGameServerStats/"; - /// game id to get stats for, if not a mod, it's safe to use appid here - /// appID of the game - /// range start date/time (Format: YYYY-MM-DD HH:MM:SS, seattle local time - /// range end date/time (Format: YYYY-MM-DD HH:MM:SS, seattle local time - /// Max number of results to return (up to 1000) + /// (uint64)game id to get stats for, if not a mod, it's safe to use appid here + /// (uint32)appID of the game + /// (string)range start date/time (Format: YYYY-MM-DD HH:MM:SS, seattle local time + /// (string)range end date/time (Format: YYYY-MM-DD HH:MM:SS, seattle local time + /// (uint32)Max number of results to return (up to 1000) public static string GetGameServerPlayerStatsForGame(ulong gameid, uint appid, string rangestart, string rangeend, uint maxresults) { - string url = $"{Url}GetGameServerPlayerStatsForGame/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&gameid={gameid}&appid={appid}&rangestart={rangestart}&rangeend={rangeend}&maxresults={maxresults}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetGameServerPlayerStatsForGame/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&gameid={gameid}&appid={appid}&rangestart={rangestart}&rangeend={rangeend}&maxresults={maxresults}" ); } } @@ -362,64 +409,91 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/ISteamLeaderboards/"; - /// appid of game - /// name of the leaderboard to delete + /// (uint32)appid of game + /// (string)name of the leaderboard to delete public static string DeleteLeaderboard(uint appid, string name) { - string url = $"{Url}/DeleteLeaderboard/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "appid", appid }, + { "name", name }, + }; + + return Utility.WebPost( $"{Url}/DeleteLeaderboard/v0001/", headers ); } - /// appid of game - /// name of the leaderboard to create - /// sort method to use for this leaderboard (defaults to Ascending) - /// display type for this leaderboard (defaults to Numeric) - /// if this is true the leaderboard will be created if it doesn't exist. Defaults to true. - /// if this is true the leaderboard scores cannot be set by clients, and can only be set by publisher via SetLeaderboardScore WebAPI. Defaults to false. - /// if this is true the leaderboard scores can only be read for friends by clients, scores can always be read by publisher. Defaults to false. + /// (uint32)appid of game + /// (string)name of the leaderboard to create + /// (string)sort method to use for this leaderboard (defaults to Ascending) + /// (string)display type for this leaderboard (defaults to Numeric) + /// (bool)if this is true the leaderboard will be created if it doesn't exist. Defaults to true. + /// (bool)if this is true the leaderboard scores cannot be set by clients, and can only be set by publisher via SetLeaderboardScore WebAPI. Defaults to false. + /// (bool)if this is true the leaderboard scores can only be read for friends by clients, scores can always be read by publisher. Defaults to false. public static string FindOrCreateLeaderboard(uint appid, string name, string sortmethod, string displaytype, bool createifnotfound, bool onlytrustedwrites, bool onlyfriendsreads) { - string url = $"{Url}/FindOrCreateLeaderboard/v0002/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "appid", appid }, + { "name", name }, + { "sortmethod", sortmethod }, + { "displaytype", displaytype }, + { "createifnotfound", createifnotfound }, + { "onlytrustedwrites", onlytrustedwrites }, + { "onlyfriendsreads", onlyfriendsreads }, + }; + + return Utility.WebPost( $"{Url}/FindOrCreateLeaderboard/v0002/", headers ); } - /// appid of game - /// range start or 0 - /// range end or max LB entries - /// SteamID used for friend & around user requests - /// ID of the leaderboard to view - /// type of request: RequestGlobal, RequestAroundUser, RequestFriends + /// (uint32)appid of game + /// (int32)range start or 0 + /// (int32)range end or max LB entries + /// (uint64)SteamID used for friend & around user requests + /// (int32)ID of the leaderboard to view + /// (uint32)type of request: RequestGlobal, RequestAroundUser, RequestFriends public static string GetLeaderboardEntries(uint appid, int rangestart, int rangeend, ulong steamid, int leaderboardid, uint datarequest) { - string url = $"{Url}GetLeaderboardEntries/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&rangestart={rangestart}&rangeend={rangeend}&steamid={steamid}&leaderboardid={leaderboardid}&datarequest={datarequest}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetLeaderboardEntries/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&rangestart={rangestart}&rangeend={rangeend}&steamid={steamid}&leaderboardid={leaderboardid}&datarequest={datarequest}" ); } - /// appid of game + /// (uint32)appid of game public static string GetLeaderboardsForGame(uint appid) { - string url = $"{Url}GetLeaderboardsForGame/v0002/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetLeaderboardsForGame/v0002/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}" ); } - /// appid of game - /// numeric ID of the target leaderboard. Can be retrieved from GetLeaderboardsForGame + /// (uint32)appid of game + /// (uint32)numeric ID of the target leaderboard. Can be retrieved from GetLeaderboardsForGame public static string ResetLeaderboard(uint appid, uint leaderboardid) { - string url = $"{Url}/ResetLeaderboard/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "appid", appid }, + { "leaderboardid", leaderboardid }, + }; + + return Utility.WebPost( $"{Url}/ResetLeaderboard/v0001/", headers ); } - /// appid of game - /// numeric ID of the target leaderboard. Can be retrieved from GetLeaderboardsForGame - /// steamID to set the score for - /// the score to set for this user - /// update method to use. Can be "KeepBest" or "ForceUpdate" - /// game-specific details for how the score was earned. Up to 256 bytes. + /// (uint32)appid of game + /// (uint32)numeric ID of the target leaderboard. Can be retrieved from GetLeaderboardsForGame + /// (uint64)steamID to set the score for + /// (int32)the score to set for this user + /// (string)update method to use. Can be "KeepBest" or "ForceUpdate" + /// (rawbinary)game-specific details for how the score was earned. Up to 256 bytes. public static string SetLeaderboardScore(uint appid, uint leaderboardid, ulong steamid, int score, string scoremethod, byte[] details) { - string url = $"{Url}/SetLeaderboardScore/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "appid", appid }, + { "leaderboardid", leaderboardid }, + { "steamid", steamid }, + { "score", score }, + { "scoremethod", scoremethod }, + { "details", details }, + }; + + return Utility.WebPost( $"{Url}/SetLeaderboardScore/v0001/", headers ); } } @@ -431,117 +505,173 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/ISteamMicroTxn/"; - /// SteamID of user with the agreement - /// ID of agreement - /// AppID of game - /// Date for next process + /// (uint64)SteamID of user with the agreement + /// (uint64)ID of agreement + /// (uint32)AppID of game + /// (string)Date for next process public static string AdjustAgreement(ulong steamid, ulong agreementid, uint appid, string nextprocessdate) { - string url = $"{Url}/AdjustAgreement/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "agreementid", agreementid }, + { "appid", appid }, + { "nextprocessdate", nextprocessdate }, + }; + + return Utility.WebPost( $"{Url}/AdjustAgreement/v0001/", headers ); } - /// SteamID of user with the agreement - /// ID of agreement - /// AppID of game + /// (uint64)SteamID of user with the agreement + /// (uint64)ID of agreement + /// (uint32)AppID of game public static string CancelAgreement(ulong steamid, ulong agreementid, uint appid) { - string url = $"{Url}/CancelAgreement/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "agreementid", agreementid }, + { "appid", appid }, + }; + + return Utility.WebPost( $"{Url}/CancelAgreement/v0001/", headers ); } - /// 3rd party ID for transaction - /// AppID of game this transaction is for + /// (uint64)3rd party ID for transaction + /// (uint32)AppID of game this transaction is for public static string FinalizeTxn(ulong orderid, uint appid) { - string url = $"{Url}/FinalizeTxn/v0002/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "orderid", orderid }, + { "appid", appid }, + }; + + return Utility.WebPost( $"{Url}/FinalizeTxn/v0002/", headers ); } - /// AppID of game this transaction is for - /// Report type (GAMESALES, STEAMSTORE, SETTLEMENT) - /// Beginning time to start report from (RFC 3339 UTC format) - /// Max number of results to return (up to 1000) + /// (uint32)AppID of game this transaction is for + /// (string)Report type (GAMESALES, STEAMSTORE, SETTLEMENT) + /// (string)Beginning time to start report from (RFC 3339 UTC format) + /// (uint32)Max number of results to return (up to 1000) public static string GetReport(uint appid, string type, string time, uint maxresults) { - string url = $"{Url}GetReport/v0003/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&type={type}&time={time}&maxresults={maxresults}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetReport/v0003/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&type={type}&time={time}&maxresults={maxresults}" ); } - /// SteamID of user making purchase - /// AppID of game + /// (uint64)SteamID of user making purchase + /// (uint32)AppID of game public static string GetUserAgreementInfo(ulong steamid, uint appid) { - string url = $"{Url}GetUserAgreementInfo/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&appid={appid}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetUserAgreementInfo/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&appid={appid}" ); } - /// SteamID of user making purchase - /// ip address of user in string format (xxx.xxx.xxx.xxx). Only required if usersession=web + /// (uint64)SteamID of user making purchase + /// (string)ip address of user in string format (xxx.xxx.xxx.xxx). Only required if usersession=web public static string GetUserInfo(ulong steamid, string ipaddress) { - string url = $"{Url}GetUserInfo/v0002/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&ipaddress={ipaddress}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetUserInfo/v0002/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&ipaddress={ipaddress}" ); } - /// 3rd party ID for transaction - /// SteamID of user making purchase - /// AppID of game this transaction is for - /// Number of items in cart - /// ISO 639-1 language code of description - /// ISO 4217 currency code - /// session where user will authorize the transaction. client or web (defaults to client) - /// ip address of user in string format (xxx.xxx.xxx.xxx). Only required if usersession=web - /// 3rd party ID for item - /// Quantity of this item - /// Total cost (in cents) of item(s) - /// Description of item - /// Optional category grouping for item - /// Optional bundleid of associated bundle - /// Optional recurring billing type - /// Optional start date for recurring billing - /// Optional end date for recurring billing - /// Optional period for recurring billing - /// Optional frequency for recurring billing - /// Optional recurring billing amount - /// Number of bundles in cart - /// 3rd party ID of the bundle. This shares the same ID space as 3rd party items. - /// Quantity of this bundle - /// Description of bundle - /// Optional category grouping for bundle + /// (uint64)3rd party ID for transaction + /// (uint64)SteamID of user making purchase + /// (uint32)AppID of game this transaction is for + /// (uint32)Number of items in cart + /// (string)ISO 639-1 language code of description + /// (string)ISO 4217 currency code + /// (string)session where user will authorize the transaction. client or web (defaults to client) + /// (string)ip address of user in string format (xxx.xxx.xxx.xxx). Only required if usersession=web + /// (uint32)3rd party ID for item + /// (uint32)Quantity of this item + /// (int32)Total cost (in cents) of item(s) + /// (string)Description of item + /// (string)Optional category grouping for item + /// (uint32)Optional bundleid of associated bundle + /// (string)Optional recurring billing type + /// (string)Optional start date for recurring billing + /// (string)Optional end date for recurring billing + /// (string)Optional period for recurring billing + /// (uint32)Optional frequency for recurring billing + /// (string)Optional recurring billing amount + /// (uint32)Number of bundles in cart + /// (uint32)3rd party ID of the bundle. This shares the same ID space as 3rd party items. + /// (uint32)Quantity of this bundle + /// (string)Description of bundle + /// (string)Optional category grouping for bundle public static string InitTxn(ulong orderid, ulong steamid, uint appid, uint itemcount, string language, string currency, string usersession, string ipaddress, uint[] itemid, uint[] qty, int[] amount, string[] description, string[] category, uint[] associated_bundle, string[] billingtype, string[] startdate, string[] enddate, string[] period, uint[] frequency, string[] recurringamt, uint bundlecount, uint[] bundleid, uint[] bundle_qty, string[] bundle_desc, string[] bundle_category) { - string url = $"{Url}/InitTxn/v0003/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "orderid", orderid }, + { "steamid", steamid }, + { "appid", appid }, + { "itemcount", itemcount }, + { "language", language }, + { "currency", currency }, + { "usersession", usersession }, + { "ipaddress", ipaddress }, + { "itemid[0]", itemid[0] }, + { "qty[0]", qty[0] }, + { "amount[0]", amount[0] }, + { "description[0]", description[0] }, + { "category[0]", category[0] }, + { "associated_bundle[0]", associated_bundle[0] }, + { "billingtype[0]", billingtype[0] }, + { "startdate[0]", startdate[0] }, + { "enddate[0]", enddate[0] }, + { "period[0]", period[0] }, + { "frequency[0]", frequency[0] }, + { "recurringamt[0]", recurringamt[0] }, + { "bundlecount", bundlecount }, + { "bundleid[0]", bundleid[0] }, + { "bundle_qty[0]", bundle_qty[0] }, + { "bundle_desc[0]", bundle_desc[0] }, + { "bundle_category[0]", bundle_category[0] }, + }; + + return Utility.WebPost( $"{Url}/InitTxn/v0003/", headers ); } - /// 3rd party ID for transaction - /// SteamID of user with the agreement - /// ID of agreement - /// AppID of game - /// Total cost (in cents) to charge - /// ISO 4217 currency code + /// (uint64)3rd party ID for transaction + /// (uint64)SteamID of user with the agreement + /// (uint64)ID of agreement + /// (uint32)AppID of game + /// (int32)Total cost (in cents) to charge + /// (string)ISO 4217 currency code public static string ProcessAgreement(ulong orderid, ulong steamid, ulong agreementid, uint appid, int amount, string currency) { - string url = $"{Url}/ProcessAgreement/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "orderid", orderid }, + { "steamid", steamid }, + { "agreementid", agreementid }, + { "appid", appid }, + { "amount", amount }, + { "currency", currency }, + }; + + return Utility.WebPost( $"{Url}/ProcessAgreement/v0001/", headers ); } - /// AppID of game this transaction is for - /// 3rd party ID for transaction - /// Steam transaction ID + /// (uint32)AppID of game this transaction is for + /// (uint64)3rd party ID for transaction + /// (uint64)Steam transaction ID public static string QueryTxn(uint appid, ulong orderid, ulong transid) { - string url = $"{Url}QueryTxn/v0002/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&orderid={orderid}&transid={transid}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}QueryTxn/v0002/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&orderid={orderid}&transid={transid}" ); } - /// 3rd party ID for transaction - /// AppID of game this transaction is for + /// (uint64)3rd party ID for transaction + /// (uint32)AppID of game this transaction is for public static string RefundTxn(ulong orderid, uint appid) { - string url = $"{Url}/RefundTxn/v0002/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "orderid", orderid }, + { "appid", appid }, + }; + + return Utility.WebPost( $"{Url}/RefundTxn/v0002/", headers ); } } @@ -553,108 +683,155 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/ISteamMicroTxnSandbox/"; - /// SteamID of user with the agreement - /// ID of agreement - /// AppID of game - /// Date for next process + /// (uint64)SteamID of user with the agreement + /// (uint64)ID of agreement + /// (uint32)AppID of game + /// (string)Date for next process public static string AdjustAgreement(ulong steamid, ulong agreementid, uint appid, string nextprocessdate) { - string url = $"{Url}/AdjustAgreement/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "agreementid", agreementid }, + { "appid", appid }, + { "nextprocessdate", nextprocessdate }, + }; + + return Utility.WebPost( $"{Url}/AdjustAgreement/v0001/", headers ); } - /// SteamID of user with the agreement - /// ID of agreement - /// AppID of game + /// (uint64)SteamID of user with the agreement + /// (uint64)ID of agreement + /// (uint32)AppID of game public static string CancelAgreement(ulong steamid, ulong agreementid, uint appid) { - string url = $"{Url}/CancelAgreement/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "agreementid", agreementid }, + { "appid", appid }, + }; + + return Utility.WebPost( $"{Url}/CancelAgreement/v0001/", headers ); } - /// 3rd party ID for transaction - /// AppID of game this transaction is for + /// (uint64)3rd party ID for transaction + /// (uint32)AppID of game this transaction is for public static string FinalizeTxn(ulong orderid, uint appid) { - string url = $"{Url}/FinalizeTxn/v0002/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "orderid", orderid }, + { "appid", appid }, + }; + + return Utility.WebPost( $"{Url}/FinalizeTxn/v0002/", headers ); } - /// AppID of game this transaction is for - /// Report type (GAMESALES, STEAMSTORE, SETTLEMENT) - /// Beginning time to start report from (RFC 3339 UTC format) - /// Max number of results to return (up to 1000) + /// (uint32)AppID of game this transaction is for + /// (string)Report type (GAMESALES, STEAMSTORE, SETTLEMENT) + /// (string)Beginning time to start report from (RFC 3339 UTC format) + /// (uint32)Max number of results to return (up to 1000) public static string GetReport(uint appid, string type, string time, uint maxresults) { - string url = $"{Url}GetReport/v0003/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&type={type}&time={time}&maxresults={maxresults}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetReport/v0003/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&type={type}&time={time}&maxresults={maxresults}" ); } - /// SteamID of user making purchase - /// AppID of game + /// (uint64)SteamID of user making purchase + /// (uint32)AppID of game public static string GetUserAgreementInfo(ulong steamid, uint appid) { - string url = $"{Url}GetUserAgreementInfo/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&appid={appid}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetUserAgreementInfo/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&appid={appid}" ); } - /// SteamID of user making purchase - /// ip address of user in string format (xxx.xxx.xxx.xxx). Only required if usersession=web + /// (uint64)SteamID of user making purchase + /// (string)ip address of user in string format (xxx.xxx.xxx.xxx). Only required if usersession=web public static string GetUserInfo(ulong steamid, string ipaddress) { - string url = $"{Url}GetUserInfo/v0002/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&ipaddress={ipaddress}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetUserInfo/v0002/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&ipaddress={ipaddress}" ); } - /// 3rd party ID for transaction - /// SteamID of user making purchase - /// AppID of game this transaction is for - /// Number of items in cart - /// ISO 639-1 language code of description - /// ISO 4217 currency code - /// 3rd party ID for item - /// Quantity of this item - /// Total cost (in cents) of item(s) - /// Description of item - /// Optional category grouping for item - /// Optional recurring billing type - /// Optional start date for recurring billing - /// Optional end date for recurring billing - /// Optional period for recurring billing - /// Optional frequency for recurring billing - /// Optional recurring billing amount + /// (uint64)3rd party ID for transaction + /// (uint64)SteamID of user making purchase + /// (uint32)AppID of game this transaction is for + /// (uint32)Number of items in cart + /// (string)ISO 639-1 language code of description + /// (string)ISO 4217 currency code + /// (uint32)3rd party ID for item + /// (uint32)Quantity of this item + /// (int32)Total cost (in cents) of item(s) + /// (string)Description of item + /// (string)Optional category grouping for item + /// (string)Optional recurring billing type + /// (string)Optional start date for recurring billing + /// (string)Optional end date for recurring billing + /// (string)Optional period for recurring billing + /// (uint32)Optional frequency for recurring billing + /// (string)Optional recurring billing amount public static string InitTxn(ulong orderid, ulong steamid, uint appid, uint itemcount, string language, string currency, uint[] itemid, uint[] qty, int[] amount, string[] description, string[] category, string[] billingtype, string[] startdate, string[] enddate, string[] period, uint[] frequency, string[] recurringamt) { - string url = $"{Url}/InitTxn/v0003/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "orderid", orderid }, + { "steamid", steamid }, + { "appid", appid }, + { "itemcount", itemcount }, + { "language", language }, + { "currency", currency }, + { "itemid[0]", itemid[0] }, + { "qty[0]", qty[0] }, + { "amount[0]", amount[0] }, + { "description[0]", description[0] }, + { "category[0]", category[0] }, + { "billingtype[0]", billingtype[0] }, + { "startdate[0]", startdate[0] }, + { "enddate[0]", enddate[0] }, + { "period[0]", period[0] }, + { "frequency[0]", frequency[0] }, + { "recurringamt[0]", recurringamt[0] }, + }; + + return Utility.WebPost( $"{Url}/InitTxn/v0003/", headers ); } - /// SteamID of user with the agreement - /// ID of agreement - /// AppID of game - /// Total cost (in cents) to charge - /// ISO 4217 currency code + /// (uint64)SteamID of user with the agreement + /// (uint64)ID of agreement + /// (uint32)AppID of game + /// (int32)Total cost (in cents) to charge + /// (string)ISO 4217 currency code public static string ProcessAgreement(ulong steamid, ulong agreementid, uint appid, int amount, string currency) { - string url = $"{Url}/ProcessAgreement/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "agreementid", agreementid }, + { "appid", appid }, + { "amount", amount }, + { "currency", currency }, + }; + + return Utility.WebPost( $"{Url}/ProcessAgreement/v0001/", headers ); } - /// AppID of game this transaction is for - /// 3rd party ID for transaction - /// Steam transaction ID + /// (uint32)AppID of game this transaction is for + /// (uint64)3rd party ID for transaction + /// (uint64)Steam transaction ID public static string QueryTxn(uint appid, ulong orderid, ulong transid) { - string url = $"{Url}QueryTxn/v0002/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&orderid={orderid}&transid={transid}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}QueryTxn/v0002/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&orderid={orderid}&transid={transid}" ); } - /// 3rd party ID for transaction - /// AppID of game this transaction is for + /// (uint64)3rd party ID for transaction + /// (uint32)AppID of game this transaction is for public static string RefundTxn(ulong orderid, uint appid) { - string url = $"{Url}/RefundTxn/v0002/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "orderid", orderid }, + { "appid", appid }, + }; + + return Utility.WebPost( $"{Url}/RefundTxn/v0002/", headers ); } } @@ -666,26 +843,28 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/ISteamNews/"; - /// AppID to retrieve news for - /// Maximum length for the content to return, if this is 0 the full content is returned, if it's less then a blurb is generated to fit. - /// Retrieve posts earlier than this date (unix epoch timestamp) - /// # of posts to retrieve (default 20) - /// Comma-seperated list of feed names to return news for - public static string GetNewsForApp(uint appid, uint maxlength, uint enddate, uint count, string feeds) + /// (uint32)AppID to retrieve news for + /// (uint32)Maximum length for the content to return, if this is 0 the full content is returned, if it's less then a blurb is generated to fit. + /// (uint32)Retrieve posts earlier than this date (unix epoch timestamp) + /// (uint32)# of posts to retrieve (default 20) + /// (string)Comma-seperated list of feed names to return news for + public static string GetNewsForApp(uint appid, uint maxlength, DateTime enddate_dt, uint count, string feeds) { - string url = $"{Url}GetNewsForApp/v0002/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&maxlength={maxlength}&enddate={enddate}&count={count}&feeds={feeds}"; - return Utility.WebGet( url ); + uint enddate = Facepunch.Steamworks.Utility.Epoch.FromDateTime( enddate_dt ); + + return Utility.WebGet( $"{Url}GetNewsForApp/v0002/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&maxlength={maxlength}&enddate={enddate}&count={count}&feeds={feeds}" ); } - /// AppID to retrieve news for - /// Maximum length for the content to return, if this is 0 the full content is returned, if it's less then a blurb is generated to fit. - /// Retrieve posts earlier than this date (unix epoch timestamp) - /// # of posts to retrieve (default 20) - /// Comma-seperated list of feed names to return news for - public static string GetNewsForAppAuthed(uint appid, uint maxlength, uint enddate, uint count, string feeds) + /// (uint32)AppID to retrieve news for + /// (uint32)Maximum length for the content to return, if this is 0 the full content is returned, if it's less then a blurb is generated to fit. + /// (uint32)Retrieve posts earlier than this date (unix epoch timestamp) + /// (uint32)# of posts to retrieve (default 20) + /// (string)Comma-seperated list of feed names to return news for + public static string GetNewsForAppAuthed(uint appid, uint maxlength, DateTime enddate_dt, uint count, string feeds) { - string url = $"{Url}GetNewsForAppAuthed/v0002/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&maxlength={maxlength}&enddate={enddate}&count={count}&feeds={feeds}"; - return Utility.WebGet( url ); + uint enddate = Facepunch.Steamworks.Utility.Epoch.FromDateTime( enddate_dt ); + + return Utility.WebGet( $"{Url}GetNewsForAppAuthed/v0002/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&maxlength={maxlength}&enddate={enddate}&count={count}&feeds={feeds}" ); } } @@ -699,8 +878,11 @@ namespace Facepunch.SteamApi public static string PayPalPaymentsHubPaymentNotification() { - string url = $"{Url}/PayPalPaymentsHubPaymentNotification/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + }; + + return Utility.WebPost( $"{Url}/PayPalPaymentsHubPaymentNotification/v0001/", headers ); } } @@ -712,67 +894,118 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/ISteamPublishedItemSearch/"; - /// SteamID of user - /// appID of product - /// Starting index in the result set (0 based) - /// Number Requested - /// Number of Tags Specified - /// Number of User specific tags requested - /// Whether the user making the request is an admin for the app and can see private files - /// EPublishedFileInfoMatchingFileType, defaults to k_PFI_MatchingFileType_Items - /// Tag to filter result set - /// A user specific tag + /// (uint64)SteamID of user + /// (uint32)appID of product + /// (uint32)Starting index in the result set (0 based) + /// (uint32)Number Requested + /// (uint32)Number of Tags Specified + /// (uint32)Number of User specific tags requested + /// (bool)Whether the user making the request is an admin for the app and can see private files + /// (uint32)EPublishedFileInfoMatchingFileType, defaults to k_PFI_MatchingFileType_Items + /// (string)Tag to filter result set + /// (string)A user specific tag public static string RankedByPublicationOrder(ulong steamid, uint appid, uint startidx, uint count, uint tagcount, uint usertagcount, bool hasappadminaccess, uint fileType, string[] tag, string[] usertag) { - string url = $"{Url}/RankedByPublicationOrder/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "appid", appid }, + { "startidx", startidx }, + { "count", count }, + { "tagcount", tagcount }, + { "usertagcount", usertagcount }, + { "hasappadminaccess", hasappadminaccess }, + { "fileType", fileType }, + { "tag[0]", tag[0] }, + { "usertag[0]", usertag[0] }, + }; + + return Utility.WebPost( $"{Url}/RankedByPublicationOrder/v0001/", headers ); } - /// SteamID of user - /// appID of product - /// Starting index in the result set (0 based) - /// Number Requested - /// Number of Tags Specified - /// Number of User specific tags requested - /// Whether the user making the request is an admin for the app and can see private files - /// EPublishedFileInfoMatchingFileType, defaults to k_PFI_MatchingFileType_Items - /// [1,7] number of days for the trend period, including today - /// Tag to filter result set - /// A user specific tag + /// (uint64)SteamID of user + /// (uint32)appID of product + /// (uint32)Starting index in the result set (0 based) + /// (uint32)Number Requested + /// (uint32)Number of Tags Specified + /// (uint32)Number of User specific tags requested + /// (bool)Whether the user making the request is an admin for the app and can see private files + /// (uint32)EPublishedFileInfoMatchingFileType, defaults to k_PFI_MatchingFileType_Items + /// (uint32)[1,7] number of days for the trend period, including today + /// (string)Tag to filter result set + /// (string)A user specific tag public static string RankedByTrend(ulong steamid, uint appid, uint startidx, uint count, uint tagcount, uint usertagcount, bool hasappadminaccess, uint fileType, uint days, string[] tag, string[] usertag) { - string url = $"{Url}/RankedByTrend/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "appid", appid }, + { "startidx", startidx }, + { "count", count }, + { "tagcount", tagcount }, + { "usertagcount", usertagcount }, + { "hasappadminaccess", hasappadminaccess }, + { "fileType", fileType }, + { "days", days }, + { "tag[0]", tag[0] }, + { "usertag[0]", usertag[0] }, + }; + + return Utility.WebPost( $"{Url}/RankedByTrend/v0001/", headers ); } - /// SteamID of user - /// appID of product - /// Starting index in the result set (0 based) - /// Number Requested - /// Number of Tags Specified - /// Number of User specific tags requested - /// Whether the user making the request is an admin for the app and can see private files - /// EPublishedFileInfoMatchingFileType, defaults to k_PFI_MatchingFileType_Items - /// Tag to filter result set - /// A user specific tag + /// (uint64)SteamID of user + /// (uint32)appID of product + /// (uint32)Starting index in the result set (0 based) + /// (uint32)Number Requested + /// (uint32)Number of Tags Specified + /// (uint32)Number of User specific tags requested + /// (bool)Whether the user making the request is an admin for the app and can see private files + /// (uint32)EPublishedFileInfoMatchingFileType, defaults to k_PFI_MatchingFileType_Items + /// (string)Tag to filter result set + /// (string)A user specific tag public static string RankedByVote(ulong steamid, uint appid, uint startidx, uint count, uint tagcount, uint usertagcount, bool hasappadminaccess, uint fileType, string[] tag, string[] usertag) { - string url = $"{Url}/RankedByVote/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "appid", appid }, + { "startidx", startidx }, + { "count", count }, + { "tagcount", tagcount }, + { "usertagcount", usertagcount }, + { "hasappadminaccess", hasappadminaccess }, + { "fileType", fileType }, + { "tag[0]", tag[0] }, + { "usertag[0]", usertag[0] }, + }; + + return Utility.WebPost( $"{Url}/RankedByVote/v0001/", headers ); } - /// SteamID of user - /// appID relevant to all subsequent tags - /// Number of Tags Specified - /// Number of User specific tags requested - /// Whether the user making the request is an admin for the app and can see private files - /// EPublishedFileInfoMatchingFileType, defaults to k_PFI_MatchingFileType_Items - /// Tag to filter result set - /// A user specific tag + /// (uint64)SteamID of user + /// (uint64)appID relevant to all subsequent tags + /// (uint32)Number of Tags Specified + /// (uint32)Number of User specific tags requested + /// (bool)Whether the user making the request is an admin for the app and can see private files + /// (uint32)EPublishedFileInfoMatchingFileType, defaults to k_PFI_MatchingFileType_Items + /// (string)Tag to filter result set + /// (string)A user specific tag public static string ResultSetSummary(ulong steamid, ulong appid, uint tagcount, uint usertagcount, bool hasappadminaccess, uint fileType, string[] tag, string[] usertag) { - string url = $"{Url}/ResultSetSummary/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "appid", appid }, + { "tagcount", tagcount }, + { "usertagcount", usertagcount }, + { "hasappadminaccess", hasappadminaccess }, + { "fileType", fileType }, + { "tag[0]", tag[0] }, + { "usertag[0]", usertag[0] }, + }; + + return Utility.WebPost( $"{Url}/ResultSetSummary/v0001/", headers ); } } @@ -784,23 +1017,36 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/ISteamPublishedItemVoting/"; - /// Steam ID of user - /// appID of product - /// Count of how many items we are querying - /// The Published File ID who's vote details are required + /// (uint64)Steam ID of user + /// (uint32)appID of product + /// (uint32)Count of how many items we are querying + /// (uint64)The Published File ID who's vote details are required public static string ItemVoteSummary(ulong steamid, uint appid, uint count, ulong[] publishedfileid) { - string url = $"{Url}/ItemVoteSummary/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "appid", appid }, + { "count", count }, + { "publishedfileid[0]", publishedfileid[0] }, + }; + + return Utility.WebPost( $"{Url}/ItemVoteSummary/v0001/", headers ); } - /// Steam ID of user - /// Count of how many items we are querying - /// A Specific Published Item + /// (uint64)Steam ID of user + /// (uint32)Count of how many items we are querying + /// (uint64)A Specific Published Item public static string UserVoteSummary(ulong steamid, uint count, ulong[] publishedfileid) { - string url = $"{Url}/UserVoteSummary/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "count", count }, + { "publishedfileid[0]", publishedfileid[0] }, + }; + + return Utility.WebPost( $"{Url}/UserVoteSummary/v0001/", headers ); } } @@ -812,74 +1058,113 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/ISteamRemoteStorage/"; - /// SteamID of user - /// appID of product + /// (uint64)SteamID of user + /// (uint32)appID of product public static string EnumerateUserPublishedFiles(ulong steamid, uint appid) { - string url = $"{Url}/EnumerateUserPublishedFiles/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "appid", appid }, + }; + + return Utility.WebPost( $"{Url}/EnumerateUserPublishedFiles/v0001/", headers ); } - /// SteamID of user - /// appID of product - /// EUCMListType + /// (uint64)SteamID of user + /// (uint32)appID of product + /// (uint32)EUCMListType public static string EnumerateUserSubscribedFiles(ulong steamid, uint appid, uint listtype) { - string url = $"{Url}/EnumerateUserSubscribedFiles/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "appid", appid }, + { "listtype", listtype }, + }; + + return Utility.WebPost( $"{Url}/EnumerateUserSubscribedFiles/v0001/", headers ); } - /// Number of collections being requested - /// collection ids to get the details for + /// (uint32)Number of collections being requested + /// (uint64)collection ids to get the details for public static string GetCollectionDetails(uint collectioncount, ulong[] publishedfileids) { - string url = $"{Url}/GetCollectionDetails/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "collectioncount", collectioncount }, + { "publishedfileids[0]", publishedfileids[0] }, + }; + + return Utility.WebPost( $"{Url}/GetCollectionDetails/v0001/", headers ); } - /// Number of items being requested - /// published file id to look up + /// (uint32)Number of items being requested + /// (uint64)published file id to look up public static string GetPublishedFileDetails(uint itemcount, ulong[] publishedfileids) { - string url = $"{Url}/GetPublishedFileDetails/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "itemcount", itemcount }, + { "publishedfileids[0]", publishedfileids[0] }, + }; + + return Utility.WebPost( $"{Url}/GetPublishedFileDetails/v0001/", headers ); } - /// If specified, only returns details if the file is owned by the SteamID specified - /// ID of UGC file to get info for - /// appID of product + /// (uint64)If specified, only returns details if the file is owned by the SteamID specified + /// (uint64)ID of UGC file to get info for + /// (uint32)appID of product public static string GetUGCFileDetails(ulong steamid, ulong ugcid, uint appid) { - string url = $"{Url}GetUGCFileDetails/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&ugcid={ugcid}&appid={appid}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetUGCFileDetails/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&ugcid={ugcid}&appid={appid}" ); } - /// SteamID of user - /// ID of UGC file whose bits are being fiddled with - /// appID of product to change updating state for - /// New state of flag + /// (uint64)SteamID of user + /// (uint64)ID of UGC file whose bits are being fiddled with + /// (uint32)appID of product to change updating state for + /// (bool)New state of flag public static string SetUGCUsedByGC(ulong steamid, ulong ugcid, uint appid, bool used) { - string url = $"{Url}/SetUGCUsedByGC/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "ugcid", ugcid }, + { "appid", appid }, + { "used", used }, + }; + + return Utility.WebPost( $"{Url}/SetUGCUsedByGC/v0001/", headers ); } - /// SteamID of user - /// appID of product - /// published file id to subscribe to + /// (uint64)SteamID of user + /// (uint32)appID of product + /// (uint64)published file id to subscribe to public static string SubscribePublishedFile(ulong steamid, uint appid, ulong publishedfileid) { - string url = $"{Url}/SubscribePublishedFile/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "appid", appid }, + { "publishedfileid", publishedfileid }, + }; + + return Utility.WebPost( $"{Url}/SubscribePublishedFile/v0001/", headers ); } - /// SteamID of user - /// appID of product - /// published file id to unsubscribe from + /// (uint64)SteamID of user + /// (uint32)appID of product + /// (uint64)published file id to unsubscribe from public static string UnsubscribePublishedFile(ulong steamid, uint appid, ulong publishedfileid) { - string url = $"{Url}/UnsubscribePublishedFile/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "appid", appid }, + { "publishedfileid", publishedfileid }, + }; + + return Utility.WebPost( $"{Url}/UnsubscribePublishedFile/v0001/", headers ); } } @@ -891,24 +1176,30 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/ISteamSpecialSurvey/"; - /// appid of game - /// ID of the survey being taken - /// SteamID of the user taking the survey - /// Survey identity verification token for the user + /// (uint32)appid of game + /// (uint32)ID of the survey being taken + /// (uint64)SteamID of the user taking the survey + /// (string)Survey identity verification token for the user public static string CheckUserStatus(uint appid, uint surveyid, ulong steamid, string token) { - string url = $"{Url}CheckUserStatus/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&surveyid={surveyid}&steamid={steamid}&token={token}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}CheckUserStatus/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&surveyid={surveyid}&steamid={steamid}&token={token}" ); } - /// appid of game - /// ID of the survey being taken - /// SteamID of the user taking the survey - /// Survey identity verification token for the user + /// (uint32)appid of game + /// (uint32)ID of the survey being taken + /// (uint64)SteamID of the user taking the survey + /// (string)Survey identity verification token for the user public static string SetUserFinished(uint appid, uint surveyid, ulong steamid, string token) { - string url = $"{Url}/SetUserFinished/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "appid", appid }, + { "surveyid", surveyid }, + { "steamid", steamid }, + { "token", token }, + }; + + return Utility.WebPost( $"{Url}/SetUserFinished/v0001/", headers ); } } @@ -920,75 +1211,75 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/ISteamUser/"; - /// SteamID of user - /// AppID to check for ownership + /// (uint64)SteamID of user + /// (uint32)AppID to check for ownership public static string CheckAppOwnership(ulong steamid, uint appid) { - string url = $"{Url}CheckAppOwnership/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&appid={appid}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}CheckAppOwnership/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&appid={appid}" ); } - /// SteamID of user - /// Comma-delimited list of appids (max: 100) + /// (uint64)SteamID of user + /// (string)Comma-delimited list of appids (max: 100) public static string GetAppPriceInfo(ulong steamid, string appids) { - string url = $"{Url}GetAppPriceInfo/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&appids={appids}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetAppPriceInfo/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&appids={appids}" ); } - /// SteamID of user - /// relationship type (ex: friend) + /// (uint64)SteamID of user + /// (string)relationship type (ex: friend) public static string GetFriendList(ulong steamid, string relationship) { - string url = $"{Url}GetFriendList/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&relationship={relationship}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetFriendList/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&relationship={relationship}" ); } - /// Comma-delimited list of SteamIDs + /// (string)Comma-delimited list of SteamIDs public static string GetPlayerBans(string steamids) { - string url = $"{Url}GetPlayerBans/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamids={steamids}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetPlayerBans/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamids={steamids}" ); } - /// Comma-delimited list of SteamIDs (max: 100) + /// (string)Comma-delimited list of SteamIDs (max: 100) public static string GetPlayerSummaries(string steamids) { - string url = $"{Url}GetPlayerSummaries/v0002/?key={Facepunch.SteamApi.Config.Key}&format=json&steamids={steamids}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetPlayerSummaries/v0002/?key={Facepunch.SteamApi.Config.Key}&format=json&steamids={steamids}" ); } - /// SteamID of user + /// (uint64)SteamID of user public static string GetPublisherAppOwnership(ulong steamid) { - string url = $"{Url}GetPublisherAppOwnership/v0002/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetPublisherAppOwnership/v0002/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}" ); } - /// SteamID of user + /// (uint64)SteamID of user public static string GetUserGroupList(ulong steamid) { - string url = $"{Url}GetUserGroupList/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetUserGroupList/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}" ); } - /// SteamID of user - /// PackageID to grant - /// ip address of user in string format (xxx.xxx.xxx.xxx). - /// Optionally associate third party key during grant. 'thirdpartyappid' will have to be set. - /// Has to be set if 'thirdpartykey' is set. The appid associated with the 'thirdpartykey'. + /// (uint64)SteamID of user + /// (uint32)PackageID to grant + /// (string)ip address of user in string format (xxx.xxx.xxx.xxx). + /// (string)Optionally associate third party key during grant. 'thirdpartyappid' will have to be set. + /// (uint32)Has to be set if 'thirdpartykey' is set. The appid associated with the 'thirdpartykey'. public static string GrantPackage(ulong steamid, uint packageid, string ipaddress, string thirdpartykey, uint thirdpartyappid) { - string url = $"{Url}/GrantPackage/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "packageid", packageid }, + { "ipaddress", ipaddress }, + { "thirdpartykey", thirdpartykey }, + { "thirdpartyappid", thirdpartyappid }, + }; + + return Utility.WebPost( $"{Url}/GrantPackage/v0001/", headers ); } - /// The vanity URL to get a SteamID for - /// The type of vanity URL. 1 (default): Individual profile, 2: Group, 3: Official game group + /// (string)The vanity URL to get a SteamID for + /// (int32)The type of vanity URL. 1 (default): Individual profile, 2: Group, 3: Official game group public static string ResolveVanityURL(string vanityurl, int url_type) { - string url = $"{Url}ResolveVanityURL/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&vanityurl={vanityurl}&url_type={url_type}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}ResolveVanityURL/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&vanityurl={vanityurl}&url_type={url_type}" ); } } @@ -1000,21 +1291,26 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/ISteamUserAuth/"; - /// Should be the users steamid, unencrypted. - /// Should be a 32 byte random blob of data, which is then encrypted with RSA using the Steam system's public key. Randomness is important here for security. - /// Should be the users hashed loginkey, AES encrypted with the sessionkey. + /// (uint64)Should be the users steamid, unencrypted. + /// (rawbinary)Should be a 32 byte random blob of data, which is then encrypted with RSA using the Steam system's public key. Randomness is important here for security. + /// (rawbinary)Should be the users hashed loginkey, AES encrypted with the sessionkey. public static string AuthenticateUser(ulong steamid, byte[] sessionkey, byte[] encrypted_loginkey) { - string url = $"{Url}/AuthenticateUser/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "sessionkey", sessionkey }, + { "encrypted_loginkey", encrypted_loginkey }, + }; + + return Utility.WebPost( $"{Url}/AuthenticateUser/v0001/", headers ); } - /// appid of game - /// Ticket from GetAuthSessionTicket. + /// (uint32)appid of game + /// (string)Ticket from GetAuthSessionTicket. public static string AuthenticateUserTicket(uint appid, string ticket) { - string url = $"{Url}AuthenticateUserTicket/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&ticket={ticket}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}AuthenticateUserTicket/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&ticket={ticket}" ); } } @@ -1026,11 +1322,10 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/ISteamUserOAuth/"; - /// OAuth2 token for which to return details + /// (string)OAuth2 token for which to return details public static string GetTokenDetails(string access_token) { - string url = $"{Url}GetTokenDetails/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&access_token={access_token}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetTokenDetails/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&access_token={access_token}" ); } } @@ -1042,65 +1337,70 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/ISteamUserStats/"; - /// GameID to retrieve the achievement percentages for + /// (uint64)GameID to retrieve the achievement percentages for public static string GetGlobalAchievementPercentagesForApp(ulong gameid) { - string url = $"{Url}GetGlobalAchievementPercentagesForApp/v0002/?key={Facepunch.SteamApi.Config.Key}&format=json&gameid={gameid}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetGlobalAchievementPercentagesForApp/v0002/?key={Facepunch.SteamApi.Config.Key}&format=json&gameid={gameid}" ); } - /// AppID that we're getting global stats for - /// Number of stats get data for - /// Names of stat to get data for - /// Start date for daily totals (unix epoch timestamp) - /// End date for daily totals (unix epoch timestamp) - public static string GetGlobalStatsForGame(uint appid, uint count, string[] name, uint startdate, uint enddate) + /// (uint32)AppID that we're getting global stats for + /// (uint32)Number of stats get data for + /// (string)Names of stat to get data for + /// (uint32)Start date for daily totals (unix epoch timestamp) + /// (uint32)End date for daily totals (unix epoch timestamp) + public static string GetGlobalStatsForGame(uint appid, uint count, string[] name, DateTime startdate_dt, DateTime enddate_dt) { - string url = $"{Url}GetGlobalStatsForGame/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&count={count}&name[0]={name[0]}&startdate={startdate}&enddate={enddate}"; - return Utility.WebGet( url ); + uint startdate = Facepunch.Steamworks.Utility.Epoch.FromDateTime( startdate_dt ); + uint enddate = Facepunch.Steamworks.Utility.Epoch.FromDateTime( enddate_dt ); + + return Utility.WebGet( $"{Url}GetGlobalStatsForGame/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&count={count}&name[0]={name[0]}&startdate={startdate}&enddate={enddate}" ); } - /// AppID that we're getting user count for + /// (uint32)AppID that we're getting user count for public static string GetNumberOfCurrentPlayers(uint appid) { - string url = $"{Url}GetNumberOfCurrentPlayers/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetNumberOfCurrentPlayers/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}" ); } - /// SteamID of user - /// AppID to get achievements for - /// Language to return strings for + /// (uint64)SteamID of user + /// (uint32)AppID to get achievements for + /// (string)Language to return strings for public static string GetPlayerAchievements(ulong steamid, uint appid, string l) { - string url = $"{Url}GetPlayerAchievements/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&appid={appid}&l={l}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetPlayerAchievements/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&appid={appid}&l={l}" ); } - /// appid of game - /// localized language to return (english, french, etc.) + /// (uint32)appid of game + /// (string)localized language to return (english, french, etc.) public static string GetSchemaForGame(uint appid, string l) { - string url = $"{Url}GetSchemaForGame/v0002/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&l={l}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetSchemaForGame/v0002/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&l={l}" ); } - /// SteamID of user - /// appid of game + /// (uint64)SteamID of user + /// (uint32)appid of game public static string GetUserStatsForGame(ulong steamid, uint appid) { - string url = $"{Url}GetUserStatsForGame/v0002/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&appid={appid}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetUserStatsForGame/v0002/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&appid={appid}" ); } - /// SteamID of user - /// appid of game - /// Number of stats and achievements to set a value for (name/value param pairs) - /// Name of stat or achievement to set - /// Value to set + /// (uint64)SteamID of user + /// (uint32)appid of game + /// (uint32)Number of stats and achievements to set a value for (name/value param pairs) + /// (string)Name of stat or achievement to set + /// (uint32)Value to set public static string SetUserStatsForGame(ulong steamid, uint appid, uint count, string[] name, uint[] value) { - string url = $"{Url}/SetUserStatsForGame/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "appid", appid }, + { "count", count }, + { "name[0]", name[0] }, + { "value[0]", value[0] }, + }; + + return Utility.WebPost( $"{Url}/SetUserStatsForGame/v0001/", headers ); } } @@ -1112,14 +1412,21 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/ISteamVideo/"; - /// SteamID of user - /// appID of the video - /// ID of the video on the provider's site - /// Account name of the video's owner on the provider's site + /// (uint64)SteamID of user + /// (uint32)appID of the video + /// (string)ID of the video on the provider's site + /// (string)Account name of the video's owner on the provider's site public static string AddVideo(ulong steamid, uint appid, string videoid, string accountname) { - string url = $"{Url}/AddVideo/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "appid", appid }, + { "videoid", videoid }, + { "accountname", accountname }, + }; + + return Utility.WebPost( $"{Url}/AddVideo/v0001/", headers ); } } @@ -1133,14 +1440,12 @@ namespace Facepunch.SteamApi public static string GetServerInfo() { - string url = $"{Url}GetServerInfo/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetServerInfo/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&" ); } public static string GetSupportedAPIList() { - string url = $"{Url}GetSupportedAPIList/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetSupportedAPIList/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&" ); } } @@ -1152,17 +1457,27 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/ISteamWebUserPresenceOAuth/"; - /// Steam ID of the user - /// UMQ Session ID - /// Message that was last known to the user - /// Caller-specific poll id - /// Long-poll timeout in seconds - /// How many seconds is client considering itself idle, e.g. screen is off - /// Boolean, 0 (default): return steamid_from in output, 1: return accountid_from + /// (string)Steam ID of the user + /// (uint64)UMQ Session ID + /// (uint32)Message that was last known to the user + /// (uint32)Caller-specific poll id + /// (uint32)Long-poll timeout in seconds + /// (uint32)How many seconds is client considering itself idle, e.g. screen is off + /// (uint32)Boolean, 0 (default): return steamid_from in output, 1: return accountid_from public static string PollStatus(string steamid, ulong umqid, uint message, uint pollid, uint sectimeout, uint secidletime, uint use_accountids) { - string url = $"{Url}/PollStatus/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "umqid", umqid }, + { "message", message }, + { "pollid", pollid }, + { "sectimeout", sectimeout }, + { "secidletime", secidletime }, + { "use_accountids", use_accountids }, + }; + + return Utility.WebPost( $"{Url}/PollStatus/v0001/", headers ); } } @@ -1174,23 +1489,36 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/ISteamWorkshop/"; - /// AppID of game this transaction is for - /// Number of items to associate - /// the workshop published file id - /// 3rd party ID for item - /// Percentage of revenue the owners of the workshop item will get from the sale of the item [0.0, 100.0]. For bundle-like items, send over an entry for each item in the bundle (gameitemid = bundle id) with different publishedfileids and with the revenue percentage pre-split amongst the items in the bundle (i.e. 30% / 10 items in the bundle) - /// Game's description of the game item + /// (uint32)AppID of game this transaction is for + /// (uint32)Number of items to associate + /// (uint64)the workshop published file id + /// (uint32)3rd party ID for item + /// (float)Percentage of revenue the owners of the workshop item will get from the sale of the item [0.0, 100.0]. For bundle-like items, send over an entry for each item in the bundle (gameitemid = bundle id) with different publishedfileids and with the revenue percentage pre-split amongst the items in the bundle (i.e. 30% / 10 items in the bundle) + /// (string)Game's description of the game item public static string AssociateWorkshopItems(uint appid, uint itemcount, ulong[] publishedfileid, uint[] gameitemid, float[] revenuepercentage, string[] gameitemdescription) { - string url = $"{Url}/AssociateWorkshopItems/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "appid", appid }, + { "itemcount", itemcount }, + { "publishedfileid[0]", publishedfileid[0] }, + { "gameitemid[0]", gameitemid[0] }, + { "revenuepercentage[0]", revenuepercentage[0] }, + { "gameitemdescription[0]", gameitemdescription[0] }, + }; + + return Utility.WebPost( $"{Url}/AssociateWorkshopItems/v0001/", headers ); } - /// AppID of game this transaction is for + /// (uint32)AppID of game this transaction is for public static string GetContributors(uint appid) { - string url = $"{Url}/GetContributors/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "appid", appid }, + }; + + return Utility.WebPost( $"{Url}/GetContributors/v0001/", headers ); } } @@ -1202,77 +1530,96 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/IGameServersService/"; - /// The app to use the account for - /// The memo to set on the new account + /// (uint32)The app to use the account for + /// (string)The memo to set on the new account public static string CreateAccount(uint appid, string memo) { - string url = $"{Url}/CreateAccount/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "appid", appid }, + { "memo", memo }, + }; + + return Utility.WebPost( $"{Url}/CreateAccount/v0001/", headers ); } - /// The SteamID of the game server account to delete + /// (uint64)The SteamID of the game server account to delete public static string DeleteAccount(ulong steamid) { - string url = $"{Url}/DeleteAccount/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + }; + + return Utility.WebPost( $"{Url}/DeleteAccount/v0001/", headers ); } public static string GetAccountList() { - string url = $"{Url}GetAccountList/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetAccountList/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&" ); } - /// The SteamID of the game server to get info on + /// (uint64)The SteamID of the game server to get info on public static string GetAccountPublicInfo(ulong steamid) { - string url = $"{Url}GetAccountPublicInfo/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetAccountPublicInfo/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}" ); } - /// + /// (uint64) public static string GetServerIPsBySteamID(ulong server_steamids) { - string url = $"{Url}GetServerIPsBySteamID/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&server_steamids={server_steamids}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetServerIPsBySteamID/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&server_steamids={server_steamids}" ); } - /// + /// (string) public static string GetServerSteamIDsByIP(string server_ips) { - string url = $"{Url}GetServerSteamIDsByIP/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&server_ips={server_ips}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetServerSteamIDsByIP/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&server_ips={server_ips}" ); } - /// Login token to query + /// (string)Login token to query public static string QueryLoginToken(string login_token) { - string url = $"{Url}QueryLoginToken/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&login_token={login_token}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}QueryLoginToken/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&login_token={login_token}" ); } - /// The SteamID of the game server to reset the login token of + /// (uint64)The SteamID of the game server to reset the login token of public static string ResetLoginToken(ulong steamid) { - string url = $"{Url}/ResetLoginToken/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + }; + + return Utility.WebPost( $"{Url}/ResetLoginToken/v0001/", headers ); } - /// - /// - /// + /// (uint64) + /// (bool) + /// (uint32) public static string SetBanStatus(ulong steamid, bool banned, uint ban_seconds) { - string url = $"{Url}/SetBanStatus/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "banned", banned }, + { "ban_seconds", ban_seconds }, + }; + + return Utility.WebPost( $"{Url}/SetBanStatus/v0001/", headers ); } - /// The SteamID of the game server to set the memo on - /// The memo to set on the new account + /// (uint64)The SteamID of the game server to set the memo on + /// (string)The memo to set on the new account public static string SetMemo(ulong steamid, string memo) { - string url = $"{Url}/SetMemo/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "memo", memo }, + }; + + return Utility.WebPost( $"{Url}/SetMemo/v0001/", headers ); } } @@ -1284,14 +1631,21 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/IBroadcastService/"; - /// - /// - /// - /// + /// (uint32) + /// (uint64) + /// (uint64) + /// (string) public static string PostGameDataFrame(uint appid, ulong steamid, ulong broadcast_id, string frame_data) { - string url = $"{Url}/PostGameDataFrame/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "appid", appid }, + { "steamid", steamid }, + { "broadcast_id", broadcast_id }, + { "frame_data", frame_data }, + }; + + return Utility.WebPost( $"{Url}/PostGameDataFrame/v0001/", headers ); } } @@ -1303,57 +1657,69 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/IPublishedFileService/"; - /// enumeration EPublishedFileQueryType in clientenums.h - /// Current page - /// (Optional) The number of results, per page to return. - /// App that created the files - /// App that consumes the files - /// Tags to match on. See match_all_tags parameter below - /// (Optional) Tags that must NOT be present on a published file to satisfy the query. - /// If true, then items must have all the tags specified, otherwise they must have at least one of the tags. - /// Required flags that must be set on any returned items - /// Flags that must not be set on any returned items - /// Text to match in the item's title or description - /// EPublishedFileInfoMatchingFileType - /// Find all items that reference the given item. - /// If query_type is k_PublishedFileQueryType_RankedByTrend, then this is the number of days to get votes for [1,7]. - /// If query_type is k_PublishedFileQueryType_RankedByTrend, then limit result set just to items that have votes within the day range given - /// Allow stale data to be returned for the specified number of seconds. - /// Language to search in and also what gets returned. Defaults to English. - /// Required key-value tags to match on. - /// (Optional) If true, only return the total number of files that satisfy this query. - /// (Optional) If true, only return the published file ids of files that satisfy this query. - /// Return vote data - /// Return tags in the file details - /// Return key-value tags in the file details - /// Return preview image and video details in the file details - /// Return child item ids in the file details - /// Populate the short_description field instead of file_description - /// Return pricing information, if applicable - /// Populate the metadata + /// (uint32)enumeration EPublishedFileQueryType in clientenums.h + /// (uint32)Current page + /// (uint32)(Optional) The number of results, per page to return. + /// (uint32)App that created the files + /// (uint32)App that consumes the files + /// (string)Tags to match on. See match_all_tags parameter below + /// (string)(Optional) Tags that must NOT be present on a published file to satisfy the query. + /// (bool)If true, then items must have all the tags specified, otherwise they must have at least one of the tags. + /// (string)Required flags that must be set on any returned items + /// (string)Flags that must not be set on any returned items + /// (string)Text to match in the item's title or description + /// (uint32)EPublishedFileInfoMatchingFileType + /// (uint64)Find all items that reference the given item. + /// (uint32)If query_type is k_PublishedFileQueryType_RankedByTrend, then this is the number of days to get votes for [1,7]. + /// (bool)If query_type is k_PublishedFileQueryType_RankedByTrend, then limit result set just to items that have votes within the day range given + /// (uint32)Allow stale data to be returned for the specified number of seconds. + /// (int32)Language to search in and also what gets returned. Defaults to English. + /// ({message})Required key-value tags to match on. + /// (bool)(Optional) If true, only return the total number of files that satisfy this query. + /// (bool)(Optional) If true, only return the published file ids of files that satisfy this query. + /// (bool)Return vote data + /// (bool)Return tags in the file details + /// (bool)Return key-value tags in the file details + /// (bool)Return preview image and video details in the file details + /// (bool)Return child item ids in the file details + /// (bool)Populate the short_description field instead of file_description + /// (bool)Return pricing information, if applicable + /// (bool)Populate the metadata public static string QueryFiles(uint query_type, uint page, uint numperpage, uint creator_appid, uint appid, string requiredtags, string excludedtags, bool match_all_tags, string required_flags, string omitted_flags, string search_text, uint filetype, ulong child_publishedfileid, uint days, bool include_recent_votes_only, uint cache_max_age_seconds, int language, string required_kv_tags, bool totalonly, bool ids_only, bool return_vote_data, bool return_tags, bool return_kv_tags, bool return_previews, bool return_children, bool return_short_description, bool return_for_sale_data, bool return_metadata) { - string url = $"{Url}QueryFiles/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&query_type={query_type}&page={page}&numperpage={numperpage}&creator_appid={creator_appid}&appid={appid}&requiredtags={requiredtags}&excludedtags={excludedtags}&match_all_tags={match_all_tags}&required_flags={required_flags}&omitted_flags={omitted_flags}&search_text={search_text}&filetype={filetype}&child_publishedfileid={child_publishedfileid}&days={days}&include_recent_votes_only={include_recent_votes_only}&cache_max_age_seconds={cache_max_age_seconds}&language={language}&required_kv_tags={required_kv_tags}&totalonly={totalonly}&ids_only={ids_only}&return_vote_data={return_vote_data}&return_tags={return_tags}&return_kv_tags={return_kv_tags}&return_previews={return_previews}&return_children={return_children}&return_short_description={return_short_description}&return_for_sale_data={return_for_sale_data}&return_metadata={return_metadata}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}QueryFiles/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&query_type={query_type}&page={page}&numperpage={numperpage}&creator_appid={creator_appid}&appid={appid}&requiredtags={requiredtags}&excludedtags={excludedtags}&match_all_tags={match_all_tags}&required_flags={required_flags}&omitted_flags={omitted_flags}&search_text={search_text}&filetype={filetype}&child_publishedfileid={child_publishedfileid}&days={days}&include_recent_votes_only={include_recent_votes_only}&cache_max_age_seconds={cache_max_age_seconds}&language={language}&required_kv_tags={required_kv_tags}&totalonly={totalonly}&ids_only={ids_only}&return_vote_data={return_vote_data}&return_tags={return_tags}&return_kv_tags={return_kv_tags}&return_previews={return_previews}&return_children={return_children}&return_short_description={return_short_description}&return_for_sale_data={return_for_sale_data}&return_metadata={return_metadata}" ); } - /// - /// - /// + /// (uint64) + /// (uint32) + /// (string) public static string SetDeveloperMetadata(ulong publishedfileid, uint appid, string metadata) { - string url = $"{Url}/SetDeveloperMetadata/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "publishedfileid", publishedfileid }, + { "appid", appid }, + { "metadata", metadata }, + }; + + return Utility.WebPost( $"{Url}/SetDeveloperMetadata/v0001/", headers ); } - /// - /// - /// - /// + /// (uint64) + /// (uint32) + /// (string) + /// (string) public static string UpdateTags(ulong publishedfileid, uint appid, string add_tags, string remove_tags) { - string url = $"{Url}/UpdateTags/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "publishedfileid", publishedfileid }, + { "appid", appid }, + { "add_tags", add_tags }, + { "remove_tags", remove_tags }, + }; + + return Utility.WebPost( $"{Url}/UpdateTags/v0001/", headers ); } } @@ -1365,76 +1731,90 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/IEconService/"; - /// + /// (uint64) public static string CancelTradeOffer(ulong tradeofferid) { - string url = $"{Url}/CancelTradeOffer/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "tradeofferid", tradeofferid }, + }; + + return Utility.WebPost( $"{Url}/CancelTradeOffer/v0001/", headers ); } - /// + /// (uint64) public static string DeclineTradeOffer(ulong tradeofferid) { - string url = $"{Url}/DeclineTradeOffer/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "tradeofferid", tradeofferid }, + }; + + return Utility.WebPost( $"{Url}/DeclineTradeOffer/v0001/", headers ); } - /// + /// (uint32) public static string FlushAssetAppearanceCache(uint appid) { - string url = $"{Url}/FlushAssetAppearanceCache/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "appid", appid }, + }; + + return Utility.WebPost( $"{Url}/FlushAssetAppearanceCache/v0001/", headers ); } - /// User to clear cache for. - /// App to clear cache for. - /// Context to clear cache for. + /// (uint64)User to clear cache for. + /// (uint32)App to clear cache for. + /// (uint64)Context to clear cache for. public static string FlushInventoryCache(ulong steamid, uint appid, ulong contextid) { - string url = $"{Url}/FlushInventoryCache/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "appid", appid }, + { "contextid", contextid }, + }; + + return Utility.WebPost( $"{Url}/FlushInventoryCache/v0001/", headers ); } - /// The number of trades to return information for - /// The time of the last trade shown on the previous page of results, or the time of the first trade if navigating back - /// The tradeid shown on the previous page of results, or the ID of the first trade if navigating back - /// The user wants the previous page of results, so return the previous max_trades trades before the start time and ID - /// If set, the item display data for the items included in the returned trades will also be returned - /// The language to use when loading item display data - /// - /// If set, the total number of trades the account has participated in will be included in the response + /// (uint32)The number of trades to return information for + /// (uint32)The time of the last trade shown on the previous page of results, or the time of the first trade if navigating back + /// (uint64)The tradeid shown on the previous page of results, or the ID of the first trade if navigating back + /// (bool)The user wants the previous page of results, so return the previous max_trades trades before the start time and ID + /// (bool)If set, the item display data for the items included in the returned trades will also be returned + /// (string)The language to use when loading item display data + /// (bool) + /// (bool)If set, the total number of trades the account has participated in will be included in the response public static string GetTradeHistory(uint max_trades, uint start_after_time, ulong start_after_tradeid, bool navigating_back, bool get_descriptions, string language, bool include_failed, bool include_total) { - string url = $"{Url}GetTradeHistory/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&max_trades={max_trades}&start_after_time={start_after_time}&start_after_tradeid={start_after_tradeid}&navigating_back={navigating_back}&get_descriptions={get_descriptions}&language={language}&include_failed={include_failed}&include_total={include_total}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetTradeHistory/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&max_trades={max_trades}&start_after_time={start_after_time}&start_after_tradeid={start_after_tradeid}&navigating_back={navigating_back}&get_descriptions={get_descriptions}&language={language}&include_failed={include_failed}&include_total={include_total}" ); } - /// - /// + /// (uint64) + /// (string) public static string GetTradeOffer(ulong tradeofferid, string language) { - string url = $"{Url}GetTradeOffer/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&tradeofferid={tradeofferid}&language={language}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetTradeOffer/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&tradeofferid={tradeofferid}&language={language}" ); } - /// Request the list of sent offers. - /// Request the list of received offers. - /// If set, the item display data for the items included in the returned trade offers will also be returned. - /// The language to use when loading item display data. - /// Indicates we should only return offers which are still active, or offers that have changed in state since the time_historical_cutoff - /// Indicates we should only return offers which are not active. - /// When active_only is set, offers updated since this time will also be returned + /// (bool)Request the list of sent offers. + /// (bool)Request the list of received offers. + /// (bool)If set, the item display data for the items included in the returned trade offers will also be returned. + /// (string)The language to use when loading item display data. + /// (bool)Indicates we should only return offers which are still active, or offers that have changed in state since the time_historical_cutoff + /// (bool)Indicates we should only return offers which are not active. + /// (uint32)When active_only is set, offers updated since this time will also be returned public static string GetTradeOffers(bool get_sent_offers, bool get_received_offers, bool get_descriptions, string language, bool active_only, bool historical_only, uint time_historical_cutoff) { - string url = $"{Url}GetTradeOffers/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&get_sent_offers={get_sent_offers}&get_received_offers={get_received_offers}&get_descriptions={get_descriptions}&language={language}&active_only={active_only}&historical_only={historical_only}&time_historical_cutoff={time_historical_cutoff}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetTradeOffers/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&get_sent_offers={get_sent_offers}&get_received_offers={get_received_offers}&get_descriptions={get_descriptions}&language={language}&active_only={active_only}&historical_only={historical_only}&time_historical_cutoff={time_historical_cutoff}" ); } - /// The time the user last visited. If not passed, will use the time the user last visited the trade offer page. + /// (uint32)The time the user last visited. If not passed, will use the time the user last visited the trade offer page. public static string GetTradeOffersSummary(uint time_last_visit) { - string url = $"{Url}GetTradeOffersSummary/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&time_last_visit={time_last_visit}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetTradeOffersSummary/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&time_last_visit={time_last_visit}" ); } } @@ -1446,61 +1826,61 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/IPlayerService/"; - /// The player we're asking about + /// (uint64)The player we're asking about public static string GetBadges(ulong steamid) { - string url = $"{Url}GetBadges/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetBadges/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}" ); } - /// The player we're asking about - /// The badge we're asking about + /// (uint64)The player we're asking about + /// (int32)The badge we're asking about public static string GetCommunityBadgeProgress(ulong steamid, int badgeid) { - string url = $"{Url}GetCommunityBadgeProgress/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&badgeid={badgeid}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetCommunityBadgeProgress/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&badgeid={badgeid}" ); } - /// The player we're asking about - /// true if we want additional details (name, icon) about each game - /// Free games are excluded by default. If this is set, free games the user has played will be returned. - /// if set, restricts result set to the passed in apps + /// (uint64)The player we're asking about + /// (bool)true if we want additional details (name, icon) about each game + /// (bool)Free games are excluded by default. If this is set, free games the user has played will be returned. + /// (uint32)if set, restricts result set to the passed in apps public static string GetOwnedGames(ulong steamid, bool include_appinfo, bool include_played_free_games, uint appids_filter) { - string url = $"{Url}GetOwnedGames/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&include_appinfo={include_appinfo}&include_played_free_games={include_played_free_games}&appids_filter={appids_filter}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetOwnedGames/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&include_appinfo={include_appinfo}&include_played_free_games={include_played_free_games}&appids_filter={appids_filter}" ); } - /// The player we're asking about - /// The number of games to return (0/unset: all) + /// (uint64)The player we're asking about + /// (uint32)The number of games to return (0/unset: all) public static string GetRecentlyPlayedGames(ulong steamid, uint count) { - string url = $"{Url}GetRecentlyPlayedGames/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&count={count}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetRecentlyPlayedGames/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&count={count}" ); } - /// The player we're asking about + /// (uint64)The player we're asking about public static string GetSteamLevel(ulong steamid) { - string url = $"{Url}GetSteamLevel/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetSteamLevel/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}" ); } - /// The player we're asking about - /// The game player is currently playing + /// (uint64)The player we're asking about + /// (uint32)The game player is currently playing public static string IsPlayingSharedGame(ulong steamid, uint appid_playing) { - string url = $"{Url}IsPlayingSharedGame/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&appid_playing={appid_playing}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}IsPlayingSharedGame/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}&appid_playing={appid_playing}" ); } - /// - /// - /// + /// (uint64) + /// (string) + /// ({message}) public static string RecordOfflinePlaytime(ulong steamid, string ticket, string play_sessions) { - string url = $"{Url}/RecordOfflinePlaytime/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "ticket", ticket }, + { "play_sessions", play_sessions }, + }; + + return Utility.WebPost( $"{Url}/RecordOfflinePlaytime/v0001/", headers ); } } @@ -1512,71 +1892,101 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/IGameNotificationsService/"; - /// The appid to create the session for. - /// Game-specified context value the game can used to associate the session with some object on their backend. - /// The title of the session to be displayed within each user's list of sessions. - /// The initial state of all users in the session. - /// (Optional) steamid to make the request on behalf of -- if specified, the user must be in the session and all users being added to the session must be friends with the user. + /// (uint32)The appid to create the session for. + /// (uint64)Game-specified context value the game can used to associate the session with some object on their backend. + /// ({message})The title of the session to be displayed within each user's list of sessions. + /// ({message})The initial state of all users in the session. + /// (uint64)(Optional) steamid to make the request on behalf of -- if specified, the user must be in the session and all users being added to the session must be friends with the user. public static string CreateSession(uint appid, ulong context, string title, string users, ulong steamid) { - string url = $"{Url}/CreateSession/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "appid", appid }, + { "context", context }, + { "title", title }, + { "users", users }, + { "steamid", steamid }, + }; + + return Utility.WebPost( $"{Url}/CreateSession/v0001/", headers ); } - /// The sessionid to delete. - /// The appid of the session to delete. - /// (Optional) steamid to make the request on behalf of -- if specified, the user must be in the session. + /// (uint64)The sessionid to delete. + /// (uint32)The appid of the session to delete. + /// (uint64)(Optional) steamid to make the request on behalf of -- if specified, the user must be in the session. public static string DeleteSession(ulong sessionid, uint appid, ulong steamid) { - string url = $"{Url}/DeleteSession/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "sessionid", sessionid }, + { "appid", appid }, + { "steamid", steamid }, + }; + + return Utility.WebPost( $"{Url}/DeleteSession/v0001/", headers ); } - /// The sessionid to delete. - /// The appid of the session to delete. + /// (uint64)The sessionid to delete. + /// (uint32)The appid of the session to delete. public static string DeleteSessionBatch(ulong sessionid, uint appid) { - string url = $"{Url}/DeleteSessionBatch/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "sessionid", sessionid }, + { "appid", appid }, + }; + + return Utility.WebPost( $"{Url}/DeleteSessionBatch/v0001/", headers ); } - /// The sessionid to request details for. Optional. If not specified, all the user's sessions will be returned. - /// The user whose sessions are to be enumerated. - /// (Optional) Boolean determining whether the message for all users should be included. Defaults to false. - /// (Optional) Boolean determining whether the message for the authenticated user should be included. Defaults to false. - /// (Optional) Language to localize the text in. + /// (uint32)The sessionid to request details for. Optional. If not specified, all the user's sessions will be returned. + /// (uint64)The user whose sessions are to be enumerated. + /// (bool)(Optional) Boolean determining whether the message for all users should be included. Defaults to false. + /// (bool)(Optional) Boolean determining whether the message for the authenticated user should be included. Defaults to false. + /// (string)(Optional) Language to localize the text in. public static string EnumerateSessionsForApp(uint appid, ulong steamid, bool include_all_user_messages, bool include_auth_user_message, string language) { - string url = $"{Url}EnumerateSessionsForApp/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&steamid={steamid}&include_all_user_messages={include_all_user_messages}&include_auth_user_message={include_auth_user_message}&language={language}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}EnumerateSessionsForApp/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&steamid={steamid}&include_all_user_messages={include_all_user_messages}&include_auth_user_message={include_auth_user_message}&language={language}" ); } - /// - /// The appid for the sessions. - /// Language to localize the text in. + /// ({message}) + /// (uint32)The appid for the sessions. + /// (string)Language to localize the text in. public static string GetSessionDetailsForApp(string sessions, uint appid, string language) { - string url = $"{Url}GetSessionDetailsForApp/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&sessions={sessions}&appid={appid}&language={language}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetSessionDetailsForApp/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&sessions={sessions}&appid={appid}&language={language}" ); } - /// The steamid to request notifications for. - /// The appid to request notifications for. + /// (uint64)The steamid to request notifications for. + /// (uint32)The appid to request notifications for. public static string RequestNotifications(ulong steamid, uint appid) { - string url = $"{Url}/RequestNotifications/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "appid", appid }, + }; + + return Utility.WebPost( $"{Url}/RequestNotifications/v0001/", headers ); } - /// The sessionid to update. - /// The appid of the session to update. - /// (Optional) The new title of the session. If not specified, the title will not be changed. - /// (Optional) A list of users whose state will be updated to reflect the given state. If the users are not already in the session, they will be added to it. - /// (Optional) steamid to make the request on behalf of -- if specified, the user must be in the session and all users being added to the session must be friends with the user. + /// (uint64)The sessionid to update. + /// (uint32)The appid of the session to update. + /// ({message})(Optional) The new title of the session. If not specified, the title will not be changed. + /// ({message})(Optional) A list of users whose state will be updated to reflect the given state. If the users are not already in the session, they will be added to it. + /// (uint64)(Optional) steamid to make the request on behalf of -- if specified, the user must be in the session and all users being added to the session must be friends with the user. public static string UpdateSession(ulong sessionid, uint appid, string title, string users, ulong steamid) { - string url = $"{Url}/UpdateSession/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "sessionid", sessionid }, + { "appid", appid }, + { "title", title }, + { "users", users }, + { "steamid", steamid }, + }; + + return Utility.WebPost( $"{Url}/UpdateSession/v0001/", headers ); } } @@ -1588,63 +1998,84 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/IInventoryService/"; - /// - /// - /// - /// - /// Should notify the user that the item was added to their Steam Inventory. + /// (uint32) + /// (uint64) + /// (string) + /// (uint64) + /// (bool)Should notify the user that the item was added to their Steam Inventory. public static string AddItem(uint appid, ulong itemdefid, string itempropsjson, ulong steamid, bool notify) { - string url = $"{Url}/AddItem/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "appid", appid }, + { "itemdefid", itemdefid }, + { "itempropsjson", itempropsjson }, + { "steamid", steamid }, + { "notify", notify }, + }; + + return Utility.WebPost( $"{Url}/AddItem/v0001/", headers ); } - /// - /// - /// - /// - /// Should notify the user that the item was added to their Steam Inventory. + /// (uint32) + /// (uint64) + /// (string) + /// (uint64) + /// (bool)Should notify the user that the item was added to their Steam Inventory. public static string AddPromoItem(uint appid, ulong itemdefid, string itempropsjson, ulong steamid, bool notify) { - string url = $"{Url}/AddPromoItem/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "appid", appid }, + { "itemdefid", itemdefid }, + { "itempropsjson", itempropsjson }, + { "steamid", steamid }, + { "notify", notify }, + }; + + return Utility.WebPost( $"{Url}/AddPromoItem/v0001/", headers ); } - /// - /// - /// - /// - /// + /// (uint32) + /// (uint64) + /// (uint64) + /// (uint32) + /// (uint64) public static string ExchangeItem(uint appid, ulong steamid, ulong materialsitemid, uint materialsquantity, ulong outputitemdefid) { - string url = $"{Url}/ExchangeItem/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "appid", appid }, + { "steamid", steamid }, + { "materialsitemid", materialsitemid }, + { "materialsquantity", materialsquantity }, + { "outputitemdefid", outputitemdefid }, + }; + + return Utility.WebPost( $"{Url}/ExchangeItem/v0001/", headers ); } - /// - /// + /// (uint32) + /// (uint64) public static string GetInventory(uint appid, ulong steamid) { - string url = $"{Url}GetInventory/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&steamid={steamid}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetInventory/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&steamid={steamid}" ); } - /// - /// - /// - /// - /// Allow stale data to be returned for the specified number of seconds. + /// (uint32) + /// (string) + /// (uint64) + /// (uint64) + /// (uint32)Allow stale data to be returned for the specified number of seconds. public static string GetItemDefs(uint appid, string modifiedsince, ulong itemdefids, ulong workshopids, uint cache_max_age_seconds) { - string url = $"{Url}GetItemDefs/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&modifiedsince={modifiedsince}&itemdefids={itemdefids}&workshopids={workshopids}&cache_max_age_seconds={cache_max_age_seconds}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetItemDefs/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&modifiedsince={modifiedsince}&itemdefids={itemdefids}&workshopids={workshopids}&cache_max_age_seconds={cache_max_age_seconds}" ); } - /// + /// (int32) public static string GetPriceSheet(int ecurrency) { - string url = $"{Url}GetPriceSheet/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&ecurrency={ecurrency}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetPriceSheet/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&ecurrency={ecurrency}" ); } } @@ -1656,39 +2087,42 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/IEconMarketService/"; - /// The app making the request - /// The SteamID of the user whose listings should be canceled - /// Whether or not to wait until all listings have been canceled before returning the response + /// (uint32)The app making the request + /// (uint64)The SteamID of the user whose listings should be canceled + /// (bool)Whether or not to wait until all listings have been canceled before returning the response public static string CancelAppListingsForUser(uint appid, ulong steamid, bool synchronous) { - string url = $"{Url}/CancelAppListingsForUser/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "appid", appid }, + { "steamid", steamid }, + { "synchronous", synchronous }, + }; + + return Utility.WebPost( $"{Url}/CancelAppListingsForUser/v0001/", headers ); } - /// The app that's asking. Must match the app of the listing and must belong to the publisher group that owns the API key making the request - /// The identifier of the listing to get information for + /// (uint32)The app that's asking. Must match the app of the listing and must belong to the publisher group that owns the API key making the request + /// (uint64)The identifier of the listing to get information for public static string GetAssetID(uint appid, ulong listingid) { - string url = $"{Url}GetAssetID/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&listingid={listingid}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetAssetID/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&listingid={listingid}" ); } - /// The SteamID of the user to check + /// (uint64)The SteamID of the user to check public static string GetMarketEligibility(ulong steamid) { - string url = $"{Url}GetMarketEligibility/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetMarketEligibility/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&steamid={steamid}" ); } - /// The language to use in item descriptions - /// Number of rows per page - /// The result number to start at - /// If present, the app ID to limit results to - /// If present, prices returned will be represented in this currency + /// (string)The language to use in item descriptions + /// (uint32)Number of rows per page + /// (uint32)The result number to start at + /// (uint32)If present, the app ID to limit results to + /// (uint32)If present, prices returned will be represented in this currency public static string GetPopular(string language, uint rows, uint start, uint filter_appid, uint ecurrency) { - string url = $"{Url}GetPopular/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&language={language}&rows={rows}&start={start}&filter_appid={filter_appid}&ecurrency={ecurrency}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetPopular/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&language={language}&rows={rows}&start={start}&filter_appid={filter_appid}&ecurrency={ecurrency}" ); } } @@ -1702,15 +2136,22 @@ namespace Facepunch.SteamApi public static string CallPublisherKey() { - string url = $"{Url}/CallPublisherKey/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + }; + + return Utility.WebPost( $"{Url}/CallPublisherKey/v0001/", headers ); } - /// + /// (uint32) public static string CallPublisherKeyOwnsApp(uint appid) { - string url = $"{Url}/CallPublisherKeyOwnsApp/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "appid", appid }, + }; + + return Utility.WebPost( $"{Url}/CallPublisherKeyOwnsApp/v0001/", headers ); } } @@ -1722,99 +2163,159 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/ICheatReportingService/"; - /// steamid of the user. - /// The appid the user is playing. - /// session id + /// (uint64)steamid of the user. + /// (uint32)The appid the user is playing. + /// (uint64)session id public static string EndSecureMultiplayerSession(ulong steamid, uint appid, ulong session_id) { - string url = $"{Url}/EndSecureMultiplayerSession/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "appid", appid }, + { "session_id", session_id }, + }; + + return Utility.WebPost( $"{Url}/EndSecureMultiplayerSession/v0001/", headers ); } - /// The appid. - /// The beginning of the time range . - /// The end of the time range. - /// Minimum reportID to include - /// (Optional) Include reports. - /// (Optional) Include ban requests. - /// (Optional) Query just for this steamid. + /// (uint32)The appid. + /// (uint32)The beginning of the time range . + /// (uint32)The end of the time range. + /// (uint64)Minimum reportID to include + /// (bool)(Optional) Include reports. + /// (bool)(Optional) Include ban requests. + /// (uint64)(Optional) Query just for this steamid. public static string GetCheatingReports(uint appid, uint timeend, uint timebegin, ulong reportidmin, bool includereports, bool includebans, ulong steamid) { - string url = $"{Url}GetCheatingReports/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&timeend={timeend}&timebegin={timebegin}&reportidmin={reportidmin}&includereports={includereports}&includebans={includebans}&steamid={steamid}"; - return Utility.WebGet( url ); + return Utility.WebGet( $"{Url}GetCheatingReports/v0001/?key={Facepunch.SteamApi.Config.Key}&format=json&appid={appid}&timeend={timeend}&timebegin={timebegin}&reportidmin={reportidmin}&includereports={includereports}&includebans={includebans}&steamid={steamid}" ); } - /// steamid of the user who is reported as cheating. - /// The appid. + /// (uint64)steamid of the user who is reported as cheating. + /// (uint32)The appid. public static string RemovePlayerGameBan(ulong steamid, uint appid) { - string url = $"{Url}/RemovePlayerGameBan/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "appid", appid }, + }; + + return Utility.WebPost( $"{Url}/RemovePlayerGameBan/v0001/", headers ); } - /// steamid of the user running and reporting the cheat. - /// The appid. - /// path and file name of the cheat executable. - /// web url where the cheat was found and downloaded. - /// local system time now. - /// local system time when cheat process started. ( 0 if not yet run ) - /// local system time when cheat process stopped. ( 0 if still running ) - /// descriptive name for the cheat. - /// process ID of the running game. - /// process ID of the cheat process that ran - /// cheat param 1 - /// cheat param 2 + /// (uint64)steamid of the user running and reporting the cheat. + /// (uint32)The appid. + /// (string)path and file name of the cheat executable. + /// (string)web url where the cheat was found and downloaded. + /// (uint64)local system time now. + /// (uint64)local system time when cheat process started. ( 0 if not yet run ) + /// (uint64)local system time when cheat process stopped. ( 0 if still running ) + /// (string)descriptive name for the cheat. + /// (uint32)process ID of the running game. + /// (uint32)process ID of the cheat process that ran + /// (uint64)cheat param 1 + /// (uint64)cheat param 2 public static string ReportCheatData(ulong steamid, uint appid, string pathandfilename, string webcheaturl, ulong time_now, ulong time_started, ulong time_stopped, string cheatname, uint game_process_id, uint cheat_process_id, ulong cheat_param_1, ulong cheat_param_2) { - string url = $"{Url}/ReportCheatData/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "appid", appid }, + { "pathandfilename", pathandfilename }, + { "webcheaturl", webcheaturl }, + { "time_now", time_now }, + { "time_started", time_started }, + { "time_stopped", time_stopped }, + { "cheatname", cheatname }, + { "game_process_id", game_process_id }, + { "cheat_process_id", cheat_process_id }, + { "cheat_param_1", cheat_param_1 }, + { "cheat_param_2", cheat_param_2 }, + }; + + return Utility.WebPost( $"{Url}/ReportCheatData/v0001/", headers ); } - /// steamid of the user who is reported as cheating. - /// The appid. - /// (Optional) steamid of the user or game server who is reporting the cheating. - /// (Optional) App specific data about the cheating. - /// (Optional) extra information about the source of the cheating - was it a heuristic. - /// (Optional) extra information about the source of the cheating - was it a detection. - /// (Optional) extra information about the source of the cheating - was it a player report. - /// (Optional) dont return report id - /// (Optional) extra information about state of game - was it a specific type of game play (0 = generic) - /// (Optional) extra information indicating how far back the game thinks is interesting for this user - /// (Optional) level of severity of bad action being reported + /// (uint64)steamid of the user who is reported as cheating. + /// (uint32)The appid. + /// (uint64)(Optional) steamid of the user or game server who is reporting the cheating. + /// (uint64)(Optional) App specific data about the cheating. + /// (bool)(Optional) extra information about the source of the cheating - was it a heuristic. + /// (bool)(Optional) extra information about the source of the cheating - was it a detection. + /// (bool)(Optional) extra information about the source of the cheating - was it a player report. + /// (bool)(Optional) dont return report id + /// (uint32)(Optional) extra information about state of game - was it a specific type of game play (0 = generic) + /// (uint32)(Optional) extra information indicating how far back the game thinks is interesting for this user + /// (uint32)(Optional) level of severity of bad action being reported public static string ReportPlayerCheating(ulong steamid, uint appid, ulong steamidreporter, ulong appdata, bool heuristic, bool detection, bool playerreport, bool noreportid, uint gamemode, uint suspicionstarttime, uint severity) { - string url = $"{Url}/ReportPlayerCheating/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "appid", appid }, + { "steamidreporter", steamidreporter }, + { "appdata", appdata }, + { "heuristic", heuristic }, + { "detection", detection }, + { "playerreport", playerreport }, + { "noreportid", noreportid }, + { "gamemode", gamemode }, + { "suspicionstarttime", suspicionstarttime }, + { "severity", severity }, + }; + + return Utility.WebPost( $"{Url}/ReportPlayerCheating/v0001/", headers ); } - /// steamid of the user who is reported as cheating. - /// The appid. - /// The reportid originally used to report cheating. - /// Text describing cheating infraction. - /// Ban duration requested in seconds. - /// Delay the ban according to default ban delay rules. - /// Additional information about the ban request. + /// (uint64)steamid of the user who is reported as cheating. + /// (uint32)The appid. + /// (uint64)The reportid originally used to report cheating. + /// (string)Text describing cheating infraction. + /// (uint32)Ban duration requested in seconds. + /// (bool)Delay the ban according to default ban delay rules. + /// (uint32)Additional information about the ban request. public static string RequestPlayerGameBan(ulong steamid, uint appid, ulong reportid, string cheatdescription, uint duration, bool delayban, uint flags) { - string url = $"{Url}/RequestPlayerGameBan/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "appid", appid }, + { "reportid", reportid }, + { "cheatdescription", cheatdescription }, + { "duration", duration }, + { "delayban", delayban }, + { "flags", flags }, + }; + + return Utility.WebPost( $"{Url}/RequestPlayerGameBan/v0001/", headers ); } - /// steamid of the user. - /// The appid the user is playing. - /// session id + /// (uint64)steamid of the user. + /// (uint32)The appid the user is playing. + /// (uint64)session id public static string RequestVacStatusForUser(ulong steamid, uint appid, ulong session_id) { - string url = $"{Url}/RequestVacStatusForUser/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "appid", appid }, + { "session_id", session_id }, + }; + + return Utility.WebPost( $"{Url}/RequestVacStatusForUser/v0001/", headers ); } - /// steamid of the user. - /// The appid the user is playing. + /// (uint64)steamid of the user. + /// (uint32)The appid the user is playing. public static string StartSecureMultiplayerSession(ulong steamid, uint appid) { - string url = $"{Url}/StartSecureMultiplayerSession/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "steamid", steamid }, + { "appid", appid }, + }; + + return Utility.WebPost( $"{Url}/StartSecureMultiplayerSession/v0001/", headers ); } } @@ -1826,21 +2327,32 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/IAccountRecoveryService/"; - /// - /// - /// - /// + /// (string) + /// (string) + /// (string) + /// (string) public static string ReportAccountRecoveryData(string loginuser_list, string install_config, string shasentryfile, string machineid) { - string url = $"{Url}/ReportAccountRecoveryData/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "loginuser_list", loginuser_list }, + { "install_config", install_config }, + { "shasentryfile", shasentryfile }, + { "machineid", machineid }, + }; + + return Utility.WebPost( $"{Url}/ReportAccountRecoveryData/v0001/", headers ); } - /// + /// (string) public static string RetrieveAccountRecoveryData(string requesthandle) { - string url = $"{Url}/RetrieveAccountRecoveryData/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "requesthandle", requesthandle }, + }; + + return Utility.WebPost( $"{Url}/RetrieveAccountRecoveryData/v0001/", headers ); } } @@ -1852,42 +2364,71 @@ namespace Facepunch.SteamApi { private const string Url = "http://api.steampowered.com/IWorkshopService/"; - /// - /// + /// (uint32) + /// (uint32) public static string GetFinalizedContributors(uint appid, uint gameitemid) { - string url = $"{Url}/GetFinalizedContributors/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "appid", appid }, + { "gameitemid", gameitemid }, + }; + + return Utility.WebPost( $"{Url}/GetFinalizedContributors/v0001/", headers ); } - /// - /// - /// - /// - public static string GetItemDailyRevenue(uint appid, uint item_id, uint date_start, uint date_end) + /// (uint32) + /// (uint32) + /// (uint32) + /// (uint32) + public static GetItemDailyRevenueResponse GetItemDailyRevenue(uint appid, uint item_id, DateTime date_start_dt, DateTime date_end_dt) { - string url = $"{Url}/GetItemDailyRevenue/v0001/"; - return url; + uint date_start = Facepunch.Steamworks.Utility.Epoch.FromDateTime( date_start_dt ); + uint date_end = Facepunch.Steamworks.Utility.Epoch.FromDateTime( date_end_dt ); + + var headers = new System.Collections.Generic.Dictionary() + { + { "appid", appid }, + { "item_id", item_id }, + { "date_start", date_start }, + { "date_end", date_end }, + }; + + return Utility.WebPost( $"{Url}/GetItemDailyRevenue/v0001/", headers ); } - /// - /// + /// (uint32) + /// ({message}) public static string PopulateItemDescriptions(uint appid, string languages) { - string url = $"{Url}/PopulateItemDescriptions/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "appid", appid }, + { "languages", languages }, + }; + + return Utility.WebPost( $"{Url}/PopulateItemDescriptions/v0001/", headers ); } - /// - /// - /// - /// - /// Only validates the rules and does not persist them. - /// + /// (uint32) + /// (uint32) + /// ({message}) + /// ({message}) + /// (bool)Only validates the rules and does not persist them. + /// (bool) public static string SetItemPaymentRules(uint appid, uint gameitemid, string associated_workshop_files, string partner_accounts, bool validate_only, bool make_workshop_files_subscribable) { - string url = $"{Url}/SetItemPaymentRules/v0001/"; - return url; + var headers = new System.Collections.Generic.Dictionary() + { + { "appid", appid }, + { "gameitemid", gameitemid }, + { "associated_workshop_files", associated_workshop_files }, + { "partner_accounts", partner_accounts }, + { "validate_only", validate_only }, + { "make_workshop_files_subscribable", make_workshop_files_subscribable }, + }; + + return Utility.WebPost( $"{Url}/SetItemPaymentRules/v0001/", headers ); } } diff --git a/Facepunch.Steamworks/Utility.cs b/Facepunch.Steamworks/Utility.cs index 0e4593b..e3cf995 100644 --- a/Facepunch.Steamworks/Utility.cs +++ b/Facepunch.Steamworks/Utility.cs @@ -38,6 +38,14 @@ namespace Facepunch.Steamworks return epoch.AddSeconds( (long)unixTime ); } + /// + /// Convert a DateTime to a unix time + /// + public static uint FromDateTime( DateTime dt ) + { + return (uint)( dt.Subtract( epoch ).TotalSeconds ); + } + } } }