blob: 3155cfda920b369d5f2ebf3f57c121c70180a80f (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
using System;
using Newtonsoft.Json;
namespace StardewModdingAPI.Web.Framework.Clients.Nexus.ResponseModels
{
/// <summary>Mod metadata from Nexus Mods.</summary>
internal class NexusMod
{
/*********
** Accessors
*********/
/// <summary>The mod name.</summary>
public string? Name { get; }
/// <summary>The mod's semantic version number.</summary>
public string? Version { get; }
/// <summary>The mod's web URL.</summary>
[JsonProperty("mod_page_uri")]
public string? Url { get; }
/// <summary>The mod's publication status.</summary>
[JsonIgnore]
public NexusModStatus Status { get; }
/// <summary>The files available to download.</summary>
[JsonIgnore]
public IModDownload[] Downloads { get; }
/// <summary>A custom user-friendly error which indicates why fetching the mod info failed (if applicable).</summary>
[JsonIgnore]
public string? Error { get; }
/*********
** Public methods
*********/
/// <summary>Construct an instance.</summary>
/// <param name="name">The mod name</param>
/// <param name="version">The mod's semantic version number.</param>
/// <param name="url">The mod's web URL.</param>
/// <param name="downloads">The files available to download.</param>
public NexusMod(string name, string? version, string url, IModDownload[] downloads)
{
this.Name = name;
this.Version = version;
this.Url = url;
this.Status = NexusModStatus.Ok;
this.Downloads = downloads;
}
/// <summary>Construct an instance.</summary>
/// <param name="status">The mod's publication status.</param>
/// <param name="error">A custom user-friendly error which indicates why fetching the mod info failed (if applicable).</param>
public NexusMod(NexusModStatus status, string error)
{
this.Status = status;
this.Error = error;
this.Downloads = Array.Empty<IModDownload>();
}
}
}
|