Module: nintendo.switch.five
Provides a client for the online play invitation server.
class FiveError(Exception)
Raised when the server returns an error code.
class FiveClient
The client.
FiveError
This exception is raised when the server returns an error code. The following constants are defined in this class:
INVALID_PARAMETER: int = 2
INVALID_REQUEST_URI: int = 3
UNAUTHORIZED: int = 6
RESOURCE_NOT_FOUND: int = 10
APPLICATION_DATA_TOO_LARGE: int = 11
The error can be inspected using the following attributes:
response: HTTPResponse
code: int
message: str
FiveClient
def __init__()
Creates a new online play invitation client.
def set_request_callback(callback: Callable) -> None
By default, requests are performed with http.request. This method lets you provide a custom callback instead.
def set_context(context: TLSContext) -> None
Changes the TLS context. By default, the server certificate is verified with Nintendo CA - G3.
def set_host(url: str) -> None
Changes the server to which the HTTP requests are sent. The default is app.lp1.five.nintendo.net.
def set_system_version(version: int) -> None
Changes the system version that is emulated by the client. The system version should be given as a decimal integer. For example, 1002 indicates system version 10.0.2. All system versions from 9.0.0 up to 22.1.0 are supported.
async def get_unread_invitation_count(access_token: str, user_id: int) -> int
Requests the number of unread invitations with /v1/users/<id>/invitations/inbox?fields=count&read=false.
async def get_inbox(access_token: str, user_id: int) -> dict
Requests the list of received online play invitations.
async def get_invitation_group(access_token: str, invitation_group_id: int) -> dict
Requests details about a specific invitation group.
async def mark_as_read(access_token: str, ids: list[int]) -> None
Marks the given list of invitations as read.
async def mark_all_as_read(access_token: str, user_id: int) -> None
Marks all received invitations as read.
async def send_invitation(access_token: str, receivers: list[int], application_id: int, application_group_id: int, application_data: bytes, messages: dict[str, str], application_id_match: bool = False, acd_index: int = 0) -> dict
Sends an online play invitation to at most 16 users. The application group id is usually the same as the application id (title id). The application data is game-specific and may contain at most 1024 bytes.