Skip to content

Commit 18e8e7b

Browse files
Request options support, Python version upgrade, and serialized enum support (#77)
Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Co-authored-by: Armando Belardo <[email protected]>
1 parent ca3049f commit 18e8e7b

File tree

184 files changed

+24328
-7674
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+24328
-7674
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,10 @@ jobs:
2323
- name: Set up python
2424
uses: actions/setup-python@v4
2525
with:
26-
python-version: 3.7
26+
python-version: 3.8
2727
- name: Bootstrap poetry
2828
run: |
29-
curl --location --show-error --silent --output poetry.py https://install.python-poetry.org \
30-
&& echo '66db5477a597b6176202ef77792076057ce50d2c5a2d2d2978c63e1f144d7b95' poetry.py | sha256sum -c \
31-
&& python poetry.py -y --version 1.5.1 \
32-
&& rm poetry.py
29+
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
3330
- name: Install dependencies
3431
run: poetry install
3532
- name: Compile
@@ -42,13 +39,10 @@ jobs:
4239
- name: Set up python
4340
uses: actions/setup-python@v4
4441
with:
45-
python-version: 3.7
42+
python-version: 3.8
4643
- name: Bootstrap poetry
4744
run: |
48-
curl --location --show-error --silent --output poetry.py https://install.python-poetry.org \
49-
&& echo '66db5477a597b6176202ef77792076057ce50d2c5a2d2d2978c63e1f144d7b95' poetry.py | sha256sum -c \
50-
&& python poetry.py -y --version 1.5.1 \
51-
&& rm poetry.py
45+
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
5246
- name: Install dependencies
5347
run: poetry install
5448
- name: Test
@@ -70,13 +64,10 @@ jobs:
7064
- name: Set up python
7165
uses: actions/setup-python@v4
7266
with:
73-
python-version: 3.7
67+
python-version: 3.8
7468
- name: Bootstrap poetry
7569
run: |
76-
curl --location --show-error --silent --output poetry.py https://install.python-poetry.org \
77-
&& echo '66db5477a597b6176202ef77792076057ce50d2c5a2d2d2978c63e1f144d7b95' poetry.py | sha256sum -c \
78-
&& python poetry.py -y --version 1.5.1 \
79-
&& rm poetry.py
70+
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
8071
- name: Install dependencies
8172
run: poetry install
8273
- name: Publish to pypi

poetry.lock

Lines changed: 158 additions & 272 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "MergePythonClient"
3-
version = "1.0.5"
3+
version = "1.0.6"
44
description = ""
55
readme = "README.md"
66
authors = []
@@ -9,12 +9,13 @@ packages = [
99
]
1010

1111
[tool.poetry.dependencies]
12-
python = "^3.7"
12+
python = "^3.8"
1313
httpx = ">=0.21.2"
14-
pydantic = ">= 1.9.2, < 2.5.0"
14+
pydantic = ">= 1.9.2"
15+
typing_extensions = ">= 4.0.0"
1516

1617
[tool.poetry.dev-dependencies]
17-
mypy = "0.971"
18+
mypy = "^1.8.0"
1819
pytest = "^7.4.0"
1920

2021
[build-system]

src/merge/core/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
from .datetime_utils import serialize_datetime
66
from .jsonable_encoder import jsonable_encoder
77
from .remove_none_from_dict import remove_none_from_dict
8+
from .request_options import RequestOptions
89

910
__all__ = [
1011
"ApiError",
1112
"AsyncClientWrapper",
1213
"BaseClientWrapper",
14+
"RequestOptions",
1315
"SyncClientWrapper",
1416
"jsonable_encoder",
1517
"remove_none_from_dict",

src/merge/core/client_wrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def get_headers(self) -> typing.Dict[str, str]:
2121
headers: typing.Dict[str, str] = {
2222
"X-Fern-Language": "Python",
2323
"X-Fern-SDK-Name": "MergePythonClient",
24-
"X-Fern-SDK-Version": "1.0.5",
24+
"X-Fern-SDK-Version": "1.0.6",
2525
}
2626
if self._account_token is not None:
2727
headers["X-Account-Token"] = self._account_token

src/merge/core/request_options.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
import typing
4+
5+
try:
6+
from typing import NotRequired # type: ignore
7+
except ImportError:
8+
from typing_extensions import NotRequired # type: ignore
9+
10+
11+
class RequestOptions(typing.TypedDict):
12+
"""
13+
Additional options for request-specific configuration when calling APIs via the SDK.
14+
This is used primarily as an optional final parameter for service functions.
15+
16+
Attributes:
17+
- timeout_in_seconds: int. The number of seconds to await an API call before timing out.
18+
19+
- additional_headers: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's header dict
20+
21+
- additional_query_parameters: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's query parameters dict
22+
23+
- additional_body_parameters: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's body parameters dict
24+
"""
25+
26+
timeout_in_seconds: NotRequired[int]
27+
additional_headers: NotRequired[typing.Dict[str, typing.Any]]
28+
additional_query_parameters: NotRequired[typing.Dict[str, typing.Any]]
29+
additional_body_parameters: NotRequired[typing.Dict[str, typing.Any]]

src/merge/resources/accounting/resources/account_details/client.py

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
# This file was auto-generated by Fern from our API Definition.
22

3+
import typing
34
import urllib.parse
45
from json.decoder import JSONDecodeError
56

67
from .....core.api_error import ApiError
78
from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
9+
from .....core.jsonable_encoder import jsonable_encoder
10+
from .....core.remove_none_from_dict import remove_none_from_dict
11+
from .....core.request_options import RequestOptions
812
from ...types.account_details import AccountDetails
913

1014
try:
@@ -17,10 +21,12 @@ class AccountDetailsClient:
1721
def __init__(self, *, client_wrapper: SyncClientWrapper):
1822
self._client_wrapper = client_wrapper
1923

20-
def retrieve(self) -> AccountDetails:
24+
def retrieve(self, *, request_options: typing.Optional[RequestOptions] = None) -> AccountDetails:
2125
"""
2226
Get details for a linked account.
2327
28+
Parameters:
29+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
2430
---
2531
from merge.client import Merge
2632
@@ -33,8 +39,20 @@ def retrieve(self) -> AccountDetails:
3339
_response = self._client_wrapper.httpx_client.request(
3440
"GET",
3541
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/accounting/v1/account-details"),
36-
headers=self._client_wrapper.get_headers(),
37-
timeout=60,
42+
params=jsonable_encoder(
43+
request_options.get("additional_query_parameters") if request_options is not None else None
44+
),
45+
headers=jsonable_encoder(
46+
remove_none_from_dict(
47+
{
48+
**self._client_wrapper.get_headers(),
49+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
50+
}
51+
)
52+
),
53+
timeout=request_options.get("timeout_in_seconds")
54+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
55+
else 60,
3856
)
3957
if 200 <= _response.status_code < 300:
4058
return pydantic.parse_obj_as(AccountDetails, _response.json()) # type: ignore
@@ -49,10 +67,12 @@ class AsyncAccountDetailsClient:
4967
def __init__(self, *, client_wrapper: AsyncClientWrapper):
5068
self._client_wrapper = client_wrapper
5169

52-
async def retrieve(self) -> AccountDetails:
70+
async def retrieve(self, *, request_options: typing.Optional[RequestOptions] = None) -> AccountDetails:
5371
"""
5472
Get details for a linked account.
5573
74+
Parameters:
75+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
5676
---
5777
from merge.client import AsyncMerge
5878
@@ -65,8 +85,20 @@ async def retrieve(self) -> AccountDetails:
6585
_response = await self._client_wrapper.httpx_client.request(
6686
"GET",
6787
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/accounting/v1/account-details"),
68-
headers=self._client_wrapper.get_headers(),
69-
timeout=60,
88+
params=jsonable_encoder(
89+
request_options.get("additional_query_parameters") if request_options is not None else None
90+
),
91+
headers=jsonable_encoder(
92+
remove_none_from_dict(
93+
{
94+
**self._client_wrapper.get_headers(),
95+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
96+
}
97+
)
98+
),
99+
timeout=request_options.get("timeout_in_seconds")
100+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
101+
else 60,
70102
)
71103
if 200 <= _response.status_code < 300:
72104
return pydantic.parse_obj_as(AccountDetails, _response.json()) # type: ignore

src/merge/resources/accounting/resources/account_token/client.py

Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
# This file was auto-generated by Fern from our API Definition.
22

3+
import typing
34
import urllib.parse
45
from json.decoder import JSONDecodeError
56

67
from .....core.api_error import ApiError
78
from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
9+
from .....core.jsonable_encoder import jsonable_encoder
10+
from .....core.remove_none_from_dict import remove_none_from_dict
11+
from .....core.request_options import RequestOptions
812
from ...types.account_token import AccountToken
913

1014
try:
@@ -17,20 +21,44 @@ class AccountTokenClient:
1721
def __init__(self, *, client_wrapper: SyncClientWrapper):
1822
self._client_wrapper = client_wrapper
1923

20-
def retrieve(self, public_token: str) -> AccountToken:
24+
def retrieve(self, public_token: str, *, request_options: typing.Optional[RequestOptions] = None) -> AccountToken:
2125
"""
2226
Returns the account token for the end user with the provided public token.
2327
2428
Parameters:
2529
- public_token: str.
30+
31+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
32+
---
33+
from merge.client import Merge
34+
35+
client = Merge(
36+
account_token="YOUR_ACCOUNT_TOKEN",
37+
api_key="YOUR_API_KEY",
38+
)
39+
client.accounting.account_token.retrieve(
40+
public_token="string",
41+
)
2642
"""
2743
_response = self._client_wrapper.httpx_client.request(
2844
"GET",
2945
urllib.parse.urljoin(
3046
f"{self._client_wrapper.get_base_url()}/", f"api/accounting/v1/account-token/{public_token}"
3147
),
32-
headers=self._client_wrapper.get_headers(),
33-
timeout=60,
48+
params=jsonable_encoder(
49+
request_options.get("additional_query_parameters") if request_options is not None else None
50+
),
51+
headers=jsonable_encoder(
52+
remove_none_from_dict(
53+
{
54+
**self._client_wrapper.get_headers(),
55+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
56+
}
57+
)
58+
),
59+
timeout=request_options.get("timeout_in_seconds")
60+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
61+
else 60,
3462
)
3563
if 200 <= _response.status_code < 300:
3664
return pydantic.parse_obj_as(AccountToken, _response.json()) # type: ignore
@@ -45,20 +73,46 @@ class AsyncAccountTokenClient:
4573
def __init__(self, *, client_wrapper: AsyncClientWrapper):
4674
self._client_wrapper = client_wrapper
4775

48-
async def retrieve(self, public_token: str) -> AccountToken:
76+
async def retrieve(
77+
self, public_token: str, *, request_options: typing.Optional[RequestOptions] = None
78+
) -> AccountToken:
4979
"""
5080
Returns the account token for the end user with the provided public token.
5181
5282
Parameters:
5383
- public_token: str.
84+
85+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
86+
---
87+
from merge.client import AsyncMerge
88+
89+
client = AsyncMerge(
90+
account_token="YOUR_ACCOUNT_TOKEN",
91+
api_key="YOUR_API_KEY",
92+
)
93+
await client.accounting.account_token.retrieve(
94+
public_token="string",
95+
)
5496
"""
5597
_response = await self._client_wrapper.httpx_client.request(
5698
"GET",
5799
urllib.parse.urljoin(
58100
f"{self._client_wrapper.get_base_url()}/", f"api/accounting/v1/account-token/{public_token}"
59101
),
60-
headers=self._client_wrapper.get_headers(),
61-
timeout=60,
102+
params=jsonable_encoder(
103+
request_options.get("additional_query_parameters") if request_options is not None else None
104+
),
105+
headers=jsonable_encoder(
106+
remove_none_from_dict(
107+
{
108+
**self._client_wrapper.get_headers(),
109+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
110+
}
111+
)
112+
),
113+
timeout=request_options.get("timeout_in_seconds")
114+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
115+
else 60,
62116
)
63117
if 200 <= _response.status_code < 300:
64118
return pydantic.parse_obj_as(AccountToken, _response.json()) # type: ignore

0 commit comments

Comments
 (0)