Files
pyteamsnap/teamsnap/models.py
2021-11-20 16:15:29 -06:00

22 lines
508 B
Python

from dataclasses import dataclass
from typing import Optional
from teamsnap.api import TeamSnap
from urllib.parse import urljoin
class Item:
id: int
type: str
data: dict = {}
def __init__(self, client:TeamSnap, rel, id, data: dict = {}):
self._client = client
self.type = rel
self.id = id
self._data = data
@property
def data(self):
if self._data: return self._data
else:
return self._client.get_item(self.type, self.id)