All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.enchant.flare.FirebaseFunctions.kt Maven / Gradle / Ivy

Go to download

Light the way for your app's backend with functional and testable Firebase components

There is a newer version: 1.0.0-alpha12
Show newest version
package enchant.flare

interface FirebaseFunctions {
    suspend fun call(name: String, data: Any? = null, timeout: Long? = null): Any?

    interface Config {
        fun useEmulator(host: String, port: Int)
    }
    val config: Config

    companion object {
        val instance: FirebaseFunctions = firebaseFunctionsInstance
        fun getInstance(app: FirebaseApp) = getFunctionsInstance(app)
    }
}

class FunctionsException(val code: Code, val description: String? = null) :
    Exception("Firebase functions operation failed with code ${code.name}: $description") {

    enum class Code {
        Aborted,
        AlreadyExists,
        DataLoss,
        DeadlineExceeded,
        FailedPrecondition,
        Internal,
        InvalidArgument,
        NotFound,
        OutOfRange,
        PermissionDenied,
        ResourceExhausted,
        Unauthenticated,
        Unavailable,
        Unimplemented,
        Unknown
    }
}
internal expect val firebaseFunctionsInstance: FirebaseFunctions
internal expect fun getFunctionsInstance(app: FirebaseApp): FirebaseFunctions




© 2015 - 2025 Weber Informatics LLC | Privacy Policy