Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions src/main/kotlin/api/wopi/models/CheckContainerInfoResponse.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// SPDX-License-Identifier: EUPL-1.2
// Copyright (C) 2026 Gemeente Utrecht
package com.baseflow.api.wopi.models

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

/**
* Response body for the WOPI CheckContainerInfo operation.
*
* See https://learn.microsoft.com/en-us/microsoft-365/cloud-storage-partner-program/rest/containers/checkcontainerinfo
*/
@Serializable
data class CheckContainerInfoResponse(
/** The display name of the container (e.g. the bronorganisatie code). */
@SerialName("Name")
val name: String,

/**
* Identifies the type of container. Use "Folder" for a generic folder container.
* Clients use this to select an appropriate icon and behaviour.
*/
@SerialName("FolderType")
val folderType: String = "Folder",

/** Whether the current user can delete files in this container. */
@SerialName("UserCanDelete")
val userCanDelete: Boolean = true,

/** Whether the current user can rename files in this container. */
@SerialName("UserCanRename")
val userCanRename: Boolean = true,

/** Whether the container is read-only for the current user. */
@SerialName("IsReadOnly")
val isReadOnly: Boolean = false,

/** Whether the host supports the DeleteFile operation on files in this container. */
@SerialName("SupportsDeleteFile")
val supportsDeleteFile: Boolean = true,

/** Whether the host supports the PutRelativeFile operation on files in this container. */
@SerialName("SupportsPutRelativeFile")
val supportsPutRelativeFile: Boolean = true,

/** Whether the host supports renaming files in this container. */
@SerialName("SupportsRenameFile")
val supportsRenameFile: Boolean = true,
)
4 changes: 3 additions & 1 deletion src/main/kotlin/api/wopi/models/CheckFileInfoResponse.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ data class CheckFileInfoResponse(
@SerialName("UserCanRename")
val userCanRename: Boolean = true,
@SerialName("SupportsDeleteFile")
val supportsDeleteFile: Boolean = true,
val supportsDeleteFile: Boolean = false,
@SerialName("SupportsPutRelativeFile")
val supportsPutRelativeFile: Boolean = true,
@SerialName("SupportsContainers")
val supportsContainers: Boolean = false,
)
38 changes: 38 additions & 0 deletions src/main/kotlin/api/wopi/routes/WopiApiRoutes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import com.baseflow.api.models.respondProblem
import com.baseflow.api.wopi.WopiFileIdPlugin
import com.baseflow.api.wopi.WopiSlatAuthPlugin
import com.baseflow.api.wopi.WopiValidatedFileIdKey
import com.baseflow.api.wopi.models.CheckContainerInfoResponse
import com.baseflow.api.wopi.models.CheckFileInfoResponse
import com.baseflow.api.wopi.models.PutRelativeFileResponse
import com.baseflow.api.wopi.models.RenameFileResponse
Expand Down Expand Up @@ -106,6 +107,43 @@ fun Route.wopiApiRoutes() {
}
}

// ── Container endpoints ────────────────────────────────────────────────
route("/containers/{container_id}") {
get {
call.respondProblem(
HttpStatusCode.NotImplemented,
notImplemented("Containers are not supported by this DRC implementation.", call.request.path()),
)
}.describe {
operationId = "checkContainerInfo"
tag("wopi")
summary = "Check container info."
description =
"Returns metadata and capability flags for the given container. " +
"Requires a valid `access_token` query parameter. " +
"In this DRC implementation a container corresponds to a bronorganisatie."
parameters {
path("container_id") {
description = "Identifier of the container (bronorganisatie code)."
required = true
}
query("access_token") {
description = "Short-lived access token obtained from POST /token/{file_id}."
required = true
}
}
responses {
response(200) {
description = "Success."
ContentType.Application.Json { schema = jsonSchema<CheckContainerInfoResponse>() }
}
response(401) { description = "Invalid access token." }
response(404) { description = "Container not found." }
response(500) { description = "Server error." }
}
}
}

// ── Protected file endpoints ───────────────────────────────────────────
route("/files/{file_id}") {
install(WopiFileIdPlugin)
Expand Down
Loading