diff --git a/simnet/models/base.py b/simnet/models/base.py new file mode 100644 index 0000000..9f2c99f --- /dev/null +++ b/simnet/models/base.py @@ -0,0 +1,16 @@ +from pydantic import BaseModel + +try: + import ujson as jsonlib +except ImportError: + import json as jsonlib + + +class APIModel(BaseModel): + """A Pydantic BaseModel class used for modeling JSON data returned by an API.""" + + class Config: + """A nested class defining configuration options for the APIModel.""" + + json_dumps = jsonlib.dumps + json_loads = jsonlib.loads