Skip to content

Commit

Permalink
Add UnlockTime to PlayerAchievement (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jcw87 authored Jul 28, 2021
1 parent 9d725ab commit fd60bb7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/Steam.Models/SteamPlayer/PlayerAchievementModel.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
namespace Steam.Models.SteamPlayer
using System;

namespace Steam.Models.SteamPlayer
{
public class PlayerAchievementModel
{
public string APIName { get; set; }

public uint Achieved { get; set; }

public DateTime UnlockTime { get; set; }

public string Name { get; set; }

public string Description { get; set; }
Expand Down
4 changes: 3 additions & 1 deletion src/SteamWebAPI2/Mappings/SteamUserStatsProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using SteamWebAPI2.Models;
using SteamWebAPI2.Models.SteamCommunity;
using SteamWebAPI2.Models.SteamPlayer;
using SteamWebAPI2.Utilities;

namespace SteamWebAPI2.Mappings
{
Expand All @@ -29,7 +30,8 @@ public SteamUserStatsProfile()
src.Result != null ? src.Result.PlayerCount : default(uint)
);

CreateMap<PlayerAchievement, PlayerAchievementModel>();
CreateMap<PlayerAchievement, PlayerAchievementModel>()
.ForMember(dest => dest.UnlockTime, opts => opts.MapFrom(source => source.UnlockTime.ToDateTime()));
CreateMap<PlayerAchievementResult, PlayerAchievementResultModel>();
CreateMap<PlayerAchievementResultContainer, PlayerAchievementResultModel>().ConvertUsing((src, dest, context) =>
context.Mapper.Map<PlayerAchievementResult, PlayerAchievementResultModel>(src.Result)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ internal class PlayerAchievement
[JsonProperty("achieved")]
public uint Achieved { get; set; }

[JsonProperty("unlocktime")]
public ulong UnlockTime { get; set; }

public string Name { get; set; }
public string Description { get; set; }
}
Expand Down

0 comments on commit fd60bb7

Please sign in to comment.