pCloud / pcloud-sdk-swift

The official pCloud Swift SDK for iOS and macOS for integration with the pCloud API.
MIT License
22 stars 7 forks source link

Missing method for simultaneously "rename" and "move" #15

Closed tobihagemann closed 2 years ago

tobihagemann commented 2 years ago

I understand that there are separate methods for renaming and moving a file/folder. However, the pCloud API is actually able to do both operations in one request. And I need that for my implementation.

I'd be glad to open another PR. However, I wanted to ask first if and how you would solve this. I could add a new PCloudAPIMethod like RenameAndMoveFile/Folder. Or maybe we could remove MoveFile/Folder and make sure that RenameFile/Folder can handle all three cases (just rename, just move, do both) or vice versa?

tobihagemann commented 2 years ago

On second thought, I don't actually "need" that for my implementation. Well, currently I'd need it but maybe it's even best if I split up these operations in my project as well. Even though I can think of other applications on iOS/macOS (mainly, command-line tools) that would profit from this missing method, I'm not sure what the target audience of this SDK is.

You may close this if you think this method shouldn't be added. Or maybe the SDK has the goal to replicate the pCloud API, then this would be indeed "missing".

tmpit commented 2 years ago

I think versatility would be best. Clients should be able to do both move and rename if the API allows it. I've been wanting to merge those two pairs of methods for a while now. I think the methods in the PCloudAPI namespace should reflect the actual API methods. It would be simpler to maintain. And we can leave expressivity and the multiple variants of some method to the PCloudClient interface. That being said, a merging those methods would be a breaking change to the public interface of the API. And I would rather wait until I can make more such changes at once. For the time being I think it would be best to add an optional newName field to the MoveFile and MoveFolder methods.

tmpit commented 2 years ago

I've pushed changes to the master branch. I thought I created a branch for the issue and noticed I didn't right as I was pushing. Anyway, I tested with the example project and everything seems to be working as expected. Could you take a look and check if this will do the job for you?

tobihagemann commented 2 years ago

LGTM! Thank you. 👍