cachapa / firedart

A dart-native implementation of the Firebase Auth and Firestore SDKs
https://pub.dev/packages/firedart
Apache License 2.0
174 stars 62 forks source link

Firebase storage support #24

Open SaadArdati opened 4 years ago

SaadArdati commented 4 years ago

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

cachapa commented 4 years ago

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

SaadArdati commented 4 years ago

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

SaadArdati commented 4 years ago

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 commented 4 years ago

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

cachapa commented 4 years ago

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

SaadArdati commented 4 years ago

PR #25

cachapa commented 4 years ago

Not merged yet

ReniDelonzek commented 4 years ago

Any update about this?

cachapa commented 4 years ago

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.

SaadArdati commented 4 years ago

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.

cachapa commented 4 years ago

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.

ReniDelonzek commented 4 years ago

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

cachapa commented 4 years ago

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.

modeckrus commented 3 years ago

any update?