23 lines
693 B
Python
23 lines
693 B
Python
from typing import Final
|
|
|
|
from pydantic import parse_obj_as
|
|
|
|
from mdrsclient.api.base import BaseApi
|
|
from mdrsclient.api.utils import token_check
|
|
from mdrsclient.models import Laboratories, Laboratory
|
|
|
|
|
|
class LaboratoryApi(BaseApi):
|
|
ENTRYPOINT: Final[str] = "v2/laboratory/"
|
|
|
|
def list(self) -> Laboratories:
|
|
# print(self.__class__.__name__ + "::" + sys._getframe().f_code.co_name)
|
|
url = self.ENTRYPOINT
|
|
token_check(self.connection)
|
|
response = self.connection.get(url)
|
|
self._raise_response_error(response)
|
|
ret = Laboratories()
|
|
for data in response.json():
|
|
ret.append(parse_obj_as(Laboratory, data))
|
|
return ret
|