Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SUGGESTION: Allow specifying a box file_id in box_write #216

Open
alexbrodersen opened this issue Jun 8, 2021 · 4 comments
Open

SUGGESTION: Allow specifying a box file_id in box_write #216

alexbrodersen opened this issue Jun 8, 2021 · 4 comments

Comments

@alexbrodersen
Copy link
Contributor

Currently box_write requires a file_name and dir_id.

The API documentation suggests it's possible to specify a file_id instead.

It seems non-symmetric that box_read can handle a file_id but box_write cannot.

Let me know if you would like me to attempt a pull request to solve this.

@nathancday
Copy link
Member

box_write() is a convenience wrapper around box_ul(), which uses this API endpoint. Today box_ul() handles both uploading new files and updating existing files (which are slightly different requests). You are correct that you can update with a file_id. But you can't upload a new file by a file_id.

Would you want to rework box_ul() so it would decided whether to update or upload new based on the presence/absence of file_id = or create a new function like box_update(file, file_id)?

I'm skeptical about changing the behavior of box_ul() because it's core function not only for users but other boxr functions like box_push(). What do you think?

@alexbrodersen
Copy link
Contributor Author

I think a new function box_update(file, file_id) would be best.

Then, would it be possible to use box_write to dispatch to the correct method based on if a file_id or a name as been provided?

@nathancday
Copy link
Member

I think that sounds nice, something like if (!is.null(file_id)) box_update(...). I'd welcome a PR for review.

I'm not sure name will work this , because at the API level names aren't unique enough. I know box_push generates a directory diff to emulate the by-name look up, but that starts to feel like a different problem. What do you think?

FWIW I've always saved objects locally and relied on box_push to sync local/remote, could that be a solve/hack in your workflow?

@ijlyttle
Copy link
Member

This sounds like it could be a part of #208.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants