Skip to content

Commit a42b3f1

Browse files
committed
fix: use BaseModel instead of TypedDict
1 parent bb3165f commit a42b3f1

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

src/auth/src/supabase_auth/_async/gotrue_admin_api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,10 @@ async def _list_oauth_clients(
222222
"""
223223
query = {}
224224
if params:
225-
if params.get("page") is not None:
226-
query["page"] = str(params["page"])
227-
if params.get("per_page") is not None:
228-
query["per_page"] = str(params["per_page"])
225+
if params.page is not None:
226+
query["page"] = str(params.page)
227+
if params.per_page is not None:
228+
query["per_page"] = str(params.per_page)
229229

230230
response = await self._request(
231231
"GET",

src/auth/src/supabase_auth/_async/gotrue_admin_oauth_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class AsyncGoTrueAdminOAuthAPI:
1414

1515
async def list_clients(
1616
self,
17-
params: PageParams = None,
17+
params: PageParams | None = None,
1818
) -> OAuthClientListResponse:
1919
"""
2020
Lists all OAuth clients with optional pagination.

src/auth/src/supabase_auth/_sync/gotrue_admin_api.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def _validate_uuid(self, id: str | None) -> None:
220220

221221
def _list_oauth_clients(
222222
self,
223-
params: PageParams = None,
223+
params: PageParams | None = None,
224224
) -> OAuthClientListResponse:
225225
"""
226226
Lists all OAuth clients with optional pagination.
@@ -231,10 +231,10 @@ def _list_oauth_clients(
231231
"""
232232
query = {}
233233
if params:
234-
if params.get("page") is not None:
235-
query["page"] = str(params["page"])
236-
if params.get("per_page") is not None:
237-
query["per_page"] = str(params["per_page"])
234+
if params.page is not None:
235+
query["page"] = str(params.page)
236+
if params.per_page is not None:
237+
query["per_page"] = str(params.per_page)
238238

239239
response = self._request(
240240
"GET",

src/auth/src/supabase_auth/_sync/gotrue_admin_oauth_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class SyncGoTrueAdminOAuthAPI:
1414

1515
def list_clients(
1616
self,
17-
params: PageParams = None,
17+
params: PageParams | None = None,
1818
) -> OAuthClientListResponse:
1919
"""
2020
Lists all OAuth clients with optional pagination.

src/auth/src/supabase_auth/types.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -928,23 +928,23 @@ class OAuthClient(BaseModel):
928928
"""Timestamp when the client was last updated"""
929929

930930

931-
class CreateOAuthClientParams(TypedDict):
931+
class CreateOAuthClientParams(BaseModel):
932932
"""
933933
Parameters for creating a new OAuth client.
934934
Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
935935
"""
936936

937937
client_name: str
938938
"""Human-readable name of the OAuth client"""
939-
client_uri: NotRequired[str]
939+
client_uri: Optional[str] = None
940940
"""URI of the OAuth client"""
941941
redirect_uris: List[str]
942942
"""Array of allowed redirect URIs"""
943-
grant_types: NotRequired[List[OAuthClientGrantType]]
943+
grant_types: Optional[List[OAuthClientGrantType]] = None
944944
"""Array of allowed grant types (optional, defaults to authorization_code and refresh_token)"""
945-
response_types: NotRequired[List[OAuthClientResponseType]]
945+
response_types: Optional[List[OAuthClientResponseType]] = None
946946
"""Array of allowed response types (optional, defaults to code)"""
947-
scope: NotRequired[str]
947+
scope: Optional[str] = None
948948
"""Scope of the OAuth client"""
949949

950950

@@ -980,14 +980,14 @@ class OAuthClientListResponse(BaseModel):
980980
total: int = 0
981981

982982

983-
class PageParams(TypedDict):
983+
class PageParams(BaseModel):
984984
"""
985985
Pagination parameters.
986986
"""
987987

988-
page: NotRequired[int]
988+
page: Optional[int] = None
989989
"""Page number"""
990-
per_page: NotRequired[int]
990+
per_page: Optional[int] = None
991991
"""Number of items per page"""
992992

993993

0 commit comments

Comments
 (0)