Skip to content

Commit

Permalink
Release 0.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Apr 25, 2023
1 parent 408c4ac commit be3669b
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 12 deletions.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

[tool.poetry]
name = "fern-metriport"
version = "0.0.2"
version = "0.0.3"
description = ""
authors = []
packages = [
Expand All @@ -11,8 +11,8 @@ packages = [
[tool.poetry.dependencies]
python = "^3.7"
httpx = "0.23.3"
pydantic = "^1.9.2"
backports-cached_property = "1.0.2"
pydantic = "^1.9.2"
types-backports = "0.1.3"

[tool.poetry.dev-dependencies]
Expand Down
2 changes: 2 additions & 0 deletions src/metriport/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file was auto-generated by Fern from our API Definition.

from .environment import MercoaEnvironment
from .resources import (
CodeableConcept,
Coding,
Expand All @@ -17,6 +18,7 @@
"Document",
"DownloadDocumentResponse",
"GetDocumentsResponse",
"MercoaEnvironment",
"QueryStatus",
"TriggerDocumentsQueryResponse",
"document",
Expand Down
5 changes: 3 additions & 2 deletions src/metriport/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

from backports.cached_property import cached_property

from .environment import MercoaEnvironment
from .resources.document.client import AsyncDocumentClient, DocumentClient


class Mercoa:
def __init__(self, *, environment: str, api_key: str):
def __init__(self, *, environment: MercoaEnvironment = MercoaEnvironment.PRODUCTION, api_key: str):
self._environment = environment
self.api_key = api_key

Expand All @@ -16,7 +17,7 @@ def document(self) -> DocumentClient:


class AsyncMercoa:
def __init__(self, *, environment: str, api_key: str):
def __init__(self, *, environment: MercoaEnvironment = MercoaEnvironment.PRODUCTION, api_key: str):
self._environment = environment
self.api_key = api_key

Expand Down
8 changes: 8 additions & 0 deletions src/metriport/environment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This file was auto-generated by Fern from our API Definition.

import enum


class MercoaEnvironment(enum.Enum):
PRODUCTION = "https://api.metriport.com"
SANDBOX = "https://api.sandbox.metriport.com"
17 changes: 9 additions & 8 deletions src/metriport/resources/document/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@

from ...core.api_error import ApiError
from ...core.remove_none_from_headers import remove_none_from_headers
from ...environment import MercoaEnvironment
from .types.download_document_response import DownloadDocumentResponse
from .types.get_documents_response import GetDocumentsResponse
from .types.trigger_documents_query_response import TriggerDocumentsQueryResponse


class DocumentClient:
def __init__(self, *, environment: str, api_key: str):
def __init__(self, *, environment: MercoaEnvironment = MercoaEnvironment.PRODUCTION, api_key: str):
self._environment = environment
self.api_key = api_key

Expand All @@ -24,7 +25,7 @@ def get(
) -> GetDocumentsResponse:
_response = httpx.request(
"GET",
urllib.parse.urljoin(f"{self._environment}/", "medical/v1/document"),
urllib.parse.urljoin(f"{self._environment.value}/", "medical/v1/document"),
params={"patientId": patient_id, "facilityId": facility_id, "forceQuery": force_query},
headers=remove_none_from_headers({"X-API-Key": self.api_key}),
)
Expand All @@ -39,7 +40,7 @@ def get(
def trigger_query(self, *, patient_id: str, facility_id: str) -> TriggerDocumentsQueryResponse:
_response = httpx.request(
"POST",
urllib.parse.urljoin(f"{self._environment}/", "medical/v1/document/query"),
urllib.parse.urljoin(f"{self._environment.value}/", "medical/v1/document/query"),
params={"patientId": patient_id, "facilityId": facility_id},
headers=remove_none_from_headers({"X-API-Key": self.api_key}),
)
Expand All @@ -54,7 +55,7 @@ def trigger_query(self, *, patient_id: str, facility_id: str) -> TriggerDocument
def download(self, *, file_name: str) -> DownloadDocumentResponse:
_response = httpx.request(
"POST",
urllib.parse.urljoin(f"{self._environment}/", "medical/v1/document/downloadUrl"),
urllib.parse.urljoin(f"{self._environment.value}/", "medical/v1/document/downloadUrl"),
params={"fileName": file_name},
headers=remove_none_from_headers({"X-API-Key": self.api_key}),
)
Expand All @@ -68,7 +69,7 @@ def download(self, *, file_name: str) -> DownloadDocumentResponse:


class AsyncDocumentClient:
def __init__(self, *, environment: str, api_key: str):
def __init__(self, *, environment: MercoaEnvironment = MercoaEnvironment.PRODUCTION, api_key: str):
self._environment = environment
self.api_key = api_key

Expand All @@ -78,7 +79,7 @@ async def get(
async with httpx.AsyncClient() as _client:
_response = await _client.request(
"GET",
urllib.parse.urljoin(f"{self._environment}/", "medical/v1/document"),
urllib.parse.urljoin(f"{self._environment.value}/", "medical/v1/document"),
params={"patientId": patient_id, "facilityId": facility_id, "forceQuery": force_query},
headers=remove_none_from_headers({"X-API-Key": self.api_key}),
)
Expand All @@ -94,7 +95,7 @@ async def trigger_query(self, *, patient_id: str, facility_id: str) -> TriggerDo
async with httpx.AsyncClient() as _client:
_response = await _client.request(
"POST",
urllib.parse.urljoin(f"{self._environment}/", "medical/v1/document/query"),
urllib.parse.urljoin(f"{self._environment.value}/", "medical/v1/document/query"),
params={"patientId": patient_id, "facilityId": facility_id},
headers=remove_none_from_headers({"X-API-Key": self.api_key}),
)
Expand All @@ -110,7 +111,7 @@ async def download(self, *, file_name: str) -> DownloadDocumentResponse:
async with httpx.AsyncClient() as _client:
_response = await _client.request(
"POST",
urllib.parse.urljoin(f"{self._environment}/", "medical/v1/document/downloadUrl"),
urllib.parse.urljoin(f"{self._environment.value}/", "medical/v1/document/downloadUrl"),
params={"fileName": file_name},
headers=remove_none_from_headers({"X-API-Key": self.api_key}),
)
Expand Down

0 comments on commit be3669b

Please sign in to comment.