Add playback handoff support

This commit is contained in:
lucast committed 2026-10-16 03:18:49 +02:00
1 parent c72596ef44
commit 77c00cc47e
5 files changed
+440 -1

No files matched your search

+62
View File
@@ -100,4 +100,66 @@ nonisolated public struct SearchResults: Decodable, Sendable {
}
nonisolated public struct TrackMembership: Decodable, Sendable { public let contains: Bool }
nonisolated public struct PlaybackHandoff: Decodable, Sendable {
public let currentTrackId: String
public let position: Double
public let queueTrackIds: [String]
public let remainingTrackIds: [String]
public let historyTrackIds: [String]
public let repeatEnabled: Bool
public let repeatOnce: Bool
public let wasPlaying: Bool
enum CodingKeys: String, CodingKey {
case currentTrackId, position, queueTrackIds, remainingTrackIds, historyTrackIds
case repeatEnabled = "repeat"
case repeatOnce, wasPlaying
}
}
nonisolated public struct PlaybackHandoffBody: Encodable, Sendable {
public let currentTrackId: String
public let position: Double
public let queueTrackIds: [String]
public let remainingTrackIds: [String]
public let historyTrackIds: [String]
public let repeatEnabled: Bool
public let repeatOnce: Bool
public let wasPlaying: Bool
enum CodingKeys: String, CodingKey {
case currentTrackId, position, queueTrackIds, remainingTrackIds, historyTrackIds
case repeatEnabled = "repeat"
case repeatOnce, wasPlaying
}
public init(
currentTrackId: String,
position: Double,
queueTrackIds: [String],
remainingTrackIds: [String],
historyTrackIds: [String],
repeatEnabled: Bool,
repeatOnce: Bool,
wasPlaying: Bool
) {
self.currentTrackId = currentTrackId
self.position = position
self.queueTrackIds = queueTrackIds
self.remainingTrackIds = remainingTrackIds
self.historyTrackIds = historyTrackIds
self.repeatEnabled = repeatEnabled
self.repeatOnce = repeatOnce
self.wasPlaying = wasPlaying
}
}
nonisolated public struct PlaybackHandoffSaveResponse: Decodable, Sendable {
public let saved: Bool
public let expiresAt: String
}
nonisolated public struct PlaybackHandoffDeleteResponse: Decodable, Sendable {
public let deleted: Bool
}
nonisolated public enum SearchType: String, Sendable { case track, album, artist, `default` }