Skip to content

Commit 68dd14c

Browse files
abstraktorslisson
authored andcommitted
feat(model-client): delete branches from js
1 parent 8029f17 commit 68dd14c

File tree

1 file changed

+17
-0
lines changed
  • model-client/src/jsMain/kotlin/org/modelix/model/client2

1 file changed

+17
-0
lines changed

model-client/src/jsMain/kotlin/org/modelix/model/client2/ClientJS.kt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ interface ClientJS {
152152

153153
fun createBranch(repositoryId: String, branchId: String, versionHash: String, failIfExists: Boolean = false): Promise<Boolean>
154154

155+
fun deleteBranch(
156+
repositoryId: String,
157+
branchId: String,
158+
): Promise<Boolean>
159+
155160
/**
156161
* Fetch existing repositories from the model server.
157162
*/
@@ -229,6 +234,18 @@ internal class ClientJSImpl(private val modelClient: ModelClientV2) : ClientJS {
229234
}
230235
}
231236

237+
override fun deleteBranch(
238+
repositoryId: String,
239+
branchId: String,
240+
): Promise<Boolean> {
241+
return GlobalScope.promise {
242+
RepositoryId(repositoryId).let { repositoryId ->
243+
val branchReference = repositoryId.getBranchReference(branchId)
244+
return@promise modelClient.deleteBranch(branchReference)
245+
}
246+
}
247+
}
248+
232249
override fun startReplicatedModel(
233250
repositoryId: String,
234251
branchId: String,

0 commit comments

Comments
 (0)