metatext/MastodonAPI/Sources/MastodonAPI/Endpoints/AccountsEndpoint.swift
2020-12-01 15:23:47 -08:00

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
}
}