Skip to content

Preserve ETags in LOCK and UNLOCK results - #251

Draft
Rello with Copilot wants to merge 2 commits into
mainfrom
copilot/preserve-etags-in-unlock-results
Draft

Rello with Copilot wants to merge 2 commits into
mainfrom
copilot/preserve-etags-in-unlock-results

Conversation

Copilot AI commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

UNLOCK responses can include a resource ETag despite containing no lock details. Expose that ETag without changing the existing optional-lock API.

  • Result API

    • Add public, Sendable NKLockOperationResult with etag and lock.
    • Add lockUnlockFileResult(...) async API for both LOCK and UNLOCK.
  • Compatibility

    • Keep lockUnlockFile(...) async unchanged; it delegates to the result API and returns result.lock.
    • Preserve NKLock.etag for locked responses.
  • Response handling

    • Normalize quoted ETags and treat absent or empty values as nil.
    • Keep successful empty responses successful with an empty result.
    • Preserve existing request behavior and HTTP error propagation.
let result = try await kit.lockUnlockFileResult(
    serverUrlFileName: fileURL,
    shouldLock: false,
    account: account
)

let etag = result.etag
let lock = result.lock // nil after UNLOCK
  • Coverage
    • Add mocked LOCK, UNLOCK, empty-body, missing-ETag, quoted-ETag, HTTP-failure, and legacy-API tests.

Copilot AI and others added 2 commits September 13, 2026 18:55
Co-authored-by: Rello <13385119+Rello@users.noreply.github.com>
Co-authored-by: Rello <13385119+Rello@users.noreply.github.com>
Signed-off-by: GitHub <noreply@github.com>
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.

2 participants