Improved handling for empty parameters.
This commit is contained in:
parent
e89704bd97
commit
3ca8090202
@ -16,19 +16,19 @@ namespace SteamStorefrontAPI
|
|||||||
|
|
||||||
public static async Task<SteamApp> GetAsync(int AppId)
|
public static async Task<SteamApp> GetAsync(int AppId)
|
||||||
{
|
{
|
||||||
return await GetAsync(AppId, null, null);
|
return await GetAsync(AppId, "", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<SteamApp> GetAsync(int AppId, string CountryCode)
|
public static async Task<SteamApp> GetAsync(int AppId, string CountryCode)
|
||||||
{
|
{
|
||||||
return await GetAsync(AppId, CountryCode, null);
|
return await GetAsync(AppId, CountryCode, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<SteamApp> GetAsync(int AppId, string CountryCode, string Language)
|
public static async Task<SteamApp> GetAsync(int AppId, string CountryCode, string Language)
|
||||||
{
|
{
|
||||||
string steamUri = $"{steamBaseUri}?appids={AppId}";
|
string steamUri = $"{steamBaseUri}?appids={AppId}";
|
||||||
steamUri = CountryCode is null ? steamUri : $"{steamUri}&cc={CountryCode}";
|
steamUri = string.IsNullOrWhiteSpace(CountryCode) ? steamUri : $"{steamUri}&cc={CountryCode}";
|
||||||
steamUri = Language is null ? steamUri : $"{steamUri}&l={Language}";
|
steamUri = string.IsNullOrWhiteSpace(Language) ? steamUri : $"{steamUri}&l={Language}";
|
||||||
|
|
||||||
var response = await client.GetAsync(steamUri);
|
var response = await client.GetAsync(steamUri);
|
||||||
if (!response.IsSuccessStatusCode) { return null; }
|
if (!response.IsSuccessStatusCode) { return null; }
|
||||||
|
@ -28,8 +28,8 @@ namespace SteamStorefrontAPI
|
|||||||
public static async Task<FeaturedApps> GetAsync(string CountryCode, string Language)
|
public static async Task<FeaturedApps> GetAsync(string CountryCode, string Language)
|
||||||
{
|
{
|
||||||
string steamUri = steamBaseUri;
|
string steamUri = steamBaseUri;
|
||||||
steamUri = CountryCode is null ? steamUri : $"{steamUri}&cc={CountryCode}";
|
steamUri = string.IsNullOrWhiteSpace(CountryCode) ? steamUri : $"{steamUri}&cc={CountryCode}";
|
||||||
steamUri = Language is null ? steamUri : $"{steamUri}&l={Language}";
|
steamUri = string.IsNullOrWhiteSpace(Language) ? steamUri : $"{steamUri}&l={Language}";
|
||||||
|
|
||||||
var response = await client.GetAsync(steamUri);
|
var response = await client.GetAsync(steamUri);
|
||||||
if (!response.IsSuccessStatusCode) { return null; }
|
if (!response.IsSuccessStatusCode) { return null; }
|
||||||
|
@ -27,8 +27,8 @@ namespace SteamStorefrontAPI
|
|||||||
public static async Task<List<FeaturedCategory>> GetAsync(string CountryCode, string Language)
|
public static async Task<List<FeaturedCategory>> GetAsync(string CountryCode, string Language)
|
||||||
{
|
{
|
||||||
string steamUri = steamBaseUri;
|
string steamUri = steamBaseUri;
|
||||||
steamUri = CountryCode is null ? steamUri : $"{steamUri}&cc={CountryCode}";
|
steamUri = string.IsNullOrWhiteSpace(CountryCode) ? steamUri : $"{steamUri}&cc={CountryCode}";
|
||||||
steamUri = Language is null ? steamUri : $"{steamUri}&l={Language}";
|
steamUri = string.IsNullOrWhiteSpace(Language) ? steamUri : $"{steamUri}&l={Language}";
|
||||||
|
|
||||||
var response = await client.GetAsync(steamUri);
|
var response = await client.GetAsync(steamUri);
|
||||||
if (!response.IsSuccessStatusCode) { return null; }
|
if (!response.IsSuccessStatusCode) { return null; }
|
||||||
|
@ -27,8 +27,8 @@ namespace SteamStorefrontAPI
|
|||||||
public static async Task<PackageInfo> GetAsync(int PackageId, string CountryCode, string Language)
|
public static async Task<PackageInfo> GetAsync(int PackageId, string CountryCode, string Language)
|
||||||
{
|
{
|
||||||
string steamUri = $"{steamBaseUri}?packageids={PackageId}";
|
string steamUri = $"{steamBaseUri}?packageids={PackageId}";
|
||||||
steamUri = CountryCode is null ? steamUri : $"{steamUri}&cc={CountryCode}";
|
steamUri = string.IsNullOrWhiteSpace(CountryCode) ? steamUri : $"{steamUri}&cc={CountryCode}";
|
||||||
steamUri = Language is null ? steamUri : $"{steamUri}&l={Language}";
|
steamUri = string.IsNullOrWhiteSpace(Language) ? steamUri : $"{steamUri}&l={Language}";
|
||||||
|
|
||||||
var response = await client.GetAsync(steamUri);
|
var response = await client.GetAsync(steamUri);
|
||||||
if (!response.IsSuccessStatusCode) { return null; }
|
if (!response.IsSuccessStatusCode) { return null; }
|
||||||
|
Loading…
Reference in New Issue
Block a user