mirror of
https://github.com/ldericher/fftcgtool
synced 2025-01-15 23:03:00 +00:00
25 lines
740 B
Python
25 lines
740 B
Python
from typing import Dict, Any, List
|
|
|
|
import requests
|
|
|
|
from .card import Card
|
|
|
|
|
|
class Cards(List[Card]):
|
|
__API_URL = "https://fftcg.square-enix-games.com/de/get-cards"
|
|
|
|
def __init__(self, params: Dict[str, Any]):
|
|
list.__init__(self)
|
|
|
|
# required params:
|
|
# text
|
|
# supported params:
|
|
# [str] text, language, code, multicard="○"|"", ex_burst="○"|"", special="《S》"|""
|
|
# [array] type, element, cost, rarity, power, category_1, set
|
|
# [int] exactmatch=0|1
|
|
|
|
req = requests.post(Cards.__API_URL, json=params)
|
|
self.extend([Card(card_data) for card_data in req.json()["cards"]])
|
|
|
|
def __str__(self) -> str:
|
|
return "\n".join(str(card) for card in self)
|