summaryrefslogtreecommitdiff
path: root/LocalAPIModels.swift
diff options
context:
space:
mode:
Diffstat (limited to 'LocalAPIModels.swift')
-rw-r--r--LocalAPIModels.swift45
1 files changed, 45 insertions, 0 deletions
diff --git a/LocalAPIModels.swift b/LocalAPIModels.swift
new file mode 100644
index 0000000..5a18f11
--- /dev/null
+++ b/LocalAPIModels.swift
@@ -0,0 +1,45 @@
+import Foundation
+
+struct LocalAPIConfig: Codable, Equatable, Sendable {
+ var isEnabled: Bool
+ var port: Int
+ var token: String
+ var requestLoggingEnabled: Bool
+
+ init(
+ isEnabled: Bool = false,
+ port: Int = 47821,
+ token: String = "",
+ requestLoggingEnabled: Bool = true
+ ) {
+ self.isEnabled = isEnabled
+ self.port = port
+ self.token = token
+ self.requestLoggingEnabled = requestLoggingEnabled
+ }
+}
+
+struct APIRequestLog: Codable, Identifiable, Equatable, Sendable {
+ let id: UUID
+ let timestamp: Date
+ let method: String
+ let path: String
+ let statusCode: Int
+ let duration: TimeInterval
+
+ init(
+ id: UUID = UUID(),
+ timestamp: Date,
+ method: String,
+ path: String,
+ statusCode: Int,
+ duration: TimeInterval
+ ) {
+ self.id = id
+ self.timestamp = timestamp
+ self.method = method
+ self.path = path
+ self.statusCode = statusCode
+ self.duration = duration
+ }
+}