Skip to content

Commit a37fe90

Browse files
author
babelshift
committed
Add wrappers for GetGoldenWrenches method.
1 parent 50750e2 commit a37fe90

4 files changed

Lines changed: 64 additions & 1 deletion

File tree

SteamWebAPI2.Models/SteamWebAPI2.Models.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
<Compile Include="SteamInterface.cs" />
9494
<Compile Include="SteamNewsResultContainer.cs" />
9595
<Compile Include="SteamServerInfo.cs" />
96+
<Compile Include="TF2\GoldenWrenchResultContainer.cs" />
9697
<Compile Include="UserAchievements.cs" />
9798
<Compile Include="UserBanStatus.cs" />
9899
<Compile Include="UserGroupListResultContainer.cs" />
@@ -110,7 +111,6 @@
110111
</ItemGroup>
111112
<ItemGroup>
112113
<Folder Include="SteamCommunity\" />
113-
<Folder Include="TF2\" />
114114
</ItemGroup>
115115
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
116116
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Generated by Xamasoft JSON Class Generator
2+
// http://www.xamasoft.com/json-class-generator
3+
4+
using Newtonsoft.Json;
5+
using SteamWebAPI2.Models.Utilities;
6+
using System;
7+
using System.Collections.Generic;
8+
9+
namespace SteamWebAPI2.Models
10+
{
11+
public class GoldenWrench
12+
{
13+
[JsonProperty("steamID")]
14+
public object SteamId { get; set; }
15+
16+
[JsonConverter(typeof(UnixTimeJsonConverter))]
17+
[JsonProperty("timestamp")]
18+
public DateTime Timestamp { get; set; }
19+
20+
[JsonProperty("itemID")]
21+
public int ItemId { get; set; }
22+
23+
[JsonProperty("wrenchNumber")]
24+
public int WrenchNumber { get; set; }
25+
}
26+
27+
public class GoldenWrenchResult
28+
{
29+
[JsonProperty("wrenches")]
30+
public IList<GoldenWrench> GoldenWrenches { get; set; }
31+
}
32+
33+
public class GoldenWrenchResultContainer
34+
{
35+
[JsonProperty("results")]
36+
public GoldenWrenchResult Result { get; set; }
37+
}
38+
}

SteamWebAPI2/SteamWebAPI2.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
<Compile Include="SteamWebInterface.cs" />
6363
<Compile Include="SteamWebRequest.cs" />
6464
<Compile Include="SteamWebRequestParameter.cs" />
65+
<Compile Include="TFItems.cs" />
6566
<Compile Include="Utilities\SteamIdExtensions.cs" />
6667
</ItemGroup>
6768
<ItemGroup>

SteamWebAPI2/TFItems.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using SteamWebAPI2.Models;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Collections.ObjectModel;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
9+
namespace SteamWebAPI2
10+
{
11+
public class TFItems : SteamWebInterface
12+
{
13+
public TFItems(string steamWebApiKey)
14+
: base(steamWebApiKey, "ITFItems_440")
15+
{
16+
}
17+
18+
public async Task<IReadOnlyCollection<GoldenWrench>> GetGoldenWrenchesAsync()
19+
{
20+
var goldenWrenchesResult = await CallMethodAsync<GoldenWrenchResultContainer>("GetGoldenWrenches", 2);
21+
return new ReadOnlyCollection<GoldenWrench>(goldenWrenchesResult.Result.GoldenWrenches);
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)