Improved parameter handling.

This commit is contained in:
mmuffins 2018-05-29 23:12:11 +02:00
parent 9067176dfa
commit 26dc983c14
9 changed files with 70 additions and 23 deletions

View File

@ -15,6 +15,11 @@ namespace SteamStorefrontAPI.Classes
public long Total { get; set; }
[JsonProperty("highlighted")]
public List<Highlighted> Highlighted { get; set; }
public List<Highlighted> Highlighted { get; }
public Achievements()
{
this.Highlighted = new List<Highlighted>();
}
}
}

View File

@ -21,10 +21,15 @@ namespace SteamStorefrontAPI.Classes
public string Thumbnail { get; set; }
[JsonProperty("webm")]
public Dictionary<string, string> Webm { get; set; }
public Dictionary<string, string> Webm { get; }
[JsonProperty("highlight")]
public bool Highlight { get; set; }
public Movie()
{
this.Webm = new Dictionary<string, string>();
}
}
}

View File

@ -34,6 +34,11 @@ namespace SteamStorefrontAPI.Classes
public string IsRecurringSubscription { get; set; }
[JsonProperty("subs")]
public List<Sub> Subs { get; set; }
public List<Sub> Subs { get; }
public PackageGroup()
{
this.Subs = new List<Sub>();
}
}
}

View File

@ -61,34 +61,34 @@ namespace SteamStorefrontAPI.Classes
public string LegalNotice { get; set; }
[JsonProperty("developers")]
public List<string> Developers { get; set; }
public List<string> Developers { get; }
[JsonProperty("publishers")]
public List<string> Publishers { get; set; }
public List<string> Publishers { get; }
[JsonProperty("price_overview")]
public PriceOverview PriceOverview { get; set; }
[JsonProperty("packages")]
public List<long> Packages { get; set; }
public List<long> Packages { get; }
[JsonProperty("package_groups")]
public List<PackageGroup> PackageGroups { get; set; }
public List<PackageGroup> PackageGroups { get; }
[JsonProperty("platforms")]
public Platforms Platforms { get; set; }
[JsonProperty("categories")]
public List<Category> Categories { get; set; }
public List<Category> Categories { get; }
[JsonProperty("genres")]
public List<Genre> Genres { get; set; }
public List<Genre> Genres { get; }
[JsonProperty("screenshots")]
public List<Screenshot> Screenshots { get; set; }
public List<Screenshot> Screenshots { get; }
[JsonProperty("movies")]
public List<Movie> Movies { get; set; }
public List<Movie> Movies { get; }
[JsonProperty("recommendations")]
public Recommendations Recommendations { get; set; }
@ -110,11 +110,24 @@ namespace SteamStorefrontAPI.Classes
public ControllerSupport? ControllerSupport { get; set; }
[JsonProperty("dlc")]
public List<int> DLC { get; set; }
public List<int> DLC { get; }
[JsonProperty("reviews")]
public string Reviews { get; set; }
public SteamApp()
{
this.Developers = new List<string>();
this.Publishers = new List<string>();
this.Packages = new List<long>();
this.PackageGroups = new List<PackageGroup>();
this.Categories = new List<Category>();
this.Genres = new List<Genre>();
this.Screenshots = new List<Screenshot>();
this.Movies = new List<Movie>();
this.DLC = new List<int>();
}
public static SteamApp FromJson(string json) {
var serializerSettings = new JsonSerializerSettings

View File

@ -12,16 +12,16 @@ namespace SteamStorefrontAPI.Classes
public class FeaturedApps
{
[JsonProperty("large_capsules")]
public List<AppInfo> LargeCapsules { get; set; }
public List<AppInfo> LargeCapsules { get; }
[JsonProperty("featured_win")]
public List<AppInfo> FeaturedWin { get; set; }
public List<AppInfo> FeaturedWin { get; }
[JsonProperty("featured_mac")]
public List<AppInfo> FeaturedMac { get; set; }
public List<AppInfo> FeaturedMac { get; }
[JsonProperty("featured_linux")]
public List<AppInfo> FeaturedLinux { get; set; }
public List<AppInfo> FeaturedLinux { get; }
[JsonProperty("layout")]
public string Layout { get; set; }
@ -29,6 +29,14 @@ namespace SteamStorefrontAPI.Classes
//[JsonProperty("status")]
//public int Status { get; set; }
public FeaturedApps()
{
this.LargeCapsules = new List<AppInfo>();
this.FeaturedWin = new List<AppInfo>();
this.FeaturedMac = new List<AppInfo>();
this.FeaturedLinux = new List<AppInfo>();
}
public static FeaturedApps FromJson(string json)
{

View File

@ -18,7 +18,7 @@ namespace SteamStorefrontAPI.Classes
public string Name { get; set; }
[JsonProperty("items")]
public List<AppInfo> Items { get; set; }
public List<AppInfo> Items { get; }
[JsonProperty("header_image")]
public string HeaderImage { get; set; }
@ -29,6 +29,11 @@ namespace SteamStorefrontAPI.Classes
[JsonProperty("url")]
public string Url { get; set; }
public FeaturedCategory()
{
this.Items = new List<AppInfo>();
}
public static FeaturedCategory FromJson(string json)
{
var serializerSettings = new JsonSerializerSettings

View File

@ -24,7 +24,7 @@ namespace SteamStorefrontAPI.Classes
public string SmallLogo { get; set; }
[JsonProperty("apps")]
public List<PackageApp> Apps { get; set; }
public List<PackageApp> Apps { get; }
[JsonProperty("price")]
public PriceOverview Price { get; set; }
@ -38,6 +38,12 @@ namespace SteamStorefrontAPI.Classes
[JsonProperty("release_date")]
public ReleaseDate ReleaseDate { get; set; }
public PackageInfo()
{
this.Apps = new List<PackageApp>();
}
public static SteamApp FromJson(string json)
{

View File

@ -18,7 +18,7 @@ namespace SteamStorefrontAPI
/// <summary>
/// Retrieves a list of featured items, grouped by category, via an asynchronous operation.</summary>
public static async Task<List<FeaturedCategory>> GetAsync()
public static async Task<IEnumerable<FeaturedCategory>> GetAsync()
{
return await GetAsync(null, null);
}
@ -26,7 +26,7 @@ namespace SteamStorefrontAPI
/// <summary>
/// Retrieves a list of featured items, grouped by category, via an asynchronous operation.</summary>
/// <param name="CountryCode">Two letter country code to customise currency and date values.</param>
public static async Task<List<FeaturedCategory>> GetAsync(string CountryCode)
public static async Task<IEnumerable<FeaturedCategory>> GetAsync(string CountryCode)
{
return await GetAsync(CountryCode, null);
}
@ -35,7 +35,7 @@ namespace SteamStorefrontAPI
/// Retrieves a list of featured items, grouped by category, via an asynchronous operation.</summary>
/// <param name="CountryCode">Two letter country code to customise currency and date values.</param>
/// <param name="Language">Full name of the language in english used for string localization e.g. name, description.</param>
public static async Task<List<FeaturedCategory>> GetAsync(string CountryCode, string Language)
public static async Task<IEnumerable<FeaturedCategory>> GetAsync(string CountryCode, string Language)
{
string steamUri = steamBaseUri;
steamUri = string.IsNullOrWhiteSpace(CountryCode) ? steamUri : $"{steamUri}?cc={CountryCode}";

View File

@ -43,10 +43,10 @@ namespace SteamStorefrontConsole
FeaturedApps featured3 = await Featured.GetAsync("DE", "english");
// Get a list of featured games grouped by category
List<FeaturedCategory> featuredCategories = await FeaturedCategories.GetAsync();
List<FeaturedCategory> featuredCategories = (await FeaturedCategories.GetAsync()).ToList();
// Get a list of featured games grouped by category for region US
List<FeaturedCategory> featuredCategories2 = await FeaturedCategories.GetAsync("DE");
List<FeaturedCategory> featuredCategories2 = (await FeaturedCategories.GetAsync("DE")).ToList();
}
}
}