aboutsummaryrefslogtreecommitdiff
path: root/LocalAPIModels.swift
blob: 5a18f114d055b84f752ba5d2329f2296fddde4e7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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
    }
}