metatext/MastodonAPI/Sources/MastodonAPI/Endpoints/ContextEndpoint.swift

27 lines
526 B
Swift
Raw Normal View History

2020-08-19 22:16:03 +00:00
// Copyright © 2020 Metabolist. All rights reserved.
import Foundation
2020-08-31 01:40:58 +00:00
import HTTP
import Mastodon
2020-08-19 22:16:03 +00:00
2020-08-30 23:33:11 +00:00
public enum ContextEndpoint {
2020-08-19 22:16:03 +00:00
case context(id: String)
}
2020-08-30 23:59:49 +00:00
extension ContextEndpoint: Endpoint {
public typealias ResultType = Context
2020-08-19 22:16:03 +00:00
2020-08-30 23:33:11 +00:00
public var context: [String] {
2020-08-19 22:16:03 +00:00
defaultContext + ["statuses"]
}
2020-08-30 23:33:11 +00:00
public var pathComponentsInContext: [String] {
2020-08-19 22:16:03 +00:00
switch self {
case let .context(id):
return [id, "context"]
}
}
2020-08-30 23:33:11 +00:00
public var method: HTTPMethod { .get }
2020-08-19 22:16:03 +00:00
}