Skip to content
Merged
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,4 @@ while response.next is not None:




2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "MergePythonClient"

[tool.poetry]
name = "MergePythonClient"
version = "2.2.0"
version = "2.3.0"
description = ""
readme = "README.md"
authors = []
Expand Down
44 changes: 40 additions & 4 deletions src/merge/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,46 @@

# isort: skip_file

from .resources import accounting, ats, crm, filestorage, hris, ticketing
from .client import AsyncMerge, Merge
from .environment import MergeEnvironment
from .version import __version__
import typing
from importlib import import_module

if typing.TYPE_CHECKING:
from .resources import accounting, ats, crm, filestorage, hris, ticketing
from .client import AsyncMerge, Merge
from .environment import MergeEnvironment
from .version import __version__
_dynamic_imports: typing.Dict[str, str] = {
"AsyncMerge": ".client",
"Merge": ".client",
"MergeEnvironment": ".environment",
"__version__": ".version",
"accounting": ".resources",
"ats": ".resources",
"crm": ".resources",
"filestorage": ".resources",
"hris": ".resources",
"ticketing": ".resources",
}


def __getattr__(attr_name: str) -> typing.Any:
module_name = _dynamic_imports.get(attr_name)
if module_name is None:
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
try:
module = import_module(module_name, __package__)
result = getattr(module, attr_name)
return result
except ImportError as e:
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
except AttributeError as e:
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e


def __dir__():
lazy_attrs = list(_dynamic_imports.keys())
return sorted(lazy_attrs)


__all__ = [
"AsyncMerge",
Expand Down
136 changes: 118 additions & 18 deletions src/merge/client.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# This file was auto-generated by Fern from our API Definition.

from __future__ import annotations

import typing

import httpx
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from .environment import MergeEnvironment
from .resources.accounting.client import AccountingClient, AsyncAccountingClient
from .resources.ats.client import AsyncAtsClient, AtsClient
from .resources.crm.client import AsyncCrmClient, CrmClient
from .resources.filestorage.client import AsyncFilestorageClient, FilestorageClient
from .resources.hris.client import AsyncHrisClient, HrisClient
from .resources.ticketing.client import AsyncTicketingClient, TicketingClient

if typing.TYPE_CHECKING:
from .resources.accounting.client import AccountingClient, AsyncAccountingClient
from .resources.ats.client import AsyncAtsClient, AtsClient
from .resources.crm.client import AsyncCrmClient, CrmClient
from .resources.filestorage.client import AsyncFilestorageClient, FilestorageClient
from .resources.hris.client import AsyncHrisClient, HrisClient
from .resources.ticketing.client import AsyncTicketingClient, TicketingClient


class Merge:
Expand Down Expand Up @@ -82,12 +86,60 @@ def __init__(
else httpx.Client(timeout=_defaulted_timeout),
timeout=_defaulted_timeout,
)
self.ats = AtsClient(client_wrapper=self._client_wrapper)
self.crm = CrmClient(client_wrapper=self._client_wrapper)
self.filestorage = FilestorageClient(client_wrapper=self._client_wrapper)
self.hris = HrisClient(client_wrapper=self._client_wrapper)
self.ticketing = TicketingClient(client_wrapper=self._client_wrapper)
self.accounting = AccountingClient(client_wrapper=self._client_wrapper)
self._ats: typing.Optional[AtsClient] = None
self._crm: typing.Optional[CrmClient] = None
self._filestorage: typing.Optional[FilestorageClient] = None
self._hris: typing.Optional[HrisClient] = None
self._ticketing: typing.Optional[TicketingClient] = None
self._accounting: typing.Optional[AccountingClient] = None

@property
def ats(self):
if self._ats is None:
from .resources.ats.client import AtsClient # noqa: E402

self._ats = AtsClient(client_wrapper=self._client_wrapper)
return self._ats

@property
def crm(self):
if self._crm is None:
from .resources.crm.client import CrmClient # noqa: E402

self._crm = CrmClient(client_wrapper=self._client_wrapper)
return self._crm

@property
def filestorage(self):
if self._filestorage is None:
from .resources.filestorage.client import FilestorageClient # noqa: E402

self._filestorage = FilestorageClient(client_wrapper=self._client_wrapper)
return self._filestorage

@property
def hris(self):
if self._hris is None:
from .resources.hris.client import HrisClient # noqa: E402

self._hris = HrisClient(client_wrapper=self._client_wrapper)
return self._hris

@property
def ticketing(self):
if self._ticketing is None:
from .resources.ticketing.client import TicketingClient # noqa: E402

self._ticketing = TicketingClient(client_wrapper=self._client_wrapper)
return self._ticketing

@property
def accounting(self):
if self._accounting is None:
from .resources.accounting.client import AccountingClient # noqa: E402

self._accounting = AccountingClient(client_wrapper=self._client_wrapper)
return self._accounting


class AsyncMerge:
Expand Down Expand Up @@ -159,12 +211,60 @@ def __init__(
else httpx.AsyncClient(timeout=_defaulted_timeout),
timeout=_defaulted_timeout,
)
self.ats = AsyncAtsClient(client_wrapper=self._client_wrapper)
self.crm = AsyncCrmClient(client_wrapper=self._client_wrapper)
self.filestorage = AsyncFilestorageClient(client_wrapper=self._client_wrapper)
self.hris = AsyncHrisClient(client_wrapper=self._client_wrapper)
self.ticketing = AsyncTicketingClient(client_wrapper=self._client_wrapper)
self.accounting = AsyncAccountingClient(client_wrapper=self._client_wrapper)
self._ats: typing.Optional[AsyncAtsClient] = None
self._crm: typing.Optional[AsyncCrmClient] = None
self._filestorage: typing.Optional[AsyncFilestorageClient] = None
self._hris: typing.Optional[AsyncHrisClient] = None
self._ticketing: typing.Optional[AsyncTicketingClient] = None
self._accounting: typing.Optional[AsyncAccountingClient] = None

@property
def ats(self):
if self._ats is None:
from .resources.ats.client import AsyncAtsClient # noqa: E402

self._ats = AsyncAtsClient(client_wrapper=self._client_wrapper)
return self._ats

@property
def crm(self):
if self._crm is None:
from .resources.crm.client import AsyncCrmClient # noqa: E402

self._crm = AsyncCrmClient(client_wrapper=self._client_wrapper)
return self._crm

@property
def filestorage(self):
if self._filestorage is None:
from .resources.filestorage.client import AsyncFilestorageClient # noqa: E402

self._filestorage = AsyncFilestorageClient(client_wrapper=self._client_wrapper)
return self._filestorage

@property
def hris(self):
if self._hris is None:
from .resources.hris.client import AsyncHrisClient # noqa: E402

self._hris = AsyncHrisClient(client_wrapper=self._client_wrapper)
return self._hris

@property
def ticketing(self):
if self._ticketing is None:
from .resources.ticketing.client import AsyncTicketingClient # noqa: E402

self._ticketing = AsyncTicketingClient(client_wrapper=self._client_wrapper)
return self._ticketing

@property
def accounting(self):
if self._accounting is None:
from .resources.accounting.client import AsyncAccountingClient # noqa: E402

self._accounting = AsyncAccountingClient(client_wrapper=self._client_wrapper)
return self._accounting


def _get_base_url(*, base_url: typing.Optional[str] = None, environment: MergeEnvironment) -> str:
Expand Down
96 changes: 75 additions & 21 deletions src/merge/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,81 @@

# isort: skip_file

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, with_content_type
from .http_client import AsyncHttpClient, HttpClient
from .http_response import AsyncHttpResponse, HttpResponse
from .jsonable_encoder import jsonable_encoder
from .pydantic_utilities import (
IS_PYDANTIC_V2,
UniversalBaseModel,
UniversalRootModel,
parse_obj_as,
universal_field_validator,
universal_root_validator,
update_forward_refs,
)
from .query_encoder import encode_query
from .remove_none_from_dict import remove_none_from_dict
from .request_options import RequestOptions
from .serialization import FieldMetadata, convert_and_respect_annotation_metadata
from .unchecked_base_model import UncheckedBaseModel, UnionMetadata, construct_type
import typing
from importlib import import_module

if typing.TYPE_CHECKING:
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, with_content_type
from .http_client import AsyncHttpClient, HttpClient
from .http_response import AsyncHttpResponse, HttpResponse
from .jsonable_encoder import jsonable_encoder
from .pydantic_utilities import (
IS_PYDANTIC_V2,
UniversalBaseModel,
UniversalRootModel,
parse_obj_as,
universal_field_validator,
universal_root_validator,
update_forward_refs,
)
from .query_encoder import encode_query
from .remove_none_from_dict import remove_none_from_dict
from .request_options import RequestOptions
from .serialization import FieldMetadata, convert_and_respect_annotation_metadata
from .unchecked_base_model import UncheckedBaseModel, UnionMetadata, construct_type
_dynamic_imports: typing.Dict[str, str] = {
"ApiError": ".api_error",
"AsyncClientWrapper": ".client_wrapper",
"AsyncHttpClient": ".http_client",
"AsyncHttpResponse": ".http_response",
"BaseClientWrapper": ".client_wrapper",
"FieldMetadata": ".serialization",
"File": ".file",
"HttpClient": ".http_client",
"HttpResponse": ".http_response",
"IS_PYDANTIC_V2": ".pydantic_utilities",
"RequestOptions": ".request_options",
"SyncClientWrapper": ".client_wrapper",
"UncheckedBaseModel": ".unchecked_base_model",
"UnionMetadata": ".unchecked_base_model",
"UniversalBaseModel": ".pydantic_utilities",
"UniversalRootModel": ".pydantic_utilities",
"construct_type": ".unchecked_base_model",
"convert_and_respect_annotation_metadata": ".serialization",
"convert_file_dict_to_httpx_tuples": ".file",
"encode_query": ".query_encoder",
"jsonable_encoder": ".jsonable_encoder",
"parse_obj_as": ".pydantic_utilities",
"remove_none_from_dict": ".remove_none_from_dict",
"serialize_datetime": ".datetime_utils",
"universal_field_validator": ".pydantic_utilities",
"universal_root_validator": ".pydantic_utilities",
"update_forward_refs": ".pydantic_utilities",
"with_content_type": ".file",
}


def __getattr__(attr_name: str) -> typing.Any:
module_name = _dynamic_imports.get(attr_name)
if module_name is None:
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
try:
module = import_module(module_name, __package__)
result = getattr(module, attr_name)
return result
except ImportError as e:
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
except AttributeError as e:
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e


def __dir__():
lazy_attrs = list(_dynamic_imports.keys())
return sorted(lazy_attrs)


__all__ = [
"ApiError",
Expand Down
4 changes: 2 additions & 2 deletions src/merge/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ def __init__(

def get_headers(self) -> typing.Dict[str, str]:
headers: typing.Dict[str, str] = {
"User-Agent": "MergePythonClient/2.2.0",
"User-Agent": "MergePythonClient/2.3.0",
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "MergePythonClient",
"X-Fern-SDK-Version": "2.2.0",
"X-Fern-SDK-Version": "2.3.0",
**(self.get_custom_headers() or {}),
}
if self._account_token is not None:
Expand Down
34 changes: 33 additions & 1 deletion src/merge/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,38 @@

# isort: skip_file

from . import accounting, ats, crm, filestorage, hris, ticketing
import typing
from importlib import import_module

if typing.TYPE_CHECKING:
from . import accounting, ats, crm, filestorage, hris, ticketing
_dynamic_imports: typing.Dict[str, str] = {
"accounting": ".",
"ats": ".",
"crm": ".",
"filestorage": ".",
"hris": ".",
"ticketing": ".",
}


def __getattr__(attr_name: str) -> typing.Any:
module_name = _dynamic_imports.get(attr_name)
if module_name is None:
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
try:
module = import_module(module_name, __package__)
result = getattr(module, attr_name)
return result
except ImportError as e:
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
except AttributeError as e:
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e


def __dir__():
lazy_attrs = list(_dynamic_imports.keys())
return sorted(lazy_attrs)


__all__ = ["accounting", "ats", "crm", "filestorage", "hris", "ticketing"]
Loading