From d76964c5f381a5b8faba123646d851e7ae2c06f0 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 29 Jan 2023 16:37:23 -0500 Subject: group response models --- .../ResponseModels/UpdateManifestModModel.cs | 34 ++++++++++++++++++++++ .../ResponseModels/UpdateManifestModel.cs | 31 ++++++++++++++++++++ .../ResponseModels/UpdateManifestVersionModel.cs | 34 ++++++++++++++++++++++ 3 files changed, 99 insertions(+) create mode 100644 src/SMAPI.Web/Framework/Clients/UpdateManifest/ResponseModels/UpdateManifestModModel.cs create mode 100644 src/SMAPI.Web/Framework/Clients/UpdateManifest/ResponseModels/UpdateManifestModel.cs create mode 100644 src/SMAPI.Web/Framework/Clients/UpdateManifest/ResponseModels/UpdateManifestVersionModel.cs (limited to 'src/SMAPI.Web/Framework/Clients/UpdateManifest/ResponseModels') diff --git a/src/SMAPI.Web/Framework/Clients/UpdateManifest/ResponseModels/UpdateManifestModModel.cs b/src/SMAPI.Web/Framework/Clients/UpdateManifest/ResponseModels/UpdateManifestModModel.cs new file mode 100644 index 00000000..ee1fbeb6 --- /dev/null +++ b/src/SMAPI.Web/Framework/Clients/UpdateManifest/ResponseModels/UpdateManifestModModel.cs @@ -0,0 +1,34 @@ +// Copyright 2022 Jamie Taylor +namespace StardewModdingAPI.Web.Framework.Clients.UpdateManifest.ResponseModels +{ + /// The data model for a mod in an update manifest file. + internal class UpdateManifestModModel + { + /********* + ** Accessors + *********/ + /// The mod's name. + public string? Name { get; } + + /// The mod page URL from which to download updates. + public string? Url { get; } + + /// The available versions for this mod. + public UpdateManifestVersionModel[]? Versions { get; } + + + /********* + ** Public methods + *********/ + /// Construct an instance. + /// The mod's name. + /// The mod page URL from which to download updates. + /// The available versions for this mod. + public UpdateManifestModModel(string? name, string? url, UpdateManifestVersionModel[]? versions) + { + this.Name = name; + this.Url = url; + this.Versions = versions; + } + } +} diff --git a/src/SMAPI.Web/Framework/Clients/UpdateManifest/ResponseModels/UpdateManifestModel.cs b/src/SMAPI.Web/Framework/Clients/UpdateManifest/ResponseModels/UpdateManifestModel.cs new file mode 100644 index 00000000..e213fbab --- /dev/null +++ b/src/SMAPI.Web/Framework/Clients/UpdateManifest/ResponseModels/UpdateManifestModel.cs @@ -0,0 +1,31 @@ +// Copyright 2022 Jamie Taylor +using System.Collections.Generic; + +namespace StardewModdingAPI.Web.Framework.Clients.UpdateManifest.ResponseModels +{ + /// The data model for an update manifest file. + internal class UpdateManifestModel + { + /********* + ** Accessors + *********/ + /// The manifest format version. + public string? ManifestVersion { get; } + + /// The mod info in this update manifest. + public IDictionary? Mods { get; } + + + /********* + ** Public methods + *********/ + /// Construct an instance. + /// The manifest format version. + /// The mod info in this update manifest. + public UpdateManifestModel(string manifestVersion, IDictionary mods) + { + this.ManifestVersion = manifestVersion; + this.Mods = mods; + } + } +} diff --git a/src/SMAPI.Web/Framework/Clients/UpdateManifest/ResponseModels/UpdateManifestVersionModel.cs b/src/SMAPI.Web/Framework/Clients/UpdateManifest/ResponseModels/UpdateManifestVersionModel.cs new file mode 100644 index 00000000..1e84501f --- /dev/null +++ b/src/SMAPI.Web/Framework/Clients/UpdateManifest/ResponseModels/UpdateManifestVersionModel.cs @@ -0,0 +1,34 @@ +// Copyright 2022 Jamie Taylor +namespace StardewModdingAPI.Web.Framework.Clients.UpdateManifest.ResponseModels +{ + /// Data model for a Version in an update manifest. + internal class UpdateManifestVersionModel + { + /********* + ** Accessors + *********/ + /// The mod's semantic version. + public string? Version { get; } + + /// The URL for this version's download page (if any). + public string? DownloadPageUrl { get; } + + /// The URL for this version's direct file download (if any). + public string? DownloadFileUrl { get; } + + + /********* + ** Public methods + *********/ + /// Construct an instance. + /// The mod's semantic version. + /// This version's download page URL, if any. + /// This version's direct file download URL, if any. + public UpdateManifestVersionModel(string version, string? downloadPageUrl, string? downloadFileUrl) + { + this.Version = version; + this.DownloadPageUrl = downloadPageUrl; + this.DownloadFileUrl = downloadFileUrl; + } + } +} -- cgit