From 567824d97bae3dd5648086ed14ae556b42b10d44 Mon Sep 17 00:00:00 2001 From: Kaan Baris BAYRAK Date: Thu, 4 Nov 2021 08:56:01 +0100 Subject: [PATCH] Signal config endpoints added --- .../HopperAPIUpdateSignalConfigRequest.kt | 7 ++++++- .../java/cryptohopper/android/sdk/CryptohopperHopper.kt | 4 ++-- .../sdk/SharedModels/Marketplace/Models/MarketSignal.kt | 3 ++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/sdk/src/main/java/cryptohopper/android/sdk/API/Hopper/Signal/UpdateSignalConfig/HopperAPIUpdateSignalConfigRequest.kt b/sdk/src/main/java/cryptohopper/android/sdk/API/Hopper/Signal/UpdateSignalConfig/HopperAPIUpdateSignalConfigRequest.kt index 92b00bb..e0cb6eb 100644 --- a/sdk/src/main/java/cryptohopper/android/sdk/API/Hopper/Signal/UpdateSignalConfig/HopperAPIUpdateSignalConfigRequest.kt +++ b/sdk/src/main/java/cryptohopper/android/sdk/API/Hopper/Signal/UpdateSignalConfig/HopperAPIUpdateSignalConfigRequest.kt @@ -9,10 +9,15 @@ import cryptohopper.android.sdk.SharedModels.ConfigModels.HopperAPIHttpMethod class HopperAPIUpdateSignalConfigRequest: HopperAPIRequest { - constructor(hopperId : String,signalId : Int) { + constructor(hopperId : String,signalId : Int,config : Map) { this.httpMethod = HopperAPIHttpMethod.PATCH this.needsAuthentication = true this.changeUrlPath("/hopper/$hopperId/signal/$signalId") + var arr = mutableMapOf() + for ((k, v) in config) { + arr[k] = v + } + addBodyItem("config",arr) } } diff --git a/sdk/src/main/java/cryptohopper/android/sdk/CryptohopperHopper.kt b/sdk/src/main/java/cryptohopper/android/sdk/CryptohopperHopper.kt index 7736e16..a782116 100644 --- a/sdk/src/main/java/cryptohopper/android/sdk/CryptohopperHopper.kt +++ b/sdk/src/main/java/cryptohopper/android/sdk/CryptohopperHopper.kt @@ -984,8 +984,8 @@ class CryptohopperHopper { /// Update Signal Config /// /// - Parameter hopperId: (required) Hopper Id - fun updateSignalConfig(hopperId : String,signalId : Int,callback: (String?, HopperAPIError?) -> Unit) { - HopperAPIUpdateSignalConfigRequest( hopperId, signalId).request({ data -> + fun updateSignalConfig(hopperId : String,signalId : Int,config : Map,callback: (String?, HopperAPIError?) -> Unit) { + HopperAPIUpdateSignalConfigRequest( hopperId, signalId,config).request({ data -> callback(data.data,null) },{error -> callback(null,error) diff --git a/sdk/src/main/java/cryptohopper/android/sdk/SharedModels/Marketplace/Models/MarketSignal.kt b/sdk/src/main/java/cryptohopper/android/sdk/SharedModels/Marketplace/Models/MarketSignal.kt index 4743abf..8a6b236 100644 --- a/sdk/src/main/java/cryptohopper/android/sdk/SharedModels/Marketplace/Models/MarketSignal.kt +++ b/sdk/src/main/java/cryptohopper/android/sdk/SharedModels/Marketplace/Models/MarketSignal.kt @@ -33,7 +33,8 @@ data class MarketSignal ( @SerializedName("is_refundable") val isRefundable: Int?, @SerializedName("price_id") val priceId: String?, @SerializedName("total_subs") val totalSubs: String?, - @SerializedName("total_reviews") val totalReviews: String? + @SerializedName("total_reviews") val totalReviews: String?, + @SerializedName("config") val config: Map? ) data class MarketSignalReviewData (