Skip to content

Commit 08db082

Browse files
author
babelshift
committed
Add method to get UGC file details (useful to retrieve DOTA 2 league team logos)
1 parent 84a6c7b commit 08db082

4 files changed

Lines changed: 61 additions & 0 deletions

File tree

SteamWebAPI2/Interfaces/DOTA2Match.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public async Task<IReadOnlyCollection<LiveLeagueGame>> GetLiveLeagueGamesAsync(i
2727
AddToParametersIfHasValue(matchId, "match_id", parameters);
2828

2929
var liveLeagueGames = await CallMethodAsync<LiveLeagueGameResultContainer>("GetLiveLeagueGames", 1, parameters);
30+
3031
return new ReadOnlyCollection<LiveLeagueGame>(liveLeagueGames.Result.Games);
3132
}
3233

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using SteamWebAPI2.Models;
2+
using SteamWebAPI2.Utilities;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Diagnostics;
6+
using System.Threading.Tasks;
7+
8+
namespace SteamWebAPI2.Interfaces
9+
{
10+
public class SteamRemoteStorage : SteamWebInterface
11+
{
12+
public SteamRemoteStorage(string steamWebApiKey)
13+
: base(steamWebApiKey, "ISteamRemoteStorage")
14+
{
15+
}
16+
17+
public async Task<UGCFileDetails> GetUGCFileDetailsAsync(long ugcId, int appId, long? steamId = null)
18+
{
19+
Debug.Assert(appId > 0);
20+
21+
if(ugcId <= 0)
22+
{
23+
return null;
24+
}
25+
26+
List<SteamWebRequestParameter> parameters = new List<SteamWebRequestParameter>();
27+
28+
AddToParametersIfHasValue(ugcId, "ugcid", parameters);
29+
AddToParametersIfHasValue(appId, "appid", parameters);
30+
AddToParametersIfHasValue(steamId, "steamid", parameters);
31+
32+
var ugcFileDetails = await CallMethodAsync<UGCFileDetailsResultContainer>("GetUGCFileDetails", 1, parameters);
33+
return ugcFileDetails.Result;
34+
}
35+
}
36+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using Newtonsoft.Json;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace SteamWebAPI2.Models
9+
{
10+
public class UGCFileDetailsResultContainer
11+
{
12+
[JsonProperty("data")]
13+
public UGCFileDetails Result { get; set; }
14+
}
15+
16+
public class UGCFileDetails
17+
{
18+
public string FileName { get; set; }
19+
public string URL { get; set; }
20+
public int Size { get; set; }
21+
}
22+
}

SteamWebAPI2/SteamWebAPI2.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
<Compile Include="Interfaces\PlayerService.cs" />
6464
<Compile Include="Interfaces\SteamEconomy.cs" />
6565
<Compile Include="Interfaces\SteamApps.cs" />
66+
<Compile Include="Interfaces\SteamRemoteStorage.cs" />
6667
<Compile Include="Interfaces\SteamNews.cs" />
6768
<Compile Include="Interfaces\SteamUser.cs" />
6869
<Compile Include="Interfaces\SteamUserStats.cs" />
@@ -114,6 +115,7 @@
114115
<Compile Include="Models\SteamPlayer\RecentlyPlayedGameResultContainer.cs" />
115116
<Compile Include="Models\SteamServerInfo.cs" />
116117
<Compile Include="Models\TF2\GoldenWrenchResultContainer.cs" />
118+
<Compile Include="Models\UGCFileDetailsResultContainer.cs" />
117119
<Compile Include="Models\UserStatsForGameResultContainer.cs" />
118120
<Compile Include="Properties\AssemblyInfo.cs" />
119121
<Compile Include="SteamWebInterface.cs" />

0 commit comments

Comments
 (0)