Initial project setup - Phases 1-3 complete
This commit is contained in:
54
ProxyCore/Sources/DataLayer/Models/ComposeRequest.swift
Normal file
54
ProxyCore/Sources/DataLayer/Models/ComposeRequest.swift
Normal file
@@ -0,0 +1,54 @@
|
||||
import Foundation
|
||||
import GRDB
|
||||
|
||||
public struct ComposeRequest: Codable, FetchableRecord, MutablePersistableRecord, Identifiable, Sendable {
|
||||
public var id: Int64?
|
||||
public var name: String
|
||||
public var method: String
|
||||
public var url: String?
|
||||
public var headers: String?
|
||||
public var queryParameters: String?
|
||||
public var body: String?
|
||||
public var bodyContentType: String?
|
||||
public var responseStatus: Int?
|
||||
public var responseHeaders: String?
|
||||
public var responseBody: Data?
|
||||
public var lastSentAt: Double?
|
||||
public var createdAt: Double
|
||||
|
||||
public static let databaseTableName = "compose_requests"
|
||||
|
||||
public mutating func didInsert(_ inserted: InsertionSuccess) {
|
||||
id = inserted.rowID
|
||||
}
|
||||
|
||||
public init(
|
||||
id: Int64? = nil,
|
||||
name: String = "New Request",
|
||||
method: String = "GET",
|
||||
url: String? = nil,
|
||||
headers: String? = nil,
|
||||
queryParameters: String? = nil,
|
||||
body: String? = nil,
|
||||
bodyContentType: String? = nil,
|
||||
responseStatus: Int? = nil,
|
||||
responseHeaders: String? = nil,
|
||||
responseBody: Data? = nil,
|
||||
lastSentAt: Double? = nil,
|
||||
createdAt: Double = Date().timeIntervalSince1970
|
||||
) {
|
||||
self.id = id
|
||||
self.name = name
|
||||
self.method = method
|
||||
self.url = url
|
||||
self.headers = headers
|
||||
self.queryParameters = queryParameters
|
||||
self.body = body
|
||||
self.bodyContentType = bodyContentType
|
||||
self.responseStatus = responseStatus
|
||||
self.responseHeaders = responseHeaders
|
||||
self.responseBody = responseBody
|
||||
self.lastSentAt = lastSentAt
|
||||
self.createdAt = createdAt
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user