summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI.Toolkit/ModToolkit.cs
blob: 6136186e5720ad9852d5649618e3d00594891221 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System.Threading.Tasks;
using StardewModdingAPI.Toolkit.Framework.Clients.Wiki;

namespace StardewModdingAPI.Toolkit
{
    /// <summary>A convenience wrapper for the various tools.</summary>
    public class ModToolkit
    {
        /*********
        ** Properties
        *********/
        /// <summary>The default HTTP user agent for the toolkit.</summary>
        private readonly string UserAgent;


        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        public ModToolkit()
        {
            ISemanticVersion version = new SemanticVersion(this.GetType().Assembly.GetName().Version);
            this.UserAgent = $"SMAPI Mod Handler Toolkit/{version}";
        }

        /// <summary>Extract mod metadata from the wiki compatibility list.</summary>
        public async Task<WikiCompatibilityEntry[]> GetWikiCompatibilityListAsync()
        {
            var client = new WikiCompatibilityClient(this.UserAgent);
            return await client.FetchAsync();
        }
    }
}