Skip to content

Commit

Permalink
Release 0.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Oct 10, 2023
1 parent 7b4329a commit 60892fa
Show file tree
Hide file tree
Showing 15 changed files with 143 additions and 141 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "mercoa"
version = "v0.3.0"
version = "v0.3.1"
description = ""
readme = "README.md"
authors = []
Expand Down
2 changes: 0 additions & 2 deletions src/mercoa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
CommentId,
CommentRequest,
CommentResponse,
CounterpartiesResponse,
CounterpartyNetworkType,
CounterpartyResponse,
CurrencyCode,
Expand Down Expand Up @@ -234,7 +233,6 @@
"CommentId",
"CommentRequest",
"CommentResponse",
"CounterpartiesResponse",
"CounterpartyNetworkType",
"CounterpartyResponse",
"CurrencyCode",
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.0",
"X-Fern-SDK-Version": "v0.3.1",
}
headers["Authorization"] = f"Bearer {self._get_token()}"
return headers
Expand Down
2 changes: 0 additions & 2 deletions src/mercoa/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
BusinessProfileRequest,
BusinessProfileResponse,
BusinessType,
CounterpartiesResponse,
CounterpartyNetworkType,
CounterpartyResponse,
Ein,
Expand Down Expand Up @@ -241,7 +240,6 @@
"CommentId",
"CommentRequest",
"CommentResponse",
"CounterpartiesResponse",
"CounterpartyNetworkType",
"CounterpartyResponse",
"CurrencyCode",
Expand Down
123 changes: 32 additions & 91 deletions src/mercoa/resources/entity/resources/counterparty/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from ....commons.errors.not_found import NotFound
from ....commons.errors.unauthorized import Unauthorized
from ....commons.errors.unimplemented import Unimplemented
from ....entity_types.types.counterparties_response import CounterpartiesResponse
from ....entity_types.types.counterparty_network_type import CounterpartyNetworkType
from ....entity_types.types.entity_add_payees_request import EntityAddPayeesRequest
from ....entity_types.types.entity_add_payors_request import EntityAddPayorsRequest
Expand All @@ -33,51 +32,6 @@ class CounterpartyClient:
def __init__(self, *, client_wrapper: SyncClientWrapper):
self._client_wrapper = client_wrapper

def find(
self,
entity_id: EntityId,
*,
payment_methods: typing.Optional[bool] = None,
counterparty_id: typing.Union[typing.Optional[EntityId], typing.List[EntityId]],
) -> CounterpartiesResponse:
"""
Find counterparties. Deprecated. Use findPayees or findPayors instead.
Parameters:
- entity_id: EntityId.
- payment_methods: typing.Optional[bool]. If true, will include counterparty payment methods as part of the response
- counterparty_id: typing.Union[typing.Optional[EntityId], typing.List[EntityId]]. Filter by counterparty ids
"""
_response = self._client_wrapper.httpx_client.request(
"GET",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"entity/{entity_id}/counterparties"),
params=remove_none_from_dict({"paymentMethods": payment_methods, "counterpartyId": counterparty_id}),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
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(CounterpartiesResponse, _response_json) # type: ignore
if "errorName" in _response_json:
if _response_json["errorName"] == "AuthHeaderMissingError":
raise AuthHeaderMissingError()
if _response_json["errorName"] == "AuthHeaderMalformedError":
raise AuthHeaderMalformedError(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
if _response_json["errorName"] == "Unauthorized":
raise Unauthorized(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
if _response_json["errorName"] == "Forbidden":
raise Forbidden(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
if _response_json["errorName"] == "NotFound":
raise NotFound(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
if _response_json["errorName"] == "Unimplemented":
raise Unimplemented(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
raise ApiError(status_code=_response.status_code, body=_response_json)

def find_payees(
self,
entity_id: EntityId,
Expand All @@ -86,6 +40,8 @@ def find_payees(
network_type: typing.Union[typing.Optional[CounterpartyNetworkType], typing.List[CounterpartyNetworkType]],
payment_methods: typing.Optional[bool] = None,
counterparty_id: typing.Union[typing.Optional[EntityId], typing.List[EntityId]],
limit: typing.Optional[int] = None,
starting_after: typing.Optional[EntityId] = None,
) -> FindCounterpartiesResponse:
"""
Find payee counterparties. This endpoint lets you find vendors linked to the entity.
Expand All @@ -100,6 +56,10 @@ def find_payees(
- payment_methods: typing.Optional[bool]. If true, will include counterparty payment methods as part of the response
- counterparty_id: typing.Union[typing.Optional[EntityId], typing.List[EntityId]]. Filter by counterparty ids
- limit: typing.Optional[int]. Number of counterparties to return. Limit can range between 1 and 100, and the default is 10.
- starting_after: typing.Optional[EntityId]. The ID of the counterparties to start after. If not provided, the first page of counterparties will be returned.
"""
_response = self._client_wrapper.httpx_client.request(
"GET",
Expand All @@ -112,6 +72,8 @@ def find_payees(
"networkType": network_type,
"paymentMethods": payment_methods,
"counterpartyId": counterparty_id,
"limit": limit,
"startingAfter": starting_after,
}
),
headers=self._client_wrapper.get_headers(),
Expand Down Expand Up @@ -146,6 +108,8 @@ def find_payors(
network_type: typing.Union[typing.Optional[CounterpartyNetworkType], typing.List[CounterpartyNetworkType]],
payment_methods: typing.Optional[bool] = None,
counterparty_id: typing.Union[typing.Optional[EntityId], typing.List[EntityId]],
limit: typing.Optional[int] = None,
starting_after: typing.Optional[EntityId] = None,
) -> FindCounterpartiesResponse:
"""
Find payor counterparties. This endpoint lets you find customers linked to the entity.
Expand All @@ -160,6 +124,10 @@ def find_payors(
- payment_methods: typing.Optional[bool]. If true, will include counterparty payment methods as part of the response
- counterparty_id: typing.Union[typing.Optional[EntityId], typing.List[EntityId]]. Filter by counterparty ids
- limit: typing.Optional[int]. Number of counterparties to return. Limit can range between 1 and 100, and the default is 10.
- starting_after: typing.Optional[EntityId]. The ID of the counterparties to start after. If not provided, the first page of counterparties will be returned.
"""
_response = self._client_wrapper.httpx_client.request(
"GET",
Expand All @@ -172,6 +140,8 @@ def find_payors(
"networkType": network_type,
"paymentMethods": payment_methods,
"counterpartyId": counterparty_id,
"limit": limit,
"startingAfter": starting_after,
}
),
headers=self._client_wrapper.get_headers(),
Expand Down Expand Up @@ -351,51 +321,6 @@ class AsyncCounterpartyClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
self._client_wrapper = client_wrapper

async def find(
self,
entity_id: EntityId,
*,
payment_methods: typing.Optional[bool] = None,
counterparty_id: typing.Union[typing.Optional[EntityId], typing.List[EntityId]],
) -> CounterpartiesResponse:
"""
Find counterparties. Deprecated. Use findPayees or findPayors instead.
Parameters:
- entity_id: EntityId.
- payment_methods: typing.Optional[bool]. If true, will include counterparty payment methods as part of the response
- counterparty_id: typing.Union[typing.Optional[EntityId], typing.List[EntityId]]. Filter by counterparty ids
"""
_response = await self._client_wrapper.httpx_client.request(
"GET",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"entity/{entity_id}/counterparties"),
params=remove_none_from_dict({"paymentMethods": payment_methods, "counterpartyId": counterparty_id}),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
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(CounterpartiesResponse, _response_json) # type: ignore
if "errorName" in _response_json:
if _response_json["errorName"] == "AuthHeaderMissingError":
raise AuthHeaderMissingError()
if _response_json["errorName"] == "AuthHeaderMalformedError":
raise AuthHeaderMalformedError(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
if _response_json["errorName"] == "Unauthorized":
raise Unauthorized(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
if _response_json["errorName"] == "Forbidden":
raise Forbidden(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
if _response_json["errorName"] == "NotFound":
raise NotFound(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
if _response_json["errorName"] == "Unimplemented":
raise Unimplemented(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
raise ApiError(status_code=_response.status_code, body=_response_json)

async def find_payees(
self,
entity_id: EntityId,
Expand All @@ -404,6 +329,8 @@ async def find_payees(
network_type: typing.Union[typing.Optional[CounterpartyNetworkType], typing.List[CounterpartyNetworkType]],
payment_methods: typing.Optional[bool] = None,
counterparty_id: typing.Union[typing.Optional[EntityId], typing.List[EntityId]],
limit: typing.Optional[int] = None,
starting_after: typing.Optional[EntityId] = None,
) -> FindCounterpartiesResponse:
"""
Find payee counterparties. This endpoint lets you find vendors linked to the entity.
Expand All @@ -418,6 +345,10 @@ async def find_payees(
- payment_methods: typing.Optional[bool]. If true, will include counterparty payment methods as part of the response
- counterparty_id: typing.Union[typing.Optional[EntityId], typing.List[EntityId]]. Filter by counterparty ids
- limit: typing.Optional[int]. Number of counterparties to return. Limit can range between 1 and 100, and the default is 10.
- starting_after: typing.Optional[EntityId]. The ID of the counterparties to start after. If not provided, the first page of counterparties will be returned.
"""
_response = await self._client_wrapper.httpx_client.request(
"GET",
Expand All @@ -430,6 +361,8 @@ async def find_payees(
"networkType": network_type,
"paymentMethods": payment_methods,
"counterpartyId": counterparty_id,
"limit": limit,
"startingAfter": starting_after,
}
),
headers=self._client_wrapper.get_headers(),
Expand Down Expand Up @@ -464,6 +397,8 @@ async def find_payors(
network_type: typing.Union[typing.Optional[CounterpartyNetworkType], typing.List[CounterpartyNetworkType]],
payment_methods: typing.Optional[bool] = None,
counterparty_id: typing.Union[typing.Optional[EntityId], typing.List[EntityId]],
limit: typing.Optional[int] = None,
starting_after: typing.Optional[EntityId] = None,
) -> FindCounterpartiesResponse:
"""
Find payor counterparties. This endpoint lets you find customers linked to the entity.
Expand All @@ -478,6 +413,10 @@ async def find_payors(
- payment_methods: typing.Optional[bool]. If true, will include counterparty payment methods as part of the response
- counterparty_id: typing.Union[typing.Optional[EntityId], typing.List[EntityId]]. Filter by counterparty ids
- limit: typing.Optional[int]. Number of counterparties to return. Limit can range between 1 and 100, and the default is 10.
- starting_after: typing.Optional[EntityId]. The ID of the counterparties to start after. If not provided, the first page of counterparties will be returned.
"""
_response = await self._client_wrapper.httpx_client.request(
"GET",
Expand All @@ -490,6 +429,8 @@ async def find_payors(
"networkType": network_type,
"paymentMethods": payment_methods,
"counterpartyId": counterparty_id,
"limit": limit,
"startingAfter": starting_after,
}
),
headers=self._client_wrapper.get_headers(),
Expand Down
2 changes: 0 additions & 2 deletions src/mercoa/resources/entity_types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
BusinessProfileRequest,
BusinessProfileResponse,
BusinessType,
CounterpartiesResponse,
CounterpartyNetworkType,
CounterpartyResponse,
Ein,
Expand Down Expand Up @@ -75,7 +74,6 @@
"BusinessProfileRequest",
"BusinessProfileResponse",
"BusinessType",
"CounterpartiesResponse",
"CounterpartyNetworkType",
"CounterpartyResponse",
"Ein",
Expand Down
2 changes: 0 additions & 2 deletions src/mercoa/resources/entity_types/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from .business_profile_request import BusinessProfileRequest
from .business_profile_response import BusinessProfileResponse
from .business_type import BusinessType
from .counterparties_response import CounterpartiesResponse
from .counterparty_network_type import CounterpartyNetworkType
from .counterparty_response import CounterpartyResponse
from .ein import Ein
Expand Down Expand Up @@ -67,7 +66,6 @@
"BusinessProfileRequest",
"BusinessProfileResponse",
"BusinessType",
"CounterpartiesResponse",
"CounterpartyNetworkType",
"CounterpartyResponse",
"Ein",
Expand Down
35 changes: 0 additions & 35 deletions src/mercoa/resources/entity_types/types/counterparties_response.py

This file was deleted.

1 change: 1 addition & 0 deletions src/mercoa/resources/entity_types/types/entity_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class EntityRequest(pydantic.BaseModel):
is_payee: bool = pydantic.Field(
alias="isPayee", description="If this entity will be receiving payments, set this to true."
)
logo: typing.Optional[str] = pydantic.Field(description="Base64 encoded PNG image data for the entity logo.")

def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class EntityUpdateRequest(pydantic.BaseModel):
is_payee: typing.Optional[bool] = pydantic.Field(
alias="isPayee", description="If this entity will be receiving payments, set this to true."
)
logo: typing.Optional[str] = pydantic.Field(description="Base64 encoded PNG image data for the entity logo.")

def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Responsibilities(pydantic.BaseModel):
alias="isOwner",
description="Indicates whether this individual has an ownership stake of at least 25% in the business",
)
ownership_percentage: typing.Optional[float] = pydantic.Field(
ownership_percentage: typing.Optional[int] = pydantic.Field(
alias="ownershipPercentage", description="Percentage of ownership in the business. Must be between 0 and 100."
)

Expand Down
Loading

0 comments on commit 60892fa

Please sign in to comment.