Skip to content

feat: add move_to/copy_to to Files resource #83#84

Merged
ypldan merged 1 commit into
developmentfrom
feat/files-move-copy-83
May 19, 2026
Merged

feat: add move_to/copy_to to Files resource #83#84
ypldan merged 1 commit into
developmentfrom
feat/files-move-copy-83

Conversation

@andrii-novikov
Copy link
Copy Markdown
Contributor

Applicable issues

Description of changes

Adds move_to and copy_to methods to both Files (sync) and AsyncFiles (async), wrapping DIAL Core's resource-operations endpoints:

  • POST /v1/ops/resource/move
  • POST /v1/ops/resource/copy

Both methods accept source / destination as str | PurePosixPath (relative, absolute, or my_files_home() / ...) and an optional overwrite: bool = False. URL normalization and same-resource-type validation come for free via the existing DialStorageResourceMixin.get_api_path() — passing a non-files URL raises InvalidDialURLError. Errors fall through the existing _files_error_processor (412 → EtagMismatchError, 404 → ResourceNotFoundError, everything else to a generic DialException).

Naming note: the issue's sketch used move / copy, but copy collides with Pydantic's BaseModel.copy() (inherited via DialStorageResourceMixin). Renamed to move_to / copy_to for symmetry and to avoid silently shadowing the base method.

Return type is None. The OpenAPI spec only promises 200 OK with no documented body schema; if a future verification against a live deployment shows a body is returned, the cast_to=NoneType can be swapped without changing the call site shape.

Out of scope:

Checklist

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Wrap DIAL Core's POST /v1/ops/resource/{move,copy} so callers can
relocate or duplicate files without dropping to raw httpx.
@ypldan ypldan removed request for adubovik and korotaav48 May 19, 2026 08:10
@ypldan ypldan merged commit 42b0c67 into development May 19, 2026
11 checks passed
@ypldan ypldan deleted the feat/files-move-copy-83 branch May 19, 2026 08:10
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.

Add copy/move support to the Files resource

3 participants