Skip to content

Commit

Permalink
Release 8.0.4-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Feb 22, 2024
1 parent 4ed8e2c commit 1095139
Show file tree
Hide file tree
Showing 757 changed files with 12,967 additions and 6,752 deletions.
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 = "8.0.4-beta"
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
4 changes: 2 additions & 2 deletions src/metriport/commons/types/address.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ class Address(pydantic.BaseModel):

address_line_1: str = pydantic.Field(alias="addressLine1", description="The address.")
address_line_2: typing.Optional[str] = pydantic.Field(
alias="addressLine2", description="The address details, for example `#4451`"
alias="addressLine2", default=None, description="The address details, for example `#4451`"
)
city: str = pydantic.Field(description="The city.")
state: UsState = pydantic.Field(description="The 2 letter state acronym, for example `CA`")
zip: str = pydantic.Field(description="Zip must be a string consisting of 5 numbers.")
country: typing.Optional[str] = pydantic.Field(description="Defaults to “USA”")
country: typing.Optional[str] = pydantic.Field(default=None, description="Defaults to “USA”")

def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
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": "8.0.4-beta",
}
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]]
23 changes: 14 additions & 9 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,27 +23,34 @@ 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."
default=None,
description="The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.",
)
meta: typing.Optional[Meta] = pydantic.Field(
description="The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content might not always be associated with version changes to the resource."
default=None,
description="The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content might not always be associated with version changes to the resource.",
)
implicit_rules: typing.Optional[Uri] = pydantic.Field(
alias="implicitRules",
default=None,
description="A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.",
)
language: typing.Optional[Code] = pydantic.Field(description="The base language in which the resource is written.")
name: typing.Optional[str] = pydantic.Field(description="A name associated with the AccessPolicy.")
language: typing.Optional[Code] = pydantic.Field(
default=None, description="The base language in which the resource is written."
)
name: typing.Optional[str] = pydantic.Field(default=None, description="A name associated with the AccessPolicy.")
compartment: typing.Optional[Reference] = pydantic.Field(
description="Optional compartment for newly created resources. If this field is set, any resources created by a user with this access policy will automatically be included in the specified compartment."
default=None,
description="Optional compartment for newly created resources. If this field is set, any resources created by a user with this access policy will automatically be included in the specified compartment.",
)
resource: typing.Optional[typing.List[AccessPolicyResource]] = pydantic.Field(
description="Access details for a resource type."
default=None, description="Access details for a resource type."
)
ip_access_rule: typing.Optional[typing.List[AccessPolicyIpAccessRule]] = pydantic.Field(
alias="ipAccessRule",
default=None,
description="Use IP Access Rules to allowlist, block, and challenge traffic based on the visitor IP address.",
)

Expand Down
3 changes: 2 additions & 1 deletion src/metriport/fhir/types/access_policy_ip_access_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class AccessPolicyIpAccessRule(pydantic.BaseModel):
"""

name: typing.Optional[str] = pydantic.Field(
description="Friendly name that will make it easy for you to identify the IP Access Rule in the future."
default=None,
description="Friendly name that will make it easy for you to identify the IP Access Rule in the future.",
)
value: str = pydantic.Field(
description="An IP Access rule will apply a certain action to incoming traffic based on the visitor IP address or IP range."
Expand Down
12 changes: 8 additions & 4 deletions src/metriport/fhir/types/access_policy_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,27 @@ class AccessPolicyResource(pydantic.BaseModel):
"""

compartment: typing.Optional[Reference] = pydantic.Field(
description="DEPRECATED Optional compartment restriction for the resource type."
default=None, description="DEPRECATED Optional compartment restriction for the resource type."
)
criteria: typing.Optional[str] = pydantic.Field(
description="The rules that the server should use to determine which resources to allow."
default=None, description="The rules that the server should use to determine which resources to allow."
)
readonly: typing.Optional[bool] = pydantic.Field(
description="Optional flag to indicate that the resource type is read-only."
default=None, description="Optional flag to indicate that the resource type is read-only."
)
hidden_fields: typing.Optional[typing.List[str]] = pydantic.Field(
alias="hiddenFields", description="Optional list of hidden fields. Hidden fields are not readable or writeable."
alias="hiddenFields",
default=None,
description="Optional list of hidden fields. Hidden fields are not readable or writeable.",
)
readonly_fields: typing.Optional[typing.List[str]] = pydantic.Field(
alias="readonlyFields",
default=None,
description="Optional list of read-only fields. Read-only fields are readable but not writeable.",
)
write_constraint: typing.Optional[typing.List[Expression]] = pydantic.Field(
alias="writeConstraint",
default=None,
description="Invariants that must be satisfied for the resource to be written. Can include %before and %after placeholders to refer to the resource before and after the updates are applied.",
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ class AccessPolicyResourceWriteCriteria(pydantic.BaseModel):
"""

pre: typing.Optional[str] = pydantic.Field(
description="Invariant to check against the state of the resource before modification."
default=None, description="Invariant to check against the state of the resource before modification."
)
post: typing.Optional[str] = pydantic.Field(
description="Invariant to check against the state of the resource with modifications tentatively applied."
default=None,
description="Invariant to check against the state of the resource with modifications tentatively applied.",
)

def json(self, **kwargs: typing.Any) -> str:
Expand Down
Loading

0 comments on commit 1095139

Please sign in to comment.