File tree Expand file tree Collapse file tree 4 files changed +30
-1
lines changed
model-client/src/commonMain/kotlin/org/modelix/model/client2
model-server/src/main/kotlin/org/modelix/model/server/handlers Expand file tree Collapse file tree 4 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -314,6 +314,18 @@ paths:
314
314
$ref : ' #/components/responses/500'
315
315
" 200 " :
316
316
$ref : ' #/components/responses/versionDelta'
317
+ /v2/repositories/{repository}/delete :
318
+ post :
319
+ operationId : deleteRepository
320
+ parameters :
321
+ - name : repository
322
+ in : " path"
323
+ required : true
324
+ schema :
325
+ type : string
326
+ responses :
327
+ " 200 " :
328
+ $ref : ' #/components/responses/200'
317
329
/v2/repositories/{repository}/versions/{versionHash} :
318
330
get :
319
331
operationId : getRepositoryVersionHash
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ interface IModelClientV2 {
41
41
42
42
suspend fun initRepository (repository : RepositoryId ): IVersion
43
43
suspend fun listRepositories (): List <RepositoryId >
44
-
44
+ suspend fun deleteRepository ( repository : RepositoryId ): Boolean
45
45
suspend fun listBranches (repository : RepositoryId ): List <BranchReference >
46
46
47
47
@Deprecated(" repository ID is required for permission checks" )
Original file line number Diff line number Diff line change @@ -140,6 +140,15 @@ class ModelClientV2(
140
140
}.bodyAsText().lines().map { RepositoryId (it) }
141
141
}
142
142
143
+ override suspend fun deleteRepository (repository : RepositoryId ): Boolean {
144
+ return httpClient.post {
145
+ url {
146
+ takeFrom(baseUrl)
147
+ appendPathSegmentsEncodingSlash(" repositories" , repository.id, " delete" )
148
+ }
149
+ }.status == HttpStatusCode .OK
150
+ }
151
+
143
152
override suspend fun listBranches (repository : RepositoryId ): List <BranchReference > {
144
153
return httpClient.get {
145
154
url {
Original file line number Diff line number Diff line change @@ -165,6 +165,14 @@ class ModelReplicationServer(val repositoriesManager: RepositoriesManager) {
165
165
call.respondDelta(initialVersion.getContentHash(), null )
166
166
}
167
167
168
+ post<Paths .deleteRepository> {
169
+ fun ApplicationCall.repositoryId () = RepositoryId (parameters[" repository" ]!! )
170
+ fun PipelineContext <Unit , ApplicationCall >.repositoryId () = call.repositoryId()
171
+
172
+ repositoriesManager.removeRepository(repositoryId())
173
+ call.respond(HttpStatusCode .OK )
174
+ }
175
+
168
176
post<Paths .postRepositoryBranch> {
169
177
fun ApplicationCall.repositoryId () = RepositoryId (parameters[" repository" ]!! )
170
178
fun PipelineContext <Unit , ApplicationCall >.repositoryId () = call.repositoryId()
You can’t perform that action at this time.
0 commit comments