-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
Refactor Storage download & upload (flow) implementation #729
Conversation
# Conflicts: # Storage/src/commonMain/kotlin/io/github/jan/supabase/storage/BucketApiImpl.kt
# Conflicts: # Storage/src/commonMain/kotlin/io/github/jan/supabase/storage/FlowExt.kt
Note that there are some commits from #694 because I backported and improved some of the changes, but file metadata and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love the new public API! Just to check, these updates are being included in another major version bump, correct?
Yes, I originally wanted to only refactor some internal stuff, but now the changes are getting very breaking alongside the WASM support. I can probably include #622 too. |
What kind of change does this PR introduce?
Internal refactor and public API improvements
What is the current behavior?
The current implementation is very complex/messy and the flow variants are even worse (calling
BucketApiImpl
methods, that shouldn't be in a public extension function).What is the new behavior?
Public API
Every upload and download method now has a
options
DSL. This makes it possible to add configuration options in the future without filling up the parameter list (e.g. file metadata)For downloads, there are currently only two things to configure:
Example of the new syntax:
For uploads, you can configure:
Example of the new syntax:
Every upload/update/download variant has this new builder including the flow variants.
BucketItem
has been renamed toFileObject
to match the JS lib.Internal implementation
For non-flow-variants I cleaned up the code to minimize duplications & improve readability.
The same approach was used for the flow variants, which no longer call internal methods from
BucketApiImpl
and instead use the newhttpOverride
option.Additional context
Add any other context or screenshots.