Skip to content

Commit

Permalink
Release 0.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Nov 8, 2023
1 parent de78bac commit 646c02a
Show file tree
Hide file tree
Showing 145 changed files with 1,206 additions and 379 deletions.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "mercoa"
version = "v0.3.3"
version = "v0.3.4"
description = ""
readme = "README.md"
authors = []
Expand All @@ -11,7 +11,7 @@ packages = [
[tool.poetry.dependencies]
python = "^3.7"
httpx = ">=0.21.2"
pydantic = "^1.9.2"
pydantic = ">= 1.9.2, < 3"

[tool.poetry.dev-dependencies]
mypy = "0.971"
Expand Down
18 changes: 16 additions & 2 deletions src/mercoa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
AuthHeaderMissingError,
BankAccountRequest,
BankAccountResponse,
BankAccountUpdateRequest,
BankAddress,
BankLookupResponse,
BankStatus,
Expand All @@ -34,6 +35,9 @@
CardType,
CheckRequest,
CheckResponse,
CloudMailinAttachment,
CloudMailinEnvelope,
CloudMailinRequest,
ColorSchemeRequest,
ColorSchemeResponse,
CommentId,
Expand Down Expand Up @@ -104,6 +108,7 @@
Itin,
MetadataSchema,
MetadataShowConditions,
MetadataTrigger,
MetadataType,
NotFound,
NotificationConfigurationRequest,
Expand Down Expand Up @@ -175,13 +180,15 @@
TokenGenerationStyleOptions,
TokenGenerationVendorOptions,
Trigger,
Trigger_All,
Trigger_Amount,
Trigger_Metadata,
Trigger_Vendor,
Unauthorized,
Unimplemented,
UserNotificationPolicyResponse,
VendorNetwork,
VendorNotFound,
VendorTrigger,
bank_lookup,
commons,
entity,
Expand Down Expand Up @@ -215,6 +222,7 @@
"AuthHeaderMissingError",
"BankAccountRequest",
"BankAccountResponse",
"BankAccountUpdateRequest",
"BankAddress",
"BankLookupResponse",
"BankStatus",
Expand All @@ -230,6 +238,9 @@
"CardType",
"CheckRequest",
"CheckResponse",
"CloudMailinAttachment",
"CloudMailinEnvelope",
"CloudMailinRequest",
"ColorSchemeRequest",
"ColorSchemeResponse",
"CommentId",
Expand Down Expand Up @@ -301,6 +312,7 @@
"MercoaEnvironment",
"MetadataSchema",
"MetadataShowConditions",
"MetadataTrigger",
"MetadataType",
"NotFound",
"NotificationConfigurationRequest",
Expand Down Expand Up @@ -372,13 +384,15 @@
"TokenGenerationStyleOptions",
"TokenGenerationVendorOptions",
"Trigger",
"Trigger_All",
"Trigger_Amount",
"Trigger_Metadata",
"Trigger_Vendor",
"Unauthorized",
"Unimplemented",
"UserNotificationPolicyResponse",
"VendorNetwork",
"VendorNotFound",
"VendorTrigger",
"bank_lookup",
"commons",
"entity",
Expand Down
2 changes: 1 addition & 1 deletion src/mercoa/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": "mercoa",
"X-Fern-SDK-Version": "v0.3.3",
"X-Fern-SDK-Version": "v0.3.4",
}
headers["Authorization"] = f"Bearer {self._get_token()}"
return headers
Expand Down
14 changes: 8 additions & 6 deletions src/mercoa/core/jsonable_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
from types import GeneratorType
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union

from pydantic import BaseModel
from pydantic.json import ENCODERS_BY_TYPE
try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore

from .datetime_utils import serialize_datetime

Expand All @@ -34,7 +36,7 @@ def generate_encoders_by_class_tuples(
return encoders_by_class_tuples


encoders_by_class_tuples = generate_encoders_by_class_tuples(ENCODERS_BY_TYPE)
encoders_by_class_tuples = generate_encoders_by_class_tuples(pydantic.json.ENCODERS_BY_TYPE)


def jsonable_encoder(obj: Any, custom_encoder: Optional[Dict[Any, Callable[[Any], Any]]] = None) -> Any:
Expand All @@ -46,7 +48,7 @@ def jsonable_encoder(obj: Any, custom_encoder: Optional[Dict[Any, Callable[[Any]
for encoder_type, encoder_instance in custom_encoder.items():
if isinstance(obj, encoder_type):
return encoder_instance(obj)
if isinstance(obj, BaseModel):
if isinstance(obj, pydantic.BaseModel):
encoder = getattr(obj.__config__, "json_encoders", {})
if custom_encoder:
encoder.update(custom_encoder)
Expand Down Expand Up @@ -82,8 +84,8 @@ def jsonable_encoder(obj: Any, custom_encoder: Optional[Dict[Any, Callable[[Any]
encoded_list.append(jsonable_encoder(item, custom_encoder=custom_encoder))
return encoded_list

if type(obj) in ENCODERS_BY_TYPE:
return ENCODERS_BY_TYPE[type(obj)](obj)
if type(obj) in pydantic.json.ENCODERS_BY_TYPE:
return pydantic.json.ENCODERS_BY_TYPE[type(obj)](obj)
for encoder, classes_tuple in encoders_by_class_tuples.items():
if isinstance(obj, classes_tuple):
return encoder(obj)
Expand Down
17 changes: 14 additions & 3 deletions src/mercoa/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
IndividualProfileRequest,
IndividualProfileResponse,
InvalidTaxId,
MetadataTrigger,
NotificationId,
NotificationPolicyRequest,
NotificationPolicyResponse,
Expand All @@ -93,10 +94,12 @@
TokenGenerationStyleOptions,
TokenGenerationVendorOptions,
Trigger,
Trigger_All,
Trigger_Amount,
Trigger_Metadata,
Trigger_Vendor,
UserNotificationPolicyResponse,
VendorNetwork,
VendorTrigger,
)
from .invoice_types import (
ApprovalRequest,
Expand Down Expand Up @@ -126,7 +129,7 @@
InvoiceStatusError,
VendorNotFound,
)
from .ocr import OcrFailure, OcrResponse
from .ocr import CloudMailinAttachment, CloudMailinEnvelope, CloudMailinRequest, OcrFailure, OcrResponse
from .organization_types import (
BusinessOnboardingOptions,
ColorSchemeRequest,
Expand Down Expand Up @@ -163,6 +166,7 @@
from .payment_method_types import (
BankAccountRequest,
BankAccountResponse,
BankAccountUpdateRequest,
BankStatus,
BankType,
CardBrand,
Expand Down Expand Up @@ -222,6 +226,7 @@
"AuthHeaderMissingError",
"BankAccountRequest",
"BankAccountResponse",
"BankAccountUpdateRequest",
"BankAddress",
"BankLookupResponse",
"BankStatus",
Expand All @@ -237,6 +242,9 @@
"CardType",
"CheckRequest",
"CheckResponse",
"CloudMailinAttachment",
"CloudMailinEnvelope",
"CloudMailinRequest",
"ColorSchemeRequest",
"ColorSchemeResponse",
"CommentId",
Expand Down Expand Up @@ -307,6 +315,7 @@
"Itin",
"MetadataSchema",
"MetadataShowConditions",
"MetadataTrigger",
"MetadataType",
"NotFound",
"NotificationConfigurationRequest",
Expand Down Expand Up @@ -378,13 +387,15 @@
"TokenGenerationStyleOptions",
"TokenGenerationVendorOptions",
"Trigger",
"Trigger_All",
"Trigger_Amount",
"Trigger_Metadata",
"Trigger_Vendor",
"Unauthorized",
"Unimplemented",
"UserNotificationPolicyResponse",
"VendorNetwork",
"VendorNotFound",
"VendorTrigger",
"bank_lookup",
"commons",
"entity",
Expand Down
7 changes: 5 additions & 2 deletions src/mercoa/resources/bank_lookup/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import urllib.parse
from json.decoder import JSONDecodeError

import pydantic

from ...core.api_error import ApiError
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ...core.remove_none_from_dict import remove_none_from_dict
Expand All @@ -16,6 +14,11 @@
from ..commons.errors.unimplemented import Unimplemented
from .types.bank_lookup_response import BankLookupResponse

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class BankLookupClient:
def __init__(self, *, client_wrapper: SyncClientWrapper):
Expand Down
7 changes: 5 additions & 2 deletions src/mercoa/resources/bank_lookup/types/bank_address.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
import datetime as dt
import typing

import pydantic

from ....core.datetime_utils import serialize_datetime

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class BankAddress(pydantic.BaseModel):
address: str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
import datetime as dt
import typing

import pydantic

from ....core.datetime_utils import serialize_datetime
from .bank_address import BankAddress

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class BankLookupResponse(pydantic.BaseModel):
bank_name: str = pydantic.Field(alias="bankName")
Expand Down
7 changes: 5 additions & 2 deletions src/mercoa/resources/commons/types/address.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
import datetime as dt
import typing

import pydantic

from ....core.datetime_utils import serialize_datetime

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class Address(pydantic.BaseModel):
address_line_1: str = pydantic.Field(alias="addressLine1")
Expand Down
7 changes: 5 additions & 2 deletions src/mercoa/resources/commons/types/birth_date.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
import datetime as dt
import typing

import pydantic

from ....core.datetime_utils import serialize_datetime

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class BirthDate(pydantic.BaseModel):
day: typing.Optional[str]
Expand Down
7 changes: 5 additions & 2 deletions src/mercoa/resources/commons/types/full_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
import datetime as dt
import typing

import pydantic

from ....core.datetime_utils import serialize_datetime

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class FullName(pydantic.BaseModel):
first_name: str = pydantic.Field(alias="firstName")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
import datetime as dt
import typing

import pydantic

from ....core.datetime_utils import serialize_datetime
from .itin import Itin
from .ssn import Ssn

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class IndividualGovernmentId(pydantic.BaseModel):
ssn: typing.Optional[Ssn]
Expand Down
7 changes: 5 additions & 2 deletions src/mercoa/resources/commons/types/itin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
import datetime as dt
import typing

import pydantic

from ....core.datetime_utils import serialize_datetime

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class Itin(pydantic.BaseModel):
full: typing.Optional[str]
Expand Down
7 changes: 5 additions & 2 deletions src/mercoa/resources/commons/types/phone_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
import datetime as dt
import typing

import pydantic

from ....core.datetime_utils import serialize_datetime

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class PhoneNumber(pydantic.BaseModel):
country_code: str = pydantic.Field(alias="countryCode")
Expand Down
Loading

0 comments on commit 646c02a

Please sign in to comment.