createJetpack
Creates a new Jetpack item in Firestore.
This method adds a new document to the Firestore collection. If a document with the same ID already exists, this operation will fail with a conflict error.
Document Path
/dev.atick.jetpack/jetpacks/{userId}/{jetpackId}
When to Use
Use this when you're certain the item doesn't exist in Firestore. For most sync operations, prefer createOrUpdateJetpack which handles both cases.
Example
suspend fun uploadNewItem(item: JetpackEntity) {
val firebaseItem = item.toFirebase().copy(
userId = getCurrentUserId(),
lastUpdated = System.currentTimeMillis()
)
firebaseDataSource.createJetpack(firebaseItem)
}Content copied to clipboard
Parameters
firebaseJetpack
The FirebaseJetpack object to create. Must have a unique ID and all required fields populated.
Throws
FirebaseFirestoreException
if creation fails or document already exists
FirebaseNetworkException
if network is unavailable