/* Options: Date: 2025-01-08 03:06:39 SwiftVersion: 6.0 Version: 8.53 Tip: To override a DTO option, remove "//" prefix before updating BaseUrl: https://blazordiffusion.com //BaseClass: //AddModelExtensions: True //AddServiceStackTypes: True //MakePropertiesOptional: True IncludeTypes: QueryGenerationApiProviders.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: False //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack public class QueryGenerationApiProviders : QueryDb, IReturn { public typealias Return = QueryResponse public var id:Int? public var name:String? required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case id case name } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) id = try container.decodeIfPresent(Int.self, forKey: .id) name = try container.decodeIfPresent(String.self, forKey: .name) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if id != nil { try container.encode(id, forKey: .id) } if name != nil { try container.encode(name, forKey: .name) } } } public class GenerationApiProvider : AiProviderBase { // @References(typeof(GenerationApiType)) public var generationApiTypeId:Int? public var type:GenerationApiType? required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case generationApiTypeId case type } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) generationApiTypeId = try container.decodeIfPresent(Int.self, forKey: .generationApiTypeId) type = try container.decodeIfPresent(GenerationApiType.self, forKey: .type) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if generationApiTypeId != nil { try container.encode(generationApiTypeId, forKey: .generationApiTypeId) } if type != nil { try container.encode(type, forKey: .type) } } } public class GenerationApiType : ApiTypeBase { required public init(){ super.init() } required public init(from decoder: Decoder) throws { try super.init(from: decoder) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) } } public class AiProviderBase : ApiProviderBase { public var models:[String] = [] required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case models } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) models = try container.decodeIfPresent([String].self, forKey: .models) ?? [] } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if models.count > 0 { try container.encode(models, forKey: .models) } } } public enum AiServiceProvider : String, Codable { case Replicate case Comfy case OpenAi } public class ApiTypeBase : Codable { public var id:Int? public var apiBaseUrl:String? public var apiKeyHeader:String? public var name:String? public var website:String? public var icon:String? public var apiModels:[String:String] = [:] public var provider:AiServiceProvider? required public init(){} } public class ApiProviderBase : Codable { public var id:Int? public var name:String? public var apiKeyVar:String? public var apiKey:String? public var apiKeyHeader:String? public var apiBaseUrl:String? public var heartbeatUrl:String? public var concurrency:Int? public var priority:Int? public var enabled:Bool? public var offlineDate:Date? public var createdDate:Date? required public init(){} }