Skip to content

Commit

Permalink
Release v0.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed May 5, 2023
1 parent f58d690 commit 2f02db0
Show file tree
Hide file tree
Showing 28 changed files with 665 additions and 12 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.6"
version = "v0.0.7"
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
18 changes: 18 additions & 0 deletions src/mercoa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
CheckId,
CheckRequest,
CheckResponse,
ColorSchemeRequest,
ColorSchemeResponse,
CommentId,
CommentRequest,
CommentResponse,
CounterpartyResponse,
CreateVendorRequest,
CustomId,
Expand All @@ -45,6 +50,9 @@
EntityResponse,
EntityStatus,
EntityUpdateRequest,
EntityUserId,
EntityUserRequest,
EntityUserResponse,
FullName,
IndividualGovernmentID,
IndividualProfileRequest,
Expand Down Expand Up @@ -90,6 +98,7 @@
commons,
counterparty,
entity,
entity_users,
invoice,
ocr,
organization,
Expand Down Expand Up @@ -121,6 +130,11 @@
"CheckId",
"CheckRequest",
"CheckResponse",
"ColorSchemeRequest",
"ColorSchemeResponse",
"CommentId",
"CommentRequest",
"CommentResponse",
"CounterpartyResponse",
"CreateVendorRequest",
"CustomId",
Expand All @@ -140,6 +154,9 @@
"EntityResponse",
"EntityStatus",
"EntityUpdateRequest",
"EntityUserId",
"EntityUserRequest",
"EntityUserResponse",
"FullName",
"ITIN",
"IndividualGovernmentID",
Expand Down Expand Up @@ -188,6 +205,7 @@
"commons",
"counterparty",
"entity",
"entity_users",
"invoice",
"ocr",
"organization",
Expand Down
9 changes: 9 additions & 0 deletions src/mercoa/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from .resources.bank_lookup.client import AsyncBankLookupClient, BankLookupClient
from .resources.counterparty.client import AsyncCounterpartyClient, CounterpartyClient
from .resources.entity.client import AsyncEntityClient, EntityClient
from .resources.entity_users.client import AsyncEntityUsersClient, EntityUsersClient
from .resources.invoice.client import AsyncInvoiceClient, InvoiceClient
from .resources.ocr.client import AsyncOcrClient, OcrClient
from .resources.organization.client import AsyncOrganizationClient, OrganizationClient
Expand All @@ -31,6 +32,10 @@ def bank_lookup(self) -> BankLookupClient:
def counterparty(self) -> CounterpartyClient:
return CounterpartyClient(environment=self._environment, token=self._token)

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

@cached_property
def entity(self) -> EntityClient:
return EntityClient(environment=self._environment, token=self._token)
Expand Down Expand Up @@ -75,6 +80,10 @@ def bank_lookup(self) -> AsyncBankLookupClient:
def counterparty(self) -> AsyncCounterpartyClient:
return AsyncCounterpartyClient(environment=self._environment, token=self._token)

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

@cached_property
def entity(self) -> AsyncEntityClient:
return AsyncEntityClient(environment=self._environment, token=self._token)
Expand Down
16 changes: 16 additions & 0 deletions src/mercoa/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
commons,
counterparty,
entity,
entity_users,
invoice,
ocr,
organization,
Expand Down Expand Up @@ -32,7 +33,11 @@
ProfileResponse,
TaxID,
)
from .entity_users import EntityUserId, EntityUserRequest, EntityUserResponse
from .invoice import (
CommentId,
CommentRequest,
CommentResponse,
CreateVendorRequest,
DocumentResponse,
InvoiceId,
Expand All @@ -46,6 +51,8 @@
)
from .ocr import Attachments, EmailOcrRequest, OcrMailbox, OCRResponse
from .organization import (
ColorSchemeRequest,
ColorSchemeResponse,
EmailLogResponse,
EmailProviderRequest,
EmailProviderResponse,
Expand Down Expand Up @@ -116,6 +123,11 @@
"CheckId",
"CheckRequest",
"CheckResponse",
"ColorSchemeRequest",
"ColorSchemeResponse",
"CommentId",
"CommentRequest",
"CommentResponse",
"CounterpartyResponse",
"CreateVendorRequest",
"CustomId",
Expand All @@ -135,6 +147,9 @@
"EntityResponse",
"EntityStatus",
"EntityUpdateRequest",
"EntityUserId",
"EntityUserRequest",
"EntityUserResponse",
"FullName",
"ITIN",
"IndividualGovernmentID",
Expand Down Expand Up @@ -182,6 +197,7 @@
"commons",
"counterparty",
"entity",
"entity_users",
"invoice",
"ocr",
"organization",
Expand Down
33 changes: 33 additions & 0 deletions src/mercoa/resources/entity/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,22 @@ def get_token(self, entity_id: EntityId) -> str:
return pydantic.parse_obj_as(str, _response_json) # type: ignore
raise ApiError(status_code=_response.status_code, body=_response_json)

def plaid_link_token(self, entity_id: EntityId) -> str:
_response = httpx.request(
"GET",
urllib.parse.urljoin(f"{self._environment.value}/", f"entity/{entity_id}/plaidLinkToken"),
headers=remove_none_from_headers(
{"Authorization": f"Bearer {self._token}" if self._token is not None else None}
),
)
try:
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, body=_response.text)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(str, _response_json) # type: ignore
raise ApiError(status_code=_response.status_code, body=_response_json)


class AsyncEntityClient:
def __init__(
Expand Down Expand Up @@ -347,3 +363,20 @@ async def get_token(self, entity_id: EntityId) -> str:
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(str, _response_json) # type: ignore
raise ApiError(status_code=_response.status_code, body=_response_json)

async def plaid_link_token(self, entity_id: EntityId) -> str:
async with httpx.AsyncClient() as _client:
_response = await _client.request(
"GET",
urllib.parse.urljoin(f"{self._environment.value}/", f"entity/{entity_id}/plaidLinkToken"),
headers=remove_none_from_headers(
{"Authorization": f"Bearer {self._token}" if self._token is not None else None}
),
)
try:
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, body=_response.text)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(str, _response_json) # type: ignore
raise ApiError(status_code=_response.status_code, body=_response_json)
5 changes: 5 additions & 0 deletions src/mercoa/resources/entity_users/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file was auto-generated by Fern from our API Definition.

from .types import EntityUserId, EntityUserRequest, EntityUserResponse

__all__ = ["EntityUserId", "EntityUserRequest", "EntityUserResponse"]
Loading

0 comments on commit 2f02db0

Please sign in to comment.