Skip to content

Commit

Permalink
Release v0.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed May 11, 2023
1 parent 2f02db0 commit 29ac931
Show file tree
Hide file tree
Showing 31 changed files with 1,104 additions and 32 deletions.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

[tool.poetry]
name = "mercoa"
version = "v0.0.7"
version = "v0.0.8"
description = ""
authors = []
packages = [
Expand All @@ -11,9 +11,9 @@ packages = [
[tool.poetry.dependencies]
python = "^3.7"
backports-cached_property = "1.0.2"
pydantic = "^1.9.2"
httpx = "0.23.3"
types-backports = "0.1.3"
pydantic = "^1.9.2"

[tool.poetry.dev-dependencies]
mypy = "0.971"
Expand Down
10 changes: 10 additions & 0 deletions src/mercoa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
CommentResponse,
CounterpartyResponse,
CreateVendorRequest,
CurrencyCode,
CustomId,
CustomPaymentMethodRequest,
CustomPaymentMethodResponse,
Expand All @@ -53,13 +54,15 @@
EntityUserId,
EntityUserRequest,
EntityUserResponse,
FindCounterpartiesResponse,
FullName,
IndividualGovernmentID,
IndividualProfileRequest,
IndividualProfileResponse,
InvoiceId,
InvoiceLineItemRequest,
InvoiceLineItemResponse,
InvoiceMetricsResponse,
InvoiceRequest,
InvoiceResponse,
InvoiceStatus,
Expand Down Expand Up @@ -91,6 +94,7 @@
RepresentativeResponse,
Responsibilities,
TaxID,
TransactionId,
TransactionResponse,
TransactionStatus,
UnauthorizedError,
Expand All @@ -105,6 +109,7 @@
payment_method,
payment_method_schema,
representative,
transaction,
)

__all__ = [
Expand Down Expand Up @@ -137,6 +142,7 @@
"CommentResponse",
"CounterpartyResponse",
"CreateVendorRequest",
"CurrencyCode",
"CustomId",
"CustomPaymentMethodRequest",
"CustomPaymentMethodResponse",
Expand All @@ -157,6 +163,7 @@
"EntityUserId",
"EntityUserRequest",
"EntityUserResponse",
"FindCounterpartiesResponse",
"FullName",
"ITIN",
"IndividualGovernmentID",
Expand All @@ -165,6 +172,7 @@
"InvoiceId",
"InvoiceLineItemRequest",
"InvoiceLineItemResponse",
"InvoiceMetricsResponse",
"InvoiceRequest",
"InvoiceResponse",
"InvoiceStatus",
Expand Down Expand Up @@ -198,6 +206,7 @@
"Responsibilities",
"SSN",
"TaxID",
"TransactionId",
"TransactionResponse",
"TransactionStatus",
"UnauthorizedError",
Expand All @@ -212,4 +221,5 @@
"payment_method",
"payment_method_schema",
"representative",
"transaction",
]
9 changes: 9 additions & 0 deletions src/mercoa/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from .resources.payment_method.client import AsyncPaymentMethodClient, PaymentMethodClient
from .resources.payment_method_schema.client import AsyncPaymentMethodSchemaClient, PaymentMethodSchemaClient
from .resources.representative.client import AsyncRepresentativeClient, RepresentativeClient
from .resources.transaction.client import AsyncTransactionClient, TransactionClient


class Mercoa:
Expand Down Expand Up @@ -64,6 +65,10 @@ def payment_method(self) -> PaymentMethodClient:
def representative(self) -> RepresentativeClient:
return RepresentativeClient(environment=self._environment, token=self._token)

@cached_property
def transaction(self) -> TransactionClient:
return TransactionClient(environment=self._environment, token=self._token)


class AsyncMercoa:
def __init__(
Expand Down Expand Up @@ -111,3 +116,7 @@ def payment_method(self) -> AsyncPaymentMethodClient:
@cached_property
def representative(self) -> AsyncRepresentativeClient:
return AsyncRepresentativeClient(environment=self._environment, token=self._token)

@cached_property
def transaction(self) -> AsyncTransactionClient:
return AsyncTransactionClient(environment=self._environment, token=self._token)
13 changes: 10 additions & 3 deletions src/mercoa/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
payment_method,
payment_method_schema,
representative,
transaction,
)
from .bank_lookup import BankAddress, BankLookupResponse
from .commons import ITIN, SSN, Address, BirthDate, FullName, IndividualGovernmentID, PhoneNumber, UnauthorizedError
from .counterparty import CounterpartyResponse
from .counterparty import CounterpartyResponse, FindCounterpartiesResponse
from .entity import (
AccountType,
BusinessProfileRequest,
Expand All @@ -29,6 +30,7 @@
EntityUpdateRequest,
IndividualProfileRequest,
IndividualProfileResponse,
InvoiceMetricsResponse,
ProfileRequest,
ProfileResponse,
TaxID,
Expand All @@ -39,15 +41,14 @@
CommentRequest,
CommentResponse,
CreateVendorRequest,
CurrencyCode,
DocumentResponse,
InvoiceId,
InvoiceLineItemRequest,
InvoiceLineItemResponse,
InvoiceRequest,
InvoiceResponse,
InvoiceStatus,
TransactionResponse,
TransactionStatus,
)
from .ocr import Attachments, EmailOcrRequest, OcrMailbox, OCRResponse
from .organization import (
Expand Down Expand Up @@ -99,6 +100,7 @@
PaymentMethodSchemaResponse,
)
from .representative import RepresentativeId, RepresentativeRequest, RepresentativeResponse, Responsibilities
from .transaction import TransactionId, TransactionResponse, TransactionStatus

__all__ = [
"AccountType",
Expand Down Expand Up @@ -130,6 +132,7 @@
"CommentResponse",
"CounterpartyResponse",
"CreateVendorRequest",
"CurrencyCode",
"CustomId",
"CustomPaymentMethodRequest",
"CustomPaymentMethodResponse",
Expand All @@ -150,6 +153,7 @@
"EntityUserId",
"EntityUserRequest",
"EntityUserResponse",
"FindCounterpartiesResponse",
"FullName",
"ITIN",
"IndividualGovernmentID",
Expand All @@ -158,6 +162,7 @@
"InvoiceId",
"InvoiceLineItemRequest",
"InvoiceLineItemResponse",
"InvoiceMetricsResponse",
"InvoiceRequest",
"InvoiceResponse",
"InvoiceStatus",
Expand Down Expand Up @@ -190,6 +195,7 @@
"Responsibilities",
"SSN",
"TaxID",
"TransactionId",
"TransactionResponse",
"TransactionStatus",
"UnauthorizedError",
Expand All @@ -204,4 +210,5 @@
"payment_method",
"payment_method_schema",
"representative",
"transaction",
]
4 changes: 2 additions & 2 deletions src/mercoa/resources/counterparty/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file was auto-generated by Fern from our API Definition.

from .types import CounterpartyResponse
from .types import CounterpartyResponse, FindCounterpartiesResponse

__all__ = ["CounterpartyResponse"]
__all__ = ["CounterpartyResponse", "FindCounterpartiesResponse"]
12 changes: 5 additions & 7 deletions src/mercoa/resources/counterparty/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from ...environment import MercoaEnvironment
from ..entity.types.entity_id import EntityId
from ..entity.types.entity_response import EntityResponse
from .types.counterparty_response import CounterpartyResponse
from .types.find_counterparties_response import FindCounterpartiesResponse


class CounterpartyClient:
Expand All @@ -38,9 +38,7 @@ def get_all(self) -> typing.List[EntityResponse]:
return pydantic.parse_obj_as(typing.List[EntityResponse], _response_json) # type: ignore
raise ApiError(status_code=_response.status_code, body=_response_json)

def find(
self, entity_id: EntityId, *, payment_methods: typing.Optional[bool] = None
) -> typing.List[CounterpartyResponse]:
def find(self, entity_id: EntityId, *, payment_methods: typing.Optional[bool] = None) -> FindCounterpartiesResponse:
_response = httpx.request(
"GET",
urllib.parse.urljoin(f"{self._environment.value}/", f"entity/{entity_id}/counterparties"),
Expand All @@ -54,7 +52,7 @@ def find(
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, body=_response.text)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(typing.List[CounterpartyResponse], _response_json) # type: ignore
return pydantic.parse_obj_as(FindCounterpartiesResponse, _response_json) # type: ignore
raise ApiError(status_code=_response.status_code, body=_response_json)


Expand Down Expand Up @@ -84,7 +82,7 @@ async def get_all(self) -> typing.List[EntityResponse]:

async def find(
self, entity_id: EntityId, *, payment_methods: typing.Optional[bool] = None
) -> typing.List[CounterpartyResponse]:
) -> FindCounterpartiesResponse:
async with httpx.AsyncClient() as _client:
_response = await _client.request(
"GET",
Expand All @@ -99,5 +97,5 @@ async def find(
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, body=_response.text)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(typing.List[CounterpartyResponse], _response_json) # type: ignore
return pydantic.parse_obj_as(FindCounterpartiesResponse, _response_json) # type: ignore
raise ApiError(status_code=_response.status_code, body=_response_json)
3 changes: 2 additions & 1 deletion src/mercoa/resources/counterparty/types/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file was auto-generated by Fern from our API Definition.

from .counterparty_response import CounterpartyResponse
from .find_counterparties_response import FindCounterpartiesResponse

__all__ = ["CounterpartyResponse"]
__all__ = ["CounterpartyResponse", "FindCounterpartiesResponse"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This file was auto-generated by Fern from our API Definition.

import datetime as dt
import typing

import pydantic

from ....core.datetime_utils import serialize_datetime
from .counterparty_response import CounterpartyResponse


class FindCounterpartiesResponse(pydantic.BaseModel):
entity_counterparties: typing.List[CounterpartyResponse] = pydantic.Field(
alias="entityCounterparties", description=("Counterparties that have been paid by this entity\n")
)
platform_counterparties: typing.List[CounterpartyResponse] = pydantic.Field(
alias="platformCounterparties", description=("Counterparties that have paid by any entity on your platform\n")
)
mercoa_counterparties: typing.List[CounterpartyResponse] = pydantic.Field(
alias="mercoaCounterparties", description=("External counterparties that have been verified by Mercoa\n")
)

def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
return super().json(**kwargs_with_defaults)

def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
return super().dict(**kwargs_with_defaults)

class Config:
frozen = True
allow_population_by_field_name = True
json_encoders = {dt.datetime: serialize_datetime}
2 changes: 2 additions & 0 deletions src/mercoa/resources/entity/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
EntityUpdateRequest,
IndividualProfileRequest,
IndividualProfileResponse,
InvoiceMetricsResponse,
ProfileRequest,
ProfileResponse,
TaxID,
Expand All @@ -31,6 +32,7 @@
"EntityUpdateRequest",
"IndividualProfileRequest",
"IndividualProfileResponse",
"InvoiceMetricsResponse",
"ProfileRequest",
"ProfileResponse",
"TaxID",
Expand Down
Loading

0 comments on commit 29ac931

Please sign in to comment.