add toolkit method for API data (#532)

This commit is contained in:
Jesse Plamondon-Willard 2018-07-01 12:23:03 -04:00
parent c12777ad53
commit 34c43f9f66
1 changed files with 12 additions and 0 deletions

View File

@ -1,3 +1,4 @@
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
@ -73,5 +74,16 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi
this.Name = this.Name ?? db.DisplayName;
}
}
/// <summary>Get update keys based on the metadata.</summary>
public IEnumerable<string> GetUpdateKeys()
{
if (this.NexusID.HasValue)
yield return $"Nexus:{this.NexusID}";
if (this.ChucklefishID.HasValue)
yield return $"Chucklefish:{this.ChucklefishID}";
if (this.GitHubRepo != null)
yield return $"GitHub:{this.GitHubRepo}";
}
}
}