diff --git a/Sources/XXClient/Functors/GetNotificationsReport.swift b/Sources/XXClient/Functors/GetNotificationsReport.swift new file mode 100644 index 0000000000000000000000000000000000000000..0b5d31f8d5ffb7fc0f9f4cd67d6c2b6a0ec11aa1 --- /dev/null +++ b/Sources/XXClient/Functors/GetNotificationsReport.swift @@ -0,0 +1,41 @@ +import Bindings +import XCTestDynamicOverlay + +public struct GetNotificationsReport { + public var run: (Int, String, Data) throws -> NotificationReport + + public func callAsFunction( + e2eId: Int, + notificationCSV: String, + marshaledServices: Data + ) throws -> NotificationReport { + try run(e2eId, notificationCSV, marshaledServices) + } +} + +extension GetNotificationsReport { + public static func live() -> GetNotificationsReport { + GetNotificationsReport { e2eId, notificationCSV, marshaledServices in + var error: NSError? + let result = BindingsGetNotificationsReport( + e2eId, + notificationCSV, + marshaledServices, + &error + ) + if let error = error { + throw error + } + guard let result = result else { + fatalError("BindingsGetNotificationsReport returned nil without providing error") + } + return try NotificationReport.decode(result) + } + } +} + +extension GetNotificationsReport { + public static let unimplemented = GetNotificationsReport( + run: XCTUnimplemented("\(Self.self)") + ) +}