metatext/Model/Timeline.swift

39 lines
789 B
Swift
Raw Normal View History

2020-08-18 05:13:37 +00:00
// Copyright © 2020 Metabolist. All rights reserved.
import Foundation
2020-08-29 00:06:09 +00:00
enum Timeline: Identifiable {
2020-08-18 05:13:37 +00:00
case home
case local
case federated
case list(MastodonList)
}
extension Timeline {
var id: String {
switch self {
case .home:
return "home"
case .local:
return "local"
case .federated:
return "federated"
case let .list(list):
return list.id
}
}
var endpoint: TimelinesEndpoint {
switch self {
case .home:
return .home
case .local:
return .public(local: true)
case .federated:
return .public(local: false)
case let .list(list):
return .list(id: list.id)
}
}
}