Updated on 2026-08-14
This commit is contained in:
parent
a72837204d
commit
96b4a46462
8 changed files with 30 additions and 24 deletions
|
|
@ -10,4 +10,13 @@ fun <T : Any, R : Any> ApiResponse<T>.fold(onSuccess: (T) -> R, onError: (ApiRes
|
|||
is ApiResponse.Error -> onError(cause)
|
||||
is ApiResponse.Success -> onSuccess(data)
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <T> catchApiResponseError(onError: (ApiResponseError) -> Unit, block: () -> T): T {
|
||||
return try {
|
||||
block()
|
||||
} catch (e: ApiResponseError) {
|
||||
onError(e)
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
|
@ -55,11 +55,11 @@ interface TangemTechApi {
|
|||
|
||||
/** Returns referral status by [walletId] */
|
||||
@GET("referral/{walletId}")
|
||||
suspend fun getReferralStatus(@Path("walletId") walletId: String): ReferralResponse
|
||||
suspend fun getReferralStatus(@Path("walletId") walletId: String): ApiResponse<ReferralResponse>
|
||||
|
||||
/** Make user referral, requires [StartReferralBody] */
|
||||
@POST("referral")
|
||||
suspend fun startReferral(@Body startReferralBody: StartReferralBody): ReferralResponse
|
||||
suspend fun startReferral(@Body startReferralBody: StartReferralBody): ApiResponse<ReferralResponse>
|
||||
|
||||
@GET("quotes")
|
||||
suspend fun getQuotes(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue