mirror of
https://github.com/metabolist/metatext.git
synced 2024-06-01 19:41:27 +00:00
43 lines
954 B
Swift
43 lines
954 B
Swift
// Copyright © 2020 Metabolist. All rights reserved.
|
|
|
|
import Foundation
|
|
import HTTP
|
|
import Mastodon
|
|
|
|
public enum AccountsEndpoint {
|
|
case rebloggedBy(id: Status.Id)
|
|
case favouritedBy(id: Status.Id)
|
|
case mutes
|
|
case blocks
|
|
}
|
|
|
|
extension AccountsEndpoint: Endpoint {
|
|
public typealias ResultType = [Account]
|
|
|
|
public var context: [String] {
|
|
switch self {
|
|
case .rebloggedBy, .favouritedBy:
|
|
return defaultContext + ["statuses"]
|
|
case .mutes, .blocks:
|
|
return defaultContext
|
|
}
|
|
}
|
|
|
|
public var pathComponentsInContext: [String] {
|
|
switch self {
|
|
case let .rebloggedBy(id):
|
|
return [id, "reblogged_by"]
|
|
case let .favouritedBy(id):
|
|
return [id, "favourited_by"]
|
|
case .mutes:
|
|
return ["mutes"]
|
|
case .blocks:
|
|
return ["blocks"]
|
|
}
|
|
}
|
|
|
|
public var method: HTTPMethod {
|
|
.get
|
|
}
|
|
}
|