2020-08-29 05:50:58 +02:00
|
|
|
// Copyright © 2020 Metabolist. All rights reserved.
|
|
|
|
|
|
|
|
import Foundation
|
2020-08-31 03:40:58 +02:00
|
|
|
import HTTP
|
2020-09-04 03:55:46 +02:00
|
|
|
import Mastodon
|
2020-08-29 05:50:58 +02:00
|
|
|
|
2020-08-31 01:33:11 +02:00
|
|
|
public enum ListsEndpoint {
|
2020-08-29 05:50:58 +02:00
|
|
|
case lists
|
2021-03-03 01:50:22 +01:00
|
|
|
case listsWithAccount(id: Account.Id)
|
2020-08-29 05:50:58 +02:00
|
|
|
}
|
|
|
|
|
2020-08-31 01:59:49 +02:00
|
|
|
extension ListsEndpoint: Endpoint {
|
2020-09-26 05:28:50 +02:00
|
|
|
public typealias ResultType = [List]
|
2020-08-29 05:50:58 +02:00
|
|
|
|
2021-03-03 01:50:22 +01:00
|
|
|
public var context: [String] {
|
|
|
|
switch self {
|
|
|
|
case .lists:
|
|
|
|
return defaultContext
|
|
|
|
case .listsWithAccount:
|
|
|
|
return defaultContext + ["accounts"]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-31 01:33:11 +02:00
|
|
|
public var pathComponentsInContext: [String] {
|
2021-03-03 01:50:22 +01:00
|
|
|
switch self {
|
|
|
|
case .lists:
|
|
|
|
return ["lists"]
|
|
|
|
case let .listsWithAccount(id):
|
|
|
|
return [id, "lists"]
|
|
|
|
}
|
2020-08-29 05:50:58 +02:00
|
|
|
}
|
|
|
|
|
2020-08-31 01:33:11 +02:00
|
|
|
public var method: HTTPMethod {
|
2020-08-29 05:50:58 +02:00
|
|
|
.get
|
|
|
|
}
|
|
|
|
}
|