mirror of
https://github.com/metabolist/metatext.git
synced 2024-05-15 15:02:55 +00:00
37 lines
712 B
Swift
37 lines
712 B
Swift
// Copyright © 2020 Metabolist. All rights reserved.
|
|
|
|
import Foundation
|
|
|
|
public enum ListEndpoint {
|
|
case create(title: String)
|
|
}
|
|
|
|
extension ListEndpoint: MastodonEndpoint {
|
|
public typealias ResultType = MastodonList
|
|
|
|
public var context: [String] {
|
|
defaultContext + ["lists"]
|
|
}
|
|
|
|
public var pathComponentsInContext: [String] {
|
|
switch self {
|
|
case .create:
|
|
return []
|
|
}
|
|
}
|
|
|
|
public var parameters: [String: Any]? {
|
|
switch self {
|
|
case let .create(title):
|
|
return ["title": title]
|
|
}
|
|
}
|
|
|
|
public var method: HTTPMethod {
|
|
switch self {
|
|
case .create:
|
|
return .post
|
|
}
|
|
}
|
|
}
|