Watch: notification switches, a model list and Ask before acting on new threads, and Ask before acting on a thread

This commit is contained in:
gib committed 2026-11-02 12:10:48 -05:00
1 parent 3cc7e40852
commit 6bc9cac6ca
14 files changed
+623 -81

No files matched your search

+12
View File
@@ -51,6 +51,8 @@ protocol GatewayAPI: Sendable {
func stop(hostId: String, threadId: String) async throws
/// Settles a thread, as in T3. A settled thread that finished or failed leaves the feed.
func settle(hostId: String, threadId: String) async throws
/// Turns Ask before acting on or off for a thread.
func setAskFirst(hostId: String, threadId: String, askFirst: Bool) async throws
/// Every unsettled finished thread, including those past the feed's first 10.
func recent() async throws -> RecentResponse
/// Settles every completed thread in Recent. Failed threads stay.
@@ -62,6 +64,8 @@ protocol GatewayAPI: Sendable {
/// Connects the host again from its first route.
func reconnect(hostId: String) async throws
func testPush() async throws -> PushResult
/// Turns one kind of push on or off for this watch, and returns all four switches.
func setNotification(_ key: NotificationPrefs.Key, _ on: Bool) async throws -> NotificationPrefs
/// Revokes this watch's device token.
func unpair() async throws
}
@@ -105,6 +109,10 @@ struct GatewayClient: GatewayAPI {
try await callIgnoringBody("POST", ["v1", "threads", hostId, threadId, "settle"], body: nil as SendMessageRequest?)
}
func setAskFirst(hostId: String, threadId: String, askFirst: Bool) async throws {
try await callIgnoringBody("POST", ["v1", "threads", hostId, threadId, "mode"], body: ThreadModeRequest(askFirst: askFirst))
}
func recent() async throws -> RecentResponse {
try await call("GET", ["v1", "recent"])
}
@@ -137,6 +145,10 @@ struct GatewayClient: GatewayAPI {
try await call("POST", ["v1", "device", "test-push"])
}
func setNotification(_ key: NotificationPrefs.Key, _ on: Bool) async throws -> NotificationPrefs {
try await call("PUT", ["v1", "device", "notifications"], body: [key.rawValue: on])
}
func unpair() async throws {
try await callIgnoringBody("DELETE", ["v1", "device"], body: nil as SendMessageRequest?)
}