forked from trustwallet/trust-wallet-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
100 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright SIX DAY LLC. All rights reserved. | ||
|
||
import Foundation | ||
import Moya | ||
|
||
enum TrustAPI { | ||
case prices(TokensPrice) | ||
} | ||
|
||
struct TokensPrice: Encodable { | ||
let currency: String | ||
let tokens: [TokenPrice] | ||
} | ||
|
||
struct TokenPrice: Encodable { | ||
let contract: String | ||
let symbol: String | ||
} | ||
|
||
extension TrustAPI: TargetType { | ||
|
||
var baseURL: URL { return Constants.trustAPI } | ||
|
||
var path: String { | ||
switch self { | ||
case .prices: | ||
return "/tokenPrices" | ||
} | ||
} | ||
|
||
var method: Moya.Method { | ||
switch self { | ||
case .prices: return .post | ||
} | ||
} | ||
|
||
var task: Task { | ||
switch self { | ||
case .prices(let tokensPrice): | ||
return .requestJSONEncodable(tokensPrice) | ||
} | ||
} | ||
|
||
var sampleData: Data { | ||
return Data() | ||
} | ||
|
||
var headers: [String: String]? { | ||
return [ | ||
"Content-type": "application/json", | ||
"client": Bundle.main.bundleIdentifier ?? "", | ||
"client-build": Bundle.main.buildNumber ?? "", | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters