Updated on 2026-08-14
This commit is contained in:
parent
03c5bdd053
commit
f829c90402
33 changed files with 1502 additions and 0 deletions
|
|
@ -0,0 +1,11 @@
|
|||
package com.tangem.datasource.api.marketing.models
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
||||
/** Cached campaigns response plus its ETag, persisted per [CampaignDto.type] for revalidation. */
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class MarketingCampaignsCacheEntry(
|
||||
@Json(name = "eTag") val eTag: String?,
|
||||
@Json(name = "response") val response: MarketingCampaignsResponse,
|
||||
)
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.tangem.datasource.api.marketing.models
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
import java.math.BigDecimal
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class MarketingCampaignsResponse(
|
||||
@Json(name = "campaigns") val campaigns: List<CampaignDto>,
|
||||
)
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class CampaignDto(
|
||||
@Json(name = "id") val id: Int,
|
||||
@Json(name = "type") val type: String,
|
||||
@Json(name = "priority") val priority: Int,
|
||||
@Json(name = "startAt") val startAt: String? = null,
|
||||
@Json(name = "endAt") val endAt: String? = null,
|
||||
@Json(name = "minAmount") val minAmount: BigDecimal? = null,
|
||||
@Json(name = "maxAmount") val maxAmount: BigDecimal? = null,
|
||||
@Json(name = "providerIds") val providerIds: List<String>? = null,
|
||||
@Json(name = "tokens") val tokens: List<CampaignTokenDto>? = null,
|
||||
@Json(name = "banner") val banner: BannerDto,
|
||||
)
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class CampaignTokenDto(
|
||||
@Json(name = "networkId") val networkId: String? = null,
|
||||
@Json(name = "contractAddress") val contractAddress: String? = null,
|
||||
@Json(name = "id") val id: String? = null,
|
||||
)
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class BannerDto(
|
||||
@Json(name = "uiType") val uiType: String,
|
||||
@Json(name = "text") val text: String? = null,
|
||||
@Json(name = "icon") val icon: String? = null,
|
||||
@Json(name = "iconAlign") val iconAlign: String? = null,
|
||||
@Json(name = "bgColor") val bgColor: String? = null,
|
||||
@Json(name = "deeplink") val deeplink: String? = null,
|
||||
@Json(name = "dismissible") val isDismissible: Boolean = false,
|
||||
)
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.tangem.datasource.api.tangemTech
|
||||
|
||||
import com.tangem.datasource.api.common.response.ApiResponse
|
||||
import com.tangem.datasource.api.marketing.models.MarketingCampaignsResponse
|
||||
import com.tangem.datasource.api.promotion.models.PromotionsResponse
|
||||
import com.tangem.datasource.api.promotion.models.YieldBoostStatusResponse
|
||||
import com.tangem.datasource.api.stories.models.StoryContentResponse
|
||||
|
|
@ -238,4 +239,18 @@ interface TangemTechApi {
|
|||
@GET("v1/earn/networks")
|
||||
suspend fun getEarnNetworks(@Query("type") type: String? = null): ApiResponse<EarnNetworkListResponse>
|
||||
// endregion
|
||||
|
||||
// region marketing
|
||||
@GET("api/v1/marketing/campaigns")
|
||||
suspend fun getMarketingCampaigns(
|
||||
@Query("type") type: String,
|
||||
@Query("language") language: String? = null,
|
||||
@Query("fromNetwork") fromNetwork: String? = null,
|
||||
@Query("fromContractAddress") fromContractAddress: String? = null,
|
||||
@Query("toNetwork") toNetwork: String? = null,
|
||||
@Query("toContractAddress") toContractAddress: String? = null,
|
||||
@Query("fromFiat") fromFiat: String? = null,
|
||||
@Header("If-None-Match") eTag: String? = null,
|
||||
): ApiResponse<MarketingCampaignsResponse>
|
||||
// endregion
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue