yakovkhalinsky/backblaze-b2

Options misssing for the listFileVersions function

michel-smarticket opened this issue · 1 comments

Hello,

I've noticed the prefix and delimiter options are missing from the listFileVersions function.
This raises an issue when trying to filter specific files from backblaze.

Proposed change:

exports.listFileVersions = function(b2, args) {
    const bucketId = args.bucketId;
    const startFileName = args.startFileName;
    const startFileId = args.startFileId;
    const maxFileCount = args.maxFileCount;
    const prefix = args.prefix;
    const delimiter = args.delimiter;

    const options = {
        url: endpoints(b2).listFileVersionsUrl,
        method: 'POST',
        headers: utils.getAuthHeaderObjectWithToken(b2),
        data: {
            bucketId: bucketId,
            startFileName: startFileName || '',
            prefix: prefix || '',
            delimiter: delimiter || null,
            startFileId: startFileId,
            maxFileCount: maxFileCount || 100
        }
    };

    // merge order matters here: later objects override earlier objects
    return request.sendRequest(_.merge({},
        _.get(args, 'axios', {}),
        options,
        _.get(args, 'axiosOverride', {})
    ));
};

I think this is pretty important, I've done the same changes in order to use the listFileVersions as intended.
Without the prefix and delimiter parameters you need additional work to select the versions of a single file.