- project.yml mit Bundle ev.mana.zitare + Widget + ShareExt-Targets - ManaSwiftCore (ManaCore + ManaTokens) + ManaSwiftUI (ManaAuthUI) als Package-Dependencies via path: - Pure SwiftUI für Native-Surfaces, WKWebView nur für Lese-Tabs (Hybrid-Sonderfall vs cards/memoro/manaspur, dokumentiert im Playbook ZITARE_NATIVE_GREENFIELD.md) - Theme: paper-Variant aus @mana/themes - ZitareAPI.healthCheck via direct URLSession (öffentlicher Endpoint, kein AuthenticatedTransport-Gate) - 6/6 AppConfigTests + 1/1 UI-Smoke grün auf iPhone 16e Simulator - Live: zitare-api.mana.how/healthz → HTTP/2 200 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
39 lines
1.5 KiB
Swift
39 lines
1.5 KiB
Swift
import Foundation
|
|
import ManaCore
|
|
|
|
/// Zitare-spezifischer API-Client. Wrapper um `AuthenticatedTransport`
|
|
/// aus ManaCore, der die zitare-api-Endpoints kennt.
|
|
///
|
|
/// Phase ζ-0: nur Health-Probe. Endpoints für Submit, Share-Receive,
|
|
/// Quote-Lookup folgen in ζ-3 / ζ-4.
|
|
actor ZitareAPI {
|
|
let transport: AuthenticatedTransport
|
|
let decoder: JSONDecoder
|
|
|
|
init(auth: AuthClient) {
|
|
transport = AuthenticatedTransport(baseURL: AppConfig.apiBaseURL, auth: auth)
|
|
decoder = JSONDecoder()
|
|
// ζ-3 TODO: bei echten DTOs `.iso8601withFractional`-Extension
|
|
// aus cards-native portieren (Server liefert ISO8601 mit
|
|
// Fractional-Seconds, Standard `.iso8601` schluckt das nicht).
|
|
}
|
|
|
|
/// `GET /healthz` — verifiziert dass zitare-api erreichbar ist.
|
|
/// Öffentlicher Endpoint, läuft direkt via `URLSession` (nicht
|
|
/// `AuthenticatedTransport`), damit auch nicht-eingeloggte Apps
|
|
/// die API-Erreichbarkeit prüfen können.
|
|
func healthCheck() async throws -> Bool {
|
|
let url = AppConfig.apiBaseURL.appendingPathComponent("healthz")
|
|
let (_, response) = try await URLSession.shared.data(from: url)
|
|
guard let http = response as? HTTPURLResponse else { return false }
|
|
return http.statusCode == 200
|
|
}
|
|
|
|
// MARK: - Phase ζ-3: Submit
|
|
|
|
// func submitQuote(_ draft: QuoteDraft) async throws -> SubmittedQuote { ... }
|
|
|
|
// MARK: - Phase ζ-4: Share-Receive
|
|
|
|
// func receiveShare(_ envelope: ShareEnvelope) async throws -> ShareReceipt { ... }
|
|
}
|