YAML is a modern configuration format which is human readable and supports more conventions than JSON. However, some people may still prefer to write in JSON, so add the option for users to write legacy JSON if they want to and to provide backwards compatability with older plugins. Signed-off-by: kingbri <bdashore3@proton.me>
39 lines
831 B
Swift
39 lines
831 B
Swift
//
|
|
// PluginModels.swift
|
|
// Ferrite
|
|
//
|
|
// Created by Brian Dashore on 1/11/23.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct PluginListJson: Codable {
|
|
let name: String
|
|
let author: String
|
|
var sources: [SourceJson]?
|
|
var actions: [ActionJson]?
|
|
}
|
|
|
|
// Color: Hex value
|
|
public struct PluginTagJson: Codable, Hashable, Sendable {
|
|
public let name: String
|
|
public let colorHex: String?
|
|
|
|
enum CodingKeys: String, CodingKey {
|
|
case name
|
|
case colorHex = "color"
|
|
}
|
|
}
|
|
|
|
extension PluginManager {
|
|
enum PluginManagerError: Error {
|
|
case ListAddition(description: String)
|
|
case ActionAddition(description: String)
|
|
case PluginFetch(description: String)
|
|
}
|
|
|
|
struct AvailablePlugins {
|
|
let availableSources: [SourceJson]
|
|
let availableActions: [ActionJson]
|
|
}
|
|
}
|