Skip to content
This repository was archived by the owner on Oct 16, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 42 additions & 2 deletions src/generated/Types.kt
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,33 @@ public enum class PaymentModeIOS(val rawValue: String) {
fun toJson(): String = rawValue
}

public enum class ProductDetailType(val rawValue: String) {
Consumable("consumable"),
NonConsumable("non-consumable"),
AutoRenewableSubscription("auto-renewable-subscription"),
NonRenewingSubscription("non-renewing-subscription")

companion object {
fun fromJson(value: String): ProductDetailType = when (value) {
"consumable" -> ProductDetailType.Consumable
"CONSUMABLE" -> ProductDetailType.Consumable
"Consumable" -> ProductDetailType.Consumable
"non-consumable" -> ProductDetailType.NonConsumable
"NON_CONSUMABLE" -> ProductDetailType.NonConsumable
"NonConsumable" -> ProductDetailType.NonConsumable
"auto-renewable-subscription" -> ProductDetailType.AutoRenewableSubscription
"AUTO_RENEWABLE_SUBSCRIPTION" -> ProductDetailType.AutoRenewableSubscription
"AutoRenewableSubscription" -> ProductDetailType.AutoRenewableSubscription
"non-renewing-subscription" -> ProductDetailType.NonRenewingSubscription
"NON_RENEWING_SUBSCRIPTION" -> ProductDetailType.NonRenewingSubscription
"NonRenewingSubscription" -> ProductDetailType.NonRenewingSubscription
else -> throw IllegalArgumentException("Unknown ProductDetailType value: $value")
}
}

fun toJson(): String = rawValue
}

public enum class ProductQueryType(val rawValue: String) {
InApp("in-app"),
Subs("subs"),
Expand Down Expand Up @@ -389,6 +416,7 @@ public interface ProductCommon {
val price: Double?
val title: String
val type: ProductType
val typeDetails: ProductDetailType
}

public interface PurchaseCommon {
Expand Down Expand Up @@ -685,7 +713,8 @@ public data class ProductAndroid(
val price: Double? = null,
val subscriptionOfferDetailsAndroid: List<ProductSubscriptionAndroidOfferDetails>? = null,
val title: String,
val type: ProductType
val type: ProductType,
val typeDetails: ProductDetailType
) : ProductCommon, Product {

companion object {
Expand All @@ -704,6 +733,7 @@ public data class ProductAndroid(
subscriptionOfferDetailsAndroid = (json["subscriptionOfferDetailsAndroid"] as List<*>?)?.map { ProductSubscriptionAndroidOfferDetails.fromJson((it as Map<String, Any?>)) },
title = json["title"] as String,
type = ProductType.fromJson(json["type"] as String),
typeDetails = ProductDetailType.fromJson(json["typeDetails"] as String),
)
}
}
Expand All @@ -723,6 +753,7 @@ public data class ProductAndroid(
"subscriptionOfferDetailsAndroid" to subscriptionOfferDetailsAndroid?.map { it.toJson() },
"title" to title,
"type" to type.toJson(),
"typeDetails" to typeDetails.toJson(),
)
}

Expand Down Expand Up @@ -765,6 +796,7 @@ public data class ProductIOS(
val subscriptionInfoIOS: SubscriptionInfoIOS? = null,
val title: String,
val type: ProductType,
val typeDetails: ProductDetailType,
val typeIOS: ProductTypeIOS
) : ProductCommon, Product {

Expand All @@ -785,6 +817,7 @@ public data class ProductIOS(
subscriptionInfoIOS = (json["subscriptionInfoIOS"] as Map<String, Any?>?)?.let { SubscriptionInfoIOS.fromJson(it) },
title = json["title"] as String,
type = ProductType.fromJson(json["type"] as String),
typeDetails = ProductDetailType.fromJson(json["typeDetails"] as String),
typeIOS = ProductTypeIOS.fromJson(json["typeIOS"] as String),
)
}
Expand All @@ -806,6 +839,7 @@ public data class ProductIOS(
"subscriptionInfoIOS" to subscriptionInfoIOS?.toJson(),
"title" to title,
"type" to type.toJson(),
"typeDetails" to typeDetails.toJson(),
"typeIOS" to typeIOS.toJson(),
)
}
Expand All @@ -823,7 +857,8 @@ public data class ProductSubscriptionAndroid(
val price: Double? = null,
val subscriptionOfferDetailsAndroid: List<ProductSubscriptionAndroidOfferDetails>,
val title: String,
val type: ProductType
val type: ProductType,
val typeDetails: ProductDetailType
) : ProductCommon, ProductSubscription {

companion object {
Expand All @@ -842,6 +877,7 @@ public data class ProductSubscriptionAndroid(
subscriptionOfferDetailsAndroid = (json["subscriptionOfferDetailsAndroid"] as List<*>).map { ProductSubscriptionAndroidOfferDetails.fromJson((it as Map<String, Any?>)) },
title = json["title"] as String,
type = ProductType.fromJson(json["type"] as String),
typeDetails = ProductDetailType.fromJson(json["typeDetails"] as String),
)
}
}
Expand All @@ -861,6 +897,7 @@ public data class ProductSubscriptionAndroid(
"subscriptionOfferDetailsAndroid" to subscriptionOfferDetailsAndroid.map { it.toJson() },
"title" to title,
"type" to type.toJson(),
"typeDetails" to typeDetails.toJson(),
)
}

Expand Down Expand Up @@ -917,6 +954,7 @@ public data class ProductSubscriptionIOS(
val subscriptionPeriodUnitIOS: SubscriptionPeriodIOS? = null,
val title: String,
val type: ProductType,
val typeDetails: ProductDetailType,
val typeIOS: ProductTypeIOS
) : ProductCommon, ProductSubscription {

Expand Down Expand Up @@ -945,6 +983,7 @@ public data class ProductSubscriptionIOS(
subscriptionPeriodUnitIOS = (json["subscriptionPeriodUnitIOS"] as String?)?.let { SubscriptionPeriodIOS.fromJson(it) },
title = json["title"] as String,
type = ProductType.fromJson(json["type"] as String),
typeDetails = ProductDetailType.fromJson(json["typeDetails"] as String),
typeIOS = ProductTypeIOS.fromJson(json["typeIOS"] as String),
)
}
Expand Down Expand Up @@ -974,6 +1013,7 @@ public data class ProductSubscriptionIOS(
"subscriptionPeriodUnitIOS" to subscriptionPeriodUnitIOS?.toJson(),
"title" to title,
"type" to type.toJson(),
"typeDetails" to typeDetails.toJson(),
"typeIOS" to typeIOS.toJson(),
)
}
Expand Down
30 changes: 30 additions & 0 deletions src/generated/Types.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ public enum PaymentModeIOS: String, Codable, CaseIterable {
case payUpFront = "pay-up-front"
}

public enum ProductDetailType: String, Codable, CaseIterable {
case consumable = "consumable"
case nonConsumable = "non-consumable"
case autoRenewableSubscription = "auto-renewable-subscription"
case nonRenewingSubscription = "non-renewing-subscription"
}

public enum ProductQueryType: String, Codable, CaseIterable {
case inApp = "in-app"
case subs = "subs"
Expand Down Expand Up @@ -115,6 +122,7 @@ public protocol ProductCommon: Codable {
var price: Double? { get }
var title: String { get }
var type: ProductType { get }
var typeDetails: ProductDetailType { get }
}

public protocol PurchaseCommon: Codable {
Expand Down Expand Up @@ -223,6 +231,7 @@ public struct ProductAndroid: Codable, ProductCommon {
public var subscriptionOfferDetailsAndroid: [ProductSubscriptionAndroidOfferDetails]?
public var title: String
public var type: ProductType
public var typeDetails: ProductDetailType
}

public struct ProductAndroidOneTimePurchaseOfferDetail: Codable {
Expand All @@ -246,6 +255,7 @@ public struct ProductIOS: Codable, ProductCommon {
public var subscriptionInfoIOS: SubscriptionInfoIOS?
public var title: String
public var type: ProductType
public var typeDetails: ProductDetailType
public var typeIOS: ProductTypeIOS
}

Expand All @@ -263,6 +273,7 @@ public struct ProductSubscriptionAndroid: Codable, ProductCommon {
public var subscriptionOfferDetailsAndroid: [ProductSubscriptionAndroidOfferDetails]
public var title: String
public var type: ProductType
public var typeDetails: ProductDetailType
}

public struct ProductSubscriptionAndroidOfferDetails: Codable {
Expand Down Expand Up @@ -296,6 +307,7 @@ public struct ProductSubscriptionIOS: Codable, ProductCommon {
public var subscriptionPeriodUnitIOS: SubscriptionPeriodIOS?
public var title: String
public var type: ProductType
public var typeDetails: ProductDetailType
public var typeIOS: ProductTypeIOS
}

Expand Down Expand Up @@ -733,6 +745,15 @@ public enum Product: Codable, ProductCommon {
return value.type
}
}

public var typeDetails: ProductDetailType {
switch self {
case let .productAndroid(value):
return value.typeDetails
case let .productIos(value):
return value.typeDetails
}
}
}

public enum ProductSubscription: Codable, ProductCommon {
Expand Down Expand Up @@ -828,6 +849,15 @@ public enum ProductSubscription: Codable, ProductCommon {
return value.type
}
}

public var typeDetails: ProductDetailType {
switch self {
case let .productSubscriptionAndroid(value):
return value.typeDetails
case let .productSubscriptionIos(value):
return value.typeDetails
}
}
}

public enum Purchase: Codable, PurchaseCommon {
Expand Down
Loading