Updated on 2026-08-14

This commit is contained in:
Tangem 2025-04-17 13:48:25 +05:00
parent 8adc79a8c3
commit 29504be863
8 changed files with 110 additions and 0 deletions

View file

@ -140,6 +140,40 @@ interface TangemTechApi {
@GET("stories/{story_id}")
suspend fun getStoryById(@Path("story_id") storyId: String): ApiResponse<StoryContentResponse>
// region push notifications
@GET("notification/push_notifications_eligible_networks")
suspend fun getEligibleNetworksForPushNotifications(): ApiResponse<List<CryptoNetworkResponse>>
@POST("user-wallets/applications/")
suspend fun createApplicationId(
@Body
body: NotificationApplicationCreateBody,
): ApiResponse<NotificationApplicationIdResponse>
@PATCH("user-wallets/applications/{application_id}")
suspend fun updatePushTokenForApplicationId(
@Path("application_id") applicationId: String,
@Body body: NotificationApplicationCreateBody,
): ApiResponse<String>
@PATCH("user-wallets/wallets/{wallet_id}/notify")
suspend fun setNotificationsEnabled(@Path("wallet_id") walletId: String, @Body body: WalletBody): ApiResponse<Unit>
// endregion
// region wallets
@PATCH("user-wallets/wallets/{wallet_id}")
suspend fun updateWallet(@Path("wallet_id") walletId: String, @Body body: WalletBody): ApiResponse<Unit>
@POST("user-wallets/wallets/create-and-connect-by-appuid/{application_id}")
suspend fun associateApplicationIdWithWallets(
@Path("application_id") applicationId: String,
@Body body: List<WalletIdBody>,
): ApiResponse<Unit>
@GET("user-wallets/wallets/{wallet_id}")
suspend fun getWalletById(@Path("wallet_id") walletId: String): ApiResponse<WalletResponse>
// endregion
companion object {
val marketsQuoteFields = listOf(
"price",

View file

@ -0,0 +1,11 @@
package com.tangem.datasource.api.tangemTech.models
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
data class CryptoNetworkResponse(
@Json(name = "id") val id: Int,
@Json(name = "networkId") val networkId: String,
@Json(name = "name") val name: String,
)

View file

@ -0,0 +1,14 @@
package com.tangem.datasource.api.tangemTech.models
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
data class NotificationApplicationCreateBody(
@Json(name = "pushToken") val pushToken: String,
@Json(name = "platform") val platform: String,
@Json(name = "device") val device: String,
@Json(name = "systemVersion") val systemVersion: String,
@Json(name = "language") val language: String,
@Json(name = "timezone") val timezone: String,
)

View file

@ -0,0 +1,9 @@
package com.tangem.datasource.api.tangemTech.models
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
data class NotificationApplicationIdResponse(
@Json(name = "uid") val appId: String,
)

View file

@ -0,0 +1,12 @@
package com.tangem.datasource.api.tangemTech.models
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
data class NotificationApplicationUpdateBody(
@Json(name = "pushToken") val pushToken: String,
@Json(name = "systemVersion") val systemVersion: String? = null,
@Json(name = "language") val language: String? = null,
@Json(name = "timezone") val timezone: String? = null,
)

View file

@ -0,0 +1,10 @@
package com.tangem.datasource.api.tangemTech.models
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
data class WalletBody(
@Json(name = "notifyStatus") val notifyStatus: String? = null,
@Json(name = "name") val name: String? = null,
)

View file

@ -0,0 +1,9 @@
package com.tangem.datasource.api.tangemTech.models
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
data class WalletIdBody(
@Json(name = "id") val walletId: String,
)

View file

@ -0,0 +1,11 @@
package com.tangem.datasource.api.tangemTech.models
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
data class WalletResponse(
@Json(name = "notifyStatus") val notifyStatus: String? = null,
@Json(name = "name") val name: String? = null,
@Json(name = "id") val id: String,
)