Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌿 Fern Regeneration -- February 22, 2024 #8

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.8
- name: Bootstrap poetry
run: |
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
Expand All @@ -26,7 +26,7 @@ jobs:
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.8
- name: Bootstrap poetry
run: |
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
Expand All @@ -45,7 +45,7 @@ jobs:
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.8
- name: Bootstrap poetry
run: |
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
Expand Down
424 changes: 155 additions & 269 deletions poetry.lock

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "metriport"
version = "8.0.3-beta"
version = "0.0.329"
description = ""
readme = "README.md"
authors = []
Expand All @@ -9,12 +9,13 @@ packages = [
]

[tool.poetry.dependencies]
python = "^3.7"
python = "^3.8"
httpx = ">=0.21.2"
pydantic = ">= 1.9.2, < 2.5.0"
pydantic = ">= 1.9.2"
typing_extensions = ">= 4.0.0"

[tool.poetry.dev-dependencies]
mypy = "0.971"
mypy = "^1.8.0"
pytest = "^7.4.0"

[build-system]
Expand Down
7 changes: 3 additions & 4 deletions src/metriport/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# This file was auto-generated by Fern from our API Definition.

from . import commons
from . import fhir
from . import medical
from . import commons, fhir, medical
from .commons import Address, UsState
from .environment import MetriportEnvironment

__all__ = ["MetriportEnvironment", "commons", "fhir", "medical"]
__all__ = ["Address", "MetriportEnvironment", "UsState", "commons", "fhir", "medical"]
47 changes: 47 additions & 0 deletions src/metriport/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,31 @@
from .environment import MetriportEnvironment
from .medical.client import AsyncMedicalClient, MedicalClient


class Metriport:
"""
Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propogate to these functions.

Parameters:
- base_url: typing.Optional[str]. The base url to use for requests from the client.

- environment: MetriportEnvironment. The environment to use for requests from the client. from .environment import MetriportEnvironment

Defaults to MetriportEnvironment.PRODUCTION

- api_key: str.

- timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds.

- httpx_client: typing.Optional[httpx.Client]. The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
---
from metriport.client import Metriport

client = Metriport(
api_key="YOUR_API_KEY",
)
"""

def __init__(
self,
*,
Expand All @@ -27,6 +51,29 @@ def __init__(


class AsyncMetriport:
"""
Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propogate to these functions.

Parameters:
- base_url: typing.Optional[str]. The base url to use for requests from the client.

- environment: MetriportEnvironment. The environment to use for requests from the client. from .environment import MetriportEnvironment

Defaults to MetriportEnvironment.PRODUCTION

- api_key: str.

- timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds.

- httpx_client: typing.Optional[httpx.AsyncClient]. The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
---
from metriport.client import AsyncMetriport

client = AsyncMetriport(
api_key="YOUR_API_KEY",
)
"""

def __init__(
self,
*,
Expand Down
5 changes: 5 additions & 0 deletions src/metriport/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@
from .api_error import ApiError
from .client_wrapper import AsyncClientWrapper, BaseClientWrapper, SyncClientWrapper
from .datetime_utils import serialize_datetime
from .file import File, convert_file_dict_to_httpx_tuples
from .jsonable_encoder import jsonable_encoder
from .remove_none_from_dict import remove_none_from_dict
from .request_options import RequestOptions

__all__ = [
"ApiError",
"AsyncClientWrapper",
"BaseClientWrapper",
"File",
"RequestOptions",
"SyncClientWrapper",
"convert_file_dict_to_httpx_tuples",
"jsonable_encoder",
"remove_none_from_dict",
"serialize_datetime",
Expand Down
2 changes: 1 addition & 1 deletion src/metriport/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def get_headers(self) -> typing.Dict[str, str]:
headers: typing.Dict[str, str] = {
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "metriport",
"X-Fern-SDK-Version": "8.0.2-beta",
"X-Fern-SDK-Version": "0.0.329",
}
headers["X-API-Key"] = self.api_key
return headers
Expand Down
38 changes: 38 additions & 0 deletions src/metriport/core/file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This file was auto-generated by Fern from our API Definition.

import typing

# File typing inspired by the flexibility of types within the httpx library
# https://github.com/encode/httpx/blob/master/httpx/_types.py
FileContent = typing.Union[typing.IO[bytes], bytes, str]
File = typing.Union[
# file (or bytes)
FileContent,
# (filename, file (or bytes))
typing.Tuple[typing.Optional[str], FileContent],
# (filename, file (or bytes), content_type)
typing.Tuple[typing.Optional[str], FileContent, typing.Optional[str]],
# (filename, file (or bytes), content_type, headers)
typing.Tuple[typing.Optional[str], FileContent, typing.Optional[str], typing.Mapping[str, str]],
]


def convert_file_dict_to_httpx_tuples(
d: typing.Dict[str, typing.Union[File, typing.List[File]]]
) -> typing.List[typing.Tuple[str, File]]:
"""
The format we use is a list of tuples, where the first element is the
name of the file and the second is the file object. Typically HTTPX wants
a dict, but to be able to send lists of files, you have to use the list
approach (which also works for non-lists)
https://github.com/encode/httpx/pull/1032
"""

httpx_tuples = []
for key, file_like in d.items():
if isinstance(file_like, list):
for file_like_item in file_like:
httpx_tuples.append((key, file_like_item))
else:
httpx_tuples.append((key, file_like))
return httpx_tuples
29 changes: 29 additions & 0 deletions src/metriport/core/request_options.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This file was auto-generated by Fern from our API Definition.

import typing

try:
from typing import NotRequired # type: ignore
except ImportError:
from typing_extensions import NotRequired # type: ignore


class RequestOptions(typing.TypedDict):
"""
Additional options for request-specific configuration when calling APIs via the SDK.
This is used primarily as an optional final parameter for service functions.

Attributes:
- timeout_in_seconds: int. The number of seconds to await an API call before timing out.

- additional_headers: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's header dict

- additional_query_parameters: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's query parameters dict

- additional_body_parameters: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's body parameters dict
"""

timeout_in_seconds: NotRequired[int]
additional_headers: NotRequired[typing.Dict[str, typing.Any]]
additional_query_parameters: NotRequired[typing.Dict[str, typing.Any]]
additional_body_parameters: NotRequired[typing.Dict[str, typing.Any]]
4 changes: 1 addition & 3 deletions src/metriport/fhir/types/access_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import datetime as dt
import typing

import typing_extensions

from ...core.datetime_utils import serialize_datetime
from .access_policy_ip_access_rule import AccessPolicyIpAccessRule
from .access_policy_resource import AccessPolicyResource
Expand All @@ -25,7 +23,7 @@ class AccessPolicy(pydantic.BaseModel):
Access Policy for user or user group that defines how entities can or cannot access resources.
"""

resource_type: typing_extensions.Literal["AccessPolicy"] = pydantic.Field(alias="resourceType")
resource_type: typing.Literal["AccessPolicy"] = pydantic.Field(alias="resourceType")
id: typing.Optional[Id] = pydantic.Field(
description="The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes."
)
Expand Down
4 changes: 1 addition & 3 deletions src/metriport/fhir/types/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import datetime as dt
import typing

import typing_extensions

from ...core.datetime_utils import serialize_datetime
from .account_coverage import AccountCoverage
from .account_guarantor import AccountGuarantor
Expand All @@ -26,7 +24,7 @@ class Account(BaseResource):
A financial tool for tracking value accrued for a particular purpose. In the healthcare field, used to track charges for a patient, cost centers, etc.
"""

resource_type: typing_extensions.Literal["Account"] = pydantic.Field(alias="resourceType")
resource_type: typing.Literal["Account"] = pydantic.Field(alias="resourceType")
identifier: typing.Optional[typing.List[Identifier]] = pydantic.Field(
description="Unique identifier used to reference the account. Might or might not be intended for human use (e.g. credit card number)."
)
Expand Down
4 changes: 1 addition & 3 deletions src/metriport/fhir/types/activity_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import datetime as dt
import typing

import typing_extensions

from ...core.datetime_utils import serialize_datetime
from .activity_definition_dynamic_value import ActivityDefinitionDynamicValue
from .activity_definition_participant import ActivityDefinitionParticipant
Expand Down Expand Up @@ -40,7 +38,7 @@ class ActivityDefinition(BaseResource):
This resource allows for the definition of some activity to be performed, independent of a particular patient, practitioner, or other performance context.
"""

resource_type: typing_extensions.Literal["ActivityDefinition"] = pydantic.Field(alias="resourceType")
resource_type: typing.Literal["ActivityDefinition"] = pydantic.Field(alias="resourceType")
url: typing.Optional[Uri] = pydantic.Field(
description="An absolute URI that is used to identify this activity definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this activity definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the activity definition is stored on different servers."
)
Expand Down
4 changes: 1 addition & 3 deletions src/metriport/fhir/types/adverse_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import datetime as dt
import typing

import typing_extensions

from ...core.datetime_utils import serialize_datetime
from .adverse_event_actuality import AdverseEventActuality
from .adverse_event_suspect_entity import AdverseEventSuspectEntity
Expand All @@ -25,7 +23,7 @@ class AdverseEvent(BaseResource):
Actual or potential/avoided event causing unintended physical injury resulting from or contributed to by medical care, a research study or other healthcare setting factors that requires additional monitoring, treatment, or hospitalization, or that results in death.
"""

resource_type: typing_extensions.Literal["AdverseEvent"] = pydantic.Field(alias="resourceType")
resource_type: typing.Literal["AdverseEvent"] = pydantic.Field(alias="resourceType")
identifier: typing.Optional[Identifier] = pydantic.Field(
description="Business identifiers assigned to this adverse event by the performer or other systems which remain constant as the resource is updated and propagates from server to server."
)
Expand Down
4 changes: 1 addition & 3 deletions src/metriport/fhir/types/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import datetime as dt
import typing

import typing_extensions

from ...core.datetime_utils import serialize_datetime
from .agent_channel import AgentChannel
from .agent_setting import AgentSetting
Expand All @@ -27,7 +25,7 @@ class Agent(pydantic.BaseModel):
Configuration details for an instance of the Medplum agent application.
"""

resource_type: typing_extensions.Literal["Agent"] = pydantic.Field(alias="resourceType")
resource_type: typing.Literal["Agent"] = pydantic.Field(alias="resourceType")
id: typing.Optional[Id] = pydantic.Field(
description="The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes."
)
Expand Down
4 changes: 1 addition & 3 deletions src/metriport/fhir/types/allergy_intolerance.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import datetime as dt
import typing

import typing_extensions

from ...core.datetime_utils import serialize_datetime
from .age import Age
from .allergy_intolerance_category_item import AllergyIntoleranceCategoryItem
Expand All @@ -31,7 +29,7 @@ class AllergyIntolerance(BaseResource):
Risk of harmful or undesirable, physiological response which is unique to an individual and associated with exposure to a substance.
"""

resource_type: typing_extensions.Literal["AllergyIntolerance"] = pydantic.Field(alias="resourceType")
resource_type: typing.Literal["AllergyIntolerance"] = pydantic.Field(alias="resourceType")
identifier: typing.Optional[typing.List[Identifier]] = pydantic.Field(
description="Business identifiers assigned to this AllergyIntolerance by the performer or other systems which remain constant as the resource is updated and propagates from server to server."
)
Expand Down
4 changes: 1 addition & 3 deletions src/metriport/fhir/types/appointment.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import datetime as dt
import typing

import typing_extensions

from ...core.datetime_utils import serialize_datetime
from .appointment_participant import AppointmentParticipant
from .appointment_status import AppointmentStatus
Expand All @@ -29,7 +27,7 @@ class Appointment(BaseResource):
A booking of a healthcare event among patient(s), practitioner(s), related person(s) and/or device(s) for a specific date/time. This may result in one or more Encounter(s).
"""

resource_type: typing_extensions.Literal["Appointment"] = pydantic.Field(alias="resourceType")
resource_type: typing.Literal["Appointment"] = pydantic.Field(alias="resourceType")
identifier: typing.Optional[typing.List[Identifier]] = pydantic.Field(
description="This records identifiers associated with this appointment concern that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation)."
)
Expand Down
4 changes: 1 addition & 3 deletions src/metriport/fhir/types/appointment_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import datetime as dt
import typing

import typing_extensions

from ...core.datetime_utils import serialize_datetime
from .base_resource import BaseResource
from .code import Code
Expand All @@ -24,7 +22,7 @@ class AppointmentResponse(BaseResource):
A reply to an appointment request for a patient and/or practitioner(s), such as a confirmation or rejection.
"""

resource_type: typing_extensions.Literal["AppointmentResponse"] = pydantic.Field(alias="resourceType")
resource_type: typing.Literal["AppointmentResponse"] = pydantic.Field(alias="resourceType")
identifier: typing.Optional[typing.List[Identifier]] = pydantic.Field(
description="This records identifiers associated with this appointment response concern that are defined by business processes and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate."
)
Expand Down
4 changes: 1 addition & 3 deletions src/metriport/fhir/types/async_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import datetime as dt
import typing

import typing_extensions

from ...core.datetime_utils import serialize_datetime
from .async_job_status import AsyncJobStatus
from .code import Code
Expand All @@ -24,7 +22,7 @@ class AsyncJob(pydantic.BaseModel):
Contains details of long running asynchronous/background jobs.
"""

resource_type: typing_extensions.Literal["AsyncJob"] = pydantic.Field(alias="resourceType")
resource_type: typing.Literal["AsyncJob"] = pydantic.Field(alias="resourceType")
id: typing.Optional[Id] = pydantic.Field(
description="The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes."
)
Expand Down
Loading
Loading