metatext/MastodonAPI/Sources/MastodonAPI/Endpoints/ListEndpoint.swift
2020-09-23 00:04:37 -07:00

39 lines
730 B
Swift

// Copyright © 2020 Metabolist. All rights reserved.
import Foundation
import HTTP
import Mastodon
public enum ListEndpoint {
case create(title: String)
}
extension ListEndpoint: Endpoint {
public typealias ResultType = MastodonList
public var context: [String] {
defaultContext + ["lists"]
}
public var pathComponentsInContext: [String] {
switch self {
case .create:
return []
}
}
public var jsonBody: [String: Any]? {
switch self {
case let .create(title):
return ["title": title]
}
}
public var method: HTTPMethod {
switch self {
case .create:
return .post
}
}
}