Skip to content

Commit

Permalink
add documentation for firebase app
Browse files Browse the repository at this point in the history
  • Loading branch information
BasBuijsen committed Jun 18, 2024
1 parent d7962a8 commit d6edc08
Showing 1 changed file with 62 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,38 @@ import kotlin.jvm.JvmName
/**
* Single access point to all firebase sdks from Kotlin.
*
* <p>Acts as a target for extension methods provided by sdks.
* Acts as a target for extension methods provided by sdks.
*/
object Firebase

/**
* The entry point of Firebase SDKs. It holds common configuration and state for Firebase APIs. Most
* applications don't need to directly interact with FirebaseApp.
*
* For a vast majority of apps, FirebaseInitProvider will handle the initialization of
* Firebase for the default project that it's configured to work with, via the data contained in the
* app's `google-services.json` file. This `ContentProvider`
* is merged into the app's manifest by default when building with Gradle,
* and it runs automatically at app launch. No additional lines of code are needed in this
* case.
*
* Any `FirebaseApp` initialization must occur only in the main process of the app.
* Use of Firebase in processes other than the main process is not supported and will likely cause
* problems related to resource contention.
*/
expect class FirebaseApp {
/** Returns the unique name of this app. */
val name: String

/** Returns the specified [FirebaseOptions]. */
val options: FirebaseOptions

/**
* Deletes the [FirebaseApp] and all its data. All calls to this [FirebaseApp]
* instance will throw once it has been called.
*
* A no-op if delete was called before.
*/
suspend fun delete()
}

Expand All @@ -44,22 +69,58 @@ expect fun Firebase.initialize(context: Any? = null, options: FirebaseOptions, n
val Firebase.options: FirebaseOptions
get() = Firebase.app.options

/** Configurable Firebase options. */
data class FirebaseOptions(
/** The Google App ID that is used to uniquely identify an instance of an app. */
val applicationId: String,

/**
* API key used for authenticating requests from your app, e.g.
* AIzaSyDdVgKwhZl0sTTTLZ7iTmt1r3N2cJLnaDk, used to identify your app to Google servers.
*/
val apiKey: String,

/** The database root URL, e.g. http://abc-xyz-123.firebaseio.com. */
val databaseUrl: String? = null,

/**
* The tracking ID for Google Analytics, e.g. UA-12345678-1, used to configure Google Analytics.
*/
val gaTrackingId: String? = null,

/** The Google Cloud Storage bucket name, e.g. abc-xyz-123.storage.firebase.com. */
val storageBucket: String? = null,

/** The Google Cloud project ID, e.g. my-project-1234 */
val projectId: String? = null,

/**
* The Project Number from the Google Developer's console, for example 012345678901, used to
* configure Google Cloud Messaging.
*/
val gcmSenderId: String? = null,

/** The auth domain. */
val authDomain: String? = null
)

/**
* Exception that gets thrown when an operation on Firebase fails.
*/
expect open class FirebaseException : Exception

/**
* Exception that gets thrown when an operation on Firebase fails.
*/
expect class FirebaseNetworkException : FirebaseException

/**
* Exception that gets thrown when an operation on Firebase fails.
*/
expect open class FirebaseTooManyRequestsException : FirebaseException

/**
* Exception that gets thrown when an operation on Firebase fails.
*/
expect open class FirebaseApiNotAvailableException : FirebaseException

0 comments on commit d6edc08

Please sign in to comment.