metatext-app-ios-iphone-ipad/MastodonAPI/Sources/MastodonAPI/Endpoints/AccountEndpoint.swift

32 lines
686 B
Swift
Raw Normal View History

// Copyright © 2020 Metabolist. All rights reserved.
import Foundation
2020-08-31 03:40:58 +02:00
import HTTP
import Mastodon
2020-08-31 01:33:11 +02:00
public enum AccountEndpoint {
case verifyCredentials
2020-10-06 00:50:05 +02:00
case accounts(id: Account.Id)
}
2020-08-31 01:59:49 +02:00
extension AccountEndpoint: Endpoint {
2020-08-31 01:33:11 +02:00
public typealias ResultType = Account
2020-08-31 01:33:11 +02:00
public var context: [String] {
defaultContext + ["accounts"]
}
2020-08-31 01:33:11 +02:00
public var pathComponentsInContext: [String] {
switch self {
case .verifyCredentials: return ["verify_credentials"]
2020-09-22 08:53:11 +02:00
case let .accounts(id): return [id]
}
}
2020-08-31 01:33:11 +02:00
public var method: HTTPMethod {
switch self {
2020-09-22 08:53:11 +02:00
case .verifyCredentials, .accounts: return .get
}
}
}