changed API endpoint from v2 to v3.
This commit is contained in:
23
mdrsclient/api/laboratories.py
Normal file
23
mdrsclient/api/laboratories.py
Normal file
@ -0,0 +1,23 @@
|
||||
from typing import Final
|
||||
|
||||
from pydantic import TypeAdapter
|
||||
|
||||
from mdrsclient.api.base import BaseApi
|
||||
from mdrsclient.api.utils import token_check
|
||||
from mdrsclient.models import Laboratories, Laboratory
|
||||
|
||||
|
||||
class LaboratoriesApi(BaseApi):
|
||||
ENTRYPOINT: Final[str] = "v3/laboratories/"
|
||||
|
||||
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(TypeAdapter(Laboratory).validate_python(data))
|
||||
ret.sort()
|
||||
return ret
|
Reference in New Issue
Block a user