Skip to content
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

fix: Types to use Option[T] #223

Merged
merged 3 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions realtime/_async/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import logging
import re
from functools import wraps
from typing import Any, Callable, Dict, List, Optional, Union
from typing import Any, Callable, Dict, List, Optional

import websockets

Expand Down Expand Up @@ -243,15 +243,15 @@ def summary(self) -> None:
for topic, channel in self.channels.items():
print(f"Topic: {topic} | Events: {[e for e, _ in channel.listeners]}]")

async def set_auth(self, token: Union[str, None]) -> None:
async def set_auth(self, token: Optional[str]) -> None:
"""
Set the authentication token for the connection and update all joined channels.

This method updates the access token for the current connection and sends the new token
to all joined channels. This is useful for refreshing authentication or changing users.

Args:
token (Union[str, None]): The new authentication token. Can be None to remove authentication.
token (Optional[str]): The new authentication token. Can be None to remove authentication.

Returns:
None
Expand Down
6 changes: 3 additions & 3 deletions realtime/_sync/client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Dict, List, Union
from typing import Any, Dict, List, Optional

from .channel import RealtimeChannelOptions, SyncRealtimeChannel

Expand Down Expand Up @@ -56,15 +56,15 @@ def remove_all_channels(self) -> None:
"""
raise NotImplementedError(NOT_IMPLEMENTED_MESSAGE)

def set_auth(self, token: Union[str, None]) -> None:
def set_auth(self, token: Optional[str]) -> None:
"""
Set the authentication token for the connection and update all joined channels.

This method updates the access token for the current connection and sends the new token
to all joined channels. This is useful for refreshing authentication or changing users.

Args:
token (Union[str, None]): The new authentication token. Can be None to remove authentication.
token (Optional[str]): The new authentication token. Can be None to remove authentication.

Returns:
None
Expand Down
Loading