-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from BITNP/swo/get-status
- Loading branch information
Showing
7 changed files
with
224 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from enum import Enum | ||
from typing import Literal, Optional, TypedDict, Union | ||
|
||
|
||
class Action(Enum): | ||
LOGIN = "login" | ||
LOGOUT = "logout" | ||
|
||
|
||
class UserResponseType(TypedDict): | ||
client_ip: str | ||
online_ip: str | ||
# Field `error` is also `login_error` when logout action fails | ||
error: Union[Literal["login_error"], Literal["ok"]] | ||
error_msg: str | ||
res: Union[Literal["login_error"], Literal["ok"]] | ||
# Field `username` is not present on login fails and all logout scenarios | ||
username: Optional[str] | ||
|
||
|
||
class LoginStatusRespType(TypedDict): | ||
# Field `error` is `not_online_error` when device is not logged in | ||
error: str | ||
client_ip: Optional[str] | ||
# Field `online_ip` is always present regardless of login status | ||
online_ip: str | ||
# Below are fields only present when device is logged in | ||
sum_bytes: Optional[int] | ||
sum_seconds: Optional[int] | ||
user_balance: Optional[int] | ||
user_name: Optional[str] | ||
wallet_balance: Optional[int] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.