Skip to content

Commit aea1e36

Browse files
committed
Added firebase functions method for use of function emulator.
1 parent 7ae2717 commit aea1e36

File tree

4 files changed

+7
-0
lines changed
  • firebase-functions/src

4 files changed

+7
-0
lines changed

firebase-functions/src/androidMain/kotlin/dev/gitlive/firebase/functions/functions.kt

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ actual fun Firebase.functions(app: FirebaseApp, region: String) =
2828
actual class FirebaseFunctions internal constructor(val android: com.google.firebase.functions.FirebaseFunctions) {
2929
actual fun httpsCallable(name: String, timeout: Long?) =
3030
HttpsCallableReference(android.getHttpsCallable(name).apply { timeout?.let { setTimeout(it, TimeUnit.MILLISECONDS) } })
31+
32+
actual fun useFunctionsEmulator(origin: String) = android.useFunctionsEmulator(origin)
3133
}
3234

3335
actual class HttpsCallableReference internal constructor(val android: com.google.firebase.functions.HttpsCallableReference) {

firebase-functions/src/commonMain/kotlin/dev/gitlive/firebase/functions/functions.kt

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import kotlinx.serialization.SerializationStrategy
1313

1414
expect class FirebaseFunctions {
1515
fun httpsCallable(name: String, timeout: Long? = null): HttpsCallableReference
16+
fun useFunctionsEmulator(origin: String)
1617
}
1718

1819
expect class HttpsCallableReference {

firebase-functions/src/iosMain/kotlin/dev/gitlive/firebase/functions/functions.kt

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ actual fun Firebase.functions(app: FirebaseApp, region: String) =
3030
actual class FirebaseFunctions internal constructor(val ios: FIRFunctions) {
3131
actual fun httpsCallable(name: String, timeout: Long?) =
3232
HttpsCallableReference(ios.HTTPSCallableWithName(name).apply { timeout?.let { setTimeoutInterval(it/1000.0) } })
33+
34+
actual fun useFunctionsEmulator(origin: String) = ios.useFunctionsEmulatorOrigin(origin)
3335
}
3436

3537
actual class HttpsCallableReference internal constructor(val ios: FIRHTTPSCallable) {

firebase-functions/src/jsMain/kotlin/dev/gitlive/firebase/functions/functions.kt

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ actual fun Firebase.functions(app: FirebaseApp, region: String) =
2525
actual class FirebaseFunctions internal constructor(val js: firebase.functions.Functions) {
2626
actual fun httpsCallable(name: String, timeout: Long?) =
2727
rethrow { HttpsCallableReference(js.httpsCallable(name, timeout?.let { json("timeout" to timeout.toDouble()) })) }
28+
29+
actual fun useFunctionsEmulator(origin: String): Unit = throw NotImplementedError()
2830
}
2931

3032
@Suppress("UNCHECKED_CAST")

0 commit comments

Comments
 (0)