commonMain.com.revenuecat.purchases.kmp.models.Offerings.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of purchases-kmp-models Show documentation
Show all versions of purchases-kmp-models Show documentation
Mobile subscriptions in hours, not months.
package com.revenuecat.purchases.kmp.models
/**
* This class contains all the offerings configured in RevenueCat dashboard.
* For more info see https://docs.revenuecat.com/docs/entitlements
*/
public class Offerings(
/**
* Dictionary of all Offerings [Offering] objects keyed by their identifier.
*/
public val all: Map,
/**
* Current offering configured in the RevenueCat dashboard.
*/
public val current: Offering?,
/**
* An implementation to retrieve a specific offering by placement identifier.
*/
private val getCurrentOfferingForPlacement: (placementId: String) -> Offering?
) {
// @JvmOverloads doesn't work for ObjC.
public constructor(
/**
* Dictionary of all Offerings [Offering] objects keyed by their identifier.
*/
all: Map,
/**
* Current offering configured in the RevenueCat dashboard.
*/
current: Offering?,
) : this(
all = all,
current = current,
getCurrentOfferingForPlacement = { null }
)
/**
* Retrieves an specific offering by its identifier. It's equivalent to
* calling [getOffering(identifier)]
* @param identifier Offering identifier
*/
public operator fun get(identifier: String): Offering? = all[identifier]
/**
* Retrieves an specific offering by its identifier.
* @param identifier Offering identifier
*/
public fun getOffering(identifier: String): Offering? = all[identifier]
/**
* Retrieves a specific offering by placement identifier. For more info see the
* [RevenueCat docs](https://www.revenuecat.com/docs/tools/targeting).
*/
public fun getCurrentOfferingForPlacement(placementId: String): Offering? =
getCurrentOfferingForPlacement.invoke(placementId)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy