smlflg's picture
Initial public upload from Projekte/PromtGarageMac
4977db2 verified
Raw History Blame Contribute Delete
1.44 kB
import Foundation
public struct PromptQuery: Hashable, Sendable {
public enum Sort: String, CaseIterable, Sendable {
case updatedDescending
case titleAscending
case mostUsed
}
public var text: String
public var tag: String?
public var sourceFamily: String?
public var promptedDay: String?
public var untaggedOnly: Bool
public var starredOnly: Bool
public var usedOnly: Bool
public var sort: Sort
public var limit: Int
public var offset: Int
public init(
text: String = "",
tag: String? = nil,
sourceFamily: String? = nil,
promptedDay: String? = nil,
untaggedOnly: Bool = false,
starredOnly: Bool = false,
usedOnly: Bool = false,
sort: Sort = .updatedDescending,
limit: Int = 100,
offset: Int = 0
) {
self.text = text
self.tag = tag
self.sourceFamily = sourceFamily
self.promptedDay = promptedDay
self.untaggedOnly = untaggedOnly
self.starredOnly = starredOnly
self.usedOnly = usedOnly
self.sort = sort
self.limit = max(1, min(limit, 500))
self.offset = max(0, offset)
}
}
public struct PromptPage: Sendable {
public let prompts: [PromptRecord]
public let total: Int
public init(prompts: [PromptRecord], total: Int) {
self.prompts = prompts
self.total = total
}
}