Adds the plugins and metadata provider management API

This commit is contained in:
BinaryAlley committed 2026-08-12 11:05:53 -07:00
1 parent 6f501a51f3
commit 7d417c1710
51 files changed
+2294

No files matched your search

@@ -0,0 +1,15 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Requests.Plugins;
/// <summary>
/// Represents a request to get the metadata providers configured for a media library.
/// </summary>
/// <param name="LibraryId">The Id of the media library whose metadata providers are retrieved. Required.</param>
[DebuggerDisplay("LibraryId: {LibraryId}")]
public sealed record GetLibraryMetadataProvidersRequest(
Guid LibraryId
);
@@ -0,0 +1,15 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Requests.Plugins;
/// <summary>
/// Represents a request to get the settings of a plugin.
/// </summary>
/// <param name="PluginId">The unique identifier of the plugin. Required.</param>
[DebuggerDisplay("PluginId: {PluginId}")]
public sealed record GetPluginSettingsRequest(
Guid PluginId
);
@@ -0,0 +1,18 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Requests.Plugins;
/// <summary>
/// Represents a request to reorder the metadata providers of a media library.
/// </summary>
/// <param name="LibraryId">The Id of the media library whose metadata providers are reordered. Required.</param>
/// <param name="PluginIds">The plugin Ids in the new order, from highest to lowest rank. Required.</param>
[DebuggerDisplay("LibraryId: {LibraryId}")]
public sealed record ReorderLibraryMetadataProvidersRequest(
Guid LibraryId,
IReadOnlyList<Guid> PluginIds
);
@@ -0,0 +1,19 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Requests.Plugins;
/// <summary>
/// Represents a request to enable or disable a metadata provider for a media library.
/// </summary>
/// <param name="LibraryId">The Id of the media library whose metadata provider is enabled or disabled. Required.</param>
/// <param name="PluginId">The unique identifier of the plugin providing the metadata. Required.</param>
/// <param name="IsEnabled">Whether the metadata provider should be enabled for the media library.</param>
[DebuggerDisplay("LibraryId: {LibraryId}, PluginId: {PluginId}")]
public sealed record SetLibraryMetadataProviderEnabledRequest(
Guid LibraryId,
Guid PluginId,
bool IsEnabled
);
@@ -0,0 +1,18 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Requests.Plugins;
/// <summary>
/// Represents a request to update the settings of a plugin.
/// </summary>
/// <param name="PluginId">The unique identifier of the plugin. Required.</param>
/// <param name="Settings">The settings of the plugin.</param>
[DebuggerDisplay("PluginId: {PluginId}")]
public sealed record UpdatePluginSettingsRequest(
Guid PluginId,
IReadOnlyDictionary<string, string>? Settings
);
@@ -0,0 +1,19 @@
#region ========================================================================= USING =====================================================================================
using System;
#endregion
namespace Lumina.Contracts.Responses.Plugins;
/// <summary>
/// Represents a metadata provider configured for a media library.
/// </summary>
/// <param name="PluginId">The unique identifier of the plugin providing the metadata.</param>
/// <param name="Name">The display name of the metadata provider.</param>
/// <param name="IsEnabled">Whether the metadata provider is enabled for the media library.</param>
/// <param name="Rank">The rank of the metadata provider, determining the order in which providers are tried.</param>
public sealed record LibraryMetadataProviderResponse(
Guid PluginId,
string Name,
bool IsEnabled,
int Rank
);
@@ -0,0 +1,31 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.SharedKernel.Common.Enums.Plugins;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Responses.Plugins;
/// <summary>
/// Represents a detected plugin.
/// </summary>
/// <param name="Id">The unique identifier of the plugin.</param>
/// <param name="Name">The display name of the plugin.</param>
/// <param name="Author">The author of the plugin.</param>
/// <param name="Version">The version of the plugin.</param>
/// <param name="Description">The description of the plugin.</param>
/// <param name="LoadStatus">The load status of the plugin.</param>
/// <param name="LoadError">The error message when the plugin failed to load, if applicable.</param>
/// <param name="Settings">The settings of the plugin.</param>
[DebuggerDisplay("Name: {Name}")]
public sealed record PluginResponse(
Guid Id,
string Name,
string Author,
string Version,
string Description,
PluginLoadStatus LoadStatus,
string? LoadError,
IReadOnlyDictionary<string, string>? Settings
);
@@ -0,0 +1,21 @@
#region ========================================================================= USING =====================================================================================
using System.Collections.Generic;
#endregion
namespace Lumina.Contracts.Responses.Plugins;
/// <summary>
/// Describes a single setting of a plugin.
/// </summary>
/// <param name="Key">The unique key of the setting.</param>
/// <param name="Label">The display label of the setting.</param>
/// <param name="Type">The type of the setting.</param>
/// <param name="DefaultValue">The optional default value of the setting.</param>
/// <param name="AllowedValues">The list of allowed values, when the setting is a selection.</param>
public sealed record PluginSettingDescriptorResponse(
string Key,
string Label,
PluginSettingType Type,
string? DefaultValue,
IReadOnlyList<string>? AllowedValues
);
@@ -0,0 +1,27 @@
namespace Lumina.Contracts.Responses.Plugins;
/// <summary>
/// Enumeration for the types of a plugin setting.
/// </summary>
public enum PluginSettingType
{
/// <summary>
/// A free-form single line text value.
/// </summary>
Text,
/// <summary>
/// A numeric value.
/// </summary>
Number,
/// <summary>
/// A boolean (true/false) value.
/// </summary>
Boolean,
/// <summary>
/// A value selected from a list of allowed values.
/// </summary>
Select
}
@@ -0,0 +1,18 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Collections.Generic;
#endregion
namespace Lumina.Contracts.Responses.Plugins;
/// <summary>
/// Represents the settings of a plugin and their schema.
/// </summary>
/// <param name="PluginId">The unique identifier of the plugin.</param>
/// <param name="Schema">The schema of the plugin settings.</param>
/// <param name="Settings">The current values of the plugin settings.</param>
public sealed record PluginSettingsResponse(
Guid PluginId,
IReadOnlyList<PluginSettingDescriptorResponse> Schema,
IReadOnlyDictionary<string, string>? Settings
);