diff --git a/pyproject.toml b/pyproject.toml
index 144e128..23c590d 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "mercoa"
-version = "0.5.8-rc1"
+version = "0.5.8"
description = ""
readme = "README.md"
authors = []
diff --git a/reference.md b/reference.md
index 4894cc4..fd397aa 100644
--- a/reference.md
+++ b/reference.md
@@ -1332,7 +1332,15 @@ If false, entities that are marked as payors will not be returned.
-
-**return_metadata:** `typing.Optional[bool]` — If true, will return simple key/value metadata for the entity. For more complex metadata, use the Metadata API.
+**metadata:** `typing.Optional[MetadataFilter]` — Filter entities by simple key/value metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
+
+
+
+
+
+-
+
+**return_metadata:** `typing.Optional[bool]` — If true, will return simple key/value metadata for the entities. For more complex metadata, use the Metadata API.
@@ -3182,9 +3190,7 @@ client.invoice.find(
-
-**metadata:** `typing.Optional[
- typing.Union[InvoiceMetadataFilter, typing.Sequence[InvoiceMetadataFilter]]
-]` — Filter invoices by metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
+**metadata:** `typing.Optional[typing.Union[MetadataFilter, typing.Sequence[MetadataFilter]]]` — Filter invoices by metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
@@ -3192,9 +3198,7 @@ client.invoice.find(
-
-**line_item_metadata:** `typing.Optional[
- typing.Union[InvoiceMetadataFilter, typing.Sequence[InvoiceMetadataFilter]]
-]` — Filter invoices by line item metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
+**line_item_metadata:** `typing.Optional[typing.Union[MetadataFilter, typing.Sequence[MetadataFilter]]]` — Filter invoices by line item metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
@@ -4852,9 +4856,7 @@ client.entity_group.invoice.find(
-
-**metadata:** `typing.Optional[
- typing.Union[InvoiceMetadataFilter, typing.Sequence[InvoiceMetadataFilter]]
-]` — Filter invoices by metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
+**metadata:** `typing.Optional[typing.Union[MetadataFilter, typing.Sequence[MetadataFilter]]]` — Filter invoices by metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
@@ -4976,10 +4978,10 @@ client.entity_group.invoice.metrics(
entity_group_id="entg_8545a84e-a45f-41bf-bdf1-33b42a55812c",
return_by_date="CREATION_DATE",
exclude_receivables=True,
- created_date_start=datetime.datetime.fromisoformat(
+ start_date=datetime.datetime.fromisoformat(
"2021-01-01 00:00:00+00:00",
),
- created_date_end=datetime.datetime.fromisoformat(
+ end_date=datetime.datetime.fromisoformat(
"2021-01-31 23:59:59.999000+00:00",
),
currency="USD",
@@ -5040,15 +5042,7 @@ client.entity_group.invoice.metrics(
-
-**payer_id:** `typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]]` — Filter invoices by payer ID.
-
-
-
-
-
--
-
-**vendor_id:** `typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]]` — Filter invoices by vendor ID.
+**return_by_date_frequency:** `typing.Optional[InvoiceMetricsPerDateFrequency]` — Return invoice metrics grouped by date. Defaults to daily.
@@ -5056,7 +5050,9 @@ client.entity_group.invoice.metrics(
-
-**approver_id:** `typing.Optional[typing.Union[EntityUserId, typing.Sequence[EntityUserId]]]` — Filter invoices by assigned approver user ID.
+**group_by:** `typing.Optional[
+ typing.Union[InvoiceMetricsGroupBy, typing.Sequence[InvoiceMetricsGroupBy]]
+]` — Return invoice metrics grouped by.
@@ -5064,15 +5060,7 @@ client.entity_group.invoice.metrics(
-
-**invoice_id:** `typing.Optional[typing.Union[InvoiceId, typing.Sequence[InvoiceId]]]` — Filter invoices by invoice ID.
-
-
-
-
-
--
-
-**status:** `typing.Optional[typing.Union[InvoiceStatus, typing.Sequence[InvoiceStatus]]]` — Invoice status to filter on
+**payer_id:** `typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]]` — Filter invoices by payer ID.
@@ -5080,7 +5068,7 @@ client.entity_group.invoice.metrics(
-
-**start_date:** `typing.Optional[dt.datetime]` — Start date filter. Defaults to CREATED_AT unless specified the dateType is specified
+**vendor_id:** `typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]]` — Filter invoices by vendor ID.
@@ -5088,7 +5076,7 @@ client.entity_group.invoice.metrics(
-
-**end_date:** `typing.Optional[dt.datetime]` — End date filter. Defaults to CREATED_AT unless specified the dateType is specified
+**approver_id:** `typing.Optional[typing.Union[EntityUserId, typing.Sequence[EntityUserId]]]` — Filter invoices by assigned approver user ID.
@@ -5096,7 +5084,7 @@ client.entity_group.invoice.metrics(
-
-**date_type:** `typing.Optional[InvoiceDateFilter]` — Type of date to filter by if startDate and endDate filters are provided. Defaults to CREATED_AT.
+**invoice_id:** `typing.Optional[typing.Union[InvoiceId, typing.Sequence[InvoiceId]]]` — Filter invoices by invoice ID.
@@ -5104,7 +5092,7 @@ client.entity_group.invoice.metrics(
-
-**due_date_start:** `typing.Optional[dt.datetime]` — DEPRECATED. Use startDate, endDate, and dateType instead. Start date for invoice dueDate filter.
+**status:** `typing.Optional[typing.Union[InvoiceStatus, typing.Sequence[InvoiceStatus]]]` — Invoice status to filter on
@@ -5112,7 +5100,7 @@ client.entity_group.invoice.metrics(
-
-**due_date_end:** `typing.Optional[dt.datetime]` — DEPRECATED. Use startDate, endDate, and dateType instead. End date for invoice dueDate filter.
+**start_date:** `typing.Optional[dt.datetime]` — Start date filter. Defaults to CREATED_AT unless specified the dateType is specified
@@ -5120,7 +5108,7 @@ client.entity_group.invoice.metrics(
-
-**created_date_start:** `typing.Optional[dt.datetime]` — DEPRECATED. Use startDate, endDate, and dateType instead. Start date for invoice created on date filter.
+**end_date:** `typing.Optional[dt.datetime]` — End date filter. Defaults to CREATED_AT unless specified the dateType is specified
@@ -5128,7 +5116,7 @@ client.entity_group.invoice.metrics(
-
-**created_date_end:** `typing.Optional[dt.datetime]` — DEPRECATED. Use startDate, endDate, and dateType instead. End date for invoice created date filter.
+**date_type:** `typing.Optional[InvoiceDateFilter]` — Type of date to filter by if startDate and endDate filters are provided. Defaults to CREATED_AT.
@@ -5692,7 +5680,15 @@ client.entity.counterparty.find_payees(
-
-**return_metadata:** `typing.Optional[bool]` — If true, will return simple key/value metadata for the counterparties.
+**metadata:** `typing.Optional[MetadataFilter]` — Filter counterparties by simple key/value metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
+
+
+
+
+
+-
+
+**return_metadata:** `typing.Optional[bool]` — If true, will return simple key/value metadata for the counterparties. For more complex metadata, use the Metadata API.
@@ -5833,7 +5829,15 @@ client.entity.counterparty.find_payors(
-
-**return_metadata:** `typing.Optional[bool]` — If true, will return simple key/value metadata for the counterparties.
+**metadata:** `typing.Optional[MetadataFilter]` — Filter counterparties by simple key/value metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
+
+
+
+
+
+-
+
+**return_metadata:** `typing.Optional[bool]` — If true, will return simple key/value metadata for the counterparties. For more complex metadata, use the Metadata API.
@@ -7125,9 +7129,7 @@ client.entity.invoice.find(
-
-**metadata:** `typing.Optional[
- typing.Union[InvoiceMetadataFilter, typing.Sequence[InvoiceMetadataFilter]]
-]` — Filter invoices by metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
+**metadata:** `typing.Optional[typing.Union[MetadataFilter, typing.Sequence[MetadataFilter]]]` — Filter invoices by metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
@@ -7135,9 +7137,7 @@ client.entity.invoice.find(
-
-**line_item_metadata:** `typing.Optional[
- typing.Union[InvoiceMetadataFilter, typing.Sequence[InvoiceMetadataFilter]]
-]` — Filter invoices by line item metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
+**line_item_metadata:** `typing.Optional[typing.Union[MetadataFilter, typing.Sequence[MetadataFilter]]]` — Filter invoices by line item metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
@@ -7241,7 +7241,7 @@ client.entity.invoice.find(
-
-Get invoice metrics for an entity with the given filters. Invoices will be grouped by currency. If none of excludePayables, excludeReceivables, payerId, vendorId, or invoiceId status filters are provided, excludeReceivables will be set to true.
+Get invoice metrics for an entity with the given filters. Invoices will always be grouped by currency. If none of excludePayables, excludeReceivables, payerId, vendorId, or invoiceId status filters are provided, excludeReceivables will be set to true.
@@ -7267,10 +7267,10 @@ client.entity.invoice.metrics(
entity_id="ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
return_by_date="CREATION_DATE",
exclude_receivables=True,
- created_date_start=datetime.datetime.fromisoformat(
+ start_date=datetime.datetime.fromisoformat(
"2021-01-01 00:00:00+00:00",
),
- created_date_end=datetime.datetime.fromisoformat(
+ end_date=datetime.datetime.fromisoformat(
"2021-01-31 23:59:59.999000+00:00",
),
currency="USD",
@@ -7331,7 +7331,7 @@ client.entity.invoice.metrics(
-
-**payer_id:** `typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]]` — Filter invoices by payer ID.
+**return_by_date_frequency:** `typing.Optional[InvoiceMetricsPerDateFrequency]` — Return invoice metrics grouped by date. Defaults to daily.
@@ -7339,7 +7339,9 @@ client.entity.invoice.metrics(
-
-**vendor_id:** `typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]]` — Filter invoices by vendor ID.
+**group_by:** `typing.Optional[
+ typing.Union[InvoiceMetricsGroupBy, typing.Sequence[InvoiceMetricsGroupBy]]
+]` — Return invoice metrics grouped by.
@@ -7347,23 +7349,7 @@ client.entity.invoice.metrics(
-
-**approver_id:** `typing.Optional[typing.Union[EntityUserId, typing.Sequence[EntityUserId]]]` — Filter invoices by assigned approver user ID.
-
-
-
-
-
--
-
-**invoice_id:** `typing.Optional[typing.Union[InvoiceId, typing.Sequence[InvoiceId]]]` — Filter invoices by invoice ID.
-
-
-
-
-
--
-
-**status:** `typing.Optional[typing.Union[InvoiceStatus, typing.Sequence[InvoiceStatus]]]` — Invoice status to filter on
+**payer_id:** `typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]]` — Filter invoices by payer ID.
@@ -7371,7 +7357,7 @@ client.entity.invoice.metrics(
-
-**start_date:** `typing.Optional[dt.datetime]` — Start date filter. Defaults to CREATED_AT unless specified the dateType is specified
+**vendor_id:** `typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]]` — Filter invoices by vendor ID.
@@ -7379,7 +7365,7 @@ client.entity.invoice.metrics(
-
-**end_date:** `typing.Optional[dt.datetime]` — End date filter. Defaults to CREATED_AT unless specified the dateType is specified
+**approver_id:** `typing.Optional[typing.Union[EntityUserId, typing.Sequence[EntityUserId]]]` — Filter invoices by assigned approver user ID.
@@ -7387,7 +7373,7 @@ client.entity.invoice.metrics(
-
-**date_type:** `typing.Optional[InvoiceDateFilter]` — Type of date to filter by if startDate and endDate filters are provided. Defaults to CREATED_AT.
+**invoice_id:** `typing.Optional[typing.Union[InvoiceId, typing.Sequence[InvoiceId]]]` — Filter invoices by invoice ID.
@@ -7395,7 +7381,7 @@ client.entity.invoice.metrics(
-
-**due_date_start:** `typing.Optional[dt.datetime]` — DEPRECATED. Use startDate, endDate, and dateType instead. Start date for invoice dueDate filter.
+**status:** `typing.Optional[typing.Union[InvoiceStatus, typing.Sequence[InvoiceStatus]]]` — Invoice status to filter on
@@ -7403,7 +7389,7 @@ client.entity.invoice.metrics(
-
-**due_date_end:** `typing.Optional[dt.datetime]` — DEPRECATED. Use startDate, endDate, and dateType instead. End date for invoice dueDate filter.
+**start_date:** `typing.Optional[dt.datetime]` — Start date filter. Defaults to CREATED_AT unless specified the dateType is specified
@@ -7411,7 +7397,7 @@ client.entity.invoice.metrics(
-
-**created_date_start:** `typing.Optional[dt.datetime]` — DEPRECATED. Use startDate, endDate, and dateType instead. Start date for invoice created on date filter.
+**end_date:** `typing.Optional[dt.datetime]` — End date filter. Defaults to CREATED_AT unless specified the dateType is specified
@@ -7419,7 +7405,7 @@ client.entity.invoice.metrics(
-
-**created_date_end:** `typing.Optional[dt.datetime]` — DEPRECATED. Use startDate, endDate, and dateType instead. End date for invoice created date filter.
+**date_type:** `typing.Optional[InvoiceDateFilter]` — Type of date to filter by if startDate and endDate filters are provided. Defaults to CREATED_AT.
diff --git a/src/mercoa/__init__.py b/src/mercoa/__init__.py
index 5193fa2..2819a37 100644
--- a/src/mercoa/__init__.py
+++ b/src/mercoa/__init__.py
@@ -36,6 +36,7 @@
NotFound,
OrderDirection,
PhoneNumber,
+ StringOrStringArray,
Unauthorized,
Unimplemented,
)
@@ -168,7 +169,8 @@
InvoiceLineItemRequestBase,
InvoiceLineItemResponse,
InvoiceLineItemUpdateRequest,
- InvoiceMetadataFilter,
+ InvoiceMetricsGroupBy,
+ InvoiceMetricsPerDateFrequency,
InvoiceMetricsPerDateGroupBy,
InvoiceMetricsPerDateResponse,
InvoiceMetricsResponse,
@@ -177,6 +179,7 @@
InvoiceResponse,
InvoiceStatus,
InvoiceUpdateRequest,
+ MetadataFilter,
PaymentDestinationOptions,
PaymentDestinationOptions_BankAccount,
PaymentDestinationOptions_Check,
@@ -463,7 +466,8 @@
"InvoiceLineItemRequestBase",
"InvoiceLineItemResponse",
"InvoiceLineItemUpdateRequest",
- "InvoiceMetadataFilter",
+ "InvoiceMetricsGroupBy",
+ "InvoiceMetricsPerDateFrequency",
"InvoiceMetricsPerDateGroupBy",
"InvoiceMetricsPerDateResponse",
"InvoiceMetricsResponse",
@@ -480,6 +484,7 @@
"Mercoa",
"MercoaEnvironment",
"MetadataCustomizationRequest",
+ "MetadataFilter",
"MetadataRegexValidationRule",
"MetadataSchema",
"MetadataShowConditions",
@@ -576,6 +581,7 @@
"Rule_Approver",
"RutterProviderRequest",
"RutterProviderResponse",
+ "StringOrStringArray",
"TaxId",
"TokenGenerationEntityOptions",
"TokenGenerationInvoiceOptions",
diff --git a/src/mercoa/commons/__init__.py b/src/mercoa/commons/__init__.py
index 254a73d..c5d41dd 100644
--- a/src/mercoa/commons/__init__.py
+++ b/src/mercoa/commons/__init__.py
@@ -9,6 +9,7 @@
IndividualGovernmentId,
OrderDirection,
PhoneNumber,
+ StringOrStringArray,
)
from .errors import BadRequest, Conflict, Forbidden, InternalServerError, NotFound, Unauthorized, Unimplemented
@@ -26,6 +27,7 @@
"NotFound",
"OrderDirection",
"PhoneNumber",
+ "StringOrStringArray",
"Unauthorized",
"Unimplemented",
]
diff --git a/src/mercoa/commons/types/__init__.py b/src/mercoa/commons/types/__init__.py
index dad9f8d..9b061d2 100644
--- a/src/mercoa/commons/types/__init__.py
+++ b/src/mercoa/commons/types/__init__.py
@@ -8,6 +8,7 @@
from .individual_government_id import IndividualGovernmentId
from .order_direction import OrderDirection
from .phone_number import PhoneNumber
+from .string_or_string_array import StringOrStringArray
__all__ = [
"Address",
@@ -18,4 +19,5 @@
"IndividualGovernmentId",
"OrderDirection",
"PhoneNumber",
+ "StringOrStringArray",
]
diff --git a/src/mercoa/commons/types/string_or_string_array.py b/src/mercoa/commons/types/string_or_string_array.py
new file mode 100644
index 0000000..850bdd9
--- /dev/null
+++ b/src/mercoa/commons/types/string_or_string_array.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+StringOrStringArray = typing.Union[str, typing.List[str]]
diff --git a/src/mercoa/core/client_wrapper.py b/src/mercoa/core/client_wrapper.py
index 0af511c..661c086 100644
--- a/src/mercoa/core/client_wrapper.py
+++ b/src/mercoa/core/client_wrapper.py
@@ -22,7 +22,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": "0.5.8-rc1",
+ "X-Fern-SDK-Version": "0.5.8",
}
headers["Authorization"] = f"Bearer {self._get_token()}"
return headers
diff --git a/src/mercoa/entity/client.py b/src/mercoa/entity/client.py
index 5a7f5f8..f85e2eb 100644
--- a/src/mercoa/entity/client.py
+++ b/src/mercoa/entity/client.py
@@ -15,9 +15,11 @@
from .payment_method.client import PaymentMethodClient
from .representative.client import RepresentativeClient
from ..entity_types.types.entity_status import EntityStatus
+from ..invoice_types.types.metadata_filter import MetadataFilter
from ..entity_types.types.entity_id import EntityId
from ..core.request_options import RequestOptions
from ..entity_types.types.find_entity_response import FindEntityResponse
+from ..core.jsonable_encoder import jsonable_encoder
from json.decoder import JSONDecodeError
from ..core.api_error import ApiError
from ..core.pydantic_utilities import parse_obj_as
@@ -30,7 +32,6 @@
from ..commons.errors.unimplemented import Unimplemented
from ..entity_types.types.entity_request import EntityRequest
from ..entity_types.types.entity_response import EntityResponse
-from ..core.jsonable_encoder import jsonable_encoder
from ..entity_types.types.entity_update_request import EntityUpdateRequest
from ..entity_types.types.token_generation_options import TokenGenerationOptions
from ..payment_method_types.types.payment_method_id import PaymentMethodId
@@ -82,6 +83,7 @@ def find(
is_payee: typing.Optional[bool] = None,
is_payor: typing.Optional[bool] = None,
name: typing.Optional[str] = None,
+ metadata: typing.Optional[MetadataFilter] = None,
return_metadata: typing.Optional[bool] = None,
limit: typing.Optional[int] = None,
starting_after: typing.Optional[EntityId] = None,
@@ -114,8 +116,11 @@ def find(
name : typing.Optional[str]
Filter entities by name. Partial matches are supported.
+ metadata : typing.Optional[MetadataFilter]
+ Filter entities by simple key/value metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
+
return_metadata : typing.Optional[bool]
- If true, will return simple key/value metadata for the entity. For more complex metadata, use the Metadata API.
+ If true, will return simple key/value metadata for the entities. For more complex metadata, use the Metadata API.
limit : typing.Optional[int]
Number of entities to return. Limit can range between 1 and 100, and the default is 10.
@@ -154,6 +159,7 @@ def find(
"isPayee": is_payee,
"isPayor": is_payor,
"name": name,
+ "metadata": jsonable_encoder(metadata),
"returnMetadata": return_metadata,
"limit": limit,
"startingAfter": starting_after,
@@ -1732,6 +1738,7 @@ async def find(
is_payee: typing.Optional[bool] = None,
is_payor: typing.Optional[bool] = None,
name: typing.Optional[str] = None,
+ metadata: typing.Optional[MetadataFilter] = None,
return_metadata: typing.Optional[bool] = None,
limit: typing.Optional[int] = None,
starting_after: typing.Optional[EntityId] = None,
@@ -1764,8 +1771,11 @@ async def find(
name : typing.Optional[str]
Filter entities by name. Partial matches are supported.
+ metadata : typing.Optional[MetadataFilter]
+ Filter entities by simple key/value metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
+
return_metadata : typing.Optional[bool]
- If true, will return simple key/value metadata for the entity. For more complex metadata, use the Metadata API.
+ If true, will return simple key/value metadata for the entities. For more complex metadata, use the Metadata API.
limit : typing.Optional[int]
Number of entities to return. Limit can range between 1 and 100, and the default is 10.
@@ -1812,6 +1822,7 @@ async def main() -> None:
"isPayee": is_payee,
"isPayor": is_payor,
"name": name,
+ "metadata": jsonable_encoder(metadata),
"returnMetadata": return_metadata,
"limit": limit,
"startingAfter": starting_after,
diff --git a/src/mercoa/entity/counterparty/client.py b/src/mercoa/entity/counterparty/client.py
index 704d802..cc51bca 100644
--- a/src/mercoa/entity/counterparty/client.py
+++ b/src/mercoa/entity/counterparty/client.py
@@ -4,6 +4,7 @@
from ...core.client_wrapper import SyncClientWrapper
from ...entity_types.types.entity_id import EntityId
from ...entity_types.types.counterparty_network_type import CounterpartyNetworkType
+from ...invoice_types.types.metadata_filter import MetadataFilter
from ...core.request_options import RequestOptions
from ...entity_types.types.find_counterparties_response import FindCounterpartiesResponse
from ...core.jsonable_encoder import jsonable_encoder
@@ -42,6 +43,7 @@ def find_payees(
payment_methods: typing.Optional[bool] = None,
invoice_metrics: typing.Optional[bool] = None,
counterparty_id: typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]] = None,
+ metadata: typing.Optional[MetadataFilter] = None,
return_metadata: typing.Optional[bool] = None,
limit: typing.Optional[int] = None,
starting_after: typing.Optional[EntityId] = None,
@@ -70,8 +72,11 @@ def find_payees(
counterparty_id : typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]]
Filter by counterparty ids (Foreign ID is supported)
+ metadata : typing.Optional[MetadataFilter]
+ Filter counterparties by simple key/value metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
+
return_metadata : typing.Optional[bool]
- If true, will return simple key/value metadata for the counterparties.
+ If true, will return simple key/value metadata for the counterparties. For more complex metadata, use the Metadata API.
limit : typing.Optional[int]
Number of counterparties to return. Limit can range between 1 and 100, and the default is 10.
@@ -109,6 +114,7 @@ def find_payees(
"paymentMethods": payment_methods,
"invoiceMetrics": invoice_metrics,
"counterpartyId": counterparty_id,
+ "metadata": jsonable_encoder(metadata),
"returnMetadata": return_metadata,
"limit": limit,
"startingAfter": starting_after,
@@ -211,6 +217,7 @@ def find_payors(
payment_methods: typing.Optional[bool] = None,
invoice_metrics: typing.Optional[bool] = None,
counterparty_id: typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]] = None,
+ metadata: typing.Optional[MetadataFilter] = None,
return_metadata: typing.Optional[bool] = None,
limit: typing.Optional[int] = None,
starting_after: typing.Optional[EntityId] = None,
@@ -239,8 +246,11 @@ def find_payors(
counterparty_id : typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]]
Filter by counterparty ids (Foreign ID is supported)
+ metadata : typing.Optional[MetadataFilter]
+ Filter counterparties by simple key/value metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
+
return_metadata : typing.Optional[bool]
- If true, will return simple key/value metadata for the counterparties.
+ If true, will return simple key/value metadata for the counterparties. For more complex metadata, use the Metadata API.
limit : typing.Optional[int]
Number of counterparties to return. Limit can range between 1 and 100, and the default is 10.
@@ -278,6 +288,7 @@ def find_payors(
"paymentMethods": payment_methods,
"invoiceMetrics": invoice_metrics,
"counterpartyId": counterparty_id,
+ "metadata": jsonable_encoder(metadata),
"returnMetadata": return_metadata,
"limit": limit,
"startingAfter": starting_after,
@@ -917,6 +928,7 @@ async def find_payees(
payment_methods: typing.Optional[bool] = None,
invoice_metrics: typing.Optional[bool] = None,
counterparty_id: typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]] = None,
+ metadata: typing.Optional[MetadataFilter] = None,
return_metadata: typing.Optional[bool] = None,
limit: typing.Optional[int] = None,
starting_after: typing.Optional[EntityId] = None,
@@ -945,8 +957,11 @@ async def find_payees(
counterparty_id : typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]]
Filter by counterparty ids (Foreign ID is supported)
+ metadata : typing.Optional[MetadataFilter]
+ Filter counterparties by simple key/value metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
+
return_metadata : typing.Optional[bool]
- If true, will return simple key/value metadata for the counterparties.
+ If true, will return simple key/value metadata for the counterparties. For more complex metadata, use the Metadata API.
limit : typing.Optional[int]
Number of counterparties to return. Limit can range between 1 and 100, and the default is 10.
@@ -992,6 +1007,7 @@ async def main() -> None:
"paymentMethods": payment_methods,
"invoiceMetrics": invoice_metrics,
"counterpartyId": counterparty_id,
+ "metadata": jsonable_encoder(metadata),
"returnMetadata": return_metadata,
"limit": limit,
"startingAfter": starting_after,
@@ -1094,6 +1110,7 @@ async def find_payors(
payment_methods: typing.Optional[bool] = None,
invoice_metrics: typing.Optional[bool] = None,
counterparty_id: typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]] = None,
+ metadata: typing.Optional[MetadataFilter] = None,
return_metadata: typing.Optional[bool] = None,
limit: typing.Optional[int] = None,
starting_after: typing.Optional[EntityId] = None,
@@ -1122,8 +1139,11 @@ async def find_payors(
counterparty_id : typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]]
Filter by counterparty ids (Foreign ID is supported)
+ metadata : typing.Optional[MetadataFilter]
+ Filter counterparties by simple key/value metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
+
return_metadata : typing.Optional[bool]
- If true, will return simple key/value metadata for the counterparties.
+ If true, will return simple key/value metadata for the counterparties. For more complex metadata, use the Metadata API.
limit : typing.Optional[int]
Number of counterparties to return. Limit can range between 1 and 100, and the default is 10.
@@ -1169,6 +1189,7 @@ async def main() -> None:
"paymentMethods": payment_methods,
"invoiceMetrics": invoice_metrics,
"counterpartyId": counterparty_id,
+ "metadata": jsonable_encoder(metadata),
"returnMetadata": return_metadata,
"limit": limit,
"startingAfter": starting_after,
diff --git a/src/mercoa/entity/invoice/client.py b/src/mercoa/entity/invoice/client.py
index 1c5c2d3..d52a48e 100644
--- a/src/mercoa/entity/invoice/client.py
+++ b/src/mercoa/entity/invoice/client.py
@@ -8,7 +8,7 @@
from ...invoice_types.types.invoice_order_by_field import InvoiceOrderByField
from ...commons.types.order_direction import OrderDirection
from ...invoice_types.types.invoice_id import InvoiceId
-from ...invoice_types.types.invoice_metadata_filter import InvoiceMetadataFilter
+from ...invoice_types.types.metadata_filter import MetadataFilter
from ...entity_types.types.entity_user_id import EntityUserId
from ...invoice_types.types.approver_action import ApproverAction
from ...invoice_types.types.invoice_status import InvoiceStatus
@@ -28,6 +28,8 @@
from ...commons.errors.internal_server_error import InternalServerError
from ...commons.errors.unimplemented import Unimplemented
from ...invoice_types.types.invoice_metrics_per_date_group_by import InvoiceMetricsPerDateGroupBy
+from ...invoice_types.types.invoice_metrics_per_date_frequency import InvoiceMetricsPerDateFrequency
+from ...invoice_types.types.invoice_metrics_group_by import InvoiceMetricsGroupBy
from ...payment_method_types.types.currency_code import CurrencyCode
from ...invoice_types.types.invoice_metrics_response import InvoiceMetricsResponse
from ...core.client_wrapper import AsyncClientWrapper
@@ -50,10 +52,8 @@ def find(
order_direction: typing.Optional[OrderDirection] = None,
limit: typing.Optional[int] = None,
starting_after: typing.Optional[InvoiceId] = None,
- metadata: typing.Optional[typing.Union[InvoiceMetadataFilter, typing.Sequence[InvoiceMetadataFilter]]] = None,
- line_item_metadata: typing.Optional[
- typing.Union[InvoiceMetadataFilter, typing.Sequence[InvoiceMetadataFilter]]
- ] = None,
+ metadata: typing.Optional[typing.Union[MetadataFilter, typing.Sequence[MetadataFilter]]] = None,
+ line_item_metadata: typing.Optional[typing.Union[MetadataFilter, typing.Sequence[MetadataFilter]]] = None,
line_item_gl_account_id: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
search: typing.Optional[str] = None,
payer_id: typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]] = None,
@@ -100,10 +100,10 @@ def find(
starting_after : typing.Optional[InvoiceId]
The ID of the invoice to start after. If not provided, the first page of invoices will be returned.
- metadata : typing.Optional[typing.Union[InvoiceMetadataFilter, typing.Sequence[InvoiceMetadataFilter]]]
+ metadata : typing.Optional[typing.Union[MetadataFilter, typing.Sequence[MetadataFilter]]]
Filter invoices by metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
- line_item_metadata : typing.Optional[typing.Union[InvoiceMetadataFilter, typing.Sequence[InvoiceMetadataFilter]]]
+ line_item_metadata : typing.Optional[typing.Union[MetadataFilter, typing.Sequence[MetadataFilter]]]
Filter invoices by line item metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
line_item_gl_account_id : typing.Optional[typing.Union[str, typing.Sequence[str]]]
@@ -275,6 +275,8 @@ def metrics(
exclude_payables: typing.Optional[bool] = None,
exclude_receivables: typing.Optional[bool] = None,
return_by_date: typing.Optional[InvoiceMetricsPerDateGroupBy] = None,
+ return_by_date_frequency: typing.Optional[InvoiceMetricsPerDateFrequency] = None,
+ group_by: typing.Optional[typing.Union[InvoiceMetricsGroupBy, typing.Sequence[InvoiceMetricsGroupBy]]] = None,
payer_id: typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]] = None,
vendor_id: typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]] = None,
approver_id: typing.Optional[typing.Union[EntityUserId, typing.Sequence[EntityUserId]]] = None,
@@ -283,15 +285,11 @@ def metrics(
start_date: typing.Optional[dt.datetime] = None,
end_date: typing.Optional[dt.datetime] = None,
date_type: typing.Optional[InvoiceDateFilter] = None,
- due_date_start: typing.Optional[dt.datetime] = None,
- due_date_end: typing.Optional[dt.datetime] = None,
- created_date_start: typing.Optional[dt.datetime] = None,
- created_date_end: typing.Optional[dt.datetime] = None,
currency: typing.Optional[typing.Union[CurrencyCode, typing.Sequence[CurrencyCode]]] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> typing.List[InvoiceMetricsResponse]:
"""
- Get invoice metrics for an entity with the given filters. Invoices will be grouped by currency. If none of excludePayables, excludeReceivables, payerId, vendorId, or invoiceId status filters are provided, excludeReceivables will be set to true.
+ Get invoice metrics for an entity with the given filters. Invoices will always be grouped by currency. If none of excludePayables, excludeReceivables, payerId, vendorId, or invoiceId status filters are provided, excludeReceivables will be set to true.
Parameters
----------
@@ -310,6 +308,12 @@ def metrics(
return_by_date : typing.Optional[InvoiceMetricsPerDateGroupBy]
Return invoice metrics grouped by date.
+ return_by_date_frequency : typing.Optional[InvoiceMetricsPerDateFrequency]
+ Return invoice metrics grouped by date. Defaults to daily.
+
+ group_by : typing.Optional[typing.Union[InvoiceMetricsGroupBy, typing.Sequence[InvoiceMetricsGroupBy]]]
+ Return invoice metrics grouped by.
+
payer_id : typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]]
Filter invoices by payer ID.
@@ -334,18 +338,6 @@ def metrics(
date_type : typing.Optional[InvoiceDateFilter]
Type of date to filter by if startDate and endDate filters are provided. Defaults to CREATED_AT.
- due_date_start : typing.Optional[dt.datetime]
- DEPRECATED. Use startDate, endDate, and dateType instead. Start date for invoice dueDate filter.
-
- due_date_end : typing.Optional[dt.datetime]
- DEPRECATED. Use startDate, endDate, and dateType instead. End date for invoice dueDate filter.
-
- created_date_start : typing.Optional[dt.datetime]
- DEPRECATED. Use startDate, endDate, and dateType instead. Start date for invoice created on date filter.
-
- created_date_end : typing.Optional[dt.datetime]
- DEPRECATED. Use startDate, endDate, and dateType instead. End date for invoice created date filter.
-
currency : typing.Optional[typing.Union[CurrencyCode, typing.Sequence[CurrencyCode]]]
Currency to filter on
@@ -369,10 +361,10 @@ def metrics(
entity_id="ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
return_by_date="CREATION_DATE",
exclude_receivables=True,
- created_date_start=datetime.datetime.fromisoformat(
+ start_date=datetime.datetime.fromisoformat(
"2021-01-01 00:00:00+00:00",
),
- created_date_end=datetime.datetime.fromisoformat(
+ end_date=datetime.datetime.fromisoformat(
"2021-01-31 23:59:59.999000+00:00",
),
currency="USD",
@@ -387,6 +379,8 @@ def metrics(
"excludePayables": exclude_payables,
"excludeReceivables": exclude_receivables,
"returnByDate": return_by_date,
+ "returnByDateFrequency": return_by_date_frequency,
+ "groupBy": group_by,
"payerId": payer_id,
"vendorId": vendor_id,
"approverId": approver_id,
@@ -395,10 +389,6 @@ def metrics(
"startDate": serialize_datetime(start_date) if start_date is not None else None,
"endDate": serialize_datetime(end_date) if end_date is not None else None,
"dateType": date_type,
- "dueDateStart": serialize_datetime(due_date_start) if due_date_start is not None else None,
- "dueDateEnd": serialize_datetime(due_date_end) if due_date_end is not None else None,
- "createdDateStart": serialize_datetime(created_date_start) if created_date_start is not None else None,
- "createdDateEnd": serialize_datetime(created_date_end) if created_date_end is not None else None,
"currency": currency,
},
request_options=request_options,
@@ -506,10 +496,8 @@ async def find(
order_direction: typing.Optional[OrderDirection] = None,
limit: typing.Optional[int] = None,
starting_after: typing.Optional[InvoiceId] = None,
- metadata: typing.Optional[typing.Union[InvoiceMetadataFilter, typing.Sequence[InvoiceMetadataFilter]]] = None,
- line_item_metadata: typing.Optional[
- typing.Union[InvoiceMetadataFilter, typing.Sequence[InvoiceMetadataFilter]]
- ] = None,
+ metadata: typing.Optional[typing.Union[MetadataFilter, typing.Sequence[MetadataFilter]]] = None,
+ line_item_metadata: typing.Optional[typing.Union[MetadataFilter, typing.Sequence[MetadataFilter]]] = None,
line_item_gl_account_id: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
search: typing.Optional[str] = None,
payer_id: typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]] = None,
@@ -556,10 +544,10 @@ async def find(
starting_after : typing.Optional[InvoiceId]
The ID of the invoice to start after. If not provided, the first page of invoices will be returned.
- metadata : typing.Optional[typing.Union[InvoiceMetadataFilter, typing.Sequence[InvoiceMetadataFilter]]]
+ metadata : typing.Optional[typing.Union[MetadataFilter, typing.Sequence[MetadataFilter]]]
Filter invoices by metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
- line_item_metadata : typing.Optional[typing.Union[InvoiceMetadataFilter, typing.Sequence[InvoiceMetadataFilter]]]
+ line_item_metadata : typing.Optional[typing.Union[MetadataFilter, typing.Sequence[MetadataFilter]]]
Filter invoices by line item metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
line_item_gl_account_id : typing.Optional[typing.Union[str, typing.Sequence[str]]]
@@ -739,6 +727,8 @@ async def metrics(
exclude_payables: typing.Optional[bool] = None,
exclude_receivables: typing.Optional[bool] = None,
return_by_date: typing.Optional[InvoiceMetricsPerDateGroupBy] = None,
+ return_by_date_frequency: typing.Optional[InvoiceMetricsPerDateFrequency] = None,
+ group_by: typing.Optional[typing.Union[InvoiceMetricsGroupBy, typing.Sequence[InvoiceMetricsGroupBy]]] = None,
payer_id: typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]] = None,
vendor_id: typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]] = None,
approver_id: typing.Optional[typing.Union[EntityUserId, typing.Sequence[EntityUserId]]] = None,
@@ -747,15 +737,11 @@ async def metrics(
start_date: typing.Optional[dt.datetime] = None,
end_date: typing.Optional[dt.datetime] = None,
date_type: typing.Optional[InvoiceDateFilter] = None,
- due_date_start: typing.Optional[dt.datetime] = None,
- due_date_end: typing.Optional[dt.datetime] = None,
- created_date_start: typing.Optional[dt.datetime] = None,
- created_date_end: typing.Optional[dt.datetime] = None,
currency: typing.Optional[typing.Union[CurrencyCode, typing.Sequence[CurrencyCode]]] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> typing.List[InvoiceMetricsResponse]:
"""
- Get invoice metrics for an entity with the given filters. Invoices will be grouped by currency. If none of excludePayables, excludeReceivables, payerId, vendorId, or invoiceId status filters are provided, excludeReceivables will be set to true.
+ Get invoice metrics for an entity with the given filters. Invoices will always be grouped by currency. If none of excludePayables, excludeReceivables, payerId, vendorId, or invoiceId status filters are provided, excludeReceivables will be set to true.
Parameters
----------
@@ -774,6 +760,12 @@ async def metrics(
return_by_date : typing.Optional[InvoiceMetricsPerDateGroupBy]
Return invoice metrics grouped by date.
+ return_by_date_frequency : typing.Optional[InvoiceMetricsPerDateFrequency]
+ Return invoice metrics grouped by date. Defaults to daily.
+
+ group_by : typing.Optional[typing.Union[InvoiceMetricsGroupBy, typing.Sequence[InvoiceMetricsGroupBy]]]
+ Return invoice metrics grouped by.
+
payer_id : typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]]
Filter invoices by payer ID.
@@ -798,18 +790,6 @@ async def metrics(
date_type : typing.Optional[InvoiceDateFilter]
Type of date to filter by if startDate and endDate filters are provided. Defaults to CREATED_AT.
- due_date_start : typing.Optional[dt.datetime]
- DEPRECATED. Use startDate, endDate, and dateType instead. Start date for invoice dueDate filter.
-
- due_date_end : typing.Optional[dt.datetime]
- DEPRECATED. Use startDate, endDate, and dateType instead. End date for invoice dueDate filter.
-
- created_date_start : typing.Optional[dt.datetime]
- DEPRECATED. Use startDate, endDate, and dateType instead. Start date for invoice created on date filter.
-
- created_date_end : typing.Optional[dt.datetime]
- DEPRECATED. Use startDate, endDate, and dateType instead. End date for invoice created date filter.
-
currency : typing.Optional[typing.Union[CurrencyCode, typing.Sequence[CurrencyCode]]]
Currency to filter on
@@ -837,10 +817,10 @@ async def main() -> None:
entity_id="ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
return_by_date="CREATION_DATE",
exclude_receivables=True,
- created_date_start=datetime.datetime.fromisoformat(
+ start_date=datetime.datetime.fromisoformat(
"2021-01-01 00:00:00+00:00",
),
- created_date_end=datetime.datetime.fromisoformat(
+ end_date=datetime.datetime.fromisoformat(
"2021-01-31 23:59:59.999000+00:00",
),
currency="USD",
@@ -858,6 +838,8 @@ async def main() -> None:
"excludePayables": exclude_payables,
"excludeReceivables": exclude_receivables,
"returnByDate": return_by_date,
+ "returnByDateFrequency": return_by_date_frequency,
+ "groupBy": group_by,
"payerId": payer_id,
"vendorId": vendor_id,
"approverId": approver_id,
@@ -866,10 +848,6 @@ async def main() -> None:
"startDate": serialize_datetime(start_date) if start_date is not None else None,
"endDate": serialize_datetime(end_date) if end_date is not None else None,
"dateType": date_type,
- "dueDateStart": serialize_datetime(due_date_start) if due_date_start is not None else None,
- "dueDateEnd": serialize_datetime(due_date_end) if due_date_end is not None else None,
- "createdDateStart": serialize_datetime(created_date_start) if created_date_start is not None else None,
- "createdDateEnd": serialize_datetime(created_date_end) if created_date_end is not None else None,
"currency": currency,
},
request_options=request_options,
diff --git a/src/mercoa/entity_group/invoice/client.py b/src/mercoa/entity_group/invoice/client.py
index 9ea3247..4b3e0d2 100644
--- a/src/mercoa/entity_group/invoice/client.py
+++ b/src/mercoa/entity_group/invoice/client.py
@@ -8,7 +8,7 @@
from ...invoice_types.types.invoice_order_by_field import InvoiceOrderByField
from ...commons.types.order_direction import OrderDirection
from ...invoice_types.types.invoice_id import InvoiceId
-from ...invoice_types.types.invoice_metadata_filter import InvoiceMetadataFilter
+from ...invoice_types.types.metadata_filter import MetadataFilter
from ...entity_types.types.entity_id import EntityId
from ...entity_types.types.entity_user_id import EntityUserId
from ...invoice_types.types.approver_action import ApproverAction
@@ -29,6 +29,8 @@
from ...commons.errors.internal_server_error import InternalServerError
from ...commons.errors.unimplemented import Unimplemented
from ...invoice_types.types.invoice_metrics_per_date_group_by import InvoiceMetricsPerDateGroupBy
+from ...invoice_types.types.invoice_metrics_per_date_frequency import InvoiceMetricsPerDateFrequency
+from ...invoice_types.types.invoice_metrics_group_by import InvoiceMetricsGroupBy
from ...payment_method_types.types.currency_code import CurrencyCode
from ...invoice_types.types.invoice_metrics_response import InvoiceMetricsResponse
from ...core.client_wrapper import AsyncClientWrapper
@@ -51,7 +53,7 @@ def find(
order_direction: typing.Optional[OrderDirection] = None,
limit: typing.Optional[int] = None,
starting_after: typing.Optional[InvoiceId] = None,
- metadata: typing.Optional[typing.Union[InvoiceMetadataFilter, typing.Sequence[InvoiceMetadataFilter]]] = None,
+ metadata: typing.Optional[typing.Union[MetadataFilter, typing.Sequence[MetadataFilter]]] = None,
search: typing.Optional[str] = None,
payer_id: typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]] = None,
vendor_id: typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]] = None,
@@ -97,7 +99,7 @@ def find(
starting_after : typing.Optional[InvoiceId]
The ID of the invoice to start after. If not provided, the first page of invoices will be returned.
- metadata : typing.Optional[typing.Union[InvoiceMetadataFilter, typing.Sequence[InvoiceMetadataFilter]]]
+ metadata : typing.Optional[typing.Union[MetadataFilter, typing.Sequence[MetadataFilter]]]
Filter invoices by metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
search : typing.Optional[str]
@@ -264,6 +266,8 @@ def metrics(
exclude_payables: typing.Optional[bool] = None,
exclude_receivables: typing.Optional[bool] = None,
return_by_date: typing.Optional[InvoiceMetricsPerDateGroupBy] = None,
+ return_by_date_frequency: typing.Optional[InvoiceMetricsPerDateFrequency] = None,
+ group_by: typing.Optional[typing.Union[InvoiceMetricsGroupBy, typing.Sequence[InvoiceMetricsGroupBy]]] = None,
payer_id: typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]] = None,
vendor_id: typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]] = None,
approver_id: typing.Optional[typing.Union[EntityUserId, typing.Sequence[EntityUserId]]] = None,
@@ -272,10 +276,6 @@ def metrics(
start_date: typing.Optional[dt.datetime] = None,
end_date: typing.Optional[dt.datetime] = None,
date_type: typing.Optional[InvoiceDateFilter] = None,
- due_date_start: typing.Optional[dt.datetime] = None,
- due_date_end: typing.Optional[dt.datetime] = None,
- created_date_start: typing.Optional[dt.datetime] = None,
- created_date_end: typing.Optional[dt.datetime] = None,
currency: typing.Optional[typing.Union[CurrencyCode, typing.Sequence[CurrencyCode]]] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> typing.List[InvoiceMetricsResponse]:
@@ -299,6 +299,12 @@ def metrics(
return_by_date : typing.Optional[InvoiceMetricsPerDateGroupBy]
Return invoice metrics grouped by date.
+ return_by_date_frequency : typing.Optional[InvoiceMetricsPerDateFrequency]
+ Return invoice metrics grouped by date. Defaults to daily.
+
+ group_by : typing.Optional[typing.Union[InvoiceMetricsGroupBy, typing.Sequence[InvoiceMetricsGroupBy]]]
+ Return invoice metrics grouped by.
+
payer_id : typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]]
Filter invoices by payer ID.
@@ -323,18 +329,6 @@ def metrics(
date_type : typing.Optional[InvoiceDateFilter]
Type of date to filter by if startDate and endDate filters are provided. Defaults to CREATED_AT.
- due_date_start : typing.Optional[dt.datetime]
- DEPRECATED. Use startDate, endDate, and dateType instead. Start date for invoice dueDate filter.
-
- due_date_end : typing.Optional[dt.datetime]
- DEPRECATED. Use startDate, endDate, and dateType instead. End date for invoice dueDate filter.
-
- created_date_start : typing.Optional[dt.datetime]
- DEPRECATED. Use startDate, endDate, and dateType instead. Start date for invoice created on date filter.
-
- created_date_end : typing.Optional[dt.datetime]
- DEPRECATED. Use startDate, endDate, and dateType instead. End date for invoice created date filter.
-
currency : typing.Optional[typing.Union[CurrencyCode, typing.Sequence[CurrencyCode]]]
Currency to filter on
@@ -358,10 +352,10 @@ def metrics(
entity_group_id="entg_8545a84e-a45f-41bf-bdf1-33b42a55812c",
return_by_date="CREATION_DATE",
exclude_receivables=True,
- created_date_start=datetime.datetime.fromisoformat(
+ start_date=datetime.datetime.fromisoformat(
"2021-01-01 00:00:00+00:00",
),
- created_date_end=datetime.datetime.fromisoformat(
+ end_date=datetime.datetime.fromisoformat(
"2021-01-31 23:59:59.999000+00:00",
),
currency="USD",
@@ -376,6 +370,8 @@ def metrics(
"excludePayables": exclude_payables,
"excludeReceivables": exclude_receivables,
"returnByDate": return_by_date,
+ "returnByDateFrequency": return_by_date_frequency,
+ "groupBy": group_by,
"payerId": payer_id,
"vendorId": vendor_id,
"approverId": approver_id,
@@ -384,10 +380,6 @@ def metrics(
"startDate": serialize_datetime(start_date) if start_date is not None else None,
"endDate": serialize_datetime(end_date) if end_date is not None else None,
"dateType": date_type,
- "dueDateStart": serialize_datetime(due_date_start) if due_date_start is not None else None,
- "dueDateEnd": serialize_datetime(due_date_end) if due_date_end is not None else None,
- "createdDateStart": serialize_datetime(created_date_start) if created_date_start is not None else None,
- "createdDateEnd": serialize_datetime(created_date_end) if created_date_end is not None else None,
"currency": currency,
},
request_options=request_options,
@@ -495,7 +487,7 @@ async def find(
order_direction: typing.Optional[OrderDirection] = None,
limit: typing.Optional[int] = None,
starting_after: typing.Optional[InvoiceId] = None,
- metadata: typing.Optional[typing.Union[InvoiceMetadataFilter, typing.Sequence[InvoiceMetadataFilter]]] = None,
+ metadata: typing.Optional[typing.Union[MetadataFilter, typing.Sequence[MetadataFilter]]] = None,
search: typing.Optional[str] = None,
payer_id: typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]] = None,
vendor_id: typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]] = None,
@@ -541,7 +533,7 @@ async def find(
starting_after : typing.Optional[InvoiceId]
The ID of the invoice to start after. If not provided, the first page of invoices will be returned.
- metadata : typing.Optional[typing.Union[InvoiceMetadataFilter, typing.Sequence[InvoiceMetadataFilter]]]
+ metadata : typing.Optional[typing.Union[MetadataFilter, typing.Sequence[MetadataFilter]]]
Filter invoices by metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
search : typing.Optional[str]
@@ -716,6 +708,8 @@ async def metrics(
exclude_payables: typing.Optional[bool] = None,
exclude_receivables: typing.Optional[bool] = None,
return_by_date: typing.Optional[InvoiceMetricsPerDateGroupBy] = None,
+ return_by_date_frequency: typing.Optional[InvoiceMetricsPerDateFrequency] = None,
+ group_by: typing.Optional[typing.Union[InvoiceMetricsGroupBy, typing.Sequence[InvoiceMetricsGroupBy]]] = None,
payer_id: typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]] = None,
vendor_id: typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]] = None,
approver_id: typing.Optional[typing.Union[EntityUserId, typing.Sequence[EntityUserId]]] = None,
@@ -724,10 +718,6 @@ async def metrics(
start_date: typing.Optional[dt.datetime] = None,
end_date: typing.Optional[dt.datetime] = None,
date_type: typing.Optional[InvoiceDateFilter] = None,
- due_date_start: typing.Optional[dt.datetime] = None,
- due_date_end: typing.Optional[dt.datetime] = None,
- created_date_start: typing.Optional[dt.datetime] = None,
- created_date_end: typing.Optional[dt.datetime] = None,
currency: typing.Optional[typing.Union[CurrencyCode, typing.Sequence[CurrencyCode]]] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> typing.List[InvoiceMetricsResponse]:
@@ -751,6 +741,12 @@ async def metrics(
return_by_date : typing.Optional[InvoiceMetricsPerDateGroupBy]
Return invoice metrics grouped by date.
+ return_by_date_frequency : typing.Optional[InvoiceMetricsPerDateFrequency]
+ Return invoice metrics grouped by date. Defaults to daily.
+
+ group_by : typing.Optional[typing.Union[InvoiceMetricsGroupBy, typing.Sequence[InvoiceMetricsGroupBy]]]
+ Return invoice metrics grouped by.
+
payer_id : typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]]
Filter invoices by payer ID.
@@ -775,18 +771,6 @@ async def metrics(
date_type : typing.Optional[InvoiceDateFilter]
Type of date to filter by if startDate and endDate filters are provided. Defaults to CREATED_AT.
- due_date_start : typing.Optional[dt.datetime]
- DEPRECATED. Use startDate, endDate, and dateType instead. Start date for invoice dueDate filter.
-
- due_date_end : typing.Optional[dt.datetime]
- DEPRECATED. Use startDate, endDate, and dateType instead. End date for invoice dueDate filter.
-
- created_date_start : typing.Optional[dt.datetime]
- DEPRECATED. Use startDate, endDate, and dateType instead. Start date for invoice created on date filter.
-
- created_date_end : typing.Optional[dt.datetime]
- DEPRECATED. Use startDate, endDate, and dateType instead. End date for invoice created date filter.
-
currency : typing.Optional[typing.Union[CurrencyCode, typing.Sequence[CurrencyCode]]]
Currency to filter on
@@ -814,10 +798,10 @@ async def main() -> None:
entity_group_id="entg_8545a84e-a45f-41bf-bdf1-33b42a55812c",
return_by_date="CREATION_DATE",
exclude_receivables=True,
- created_date_start=datetime.datetime.fromisoformat(
+ start_date=datetime.datetime.fromisoformat(
"2021-01-01 00:00:00+00:00",
),
- created_date_end=datetime.datetime.fromisoformat(
+ end_date=datetime.datetime.fromisoformat(
"2021-01-31 23:59:59.999000+00:00",
),
currency="USD",
@@ -835,6 +819,8 @@ async def main() -> None:
"excludePayables": exclude_payables,
"excludeReceivables": exclude_receivables,
"returnByDate": return_by_date,
+ "returnByDateFrequency": return_by_date_frequency,
+ "groupBy": group_by,
"payerId": payer_id,
"vendorId": vendor_id,
"approverId": approver_id,
@@ -843,10 +829,6 @@ async def main() -> None:
"startDate": serialize_datetime(start_date) if start_date is not None else None,
"endDate": serialize_datetime(end_date) if end_date is not None else None,
"dateType": date_type,
- "dueDateStart": serialize_datetime(due_date_start) if due_date_start is not None else None,
- "dueDateEnd": serialize_datetime(due_date_end) if due_date_end is not None else None,
- "createdDateStart": serialize_datetime(created_date_start) if created_date_start is not None else None,
- "createdDateEnd": serialize_datetime(created_date_end) if created_date_end is not None else None,
"currency": currency,
},
request_options=request_options,
diff --git a/src/mercoa/invoice/client.py b/src/mercoa/invoice/client.py
index 91e467d..e81e3b9 100644
--- a/src/mercoa/invoice/client.py
+++ b/src/mercoa/invoice/client.py
@@ -13,7 +13,7 @@
from ..invoice_types.types.invoice_order_by_field import InvoiceOrderByField
from ..commons.types.order_direction import OrderDirection
from ..invoice_types.types.invoice_id import InvoiceId
-from ..invoice_types.types.invoice_metadata_filter import InvoiceMetadataFilter
+from ..invoice_types.types.metadata_filter import MetadataFilter
from ..entity_types.types.entity_user_id import EntityUserId
from ..invoice_types.types.approver_action import ApproverAction
from ..invoice_types.types.invoice_status import InvoiceStatus
@@ -68,10 +68,8 @@ def find(
limit: typing.Optional[int] = None,
starting_after: typing.Optional[InvoiceId] = None,
search: typing.Optional[str] = None,
- metadata: typing.Optional[typing.Union[InvoiceMetadataFilter, typing.Sequence[InvoiceMetadataFilter]]] = None,
- line_item_metadata: typing.Optional[
- typing.Union[InvoiceMetadataFilter, typing.Sequence[InvoiceMetadataFilter]]
- ] = None,
+ metadata: typing.Optional[typing.Union[MetadataFilter, typing.Sequence[MetadataFilter]]] = None,
+ line_item_metadata: typing.Optional[typing.Union[MetadataFilter, typing.Sequence[MetadataFilter]]] = None,
line_item_gl_account_id: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
payer_id: typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]] = None,
vendor_id: typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]] = None,
@@ -114,10 +112,10 @@ def find(
search : typing.Optional[str]
Find invoices by vendor name, invoice number, or amount. Partial matches are supported.
- metadata : typing.Optional[typing.Union[InvoiceMetadataFilter, typing.Sequence[InvoiceMetadataFilter]]]
+ metadata : typing.Optional[typing.Union[MetadataFilter, typing.Sequence[MetadataFilter]]]
Filter invoices by metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
- line_item_metadata : typing.Optional[typing.Union[InvoiceMetadataFilter, typing.Sequence[InvoiceMetadataFilter]]]
+ line_item_metadata : typing.Optional[typing.Union[MetadataFilter, typing.Sequence[MetadataFilter]]]
Filter invoices by line item metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
line_item_gl_account_id : typing.Optional[typing.Union[str, typing.Sequence[str]]]
@@ -994,10 +992,8 @@ async def find(
limit: typing.Optional[int] = None,
starting_after: typing.Optional[InvoiceId] = None,
search: typing.Optional[str] = None,
- metadata: typing.Optional[typing.Union[InvoiceMetadataFilter, typing.Sequence[InvoiceMetadataFilter]]] = None,
- line_item_metadata: typing.Optional[
- typing.Union[InvoiceMetadataFilter, typing.Sequence[InvoiceMetadataFilter]]
- ] = None,
+ metadata: typing.Optional[typing.Union[MetadataFilter, typing.Sequence[MetadataFilter]]] = None,
+ line_item_metadata: typing.Optional[typing.Union[MetadataFilter, typing.Sequence[MetadataFilter]]] = None,
line_item_gl_account_id: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
payer_id: typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]] = None,
vendor_id: typing.Optional[typing.Union[EntityId, typing.Sequence[EntityId]]] = None,
@@ -1040,10 +1036,10 @@ async def find(
search : typing.Optional[str]
Find invoices by vendor name, invoice number, or amount. Partial matches are supported.
- metadata : typing.Optional[typing.Union[InvoiceMetadataFilter, typing.Sequence[InvoiceMetadataFilter]]]
+ metadata : typing.Optional[typing.Union[MetadataFilter, typing.Sequence[MetadataFilter]]]
Filter invoices by metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
- line_item_metadata : typing.Optional[typing.Union[InvoiceMetadataFilter, typing.Sequence[InvoiceMetadataFilter]]]
+ line_item_metadata : typing.Optional[typing.Union[MetadataFilter, typing.Sequence[MetadataFilter]]]
Filter invoices by line item metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
line_item_gl_account_id : typing.Optional[typing.Union[str, typing.Sequence[str]]]
diff --git a/src/mercoa/invoice_types/__init__.py b/src/mercoa/invoice_types/__init__.py
index 3d21655..0b0bf52 100644
--- a/src/mercoa/invoice_types/__init__.py
+++ b/src/mercoa/invoice_types/__init__.py
@@ -32,7 +32,8 @@
InvoiceLineItemRequestBase,
InvoiceLineItemResponse,
InvoiceLineItemUpdateRequest,
- InvoiceMetadataFilter,
+ InvoiceMetricsGroupBy,
+ InvoiceMetricsPerDateFrequency,
InvoiceMetricsPerDateGroupBy,
InvoiceMetricsPerDateResponse,
InvoiceMetricsResponse,
@@ -41,6 +42,7 @@
InvoiceResponse,
InvoiceStatus,
InvoiceUpdateRequest,
+ MetadataFilter,
PaymentDestinationOptions,
PaymentDestinationOptions_BankAccount,
PaymentDestinationOptions_Check,
@@ -93,7 +95,8 @@
"InvoiceLineItemRequestBase",
"InvoiceLineItemResponse",
"InvoiceLineItemUpdateRequest",
- "InvoiceMetadataFilter",
+ "InvoiceMetricsGroupBy",
+ "InvoiceMetricsPerDateFrequency",
"InvoiceMetricsPerDateGroupBy",
"InvoiceMetricsPerDateResponse",
"InvoiceMetricsResponse",
@@ -102,6 +105,7 @@
"InvoiceResponse",
"InvoiceStatus",
"InvoiceUpdateRequest",
+ "MetadataFilter",
"PaymentDestinationOptions",
"PaymentDestinationOptions_BankAccount",
"PaymentDestinationOptions_Check",
diff --git a/src/mercoa/invoice_types/types/__init__.py b/src/mercoa/invoice_types/types/__init__.py
index fa80ecf..23d7291 100644
--- a/src/mercoa/invoice_types/types/__init__.py
+++ b/src/mercoa/invoice_types/types/__init__.py
@@ -31,7 +31,8 @@
from .invoice_line_item_request_base import InvoiceLineItemRequestBase
from .invoice_line_item_response import InvoiceLineItemResponse
from .invoice_line_item_update_request import InvoiceLineItemUpdateRequest
-from .invoice_metadata_filter import InvoiceMetadataFilter
+from .invoice_metrics_group_by import InvoiceMetricsGroupBy
+from .invoice_metrics_per_date_frequency import InvoiceMetricsPerDateFrequency
from .invoice_metrics_per_date_group_by import InvoiceMetricsPerDateGroupBy
from .invoice_metrics_per_date_response import InvoiceMetricsPerDateResponse
from .invoice_metrics_response import InvoiceMetricsResponse
@@ -40,6 +41,7 @@
from .invoice_response import InvoiceResponse
from .invoice_status import InvoiceStatus
from .invoice_update_request import InvoiceUpdateRequest
+from .metadata_filter import MetadataFilter
from .payment_destination_options import (
PaymentDestinationOptions,
PaymentDestinationOptions_BankAccount,
@@ -95,7 +97,8 @@
"InvoiceLineItemRequestBase",
"InvoiceLineItemResponse",
"InvoiceLineItemUpdateRequest",
- "InvoiceMetadataFilter",
+ "InvoiceMetricsGroupBy",
+ "InvoiceMetricsPerDateFrequency",
"InvoiceMetricsPerDateGroupBy",
"InvoiceMetricsPerDateResponse",
"InvoiceMetricsResponse",
@@ -104,6 +107,7 @@
"InvoiceResponse",
"InvoiceStatus",
"InvoiceUpdateRequest",
+ "MetadataFilter",
"PaymentDestinationOptions",
"PaymentDestinationOptions_BankAccount",
"PaymentDestinationOptions_Check",
diff --git a/src/mercoa/invoice_types/types/invoice_metrics_group_by.py b/src/mercoa/invoice_types/types/invoice_metrics_group_by.py
new file mode 100644
index 0000000..5cde130
--- /dev/null
+++ b/src/mercoa/invoice_types/types/invoice_metrics_group_by.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+InvoiceMetricsGroupBy = typing.Union[typing.Literal["STATUS"], typing.Any]
diff --git a/src/mercoa/invoice_types/types/invoice_metrics_per_date_frequency.py b/src/mercoa/invoice_types/types/invoice_metrics_per_date_frequency.py
new file mode 100644
index 0000000..84c4667
--- /dev/null
+++ b/src/mercoa/invoice_types/types/invoice_metrics_per_date_frequency.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+InvoiceMetricsPerDateFrequency = typing.Union[typing.Literal["DAILY", "WEEKLY", "MONTHLY", "YEARLY"], typing.Any]
diff --git a/src/mercoa/invoice_types/types/invoice_metrics_per_date_response.py b/src/mercoa/invoice_types/types/invoice_metrics_per_date_response.py
index c5aa7c7..bcbf52b 100644
--- a/src/mercoa/invoice_types/types/invoice_metrics_per_date_response.py
+++ b/src/mercoa/invoice_types/types/invoice_metrics_per_date_response.py
@@ -1,11 +1,11 @@
# This file was auto-generated by Fern from our API Definition.
from ...core.pydantic_utilities import UniversalBaseModel
-import datetime as dt
+import typing
import pydantic
+import datetime as dt
from ...payment_method_types.types.currency_code import CurrencyCode
from ...core.pydantic_utilities import IS_PYDANTIC_V2
-import typing
class InvoiceMetricsPerDateResponse(UniversalBaseModel):
@@ -27,6 +27,11 @@ class InvoiceMetricsPerDateResponse(UniversalBaseModel):
)
"""
+ group: typing.Optional[typing.List[typing.Dict[str, str]]] = pydantic.Field(default=None)
+ """
+ If groupBy is provided, this will be the group by value.
+ """
+
date: dt.datetime
total_amount: float = pydantic.Field(alias="totalAmount")
total_count: int = pydantic.Field(alias="totalCount")
diff --git a/src/mercoa/invoice_types/types/invoice_metrics_response.py b/src/mercoa/invoice_types/types/invoice_metrics_response.py
index e68064d..77e272b 100644
--- a/src/mercoa/invoice_types/types/invoice_metrics_response.py
+++ b/src/mercoa/invoice_types/types/invoice_metrics_response.py
@@ -1,9 +1,9 @@
# This file was auto-generated by Fern from our API Definition.
from ...core.pydantic_utilities import UniversalBaseModel
+import typing
import pydantic
from ...payment_method_types.types.currency_code import CurrencyCode
-import typing
from .invoice_metrics_per_date_response import InvoiceMetricsPerDateResponse
from ...core.pydantic_utilities import IS_PYDANTIC_V2
@@ -56,6 +56,11 @@ class InvoiceMetricsResponse(UniversalBaseModel):
)
"""
+ group: typing.Optional[typing.List[typing.Dict[str, str]]] = pydantic.Field(default=None)
+ """
+ If groupBy is provided, this will be the group by value.
+ """
+
total_amount: float = pydantic.Field(alias="totalAmount")
total_count: int = pydantic.Field(alias="totalCount")
average_amount: float = pydantic.Field(alias="averageAmount")
diff --git a/src/mercoa/invoice_types/types/invoice_metadata_filter.py b/src/mercoa/invoice_types/types/metadata_filter.py
similarity index 64%
rename from src/mercoa/invoice_types/types/invoice_metadata_filter.py
rename to src/mercoa/invoice_types/types/metadata_filter.py
index 374207d..3eba0dd 100644
--- a/src/mercoa/invoice_types/types/invoice_metadata_filter.py
+++ b/src/mercoa/invoice_types/types/metadata_filter.py
@@ -1,14 +1,18 @@
# This file was auto-generated by Fern from our API Definition.
from ...core.pydantic_utilities import UniversalBaseModel
+from ...commons.types.string_or_string_array import StringOrStringArray
+import pydantic
from ...core.pydantic_utilities import IS_PYDANTIC_V2
import typing
-import pydantic
-class InvoiceMetadataFilter(UniversalBaseModel):
+class MetadataFilter(UniversalBaseModel):
key: str
- value: str
+ value: StringOrStringArray = pydantic.Field()
+ """
+ If multiple values are provided, the filter will match if any of the values match (OR filter)
+ """
if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2