Skip to content

feat: add driveItem versions API - #73

Open
dschmidt wants to merge 1 commit into
mainfrom
feat/driveitem-versions
Open

feat: add driveItem versions API#73
dschmidt wants to merge 1 commit into
mainfrom
feat/driveitem-versions

Conversation

@dschmidt

@dschmidt dschmidt commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Models the MS Graph driveItemVersion resource and its four operations under /v1.0/drives/{drive-id}/items/{item-id}/versions:

  • GET .../versions lists the versions of a file, newest first. Like MS Graph, no $orderby, $filter, $top or $skip.
  • GET .../versions/{version-id} returns one version. current is accepted as an alias for the current version, as in MS Graph.
  • GET .../versions/{version-id}/content answers with a 302 to a pre-authenticated URL, same pattern as the driveItem /content endpoint.
  • POST .../versions/{version-id}/restoreVersion returns 204. The previously current content is kept as a new version, the restored version leaves the collection. 423 if the file is locked.

The driveItemVersion schema carries id, lastModifiedDateTime, size, content and the @microsoft.graph.downloadUrl annotation, which is only populated when requested via $select. lastModifiedBy is part of the schema for MS Graph compatibility but documented as omitted, since the storage does not record who created a version. The MS Graph publication facet is left out.

The operations map onto the existing CS3 calls ListFileVersions, RestoreFileVersion and a revision-key download, so no storage changes are needed. The MS Graph versions relationship on driveItem and $expand=versions are intentionally not included yet, as that would need a batched listing path in the storage provider.

@dschmidt
dschmidt marked this pull request as ready for review September 7, 2026 09:18
dschmidt added a commit to opencloud-eu/opencloud that referenced this pull request Sep 7, 2026
Implements the MS Graph driveItemVersion operations on files:

- GET  .../items/{id}/versions lists the versions, newest first
- GET  .../versions/{version-id} returns one version, "current" describes the file itself
- GET  .../versions/{version-id}/content redirects to a signed download url for the version
- POST .../versions/{version-id}/restoreVersion makes the version the current content

The operations map onto ListFileVersions and RestoreFileVersion of the
gateway. Version downloads point at the WebDAV meta endpoint, signed the
same way as the driveItem download url. The download url is only added
when requested via $select.

The driveItemVersion models are vendored from the regenerated client of
opencloud-eu/libre-graph-api#73 until that spec change is merged and the
dependency can be bumped.
dschmidt added a commit to opencloud-eu/opencloud that referenced this pull request Sep 7, 2026
Implements the MS Graph driveItemVersion operations on files:

- GET  .../items/{id}/versions lists the versions, newest first
- GET  .../versions/{version-id} returns one version, "current" describes the file itself
- GET  .../versions/{version-id}/content redirects to a signed download url for the version
- POST .../versions/{version-id}/restoreVersion makes the version the current content

The operations map onto ListFileVersions and RestoreFileVersion of the
gateway. Version downloads point at the WebDAV meta endpoint, signed the
same way as the driveItem download url. The download url is only added
when requested via $select.

The driveItemVersion models are vendored from the regenerated client of
opencloud-eu/libre-graph-api#73 until that spec change is merged and the
dependency can be bumped.
dschmidt added a commit to opencloud-eu/opencloud that referenced this pull request Sep 7, 2026
Implements the MS Graph driveItemVersion operations on files:

- GET  .../items/{id}/versions lists the versions, newest first
- GET  .../versions/{version-id} returns one version, "current" describes the file itself
- GET  .../versions/{version-id}/content redirects to a signed download url for the version
- POST .../versions/{version-id}/restoreVersion makes the version the current content

The operations map onto ListFileVersions and RestoreFileVersion of the
gateway. Version downloads point at the WebDAV meta endpoint, signed the
same way as the driveItem download url. The download url is only added
when requested via $select.

The driveItemVersion models are vendored from the regenerated client of
opencloud-eu/libre-graph-api#73 until that spec change is merged and the
dependency can be bumped.
dschmidt added a commit to opencloud-eu/opencloud that referenced this pull request Sep 7, 2026
Implements the MS Graph driveItemVersion operations on files:

- GET  .../items/{id}/versions lists the versions, newest first
- GET  .../versions/{version-id} returns one version, "current" describes the file itself
- GET  .../versions/{version-id}/content redirects to a signed download url for the version
- POST .../versions/{version-id}/restoreVersion makes the version the current content

The operations map onto ListFileVersions and RestoreFileVersion of the
gateway. Version downloads point at the WebDAV meta endpoint, signed the
same way as the driveItem download url. The download url is only added
when requested via $select.

The driveItemVersion models are vendored from the regenerated client of
opencloud-eu/libre-graph-api#73 until that spec change is merged and the
dependency can be bumped.
@dschmidt
dschmidt force-pushed the feat/driveitem-versions branch from d6a2120 to 779085d Compare September 8, 2026 07:44
Model the MS Graph driveItemVersion resource and its operations:
list, get, download content and restore a version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant