lnbits-legend/lnbits/extensions/twitchalerts/models.py

36 lines
651 B
Python
Raw Normal View History

2021-06-22 13:18:50 +02:00
from sqlite3 import Row
from typing import NamedTuple, Optional
2021-06-20 06:34:01 +02:00
2021-06-22 16:42:50 +02:00
class Donation(NamedTuple):
2021-06-22 13:18:50 +02:00
id: str
2021-06-28 17:18:35 +02:00
wallet: str
2021-06-22 13:18:50 +02:00
name: str
2021-06-24 09:59:11 +02:00
message: str
2021-06-22 13:18:50 +02:00
cur_code: str
sats: int
amount: float
service: int
posted: bool
@classmethod
2021-06-22 16:42:50 +02:00
def from_row(cls, row: Row) -> "Donation":
2021-06-22 13:18:50 +02:00
return cls(**dict(row))
2021-06-22 16:42:50 +02:00
class Service(NamedTuple):
2021-06-22 13:18:50 +02:00
id: int
2021-06-22 18:05:07 +02:00
state: str
2021-06-22 13:18:50 +02:00
twitchuser: str
client_id: str
client_secret: str
wallet: str
onchain: str
servicename: str
authenticated: bool
token: Optional[int]
@classmethod
2021-06-22 16:42:50 +02:00
def from_row(cls, row: Row) -> "Service":
2021-06-22 13:18:50 +02:00
return cls(**dict(row))