Skip to content

Commit

Permalink
Release 0.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Oct 19, 2023
1 parent 415df2b commit de78bac
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 16 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.2"
version = "v0.3.3"
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 @@ -88,6 +88,7 @@
InvalidTaxId,
InvoiceError,
InvoiceFailureType,
InvoiceFeesResponse,
InvoiceId,
InvoiceLineItemRequest,
InvoiceLineItemResponse,
Expand Down Expand Up @@ -283,6 +284,7 @@
"InvalidTaxId",
"InvoiceError",
"InvoiceFailureType",
"InvoiceFeesResponse",
"InvoiceId",
"InvoiceLineItemRequest",
"InvoiceLineItemResponse",
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.2",
"X-Fern-SDK-Version": "v0.3.3",
}
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 @@ -113,6 +113,7 @@
FindInvoiceResponse,
InvoiceError,
InvoiceFailureType,
InvoiceFeesResponse,
InvoiceId,
InvoiceLineItemRequest,
InvoiceLineItemResponse,
Expand Down Expand Up @@ -290,6 +291,7 @@
"InvalidTaxId",
"InvoiceError",
"InvoiceFailureType",
"InvoiceFeesResponse",
"InvoiceId",
"InvoiceLineItemRequest",
"InvoiceLineItemResponse",
Expand Down
42 changes: 30 additions & 12 deletions src/mercoa/resources/entity/resources/invoice/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@ def find(
limit: typing.Optional[int] = None,
starting_after: typing.Optional[InvoiceId] = None,
search: typing.Optional[str] = None,
vendor_id: typing.Union[typing.Optional[EntityId], typing.List[EntityId]],
payer_id: typing.Union[typing.Optional[EntityId], typing.List[EntityId]],
vendor_id: typing.Union[typing.Optional[EntityId], typing.List[EntityId]],
approver_id: typing.Union[typing.Optional[EntityUserId], typing.List[EntityUserId]],
invoice_id: typing.Union[typing.Optional[InvoiceId], typing.List[InvoiceId]],
status: typing.Union[typing.Optional[InvoiceStatus], typing.List[InvoiceStatus]],
include_fees: typing.Optional[bool] = None,
) -> FindInvoiceResponse:
"""
Get invoices for an entity with the given filters.
Expand All @@ -77,15 +78,17 @@ def find(
- search: typing.Optional[str]. Filter vendors by name. Partial matches are supported.
- vendor_id: typing.Union[typing.Optional[EntityId], typing.List[EntityId]]. Filter invoices by vendor ID.
- payer_id: typing.Union[typing.Optional[EntityId], typing.List[EntityId]]. Filter invoices by payer ID.
- vendor_id: typing.Union[typing.Optional[EntityId], typing.List[EntityId]]. Filter invoices by vendor ID.
- approver_id: typing.Union[typing.Optional[EntityUserId], typing.List[EntityUserId]]. Filter invoices by assigned approver user ID.
- invoice_id: typing.Union[typing.Optional[InvoiceId], typing.List[InvoiceId]]. Filter invoices by invoice ID.
- status: typing.Union[typing.Optional[InvoiceStatus], typing.List[InvoiceStatus]]. Invoice status to filter on
- status: typing.Union[typing.Optional[InvoiceStatus], typing.List[InvoiceStatus]]. Invoice status to filter on.
- include_fees: typing.Optional[bool]. If true, will include fees as part of the response.
"""
_response = self._client_wrapper.httpx_client.request(
"GET",
Expand All @@ -101,11 +104,12 @@ def find(
"limit": limit,
"startingAfter": starting_after,
"search": search,
"vendorId": vendor_id,
"payerId": payer_id,
"vendorId": vendor_id,
"approverId": approver_id,
"invoiceId": invoice_id,
"status": status,
"includeFees": include_fees,
}
),
headers=self._client_wrapper.get_headers(),
Expand Down Expand Up @@ -134,16 +138,21 @@ def find(
raise Unimplemented(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
raise ApiError(status_code=_response.status_code, body=_response_json)

def get(self, entity_id: EntityId, invoice_id: InvoiceId) -> InvoiceResponse:
def get(
self, entity_id: EntityId, invoice_id: InvoiceId, *, include_fees: typing.Optional[bool] = None
) -> InvoiceResponse:
"""
Parameters:
- entity_id: EntityId.
- invoice_id: InvoiceId. ID of the invoice to retrieve. This can be the full invoice ID (in_11aa2b77-6391-49e4-8c3f-b198009202c1) or the first 8 characters of the ID (11aa2b77).
- include_fees: typing.Optional[bool]. If true, will include fees as part of the response.
"""
_response = self._client_wrapper.httpx_client.request(
"GET",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"entity/{entity_id}/invoice/{invoice_id}"),
params=remove_none_from_dict({"includeFees": include_fees}),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
Expand Down Expand Up @@ -284,11 +293,12 @@ async def find(
limit: typing.Optional[int] = None,
starting_after: typing.Optional[InvoiceId] = None,
search: typing.Optional[str] = None,
vendor_id: typing.Union[typing.Optional[EntityId], typing.List[EntityId]],
payer_id: typing.Union[typing.Optional[EntityId], typing.List[EntityId]],
vendor_id: typing.Union[typing.Optional[EntityId], typing.List[EntityId]],
approver_id: typing.Union[typing.Optional[EntityUserId], typing.List[EntityUserId]],
invoice_id: typing.Union[typing.Optional[InvoiceId], typing.List[InvoiceId]],
status: typing.Union[typing.Optional[InvoiceStatus], typing.List[InvoiceStatus]],
include_fees: typing.Optional[bool] = None,
) -> FindInvoiceResponse:
"""
Get invoices for an entity with the given filters.
Expand All @@ -314,15 +324,17 @@ async def find(
- search: typing.Optional[str]. Filter vendors by name. Partial matches are supported.
- vendor_id: typing.Union[typing.Optional[EntityId], typing.List[EntityId]]. Filter invoices by vendor ID.
- payer_id: typing.Union[typing.Optional[EntityId], typing.List[EntityId]]. Filter invoices by payer ID.
- vendor_id: typing.Union[typing.Optional[EntityId], typing.List[EntityId]]. Filter invoices by vendor ID.
- approver_id: typing.Union[typing.Optional[EntityUserId], typing.List[EntityUserId]]. Filter invoices by assigned approver user ID.
- invoice_id: typing.Union[typing.Optional[InvoiceId], typing.List[InvoiceId]]. Filter invoices by invoice ID.
- status: typing.Union[typing.Optional[InvoiceStatus], typing.List[InvoiceStatus]]. Invoice status to filter on
- status: typing.Union[typing.Optional[InvoiceStatus], typing.List[InvoiceStatus]]. Invoice status to filter on.
- include_fees: typing.Optional[bool]. If true, will include fees as part of the response.
"""
_response = await self._client_wrapper.httpx_client.request(
"GET",
Expand All @@ -338,11 +350,12 @@ async def find(
"limit": limit,
"startingAfter": starting_after,
"search": search,
"vendorId": vendor_id,
"payerId": payer_id,
"vendorId": vendor_id,
"approverId": approver_id,
"invoiceId": invoice_id,
"status": status,
"includeFees": include_fees,
}
),
headers=self._client_wrapper.get_headers(),
Expand Down Expand Up @@ -371,16 +384,21 @@ async def find(
raise Unimplemented(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
raise ApiError(status_code=_response.status_code, body=_response_json)

async def get(self, entity_id: EntityId, invoice_id: InvoiceId) -> InvoiceResponse:
async def get(
self, entity_id: EntityId, invoice_id: InvoiceId, *, include_fees: typing.Optional[bool] = None
) -> InvoiceResponse:
"""
Parameters:
- entity_id: EntityId.
- invoice_id: InvoiceId. ID of the invoice to retrieve. This can be the full invoice ID (in_11aa2b77-6391-49e4-8c3f-b198009202c1) or the first 8 characters of the ID (11aa2b77).
- include_fees: typing.Optional[bool]. If true, will include fees as part of the response.
"""
_response = await self._client_wrapper.httpx_client.request(
"GET",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"entity/{entity_id}/invoice/{invoice_id}"),
params=remove_none_from_dict({"includeFees": include_fees}),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
Expand Down
18 changes: 16 additions & 2 deletions src/mercoa/resources/invoice/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def find(
approver_id: typing.Union[typing.Optional[EntityUserId], typing.List[EntityUserId]],
invoice_id: typing.Union[typing.Optional[InvoiceId], typing.List[InvoiceId]],
status: typing.Union[typing.Optional[InvoiceStatus], typing.List[InvoiceStatus]],
include_fees: typing.Optional[bool] = None,
) -> FindInvoiceResponse:
"""
Search invoices for all entities in the organization
Expand Down Expand Up @@ -93,6 +94,8 @@ def find(
- invoice_id: typing.Union[typing.Optional[InvoiceId], typing.List[InvoiceId]]. Filter invoices by invoice ID.
- status: typing.Union[typing.Optional[InvoiceStatus], typing.List[InvoiceStatus]]. Invoice status to filter on
- include_fees: typing.Optional[bool]. If true, will include fees as part of the response.
"""
_response = self._client_wrapper.httpx_client.request(
"GET",
Expand All @@ -112,6 +115,7 @@ def find(
"approverId": approver_id,
"invoiceId": invoice_id,
"status": status,
"includeFees": include_fees,
}
),
headers=self._client_wrapper.get_headers(),
Expand Down Expand Up @@ -177,14 +181,17 @@ def create(self, *, request: InvoiceRequest) -> InvoiceResponse:
raise Unimplemented(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
raise ApiError(status_code=_response.status_code, body=_response_json)

def get(self, invoice_id: InvoiceId) -> InvoiceResponse:
def get(self, invoice_id: InvoiceId, *, include_fees: typing.Optional[bool] = None) -> InvoiceResponse:
"""
Parameters:
- invoice_id: InvoiceId.
- include_fees: typing.Optional[bool]. If true, will include fees as part of the response.
"""
_response = self._client_wrapper.httpx_client.request(
"GET",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"invoice/{invoice_id}"),
params=remove_none_from_dict({"includeFees": include_fees}),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
Expand Down Expand Up @@ -491,6 +498,7 @@ async def find(
approver_id: typing.Union[typing.Optional[EntityUserId], typing.List[EntityUserId]],
invoice_id: typing.Union[typing.Optional[InvoiceId], typing.List[InvoiceId]],
status: typing.Union[typing.Optional[InvoiceStatus], typing.List[InvoiceStatus]],
include_fees: typing.Optional[bool] = None,
) -> FindInvoiceResponse:
"""
Search invoices for all entities in the organization
Expand Down Expand Up @@ -521,6 +529,8 @@ async def find(
- invoice_id: typing.Union[typing.Optional[InvoiceId], typing.List[InvoiceId]]. Filter invoices by invoice ID.
- status: typing.Union[typing.Optional[InvoiceStatus], typing.List[InvoiceStatus]]. Invoice status to filter on
- include_fees: typing.Optional[bool]. If true, will include fees as part of the response.
"""
_response = await self._client_wrapper.httpx_client.request(
"GET",
Expand All @@ -540,6 +550,7 @@ async def find(
"approverId": approver_id,
"invoiceId": invoice_id,
"status": status,
"includeFees": include_fees,
}
),
headers=self._client_wrapper.get_headers(),
Expand Down Expand Up @@ -605,14 +616,17 @@ async def create(self, *, request: InvoiceRequest) -> InvoiceResponse:
raise Unimplemented(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
raise ApiError(status_code=_response.status_code, body=_response_json)

async def get(self, invoice_id: InvoiceId) -> InvoiceResponse:
async def get(self, invoice_id: InvoiceId, *, include_fees: typing.Optional[bool] = None) -> InvoiceResponse:
"""
Parameters:
- invoice_id: InvoiceId.
- include_fees: typing.Optional[bool]. If true, will include fees as part of the response.
"""
_response = await self._client_wrapper.httpx_client.request(
"GET",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"invoice/{invoice_id}"),
params=remove_none_from_dict({"includeFees": include_fees}),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
Expand Down
2 changes: 2 additions & 0 deletions src/mercoa/resources/invoice_types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
DocumentResponse,
FindInvoiceResponse,
InvoiceFailureType,
InvoiceFeesResponse,
InvoiceId,
InvoiceLineItemRequest,
InvoiceLineItemResponse,
Expand All @@ -39,6 +40,7 @@
"FindInvoiceResponse",
"InvoiceError",
"InvoiceFailureType",
"InvoiceFeesResponse",
"InvoiceId",
"InvoiceLineItemRequest",
"InvoiceLineItemResponse",
Expand Down
2 changes: 2 additions & 0 deletions src/mercoa/resources/invoice_types/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from .document_response import DocumentResponse
from .find_invoice_response import FindInvoiceResponse
from .invoice_failure_type import InvoiceFailureType
from .invoice_fees_response import InvoiceFeesResponse
from .invoice_id import InvoiceId
from .invoice_line_item_request import InvoiceLineItemRequest
from .invoice_line_item_response import InvoiceLineItemResponse
Expand All @@ -34,6 +35,7 @@
"DocumentResponse",
"FindInvoiceResponse",
"InvoiceFailureType",
"InvoiceFeesResponse",
"InvoiceId",
"InvoiceLineItemRequest",
"InvoiceLineItemResponse",
Expand Down
39 changes: 39 additions & 0 deletions src/mercoa/resources/invoice_types/types/invoice_fees_response.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# 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


class InvoiceFeesResponse(pydantic.BaseModel):
source_payment_method_fee: float = pydantic.Field(
alias="sourcePaymentMethodFee",
description="Fee charged for processing the source payment method. For example, credit card interchange and acquiring fees.",
)
source_platform_markup_fee: float = pydantic.Field(
alias="sourcePlatformMarkupFee", description="Additional fee charged to the payer."
)
destination_payment_method_fee: float = pydantic.Field(
alias="destinationPaymentMethodFee",
description="Fee charged for processing the destination payment method. For example, postage for a check payment.",
)
destination_platform_markup_fee: float = pydantic.Field(
alias="destinationPlatformMarkupFee", description="Additional fee charged to the payee."
)

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
smart_union = True
allow_population_by_field_name = True
json_encoders = {dt.datetime: serialize_datetime}
2 changes: 2 additions & 0 deletions src/mercoa/resources/invoice_types/types/invoice_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from .approval_slot import ApprovalSlot
from .comment_response import CommentResponse
from .invoice_failure_type import InvoiceFailureType
from .invoice_fees_response import InvoiceFeesResponse
from .invoice_id import InvoiceId
from .invoice_line_item_response import InvoiceLineItemResponse
from .invoice_status import InvoiceStatus
Expand Down Expand Up @@ -70,6 +71,7 @@ class InvoiceResponse(pydantic.BaseModel):
processed_at: typing.Optional[dt.datetime] = pydantic.Field(alias="processedAt")
created_at: dt.datetime = pydantic.Field(alias="createdAt")
updated_at: dt.datetime = pydantic.Field(alias="updatedAt")
fees: typing.Optional[InvoiceFeesResponse] = pydantic.Field(description="Fees associated with this invoice.")

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

0 comments on commit de78bac

Please sign in to comment.