Lightmatter / welkin-health

A Python wrapper of the Welkin Health API
https://welkin.readthedocs.io
Other
4 stars 3 forks source link

Calling `CDTs.get()` with no arguments calls the wrong endpoint #85

Open samamorgan opened 1 year ago

samamorgan commented 1 year ago

If you call patient.CDTs().get() with no arguments, welkin.models.cdt.CDTs.get calls the patient endpoint ({instance}/patients/{patient_id}).

Calling {instance}/patients/{patient_id}/cdts results in a 404:

welkin.exceptions.WelkinHTTPError: 404 Client Error: Not Found for url: https://api.live.welkincloud.io/{tenant}/{instance}/patients/{patient_id}/cdts
{
  "timestamp": "2023-09-19T18:54:54.072Z",
  "path": "/{tenant}/{instance}/patients/{patient_id}/cdts",
  "status": 404,
  "error": "Not Found",
  "message": null,
  "requestId": "263e23cf-573925"
}

This method needs to sort out whether the appropriate arguments have been passed, and if not, an appropriate ValueError should be raised indicating what is missing.