/// /// Variant_Boolean_NitroPurchaseResult.kt /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © Marc Rousavy @ Margelo /// package com.margelo.nitro.iap import com.facebook.proguard.annotations.DoNotStrip /** * Represents the TypeScript variant "Boolean | NitroPurchaseResult". */ @Suppress("ClassName") @DoNotStrip sealed class Variant_Boolean_NitroPurchaseResult { @DoNotStrip data class First(@DoNotStrip val value: Boolean): Variant_Boolean_NitroPurchaseResult() @DoNotStrip data class Second(@DoNotStrip val value: NitroPurchaseResult): Variant_Boolean_NitroPurchaseResult() val isFirst: Boolean get() = this is First val isSecond: Boolean get() = this is Second fun asFirstOrNull(): Boolean? { val value = (this as? First)?.value ?: return null return value } fun asSecondOrNull(): NitroPurchaseResult? { val value = (this as? Second)?.value ?: return null return value } inline fun match(first: (Boolean) -> R, second: (NitroPurchaseResult) -> R): R { return when (this) { is First -> first(value) is Second -> second(value) } } companion object { @JvmStatic @DoNotStrip fun create(value: Boolean): Variant_Boolean_NitroPurchaseResult = First(value) @JvmStatic @DoNotStrip fun create(value: NitroPurchaseResult): Variant_Boolean_NitroPurchaseResult = Second(value) } }