Skip to content

Commit

Permalink
Release 0.3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Nov 17, 2023
1 parent 646c02a commit 5b605a7
Show file tree
Hide file tree
Showing 14 changed files with 134 additions and 34 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.4"
version = "v0.3.5"
description = ""
readme = "README.md"
authors = []
Expand Down
2 changes: 2 additions & 0 deletions src/mercoa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
EntityUserId,
EntityUserRequest,
EntityUserResponse,
EntityWithPaymentMethodResponse,
FindCounterpartiesResponse,
FindEntityResponse,
FindInvoiceResponse,
Expand Down Expand Up @@ -277,6 +278,7 @@
"EntityUserId",
"EntityUserRequest",
"EntityUserResponse",
"EntityWithPaymentMethodResponse",
"FindCounterpartiesResponse",
"FindEntityResponse",
"FindInvoiceResponse",
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.4",
"X-Fern-SDK-Version": "v0.3.5",
}
headers["Authorization"] = f"Bearer {self._get_token()}"
return headers
Expand Down
2 changes: 2 additions & 0 deletions src/mercoa/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
EntityUserId,
EntityUserRequest,
EntityUserResponse,
EntityWithPaymentMethodResponse,
FindCounterpartiesResponse,
FindEntityResponse,
FindNotificationResponse,
Expand Down Expand Up @@ -281,6 +282,7 @@
"EntityUserId",
"EntityUserRequest",
"EntityUserResponse",
"EntityWithPaymentMethodResponse",
"FindCounterpartiesResponse",
"FindEntityResponse",
"FindInvoiceResponse",
Expand Down
64 changes: 50 additions & 14 deletions src/mercoa/resources/entity/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,24 @@ def __init__(self, *, client_wrapper: SyncClientWrapper):
def find(
self,
*,
owned_by_org: typing.Optional[bool] = None,
payment_methods: typing.Optional[bool] = None,
is_customer: typing.Optional[bool] = None,
foreign_id: typing.Optional[typing.Union[str, typing.List[str]]] = None,
status: typing.Optional[typing.Union[EntityStatus, typing.List[EntityStatus]]] = None,
is_payee: typing.Optional[bool] = None,
is_payor: typing.Optional[bool] = None,
name: typing.Optional[str] = None,
limit: typing.Optional[int] = None,
starting_after: typing.Optional[EntityId] = None,
owned_by_org: typing.Optional[bool] = None,
) -> FindEntityResponse:
"""
Search all entities with the given filters. If no filters are provided, all entities will be returned.
Parameters:
- owned_by_org: typing.Optional[bool]. If true, only entities with a direct relationship to the requesting organization will be returned. If false or not provided, all entities will be returned.
- payment_methods: typing.Optional[bool]. If true, will include entity payment methods as part of the response
- is_customer: typing.Optional[bool]. If true, only entities with a direct relationship to the requesting organization will be returned. If false or not provided, all entities will be returned.
- foreign_id: typing.Optional[typing.Union[str, typing.List[str]]]. ID used to identify this entity in your system
Expand All @@ -91,20 +95,24 @@ def find(
- limit: typing.Optional[int]. Number of entities to return. Limit can range between 1 and 100, and the default is 10.
- starting_after: typing.Optional[EntityId]. The ID of the entity to start after. If not provided, the first page of entities will be returned.
- owned_by_org: typing.Optional[bool]. [DEPRECATED - use isCustomer] If true, only entities with a direct relationship to the requesting organization will be returned. If false or not provided, all entities will be returned.
"""
_response = self._client_wrapper.httpx_client.request(
"GET",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "entity"),
params=remove_none_from_dict(
{
"ownedByOrg": owned_by_org,
"paymentMethods": payment_methods,
"isCustomer": is_customer,
"foreignId": foreign_id,
"status": status,
"isPayee": is_payee,
"isPayor": is_payor,
"name": name,
"limit": limit,
"startingAfter": starting_after,
"ownedByOrg": owned_by_org,
}
),
headers=self._client_wrapper.get_headers(),
Expand Down Expand Up @@ -418,22 +426,27 @@ def get_onboarding_link(
entity_id: EntityId,
*,
type: EntityOnboardingLinkType,
expires_in: typing.Optional[str] = None,
connected_entity_id: typing.Optional[EntityId] = None,
) -> str:
"""
Generate an onboarding link for the entity. The onboarding link will be valid for 24 hours.
Generate an onboarding link for the entity.
Parameters:
- entity_id: EntityId.
- type: EntityOnboardingLinkType. The type of onboarding link to generate. If not provided, the default is payee. The onboarding options are determined by your organization's onboarding configuration.
- expires_in: typing.Optional[str]. Expressed in seconds or a string describing a time span. The default is 24h.
- connected_entity_id: typing.Optional[EntityId]. The ID of the entity to connect to. If onboarding a payee, this should be the payor entity ID. If onboarding a payor, this should be the payee entity ID. If no connected entity ID is provided, the onboarding link will be for a standalone entity.
"""
_response = self._client_wrapper.httpx_client.request(
"GET",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"entity/{entity_id}/onboarding"),
params=remove_none_from_dict({"type": type, "connectedEntityId": connected_entity_id}),
params=remove_none_from_dict(
{"type": type, "expiresIn": expires_in, "connectedEntityId": connected_entity_id}
),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
Expand Down Expand Up @@ -463,22 +476,27 @@ def send_onboarding_link(
entity_id: EntityId,
*,
type: EntityOnboardingLinkType,
expires_in: typing.Optional[str] = None,
connected_entity_id: typing.Optional[EntityId] = None,
) -> None:
"""
Send an email with a onboarding link to the entity. The email will be sent to the email address associated with the entity. The onboarding link will be valid for 7 days.
Send an email with a onboarding link to the entity. The email will be sent to the email address associated with the entity.
Parameters:
- entity_id: EntityId.
- type: EntityOnboardingLinkType. The type of onboarding link to generate. If not provided, the default is payee. The onboarding options are determined by your organization's onboarding configuration.
- expires_in: typing.Optional[str]. Expressed in seconds or a string describing a time span. The default is 7 days.
- connected_entity_id: typing.Optional[EntityId]. The ID of the entity to connect to. If onboarding a payee, this should be the payor entity ID. If onboarding a payor, this should be the payee entity ID. If no connected entity ID is provided, the onboarding link will be for a standalone entity.
"""
_response = self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"entity/{entity_id}/onboarding"),
params=remove_none_from_dict({"type": type, "connectedEntityId": connected_entity_id}),
params=remove_none_from_dict(
{"type": type, "expiresIn": expires_in, "connectedEntityId": connected_entity_id}
),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
Expand Down Expand Up @@ -519,20 +537,24 @@ def __init__(self, *, client_wrapper: AsyncClientWrapper):
async def find(
self,
*,
owned_by_org: typing.Optional[bool] = None,
payment_methods: typing.Optional[bool] = None,
is_customer: typing.Optional[bool] = None,
foreign_id: typing.Optional[typing.Union[str, typing.List[str]]] = None,
status: typing.Optional[typing.Union[EntityStatus, typing.List[EntityStatus]]] = None,
is_payee: typing.Optional[bool] = None,
is_payor: typing.Optional[bool] = None,
name: typing.Optional[str] = None,
limit: typing.Optional[int] = None,
starting_after: typing.Optional[EntityId] = None,
owned_by_org: typing.Optional[bool] = None,
) -> FindEntityResponse:
"""
Search all entities with the given filters. If no filters are provided, all entities will be returned.
Parameters:
- owned_by_org: typing.Optional[bool]. If true, only entities with a direct relationship to the requesting organization will be returned. If false or not provided, all entities will be returned.
- payment_methods: typing.Optional[bool]. If true, will include entity payment methods as part of the response
- is_customer: typing.Optional[bool]. If true, only entities with a direct relationship to the requesting organization will be returned. If false or not provided, all entities will be returned.
- foreign_id: typing.Optional[typing.Union[str, typing.List[str]]]. ID used to identify this entity in your system
Expand All @@ -549,20 +571,24 @@ async def find(
- limit: typing.Optional[int]. Number of entities to return. Limit can range between 1 and 100, and the default is 10.
- starting_after: typing.Optional[EntityId]. The ID of the entity to start after. If not provided, the first page of entities will be returned.
- owned_by_org: typing.Optional[bool]. [DEPRECATED - use isCustomer] If true, only entities with a direct relationship to the requesting organization will be returned. If false or not provided, all entities will be returned.
"""
_response = await self._client_wrapper.httpx_client.request(
"GET",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "entity"),
params=remove_none_from_dict(
{
"ownedByOrg": owned_by_org,
"paymentMethods": payment_methods,
"isCustomer": is_customer,
"foreignId": foreign_id,
"status": status,
"isPayee": is_payee,
"isPayor": is_payor,
"name": name,
"limit": limit,
"startingAfter": starting_after,
"ownedByOrg": owned_by_org,
}
),
headers=self._client_wrapper.get_headers(),
Expand Down Expand Up @@ -876,22 +902,27 @@ async def get_onboarding_link(
entity_id: EntityId,
*,
type: EntityOnboardingLinkType,
expires_in: typing.Optional[str] = None,
connected_entity_id: typing.Optional[EntityId] = None,
) -> str:
"""
Generate an onboarding link for the entity. The onboarding link will be valid for 24 hours.
Generate an onboarding link for the entity.
Parameters:
- entity_id: EntityId.
- type: EntityOnboardingLinkType. The type of onboarding link to generate. If not provided, the default is payee. The onboarding options are determined by your organization's onboarding configuration.
- expires_in: typing.Optional[str]. Expressed in seconds or a string describing a time span. The default is 24h.
- connected_entity_id: typing.Optional[EntityId]. The ID of the entity to connect to. If onboarding a payee, this should be the payor entity ID. If onboarding a payor, this should be the payee entity ID. If no connected entity ID is provided, the onboarding link will be for a standalone entity.
"""
_response = await self._client_wrapper.httpx_client.request(
"GET",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"entity/{entity_id}/onboarding"),
params=remove_none_from_dict({"type": type, "connectedEntityId": connected_entity_id}),
params=remove_none_from_dict(
{"type": type, "expiresIn": expires_in, "connectedEntityId": connected_entity_id}
),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
Expand Down Expand Up @@ -921,22 +952,27 @@ async def send_onboarding_link(
entity_id: EntityId,
*,
type: EntityOnboardingLinkType,
expires_in: typing.Optional[str] = None,
connected_entity_id: typing.Optional[EntityId] = None,
) -> None:
"""
Send an email with a onboarding link to the entity. The email will be sent to the email address associated with the entity. The onboarding link will be valid for 7 days.
Send an email with a onboarding link to the entity. The email will be sent to the email address associated with the entity.
Parameters:
- entity_id: EntityId.
- type: EntityOnboardingLinkType. The type of onboarding link to generate. If not provided, the default is payee. The onboarding options are determined by your organization's onboarding configuration.
- expires_in: typing.Optional[str]. Expressed in seconds or a string describing a time span. The default is 7 days.
- connected_entity_id: typing.Optional[EntityId]. The ID of the entity to connect to. If onboarding a payee, this should be the payor entity ID. If onboarding a payor, this should be the payee entity ID. If no connected entity ID is provided, the onboarding link will be for a standalone entity.
"""
_response = await self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"entity/{entity_id}/onboarding"),
params=remove_none_from_dict({"type": type, "connectedEntityId": connected_entity_id}),
params=remove_none_from_dict(
{"type": type, "expiresIn": expires_in, "connectedEntityId": connected_entity_id}
),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
Expand Down
2 changes: 2 additions & 0 deletions src/mercoa/resources/entity_types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
EntityUserId,
EntityUserRequest,
EntityUserResponse,
EntityWithPaymentMethodResponse,
FindCounterpartiesResponse,
FindEntityResponse,
FindNotificationResponse,
Expand Down Expand Up @@ -97,6 +98,7 @@
"EntityUserId",
"EntityUserRequest",
"EntityUserResponse",
"EntityWithPaymentMethodResponse",
"FindCounterpartiesResponse",
"FindEntityResponse",
"FindNotificationResponse",
Expand Down
2 changes: 2 additions & 0 deletions src/mercoa/resources/entity_types/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from .entity_user_id import EntityUserId
from .entity_user_request import EntityUserRequest
from .entity_user_response import EntityUserResponse
from .entity_with_payment_method_response import EntityWithPaymentMethodResponse
from .find_counterparties_response import FindCounterpartiesResponse
from .find_entity_response import FindEntityResponse
from .find_notification_response import FindNotificationResponse
Expand Down Expand Up @@ -86,6 +87,7 @@
"EntityUserId",
"EntityUserRequest",
"EntityUserResponse",
"EntityWithPaymentMethodResponse",
"FindCounterpartiesResponse",
"FindEntityResponse",
"FindNotificationResponse",
Expand Down
10 changes: 7 additions & 3 deletions src/mercoa/resources/entity_types/types/entity_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class EntityRequest(pydantic.BaseModel):
alias="emailToAlias",
description="Email inbox alias addresses. Used when forwarding emails to the emailTo address from an alias. Include the full email address.",
)
owned_by_org: typing.Optional[bool] = pydantic.Field(
alias="ownedByOrg",
description="If this entity has a direct relationship with your organization, set this to true. Otherwise, set to false.",
is_customer: typing.Optional[bool] = pydantic.Field(
alias="isCustomer",
description="If this entity has a direct relationship with your organization (e.g your direct customer or client), set this to true. Otherwise, set to false (e.g your customer's vendors).",
)
account_type: AccountType = pydantic.Field(alias="accountType")
profile: ProfileRequest
Expand All @@ -39,6 +39,10 @@ class EntityRequest(pydantic.BaseModel):
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.")
owned_by_org: typing.Optional[bool] = pydantic.Field(
alias="ownedByOrg",
description="[DEPRECATED - use isCustomer] - If this entity has a direct relationship with your organization, set this to true. Otherwise, set to false.",
)

def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
Expand Down
8 changes: 6 additions & 2 deletions src/mercoa/resources/entity_types/types/entity_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class EntityResponse(pydantic.BaseModel):
alias="emailToAlias",
description="Email inbox alias addresses. Used when forwarding emails to the emailTo address from an alias.",
)
owned_by_org: bool = pydantic.Field(
alias="ownedByOrg", description="True if this entity has a direct relationship with your organization."
is_customer: bool = pydantic.Field(
alias="isCustomer", description="True if this entity has a direct relationship with your organization."
)
account_type: AccountType = pydantic.Field(alias="accountType")
profile: ProfileResponse
Expand All @@ -41,6 +41,10 @@ class EntityResponse(pydantic.BaseModel):
)
is_payor: bool = pydantic.Field(alias="isPayor", description="True if this entity can pay invoices.")
is_payee: bool = pydantic.Field(alias="isPayee", description="True if this entity can receive payments.")
owned_by_org: bool = pydantic.Field(
alias="ownedByOrg",
description="[DEPRECATED - use isCustomer] - True if this entity has a direct relationship with your organization.",
)
created_at: dt.datetime = pydantic.Field(alias="createdAt")
updated_at: dt.datetime = pydantic.Field(alias="updatedAt")

Expand Down
10 changes: 7 additions & 3 deletions src/mercoa/resources/entity_types/types/entity_update_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class EntityUpdateRequest(pydantic.BaseModel):
alias="emailToAlias",
description="Email inbox alias addresses. Used when forwarding emails to the emailTo address from an alias. Include the full email address.",
)
owned_by_org: typing.Optional[bool] = pydantic.Field(
alias="ownedByOrg",
description="If this entity has a direct relationship with your organization, set this to true. Otherwise, set to false.",
is_customer: typing.Optional[bool] = pydantic.Field(
alias="isCustomer",
description="If this entity has a direct relationship with your organization (e.g your direct customer or client), set this to true. Otherwise, set to false (e.g your customer's vendors).",
)
account_type: typing.Optional[AccountType] = pydantic.Field(alias="accountType")
profile: typing.Optional[ProfileRequest]
Expand All @@ -39,6 +39,10 @@ class EntityUpdateRequest(pydantic.BaseModel):
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.")
owned_by_org: typing.Optional[bool] = pydantic.Field(
alias="ownedByOrg",
description="[DEPRECATED - use isCustomer] - If this entity has a direct relationship with your organization, set this to true. Otherwise, set to false.",
)

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

0 comments on commit 5b605a7

Please sign in to comment.