box / box-windows-sdk-v2

Windows SDK for v2 of the Box API. The SDK is built upon .NET Framework 4.5
https://developer.box.com
Apache License 2.0
186 stars 163 forks source link

Add File Path or URI-based navigation inputs. #927

Closed willnationsdev closed 1 year ago

willnationsdev commented 1 year ago

Problem & Alternatives

When I first started using this API, I had a deeply nested folder structure in mind for my app's file data, to keep it organized.

However, even if you already know in advance the exact file path through the virtual Box filesystem that you want to store the file, so long as you don't already have the necessary folder IDs cached, you have to use one of several distinct, but equally roundabout ways to actually get the file/folder you want:

Considering that I already know the exact path to navigate already, Box does not offer any simple solution to just get me the thing I want directly & without needing to provide additional filtering once I have the results. The first option is the closest one available, but even that still requires extra work on the application side to get the targeted leaf item reliably.

Proposed Solution

The first option is the simplest fallback available, but it would be a lot more convenient if the Box API itself offered a built-in solution for allowing people to just navigate directly to whatever file or folder they are looking for using a string path or a Uri (with whatever arbitrary protocol/domain Box sees fit to expose, if they go that route, e.g. box://[user|enterprise]/path/from/root/to/file).

example:

// Get Root Folder (with string path)
var folder = await Client.FoldersManager.GetInformationByPathAsync("/");

// Get Root Folder (with Uri uri)
var folder = await Client.FoldersManager.GetInformationAsync(new Uri("box://user/"));

// Get /docs/README.md file (with string path)
var file = await Client.FilesManager.GetInformationByPathAsync("/docs/README.md");

// Get /docs/README.md file (with Uri uri)
var file = await Client.FilesManager.GetInformationAsync(new Uri("box://user/docs/README.md"));

Similar variants for uploading, downloading, creating, updating, and deleting files & folders would likewise be very helpful.

mgrytsai commented 1 year ago

Hi Will,

Thank you for your valuable suggestion! We appreciate your input and are always eager to enhance our API to better serve your needs.

Your suggestion has been noted, and we encourage you to submit it through our feature request platform at pulse.box.com. Our product team regularly reviews requests there and evaluates them for potential enhancements.

Please feel free to share any additional details or specific use cases for this feature to help us understand your needs better.