Skip to content

Commit c3e33a5

Browse files
anand2312Dani Reinón
authored and
Dani Reinón
committed
chore: deprecate StorageClient.StorageFileAPI
As the commit message says, we deprecate this method in favour of StorageClient.from_. This method name now conforms to PEP8.
1 parent cb5b4b2 commit c3e33a5

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

Diff for: supabase/client.py

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
from typing import Any, Dict
22

33
from postgrest import SyncFilterRequestBuilder, SyncPostgrestClient, SyncRequestBuilder
4-
from storage3 import SyncStorageClient
5-
from storage3 import create_client as create_storage_client
64

7-
from supabase.lib.auth_client import SupabaseAuthClient
8-
from supabase.lib.client_options import ClientOptions
5+
from .lib.auth_client import SupabaseAuthClient
6+
from .lib.client_options import ClientOptions
7+
from .lib.storage_client import SupabaseStorageClient
98

109

1110
class Client:
@@ -61,11 +60,9 @@ def __init__(
6160
headers=options.headers,
6261
)
6362

64-
def storage(self) -> SyncStorageClient:
63+
def storage(self) -> SupabaseStorageClient:
6564
"""Create instance of the storage client"""
66-
return create_storage_client(
67-
self.storage_url, self._get_auth_headers(), is_async=False
68-
)
65+
return SupabaseStorageClient(self.storage_url, self._get_auth_headers())
6966

7067
def table(self, table_name: str) -> SyncRequestBuilder:
7168
"""Perform a table operation.

Diff for: supabase/lib/storage_client.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from deprecation import deprecated
2+
from storage3 import SyncStorageClient
3+
from storage3._sync.file_api import SyncBucketProxy
4+
5+
6+
class SupabaseStorageClient(SyncStorageClient):
7+
"""Manage storage buckets and files."""
8+
9+
@deprecated("0.5.4", "0.6.0", details="Use `.from_()` instead")
10+
def StorageFileAPI(self, id_: str) -> SyncBucketProxy:
11+
return super().from_(id_)

0 commit comments

Comments
 (0)