summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI.Toolkit/Framework/Clients/WebApi/ModSeachModel.cs
blob: c0ee34ea7fd3bdfc2b5bf727121d5958177adc8f (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
34
35
36
37
using System.Collections.Generic;
using System.Linq;

namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi
{
    /// <summary>Specifies mods whose update-check info to fetch.</summary>
    public class ModSearchModel
    {
        /*********
        ** Accessors
        *********/
        /// <summary>The namespaced mod keys to search.</summary>
        public string[] ModKeys { get; set; }

        /// <summary>Whether to allow non-semantic versions, instead of returning an error for those.</summary>
        public bool AllowInvalidVersions { get; set; }


        /*********
        ** Public methods
        *********/
        /// <summary>Construct an empty instance.</summary>
        public ModSearchModel()
        {
            // needed for JSON deserialising
        }

        /// <summary>Construct an instance.</summary>
        /// <param name="modKeys">The namespaced mod keys to search.</param>
        /// <param name="allowInvalidVersions">Whether to allow non-semantic versions, instead of returning an error for those.</param>
        public ModSearchModel(IEnumerable<string> modKeys, bool allowInvalidVersions)
        {
            this.ModKeys = modKeys.ToArray();
            this.AllowInvalidVersions = allowInvalidVersions;
        }
    }
}