firedart icon indicating copy to clipboard operation
firedart copied to clipboard

Firebase storage support

Open SaadArdati opened this issue 5 years ago • 14 comments

If someone can implement a messy version of it, I can clean it up in a PR. :P

SaadArdati avatar May 16 '20 11:05 SaadArdati

So according to this 3 year old Reddit thread, there isn't an official REST API for it, but you can use the standard Google Cloud Storage API.

I do have a working implementation of Google Storage for another project which depends on the gcoud package. Another option might be integrating the storage protobuffs, as we have for firestore: https://github.com/googleapis/googleapis/tree/master/google/storage/v1

I haven't tested any of those options. Here is the my code using the gcloud package. I had to remove some proprietary stuff so it might not work out of the box, but it should be enough to give an idea: https://gist.github.com/cachapa/61d7ba5673531dd12b85456b32455ba6

cachapa avatar May 16 '20 15:05 cachapa

I'll see if I can cook something from the gist you gave.

SaadArdati avatar May 16 '20 16:05 SaadArdati

the firebase_admin pub package supports firebase storage, but i ran into authentication issues with it, so I'll see if I can snag something from their as well

SaadArdati avatar May 16 '20 16:05 SaadArdati

Done. As soon as the collection query PR is done, I'll push the new pr

SaadArdati avatar May 17 '20 09:05 SaadArdati

Please don't close issues before they're merged :-)

cachapa avatar May 17 '20 10:05 cachapa

PR #25

SaadArdati avatar May 17 '20 19:05 SaadArdati

Not merged yet

cachapa avatar May 17 '20 19:05 cachapa

Any update about this?

ReniDelonzek avatar Jun 13 '20 23:06 ReniDelonzek

I looked into this and the current approach depends on gcloud and googleapis_auth packages which I'm not super excited about. In particular the second one, since it just duplicates what we already have.

One option would be to take a closer look at googleapis_auth. If it's a complete replacement to Firedart.Auth, and meets the same requirements (pure Dart, runs everywhere) then we could simply adopt it. Another option would be to explore how to feed our Auth client to gcloud so we would only have to add that dependency. A third option would be to somehow figure out how the storage API works and implement it. It's likely that we could leverage the official protobuffs as we did for Firestore, but that would be a larger time investment.

Unfortunately I don't have much time to work on this so there won't be any progress unless someone else steps up to do it.

cachapa avatar Jun 14 '20 13:06 cachapa

On the flip side, if you need it for admin/server/backend, I implemented it in my package dartbase_admin. I'm depending on gcloud and all that, I'm wrapping it. I know cachapa wouldn't like that but I just needed something to work.

SaadArdati avatar Jun 14 '20 14:06 SaadArdati

I wouldn't say I don't like it - it's based on my solution after all ;-) I just don't think it's a fit to firedart for the reasons above.

cachapa avatar Jun 14 '20 14:06 cachapa

Wouldn't it be better to have a separate package for that then?

ReniDelonzek avatar Jul 02 '20 16:07 ReniDelonzek

A separate package just for storage? Depends - if storage can be integrated using what we already have, then I think it would be better to add it here.

Otherwise I'm not sure. It's not a lot of code to glue the googleapis_auth and gcloud packages, so creating a package for it seems to be a bit overkill.

cachapa avatar Jul 03 '20 06:07 cachapa

any update?

modeckrus avatar Nov 25 '20 11:11 modeckrus