box / box-windows-sdk-v2

Windows SDK for v2 of the Box API. The SDK is built upon .NET Framework 4.5

Home Page:https://developer.box.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Provide a way to get the file version back from the PromoteVersionAsync method.

hada79 opened this issue · comments

.Net 5.0 using nuget package Box.V2.Core 4.31.

Is your feature request related to a problem? Please describe.

When using FIlesManager.PromoteVersionAsync, the BoxFileVersion that is returned does not have a version property to know which version number the newly promoted version was assigned. There is a FileVersion property on the returned object, but it is null and there is no way to request it.

Describe the solution you'd like

Either hydrate the FileVersion object property by default, or provide an additional property to the PromoteVersionAsync method to allow fields to include so you can specify to return that object.

Describe alternatives you've considered

I am currently forced to call the api again to get the versions and determine which version is the current one.

Hi @hada79,

Thank you for submit this issue.

I'm afraid that currently we can't do what you ask. This is because Box sdk works just as a wrapper for exposed APIs. So if this API doesn't provide an option to return file version back, we as as SDK Team, can't do this either.

Please take a look at this promote API description and its return type FileVersion.
As you can see there, FileVersion type doesn't provide any version parameter.

If you want to propose this API change, please submit a request on https://support.box.com/.

Regards
@arjankowski

Makes sense, I may do that. In the mean time, do you know of an endpoint where Version number(like v1, v2, v3 etc) is exposed, given a versionId?

Currently only the File object contain a version_number (1, 2, etc) which is set to current version (last one).

So If you want to get this data you should add version_number value to fields parameter either on:
BoxFilesManager#GetInformationAsync() to get this separately to particular file, or BoxFoldersManager#GetItemsAsync() to get version_number to all files in folder.

You can use version_number key defined in BoxFile.cs file:

 public const string FieldVersionNumber = "version_number";

Hope this help.

@hada79,

We plan to extend the BoxFileVersion class with a version_number field so that you can call the BoxFilesManger# ViewVersionsAync() method with the version_number value passed into the fields parameter to retrieve that value.

jira-ticket: SDK-2155