An advanced Ethereum/EVM mobile wallet
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
alpha-wallet-ios/Trust/EtherClient/CoinMarket/CoinMarketClient.swift

42 lines
856 B

// Copyright SIX DAY LLC. All rights reserved.
import Foundation
import Moya
enum CoinMarketService {
case price(id: String, currency: String)
}
extension CoinMarketService: TargetType {
var baseURL: URL { return URL(string: "https://api.coinmarketcap.com/v1")! }
var path: String {
switch self {
case .price(let id, _):
return "/ticker/\(id)"
}
}
var method: Moya.Method {
switch self {
case .price: return .get
}
}
var task: Task {
switch self {
case .price(_, let currency):
return .requestCompositeData(bodyData: Data(), urlParameters: ["convert": currency])
}
}
var sampleData: Data {
return Data()
}
var headers: [String: String]? {
return ["Content-type": "application/json"]
}
}