Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
369 changes: 125 additions & 244 deletions poetry.lock

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "MergePythonClient"
version = "1.0.5"
version = "1.0.7"
description = ""
readme = "README.md"
authors = []
Expand All @@ -9,9 +9,10 @@ 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"
Expand Down
2 changes: 2 additions & 0 deletions src/merge/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
from .datetime_utils import serialize_datetime
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",
"RequestOptions",
"SyncClientWrapper",
"jsonable_encoder",
"remove_none_from_dict",
Expand Down
2 changes: 1 addition & 1 deletion src/merge/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def get_headers(self) -> typing.Dict[str, str]:
headers: typing.Dict[str, str] = {
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "MergePythonClient",
"X-Fern-SDK-Version": "1.0.5",
"X-Fern-SDK-Version": "1.0.7",
}
if self._account_token is not None:
headers["X-Account-Token"] = self._account_token
Expand Down
29 changes: 29 additions & 0 deletions src/merge/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]]
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# This file was auto-generated by Fern from our API Definition.

import typing
import urllib.parse
from json.decoder import JSONDecodeError

from .....core.api_error import ApiError
from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from .....core.jsonable_encoder import jsonable_encoder
from .....core.remove_none_from_dict import remove_none_from_dict
from .....core.request_options import RequestOptions
from ...types.account_details import AccountDetails

try:
Expand All @@ -17,10 +21,12 @@ class AccountDetailsClient:
def __init__(self, *, client_wrapper: SyncClientWrapper):
self._client_wrapper = client_wrapper

def retrieve(self) -> AccountDetails:
def retrieve(self, *, request_options: typing.Optional[RequestOptions] = None) -> AccountDetails:
"""
Get details for a linked account.

Parameters:
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
---
from merge.client import Merge

Expand All @@ -33,8 +39,20 @@ def retrieve(self) -> AccountDetails:
_response = self._client_wrapper.httpx_client.request(
"GET",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/accounting/v1/account-details"),
headers=self._client_wrapper.get_headers(),
timeout=60,
params=jsonable_encoder(
request_options.get("additional_query_parameters") if request_options is not None else None
),
headers=jsonable_encoder(
remove_none_from_dict(
{
**self._client_wrapper.get_headers(),
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
}
)
),
timeout=request_options.get("timeout_in_seconds")
if request_options is not None and request_options.get("timeout_in_seconds") is not None
else 60,
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(AccountDetails, _response.json()) # type: ignore
Expand All @@ -49,10 +67,12 @@ class AsyncAccountDetailsClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
self._client_wrapper = client_wrapper

async def retrieve(self) -> AccountDetails:
async def retrieve(self, *, request_options: typing.Optional[RequestOptions] = None) -> AccountDetails:
"""
Get details for a linked account.

Parameters:
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
---
from merge.client import AsyncMerge

Expand All @@ -65,8 +85,20 @@ async def retrieve(self) -> AccountDetails:
_response = await self._client_wrapper.httpx_client.request(
"GET",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/accounting/v1/account-details"),
headers=self._client_wrapper.get_headers(),
timeout=60,
params=jsonable_encoder(
request_options.get("additional_query_parameters") if request_options is not None else None
),
headers=jsonable_encoder(
remove_none_from_dict(
{
**self._client_wrapper.get_headers(),
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
}
)
),
timeout=request_options.get("timeout_in_seconds")
if request_options is not None and request_options.get("timeout_in_seconds") is not None
else 60,
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(AccountDetails, _response.json()) # type: ignore
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# This file was auto-generated by Fern from our API Definition.

import typing
import urllib.parse
from json.decoder import JSONDecodeError

from .....core.api_error import ApiError
from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from .....core.jsonable_encoder import jsonable_encoder
from .....core.remove_none_from_dict import remove_none_from_dict
from .....core.request_options import RequestOptions
from ...types.account_token import AccountToken

try:
Expand All @@ -17,20 +21,44 @@ class AccountTokenClient:
def __init__(self, *, client_wrapper: SyncClientWrapper):
self._client_wrapper = client_wrapper

def retrieve(self, public_token: str) -> AccountToken:
def retrieve(self, public_token: str, *, request_options: typing.Optional[RequestOptions] = None) -> AccountToken:
"""
Returns the account token for the end user with the provided public token.

Parameters:
- public_token: str.

- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
---
from merge.client import Merge

client = Merge(
account_token="YOUR_ACCOUNT_TOKEN",
api_key="YOUR_API_KEY",
)
client.accounting.account_token.retrieve(
public_token="string",
)
"""
_response = self._client_wrapper.httpx_client.request(
"GET",
urllib.parse.urljoin(
f"{self._client_wrapper.get_base_url()}/", f"api/accounting/v1/account-token/{public_token}"
),
headers=self._client_wrapper.get_headers(),
timeout=60,
params=jsonable_encoder(
request_options.get("additional_query_parameters") if request_options is not None else None
),
headers=jsonable_encoder(
remove_none_from_dict(
{
**self._client_wrapper.get_headers(),
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
}
)
),
timeout=request_options.get("timeout_in_seconds")
if request_options is not None and request_options.get("timeout_in_seconds") is not None
else 60,
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(AccountToken, _response.json()) # type: ignore
Expand All @@ -45,20 +73,46 @@ class AsyncAccountTokenClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
self._client_wrapper = client_wrapper

async def retrieve(self, public_token: str) -> AccountToken:
async def retrieve(
self, public_token: str, *, request_options: typing.Optional[RequestOptions] = None
) -> AccountToken:
"""
Returns the account token for the end user with the provided public token.

Parameters:
- public_token: str.

- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
---
from merge.client import AsyncMerge

client = AsyncMerge(
account_token="YOUR_ACCOUNT_TOKEN",
api_key="YOUR_API_KEY",
)
await client.accounting.account_token.retrieve(
public_token="string",
)
"""
_response = await self._client_wrapper.httpx_client.request(
"GET",
urllib.parse.urljoin(
f"{self._client_wrapper.get_base_url()}/", f"api/accounting/v1/account-token/{public_token}"
),
headers=self._client_wrapper.get_headers(),
timeout=60,
params=jsonable_encoder(
request_options.get("additional_query_parameters") if request_options is not None else None
),
headers=jsonable_encoder(
remove_none_from_dict(
{
**self._client_wrapper.get_headers(),
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
}
)
),
timeout=request_options.get("timeout_in_seconds")
if request_options is not None and request_options.get("timeout_in_seconds") is not None
else 60,
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(AccountToken, _response.json()) # type: ignore
Expand Down
Loading