feat: add move_to/copy_to to Files resource #83#84
Merged
Conversation
Wrap DIAL Core's POST /v1/ops/resource/{move,copy} so callers can
relocate or duplicate files without dropping to raw httpx.
VinShurik
approved these changes
May 19, 2026
ypldan
approved these changes
May 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Applicable issues
Description of changes
Adds
move_toandcopy_tomethods to bothFiles(sync) andAsyncFiles(async), wrapping DIAL Core's resource-operations endpoints:POST /v1/ops/resource/movePOST /v1/ops/resource/copyBoth methods accept
source/destinationasstr | PurePosixPath(relative, absolute, ormy_files_home() / ...) and an optionaloverwrite: bool = False. URL normalization and same-resource-type validation come for free via the existingDialStorageResourceMixin.get_api_path()— passing a non-files URL raisesInvalidDialURLError. Errors fall through the existing_files_error_processor(412 →EtagMismatchError, 404 →ResourceNotFoundError, everything else to a genericDialException).Naming note: the issue's sketch used
move/copy, butcopycollides with Pydantic'sBaseModel.copy()(inherited viaDialStorageResourceMixin). Renamed tomove_to/copy_tofor 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, thecast_to=NoneTypecan be swapped without changing the call site shape.Out of scope:
ops.resourceresource (rejected in the issue in favor of Files-only).subscribeendpoint (tracked separately in Support resource subscribe #21).Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.