From 89f463f7ffae3ca1d17c28ab8640e1190c4b6ef8 Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Wed, 22 May 2024 16:37:40 +0000 Subject: [PATCH] Release v0.3.35 --- poetry.lock | 12 +- pyproject.toml | 2 +- src/mercoa/__init__.py | 49 +-- src/mercoa/bank_lookup/client.py | 25 +- src/mercoa/commons/__init__.py | 18 +- src/mercoa/commons/errors/__init__.py | 18 +- .../errors/auth_header_malformed_error.py | 8 - .../errors/auth_header_missing_error.py | 8 - .../errors/bad_request.py} | 2 +- .../errors/conflict.py} | 2 +- .../errors/internal_server_error.py} | 2 +- .../commons/errors/invalid_postal_code.py | 8 - .../errors/invalid_state_or_province.py | 8 - src/mercoa/commons/types/address.py | 4 + src/mercoa/core/client_wrapper.py | 2 +- .../custom_payment_method_schema/client.py | 105 ++++--- src/mercoa/entity/__init__.py | 5 +- src/mercoa/entity/approval_policy/__init__.py | 3 - src/mercoa/entity/approval_policy/client.py | 139 ++++----- .../entity/approval_policy/errors/__init__.py | 6 - .../num_approver_less_than_one_error.py | 8 - .../num_approvers_user_list_mismatch_error.py | 8 - src/mercoa/entity/client.py | 295 ++++++++---------- src/mercoa/entity/counterparty/client.py | 125 +++++--- src/mercoa/entity/email_log/client.py | 45 +-- .../external_accounting_system/__init__.py | 2 + .../external_accounting_system/client.py | 136 ++++++-- .../types/__init__.py | 2 + .../types/sync_type.py | 5 + src/mercoa/entity/invoice/client.py | 74 ++--- src/mercoa/entity/metadata/client.py | 85 +++-- .../entity/notification_policy/client.py | 65 ++-- src/mercoa/entity/payment_method/client.py | 198 ++++++------ src/mercoa/entity/representative/client.py | 105 +++---- src/mercoa/entity/user/client.py | 130 ++++---- .../entity/user/notification_policy/client.py | 65 ++-- .../entity/user/notifications/client.py | 45 +-- src/mercoa/entity_types/__init__.py | 5 - src/mercoa/entity_types/errors/__init__.py | 8 - .../entity_foreign_id_already_exists.py | 8 - .../entity_types/errors/invalid_tax_id.py | 8 - .../errors/token_generation_failed.py | 8 - src/mercoa/fees/client.py | 25 +- src/mercoa/invoice/approval/client.py | 91 +++--- src/mercoa/invoice/client.py | 269 +++++++++++----- src/mercoa/invoice/comment/client.py | 105 ++++--- src/mercoa/invoice/document/client.py | 138 ++++---- src/mercoa/invoice/payment_links/client.py | 103 +++--- src/mercoa/invoice_types/__init__.py | 12 +- src/mercoa/invoice_types/errors/__init__.py | 9 - .../invoice_types/errors/invoice_error.py | 8 - .../errors/invoice_query_error.py | 8 - .../errors/invoice_status_error.py | 8 - .../invoice_types/errors/vendor_not_found.py | 8 - src/mercoa/invoice_types/types/__init__.py | 6 +- .../types/invoice_creation_request.py | 65 +++- ...ice_request.py => invoice_request_base.py} | 66 +--- .../types/invoice_update_request.py | 91 ++++++ src/mercoa/ocr/__init__.py | 3 +- src/mercoa/ocr/client.py | 78 ++--- src/mercoa/ocr/errors/__init__.py | 5 - src/mercoa/organization/client.py | 65 ++-- .../notification_configuration/client.py | 85 +++-- src/mercoa/organization_types/__init__.py | 6 + .../organization_types/types/__init__.py | 5 + .../types/metadata_regex_validation_rule.py | 35 +++ .../types/metadata_schema.py | 6 + .../types/metadata_validation_rule.py | 22 ++ src/mercoa/payment_method_types/__init__.py | 2 - .../payment_method_types/errors/__init__.py | 5 - .../errors/payment_method_error.py | 8 - 71 files changed, 1749 insertions(+), 1444 deletions(-) delete mode 100644 src/mercoa/commons/errors/auth_header_malformed_error.py delete mode 100644 src/mercoa/commons/errors/auth_header_missing_error.py rename src/mercoa/{entity_types/errors/entity_error.py => commons/errors/bad_request.py} (86%) rename src/mercoa/{invoice_types/errors/duplicate_invoice_number.py => commons/errors/conflict.py} (82%) rename src/mercoa/{ocr/errors/ocr_failure.py => commons/errors/internal_server_error.py} (83%) delete mode 100644 src/mercoa/commons/errors/invalid_postal_code.py delete mode 100644 src/mercoa/commons/errors/invalid_state_or_province.py delete mode 100644 src/mercoa/entity/approval_policy/errors/__init__.py delete mode 100644 src/mercoa/entity/approval_policy/errors/num_approver_less_than_one_error.py delete mode 100644 src/mercoa/entity/approval_policy/errors/num_approvers_user_list_mismatch_error.py create mode 100644 src/mercoa/entity/external_accounting_system/types/sync_type.py delete mode 100644 src/mercoa/entity_types/errors/__init__.py delete mode 100644 src/mercoa/entity_types/errors/entity_foreign_id_already_exists.py delete mode 100644 src/mercoa/entity_types/errors/invalid_tax_id.py delete mode 100644 src/mercoa/entity_types/errors/token_generation_failed.py delete mode 100644 src/mercoa/invoice_types/errors/__init__.py delete mode 100644 src/mercoa/invoice_types/errors/invoice_error.py delete mode 100644 src/mercoa/invoice_types/errors/invoice_query_error.py delete mode 100644 src/mercoa/invoice_types/errors/invoice_status_error.py delete mode 100644 src/mercoa/invoice_types/errors/vendor_not_found.py rename src/mercoa/invoice_types/types/{invoice_request.py => invoice_request_base.py} (70%) create mode 100644 src/mercoa/invoice_types/types/invoice_update_request.py delete mode 100644 src/mercoa/ocr/errors/__init__.py create mode 100644 src/mercoa/organization_types/types/metadata_regex_validation_rule.py create mode 100644 src/mercoa/organization_types/types/metadata_validation_rule.py delete mode 100644 src/mercoa/payment_method_types/errors/__init__.py delete mode 100644 src/mercoa/payment_method_types/errors/payment_method_error.py diff --git a/poetry.lock b/poetry.lock index 397785f..65e19e2 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2,13 +2,13 @@ [[package]] name = "annotated-types" -version = "0.6.0" +version = "0.7.0" description = "Reusable constraint types to use with typing.Annotated" optional = false python-versions = ">=3.8" files = [ - {file = "annotated_types-0.6.0-py3-none-any.whl", hash = "sha256:0641064de18ba7a25dee8f96403ebc39113d0cb953a01429249d5c7564666a43"}, - {file = "annotated_types-0.6.0.tar.gz", hash = "sha256:563339e807e53ffd9c267e99fc6d9ea23eb8443c08f112651963e24e22f84a5d"}, + {file = "annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53"}, + {file = "annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89"}, ] [package.dependencies] @@ -368,13 +368,13 @@ testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "no [[package]] name = "pytest-asyncio" -version = "0.23.6" +version = "0.23.7" description = "Pytest support for asyncio" optional = false python-versions = ">=3.8" files = [ - {file = "pytest-asyncio-0.23.6.tar.gz", hash = "sha256:ffe523a89c1c222598c76856e76852b787504ddb72dd5d9b6617ffa8aa2cde5f"}, - {file = "pytest_asyncio-0.23.6-py3-none-any.whl", hash = "sha256:68516fdd1018ac57b846c9846b954f0393b26f094764a28c955eabb0536a4e8a"}, + {file = "pytest_asyncio-0.23.7-py3-none-any.whl", hash = "sha256:009b48127fbe44518a547bddd25611551b0e43ccdbf1e67d12479f569832c20b"}, + {file = "pytest_asyncio-0.23.7.tar.gz", hash = "sha256:5f5c72948f4c49e7db4f29f2521d4031f1c27f86e57b046126654083d4770268"}, ] [package.dependencies] diff --git a/pyproject.toml b/pyproject.toml index a67690f..54e3bad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "mercoa" -version = "v0.3.34" +version = "v0.3.35" description = "" readme = "README.md" authors = [] diff --git a/src/mercoa/__init__.py b/src/mercoa/__init__.py index 0e0bc8b..6ee8ce4 100644 --- a/src/mercoa/__init__.py +++ b/src/mercoa/__init__.py @@ -18,14 +18,13 @@ from .bank_lookup import BankAddress, BankLookupResponse from .commons import ( Address, - AuthHeaderMalformedError, - AuthHeaderMissingError, + BadRequest, BirthDate, + Conflict, Forbidden, FullName, IndividualGovernmentId, - InvalidPostalCode, - InvalidStateOrProvince, + InternalServerError, NotFound, OrderDirection, PhoneNumber, @@ -51,8 +50,6 @@ Ein, EntityAddPayeesRequest, EntityAddPayorsRequest, - EntityError, - EntityForeignIdAlreadyExists, EntityHidePayeesRequest, EntityHidePayorsRequest, EntityId, @@ -74,7 +71,6 @@ IdentifierList_UserList, IndividualProfileRequest, IndividualProfileResponse, - InvalidTaxId, LineItemAvailabilities, MetadataTrigger, NotificationId, @@ -92,7 +88,6 @@ Rule_Approver, TaxId, TokenGenerationEntityOptions, - TokenGenerationFailed, TokenGenerationInvoiceOptions, TokenGenerationOptions, TokenGenerationPagesOptions, @@ -125,10 +120,8 @@ CommentRequest, CommentResponse, DocumentResponse, - DuplicateInvoiceNumber, FindInvoiceResponse, InvoiceCreationRequest, - InvoiceError, InvoiceFailureType, InvoiceFeesResponse, InvoiceId, @@ -139,17 +132,15 @@ InvoiceMetricsPerDateResponse, InvoiceMetricsResponse, InvoiceOrderByField, - InvoiceQueryError, - InvoiceRequest, + InvoiceRequestBase, InvoiceResponse, InvoiceStatus, - InvoiceStatusError, + InvoiceUpdateRequest, PaymentDestinationOptions, PaymentDestinationOptions_BankAccount, PaymentDestinationOptions_Check, - VendorNotFound, ) -from .ocr import OcrAsyncResponse, OcrFailure, OcrJobResponse, OcrJobStatus, OcrResponse +from .ocr import OcrAsyncResponse, OcrJobResponse, OcrJobStatus, OcrResponse from .organization_types import ( BusinessOnboardingOptions, CodatProviderRequest, @@ -172,9 +163,12 @@ IndividualOnboardingOptions, InvoiceNotificationConfigurationRequest, InvoiceNotificationConfigurationResponse, + MetadataRegexValidationRule, MetadataSchema, MetadataShowConditions, MetadataType, + MetadataValidationRule, + MetadataValidationRule_Regex, NotificationConfigurationRequest, NotificationConfigurationRequest_Invoice, NotificationConfigurationResponse, @@ -220,7 +214,6 @@ PaymentMethodBalanceStatus, PaymentMethodBaseRequest, PaymentMethodBaseResponse, - PaymentMethodError, PaymentMethodId, PaymentMethodRequest, PaymentMethodRequest_BankAccount, @@ -261,8 +254,7 @@ "ApproverAction", "ApproverRule", "AssociatedApprovalAction", - "AuthHeaderMalformedError", - "AuthHeaderMissingError", + "BadRequest", "BankAccountCheckOptions", "BankAccountPaymentDestinationOptions", "BankAccountRequest", @@ -294,6 +286,7 @@ "CommentId", "CommentRequest", "CommentResponse", + "Conflict", "CounterpartyInvoiceMetricsResponse", "CounterpartyInvoiceMetricsStatusResponse", "CounterpartyNetworkType", @@ -308,7 +301,6 @@ "CustomPaymentMethodSchemaResponse", "CustomPaymentMethodUpdateRequest", "DocumentResponse", - "DuplicateInvoiceNumber", "Ein", "EmailLog", "EmailLogId", @@ -320,8 +312,6 @@ "EmailSenderResponse", "EntityAddPayeesRequest", "EntityAddPayorsRequest", - "EntityError", - "EntityForeignIdAlreadyExists", "EntityHidePayeesRequest", "EntityHidePayorsRequest", "EntityId", @@ -356,11 +346,8 @@ "IndividualOnboardingOptions", "IndividualProfileRequest", "IndividualProfileResponse", - "InvalidPostalCode", - "InvalidStateOrProvince", - "InvalidTaxId", + "InternalServerError", "InvoiceCreationRequest", - "InvoiceError", "InvoiceFailureType", "InvoiceFeesResponse", "InvoiceId", @@ -373,17 +360,19 @@ "InvoiceNotificationConfigurationRequest", "InvoiceNotificationConfigurationResponse", "InvoiceOrderByField", - "InvoiceQueryError", - "InvoiceRequest", + "InvoiceRequestBase", "InvoiceResponse", "InvoiceStatus", - "InvoiceStatusError", + "InvoiceUpdateRequest", "LineItemAvailabilities", "MercoaEnvironment", + "MetadataRegexValidationRule", "MetadataSchema", "MetadataShowConditions", "MetadataTrigger", "MetadataType", + "MetadataValidationRule", + "MetadataValidationRule_Regex", "NotFound", "NotificationConfigurationRequest", "NotificationConfigurationRequest_Invoice", @@ -395,7 +384,6 @@ "NotificationResponse", "NotificationType", "OcrAsyncResponse", - "OcrFailure", "OcrJobResponse", "OcrJobStatus", "OcrResponse", @@ -413,7 +401,6 @@ "PaymentMethodBalanceStatus", "PaymentMethodBaseRequest", "PaymentMethodBaseResponse", - "PaymentMethodError", "PaymentMethodId", "PaymentMethodRequest", "PaymentMethodRequest_BankAccount", @@ -454,7 +441,6 @@ "RutterProviderResponse", "TaxId", "TokenGenerationEntityOptions", - "TokenGenerationFailed", "TokenGenerationInvoiceOptions", "TokenGenerationOptions", "TokenGenerationPagesOptions", @@ -469,7 +455,6 @@ "UserNotificationPolicyRequest", "UserNotificationPolicyResponse", "VendorNetwork", - "VendorNotFound", "VendorTrigger", "__version__", "bank_lookup", diff --git a/src/mercoa/bank_lookup/client.py b/src/mercoa/bank_lookup/client.py index c89e9cd..797cf5b 100644 --- a/src/mercoa/bank_lookup/client.py +++ b/src/mercoa/bank_lookup/client.py @@ -4,9 +4,10 @@ import urllib.parse from json.decoder import JSONDecodeError -from ..commons.errors.auth_header_malformed_error import AuthHeaderMalformedError -from ..commons.errors.auth_header_missing_error import AuthHeaderMissingError +from ..commons.errors.bad_request import BadRequest +from ..commons.errors.conflict import Conflict from ..commons.errors.forbidden import Forbidden +from ..commons.errors.internal_server_error import InternalServerError from ..commons.errors.not_found import NotFound from ..commons.errors.unauthorized import Unauthorized from ..commons.errors.unimplemented import Unimplemented @@ -88,16 +89,18 @@ def find( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(BankLookupResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -172,16 +175,18 @@ async def find( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(BankLookupResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/mercoa/commons/__init__.py b/src/mercoa/commons/__init__.py index b195f06..26ef575 100644 --- a/src/mercoa/commons/__init__.py +++ b/src/mercoa/commons/__init__.py @@ -1,27 +1,17 @@ # This file was auto-generated by Fern from our API Definition. from .types import Address, BirthDate, FullName, IndividualGovernmentId, OrderDirection, PhoneNumber -from .errors import ( - AuthHeaderMalformedError, - AuthHeaderMissingError, - Forbidden, - InvalidPostalCode, - InvalidStateOrProvince, - NotFound, - Unauthorized, - Unimplemented, -) +from .errors import BadRequest, Conflict, Forbidden, InternalServerError, NotFound, Unauthorized, Unimplemented __all__ = [ "Address", - "AuthHeaderMalformedError", - "AuthHeaderMissingError", + "BadRequest", "BirthDate", + "Conflict", "Forbidden", "FullName", "IndividualGovernmentId", - "InvalidPostalCode", - "InvalidStateOrProvince", + "InternalServerError", "NotFound", "OrderDirection", "PhoneNumber", diff --git a/src/mercoa/commons/errors/__init__.py b/src/mercoa/commons/errors/__init__.py index 8c59fe0..167bb82 100644 --- a/src/mercoa/commons/errors/__init__.py +++ b/src/mercoa/commons/errors/__init__.py @@ -1,21 +1,11 @@ # This file was auto-generated by Fern from our API Definition. -from .auth_header_malformed_error import AuthHeaderMalformedError -from .auth_header_missing_error import AuthHeaderMissingError +from .bad_request import BadRequest +from .conflict import Conflict from .forbidden import Forbidden -from .invalid_postal_code import InvalidPostalCode -from .invalid_state_or_province import InvalidStateOrProvince +from .internal_server_error import InternalServerError from .not_found import NotFound from .unauthorized import Unauthorized from .unimplemented import Unimplemented -__all__ = [ - "AuthHeaderMalformedError", - "AuthHeaderMissingError", - "Forbidden", - "InvalidPostalCode", - "InvalidStateOrProvince", - "NotFound", - "Unauthorized", - "Unimplemented", -] +__all__ = ["BadRequest", "Conflict", "Forbidden", "InternalServerError", "NotFound", "Unauthorized", "Unimplemented"] diff --git a/src/mercoa/commons/errors/auth_header_malformed_error.py b/src/mercoa/commons/errors/auth_header_malformed_error.py deleted file mode 100644 index 1c0f919..0000000 --- a/src/mercoa/commons/errors/auth_header_malformed_error.py +++ /dev/null @@ -1,8 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ...core.api_error import ApiError - - -class AuthHeaderMalformedError(ApiError): - def __init__(self, body: str): - super().__init__(status_code=400, body=body) diff --git a/src/mercoa/commons/errors/auth_header_missing_error.py b/src/mercoa/commons/errors/auth_header_missing_error.py deleted file mode 100644 index e71b390..0000000 --- a/src/mercoa/commons/errors/auth_header_missing_error.py +++ /dev/null @@ -1,8 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ...core.api_error import ApiError - - -class AuthHeaderMissingError(ApiError): - def __init__(self) -> None: - super().__init__(status_code=400) diff --git a/src/mercoa/entity_types/errors/entity_error.py b/src/mercoa/commons/errors/bad_request.py similarity index 86% rename from src/mercoa/entity_types/errors/entity_error.py rename to src/mercoa/commons/errors/bad_request.py index 0d870a1..10866c9 100644 --- a/src/mercoa/entity_types/errors/entity_error.py +++ b/src/mercoa/commons/errors/bad_request.py @@ -3,6 +3,6 @@ from ...core.api_error import ApiError -class EntityError(ApiError): +class BadRequest(ApiError): def __init__(self, body: str): super().__init__(status_code=400, body=body) diff --git a/src/mercoa/invoice_types/errors/duplicate_invoice_number.py b/src/mercoa/commons/errors/conflict.py similarity index 82% rename from src/mercoa/invoice_types/errors/duplicate_invoice_number.py rename to src/mercoa/commons/errors/conflict.py index bef98e5..ece20c9 100644 --- a/src/mercoa/invoice_types/errors/duplicate_invoice_number.py +++ b/src/mercoa/commons/errors/conflict.py @@ -3,6 +3,6 @@ from ...core.api_error import ApiError -class DuplicateInvoiceNumber(ApiError): +class Conflict(ApiError): def __init__(self, body: str): super().__init__(status_code=409, body=body) diff --git a/src/mercoa/ocr/errors/ocr_failure.py b/src/mercoa/commons/errors/internal_server_error.py similarity index 83% rename from src/mercoa/ocr/errors/ocr_failure.py rename to src/mercoa/commons/errors/internal_server_error.py index 41cd59d..6b31e6e 100644 --- a/src/mercoa/ocr/errors/ocr_failure.py +++ b/src/mercoa/commons/errors/internal_server_error.py @@ -3,6 +3,6 @@ from ...core.api_error import ApiError -class OcrFailure(ApiError): +class InternalServerError(ApiError): def __init__(self, body: str): super().__init__(status_code=500, body=body) diff --git a/src/mercoa/commons/errors/invalid_postal_code.py b/src/mercoa/commons/errors/invalid_postal_code.py deleted file mode 100644 index 4b8c92a..0000000 --- a/src/mercoa/commons/errors/invalid_postal_code.py +++ /dev/null @@ -1,8 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ...core.api_error import ApiError - - -class InvalidPostalCode(ApiError): - def __init__(self, body: str): - super().__init__(status_code=400, body=body) diff --git a/src/mercoa/commons/errors/invalid_state_or_province.py b/src/mercoa/commons/errors/invalid_state_or_province.py deleted file mode 100644 index 416f311..0000000 --- a/src/mercoa/commons/errors/invalid_state_or_province.py +++ /dev/null @@ -1,8 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ...core.api_error import ApiError - - -class InvalidStateOrProvince(ApiError): - def __init__(self, body: str): - super().__init__(status_code=400, body=body) diff --git a/src/mercoa/commons/types/address.py b/src/mercoa/commons/types/address.py index c224073..571954e 100644 --- a/src/mercoa/commons/types/address.py +++ b/src/mercoa/commons/types/address.py @@ -32,6 +32,10 @@ class Address(pydantic_v1.BaseModel): """ postal_code: str = pydantic_v1.Field(alias="postalCode") + """ + Postal code. Must be in the format XXXXX or XXXXX-XXXX. + """ + country: typing.Optional[str] = None def json(self, **kwargs: typing.Any) -> str: diff --git a/src/mercoa/core/client_wrapper.py b/src/mercoa/core/client_wrapper.py index dbffd9a..8eaf788 100644 --- a/src/mercoa/core/client_wrapper.py +++ b/src/mercoa/core/client_wrapper.py @@ -23,7 +23,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.34", + "X-Fern-SDK-Version": "v0.3.35", } headers["Authorization"] = f"Bearer {self._get_token()}" return headers diff --git a/src/mercoa/custom_payment_method_schema/client.py b/src/mercoa/custom_payment_method_schema/client.py index 80ae289..2894078 100644 --- a/src/mercoa/custom_payment_method_schema/client.py +++ b/src/mercoa/custom_payment_method_schema/client.py @@ -4,9 +4,10 @@ import urllib.parse from json.decoder import JSONDecodeError -from ..commons.errors.auth_header_malformed_error import AuthHeaderMalformedError -from ..commons.errors.auth_header_missing_error import AuthHeaderMissingError +from ..commons.errors.bad_request import BadRequest +from ..commons.errors.conflict import Conflict from ..commons.errors.forbidden import Forbidden +from ..commons.errors.internal_server_error import InternalServerError from ..commons.errors.not_found import NotFound from ..commons.errors.unauthorized import Unauthorized from ..commons.errors.unimplemented import Unimplemented @@ -79,16 +80,18 @@ def get_all( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(typing.List[CustomPaymentMethodSchemaResponse], _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -164,16 +167,18 @@ def create( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(CustomPaymentMethodSchemaResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -258,16 +263,18 @@ def update( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(CustomPaymentMethodSchemaResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -329,16 +336,18 @@ def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(CustomPaymentMethodSchemaResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -400,16 +409,18 @@ def delete( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -470,16 +481,18 @@ async def get_all( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(typing.List[CustomPaymentMethodSchemaResponse], _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -555,16 +568,18 @@ async def create( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(CustomPaymentMethodSchemaResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -649,16 +664,18 @@ async def update( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(CustomPaymentMethodSchemaResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -720,16 +737,18 @@ async def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(CustomPaymentMethodSchemaResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -791,16 +810,18 @@ async def delete( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/mercoa/entity/__init__.py b/src/mercoa/entity/__init__.py index 222e575..9b120bf 100644 --- a/src/mercoa/entity/__init__.py +++ b/src/mercoa/entity/__init__.py @@ -12,7 +12,6 @@ representative, user, ) -from .approval_policy import NumApproverLessThanOneError, NumApproversUserListMismatchError from .external_accounting_system import ( CodatCompanyCreationRequest, CodatCompanyResponse, @@ -24,6 +23,7 @@ ExternalAccountingSystemCompanyResponse_Rutter, RutterCompanyCreationRequest, RutterCompanyResponse, + SyncType, ) __all__ = [ @@ -35,10 +35,9 @@ "ExternalAccountingSystemCompanyResponse", "ExternalAccountingSystemCompanyResponse_Codat", "ExternalAccountingSystemCompanyResponse_Rutter", - "NumApproverLessThanOneError", - "NumApproversUserListMismatchError", "RutterCompanyCreationRequest", "RutterCompanyResponse", + "SyncType", "approval_policy", "counterparty", "email_log", diff --git a/src/mercoa/entity/approval_policy/__init__.py b/src/mercoa/entity/approval_policy/__init__.py index 9e5333f..f3ea265 100644 --- a/src/mercoa/entity/approval_policy/__init__.py +++ b/src/mercoa/entity/approval_policy/__init__.py @@ -1,5 +1,2 @@ # This file was auto-generated by Fern from our API Definition. -from .errors import NumApproverLessThanOneError, NumApproversUserListMismatchError - -__all__ = ["NumApproverLessThanOneError", "NumApproversUserListMismatchError"] diff --git a/src/mercoa/entity/approval_policy/client.py b/src/mercoa/entity/approval_policy/client.py index 761b1a4..40bf584 100644 --- a/src/mercoa/entity/approval_policy/client.py +++ b/src/mercoa/entity/approval_policy/client.py @@ -4,9 +4,10 @@ import urllib.parse from json.decoder import JSONDecodeError -from ...commons.errors.auth_header_malformed_error import AuthHeaderMalformedError -from ...commons.errors.auth_header_missing_error import AuthHeaderMissingError +from ...commons.errors.bad_request import BadRequest +from ...commons.errors.conflict import Conflict from ...commons.errors.forbidden import Forbidden +from ...commons.errors.internal_server_error import InternalServerError from ...commons.errors.not_found import NotFound from ...commons.errors.unauthorized import Unauthorized from ...commons.errors.unimplemented import Unimplemented @@ -21,8 +22,6 @@ from ...entity_types.types.approval_policy_response import ApprovalPolicyResponse from ...entity_types.types.approval_policy_update_request import ApprovalPolicyUpdateRequest from ...entity_types.types.entity_id import EntityId -from .errors.num_approver_less_than_one_error import NumApproverLessThanOneError -from .errors.num_approvers_user_list_mismatch_error import NumApproversUserListMismatchError # this is used as the default value for optional parameters OMIT = typing.cast(typing.Any, ...) @@ -89,16 +88,18 @@ def get_all( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(typing.List[ApprovalPolicyResponse], _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -186,24 +187,18 @@ def create( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(ApprovalPolicyResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "NumApproversUserListMismatchError": - raise NumApproversUserListMismatchError( - pydantic_v1.parse_obj_as(str, _response_json["content"]) # type: ignore - ) - if _response_json["errorName"] == "NumApproverLessThanOneError": - raise NumApproverLessThanOneError( - pydantic_v1.parse_obj_as(str, _response_json["content"]) # type: ignore - ) - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -273,16 +268,18 @@ def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(ApprovalPolicyResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -375,24 +372,18 @@ def update( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(ApprovalPolicyResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "NumApproversUserListMismatchError": - raise NumApproversUserListMismatchError( - pydantic_v1.parse_obj_as(str, _response_json["content"]) # type: ignore - ) - if _response_json["errorName"] == "NumApproverLessThanOneError": - raise NumApproverLessThanOneError( - pydantic_v1.parse_obj_as(str, _response_json["content"]) # type: ignore - ) - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -462,16 +453,18 @@ def delete( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -538,16 +531,18 @@ async def get_all( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(typing.List[ApprovalPolicyResponse], _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -635,24 +630,18 @@ async def create( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(ApprovalPolicyResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "NumApproversUserListMismatchError": - raise NumApproversUserListMismatchError( - pydantic_v1.parse_obj_as(str, _response_json["content"]) # type: ignore - ) - if _response_json["errorName"] == "NumApproverLessThanOneError": - raise NumApproverLessThanOneError( - pydantic_v1.parse_obj_as(str, _response_json["content"]) # type: ignore - ) - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -722,16 +711,18 @@ async def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(ApprovalPolicyResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -824,24 +815,18 @@ async def update( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(ApprovalPolicyResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "NumApproversUserListMismatchError": - raise NumApproversUserListMismatchError( - pydantic_v1.parse_obj_as(str, _response_json["content"]) # type: ignore - ) - if _response_json["errorName"] == "NumApproverLessThanOneError": - raise NumApproverLessThanOneError( - pydantic_v1.parse_obj_as(str, _response_json["content"]) # type: ignore - ) - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -911,16 +896,18 @@ async def delete( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/mercoa/entity/approval_policy/errors/__init__.py b/src/mercoa/entity/approval_policy/errors/__init__.py deleted file mode 100644 index bb08044..0000000 --- a/src/mercoa/entity/approval_policy/errors/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from .num_approver_less_than_one_error import NumApproverLessThanOneError -from .num_approvers_user_list_mismatch_error import NumApproversUserListMismatchError - -__all__ = ["NumApproverLessThanOneError", "NumApproversUserListMismatchError"] diff --git a/src/mercoa/entity/approval_policy/errors/num_approver_less_than_one_error.py b/src/mercoa/entity/approval_policy/errors/num_approver_less_than_one_error.py deleted file mode 100644 index 40b9a9f..0000000 --- a/src/mercoa/entity/approval_policy/errors/num_approver_less_than_one_error.py +++ /dev/null @@ -1,8 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ....core.api_error import ApiError - - -class NumApproverLessThanOneError(ApiError): - def __init__(self, body: str): - super().__init__(status_code=400, body=body) diff --git a/src/mercoa/entity/approval_policy/errors/num_approvers_user_list_mismatch_error.py b/src/mercoa/entity/approval_policy/errors/num_approvers_user_list_mismatch_error.py deleted file mode 100644 index 431fc3f..0000000 --- a/src/mercoa/entity/approval_policy/errors/num_approvers_user_list_mismatch_error.py +++ /dev/null @@ -1,8 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ....core.api_error import ApiError - - -class NumApproversUserListMismatchError(ApiError): - def __init__(self, body: str): - super().__init__(status_code=400, body=body) diff --git a/src/mercoa/entity/client.py b/src/mercoa/entity/client.py index ceadcab..1a2decf 100644 --- a/src/mercoa/entity/client.py +++ b/src/mercoa/entity/client.py @@ -4,11 +4,10 @@ import urllib.parse from json.decoder import JSONDecodeError -from ..commons.errors.auth_header_malformed_error import AuthHeaderMalformedError -from ..commons.errors.auth_header_missing_error import AuthHeaderMissingError +from ..commons.errors.bad_request import BadRequest +from ..commons.errors.conflict import Conflict from ..commons.errors.forbidden import Forbidden -from ..commons.errors.invalid_postal_code import InvalidPostalCode -from ..commons.errors.invalid_state_or_province import InvalidStateOrProvince +from ..commons.errors.internal_server_error import InternalServerError from ..commons.errors.not_found import NotFound from ..commons.errors.unauthorized import Unauthorized from ..commons.errors.unimplemented import Unimplemented @@ -18,10 +17,6 @@ from ..core.pydantic_utilities import pydantic_v1 from ..core.remove_none_from_dict import remove_none_from_dict from ..core.request_options import RequestOptions -from ..entity_types.errors.entity_error import EntityError -from ..entity_types.errors.entity_foreign_id_already_exists import EntityForeignIdAlreadyExists -from ..entity_types.errors.invalid_tax_id import InvalidTaxId -from ..entity_types.errors.token_generation_failed import TokenGenerationFailed from ..entity_types.types.entity_id import EntityId from ..entity_types.types.entity_onboarding_link_type import EntityOnboardingLinkType from ..entity_types.types.entity_request import EntityRequest @@ -171,16 +166,18 @@ def find( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(FindEntityResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -284,28 +281,18 @@ def create( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(EntityResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "EntityForeignIdAlreadyExists": - raise EntityForeignIdAlreadyExists( - pydantic_v1.parse_obj_as(str, _response_json["content"]) # type: ignore - ) - if _response_json["errorName"] == "EntityError": - raise EntityError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "InvalidTaxId": - raise InvalidTaxId(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "InvalidPostalCode": - raise InvalidPostalCode(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "InvalidStateOrProvince": - raise InvalidStateOrProvince(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -363,16 +350,18 @@ def get(self, entity_id: EntityId, *, request_options: typing.Optional[RequestOp if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(EntityResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -485,28 +474,18 @@ def update( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(EntityResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "EntityForeignIdAlreadyExists": - raise EntityForeignIdAlreadyExists( - pydantic_v1.parse_obj_as(str, _response_json["content"]) # type: ignore - ) - if _response_json["errorName"] == "EntityError": - raise EntityError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "InvalidTaxId": - raise InvalidTaxId(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "InvalidPostalCode": - raise InvalidPostalCode(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "InvalidStateOrProvince": - raise InvalidStateOrProvince(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -564,16 +543,18 @@ def delete(self, entity_id: EntityId, *, request_options: typing.Optional[Reques except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -638,18 +619,18 @@ def accept_terms_of_service( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "EntityError": - raise EntityError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -714,18 +695,18 @@ def initiate_kyb(self, entity_id: EntityId, *, request_options: typing.Optional[ except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "EntityError": - raise EntityError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -803,18 +784,18 @@ def get_token( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(str, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "TokenGenerationFailed": - raise TokenGenerationFailed(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -893,18 +874,18 @@ def plaid_link_token( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(str, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "TokenGenerationFailed": - raise TokenGenerationFailed(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -995,16 +976,18 @@ def get_onboarding_link( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(str, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -1098,16 +1081,18 @@ def send_onboarding_link( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -1238,16 +1223,18 @@ async def find( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(FindEntityResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -1351,28 +1338,18 @@ async def create( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(EntityResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "EntityForeignIdAlreadyExists": - raise EntityForeignIdAlreadyExists( - pydantic_v1.parse_obj_as(str, _response_json["content"]) # type: ignore - ) - if _response_json["errorName"] == "EntityError": - raise EntityError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "InvalidTaxId": - raise InvalidTaxId(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "InvalidPostalCode": - raise InvalidPostalCode(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "InvalidStateOrProvince": - raise InvalidStateOrProvince(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -1432,16 +1409,18 @@ async def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(EntityResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -1554,28 +1533,18 @@ async def update( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(EntityResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "EntityForeignIdAlreadyExists": - raise EntityForeignIdAlreadyExists( - pydantic_v1.parse_obj_as(str, _response_json["content"]) # type: ignore - ) - if _response_json["errorName"] == "EntityError": - raise EntityError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "InvalidTaxId": - raise InvalidTaxId(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "InvalidPostalCode": - raise InvalidPostalCode(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "InvalidStateOrProvince": - raise InvalidStateOrProvince(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -1633,16 +1602,18 @@ async def delete(self, entity_id: EntityId, *, request_options: typing.Optional[ except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -1707,18 +1678,18 @@ async def accept_terms_of_service( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "EntityError": - raise EntityError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -1785,18 +1756,18 @@ async def initiate_kyb( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "EntityError": - raise EntityError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -1874,18 +1845,18 @@ async def get_token( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(str, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "TokenGenerationFailed": - raise TokenGenerationFailed(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -1964,18 +1935,18 @@ async def plaid_link_token( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(str, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "TokenGenerationFailed": - raise TokenGenerationFailed(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -2066,16 +2037,18 @@ async def get_onboarding_link( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(str, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -2169,16 +2142,18 @@ async def send_onboarding_link( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/mercoa/entity/counterparty/client.py b/src/mercoa/entity/counterparty/client.py index 35d5437..19310a1 100644 --- a/src/mercoa/entity/counterparty/client.py +++ b/src/mercoa/entity/counterparty/client.py @@ -4,9 +4,10 @@ import urllib.parse from json.decoder import JSONDecodeError -from ...commons.errors.auth_header_malformed_error import AuthHeaderMalformedError -from ...commons.errors.auth_header_missing_error import AuthHeaderMissingError +from ...commons.errors.bad_request import BadRequest +from ...commons.errors.conflict import Conflict from ...commons.errors.forbidden import Forbidden +from ...commons.errors.internal_server_error import InternalServerError from ...commons.errors.not_found import NotFound from ...commons.errors.unauthorized import Unauthorized from ...commons.errors.unimplemented import Unimplemented @@ -144,16 +145,18 @@ def find_payees( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(FindCounterpartiesResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -270,16 +273,18 @@ def find_payors( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(FindCounterpartiesResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -357,16 +362,18 @@ def add_payees( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -444,16 +451,18 @@ def hide_payees( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -531,16 +540,18 @@ def add_payors( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -618,16 +629,18 @@ def hide_payors( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -749,16 +762,18 @@ async def find_payees( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(FindCounterpartiesResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -875,16 +890,18 @@ async def find_payors( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(FindCounterpartiesResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -962,16 +979,18 @@ async def add_payees( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -1049,16 +1068,18 @@ async def hide_payees( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -1136,16 +1157,18 @@ async def add_payors( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -1223,16 +1246,18 @@ async def hide_payors( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/mercoa/entity/email_log/client.py b/src/mercoa/entity/email_log/client.py index faec9e1..63e9ea2 100644 --- a/src/mercoa/entity/email_log/client.py +++ b/src/mercoa/entity/email_log/client.py @@ -5,9 +5,10 @@ import urllib.parse from json.decoder import JSONDecodeError -from ...commons.errors.auth_header_malformed_error import AuthHeaderMalformedError -from ...commons.errors.auth_header_missing_error import AuthHeaderMissingError +from ...commons.errors.bad_request import BadRequest +from ...commons.errors.conflict import Conflict from ...commons.errors.forbidden import Forbidden +from ...commons.errors.internal_server_error import InternalServerError from ...commons.errors.not_found import NotFound from ...commons.errors.unauthorized import Unauthorized from ...commons.errors.unimplemented import Unimplemented @@ -130,16 +131,18 @@ def find( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(EmailLogResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -205,16 +208,18 @@ def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(EmailLog, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -326,16 +331,18 @@ async def find( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(EmailLogResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -401,16 +408,18 @@ async def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(EmailLog, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/mercoa/entity/external_accounting_system/__init__.py b/src/mercoa/entity/external_accounting_system/__init__.py index 6bc539b..230247d 100644 --- a/src/mercoa/entity/external_accounting_system/__init__.py +++ b/src/mercoa/entity/external_accounting_system/__init__.py @@ -11,6 +11,7 @@ ExternalAccountingSystemCompanyResponse_Rutter, RutterCompanyCreationRequest, RutterCompanyResponse, + SyncType, ) __all__ = [ @@ -24,4 +25,5 @@ "ExternalAccountingSystemCompanyResponse_Rutter", "RutterCompanyCreationRequest", "RutterCompanyResponse", + "SyncType", ] diff --git a/src/mercoa/entity/external_accounting_system/client.py b/src/mercoa/entity/external_accounting_system/client.py index 988de90..6194de4 100644 --- a/src/mercoa/entity/external_accounting_system/client.py +++ b/src/mercoa/entity/external_accounting_system/client.py @@ -4,9 +4,10 @@ import urllib.parse from json.decoder import JSONDecodeError -from ...commons.errors.auth_header_malformed_error import AuthHeaderMalformedError -from ...commons.errors.auth_header_missing_error import AuthHeaderMissingError +from ...commons.errors.bad_request import BadRequest +from ...commons.errors.conflict import Conflict from ...commons.errors.forbidden import Forbidden +from ...commons.errors.internal_server_error import InternalServerError from ...commons.errors.not_found import NotFound from ...commons.errors.unauthorized import Unauthorized from ...commons.errors.unimplemented import Unimplemented @@ -19,6 +20,7 @@ from ...entity_types.types.entity_id import EntityId from .types.external_accounting_system_company_creation_request import ExternalAccountingSystemCompanyCreationRequest from .types.external_accounting_system_company_response import ExternalAccountingSystemCompanyResponse +from .types.sync_type import SyncType # this is used as the default value for optional parameters OMIT = typing.cast(typing.Any, ...) @@ -102,16 +104,18 @@ def create( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(ExternalAccountingSystemCompanyResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -172,21 +176,31 @@ def connect(self, entity_id: EntityId, *, request_options: typing.Optional[Reque if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(str, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) - def sync(self, entity_id: EntityId, *, request_options: typing.Optional[RequestOptions] = None) -> None: + def sync( + self, + entity_id: EntityId, + *, + vendors: typing.Optional[SyncType] = None, + bills: typing.Optional[SyncType] = None, + gl_accounts: typing.Optional[SyncType] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: """ Sync an entity with an external accounting system. Will sync customers/vendors and invoices. @@ -194,6 +208,15 @@ def sync(self, entity_id: EntityId, *, request_options: typing.Optional[RequestO ---------- entity_id : EntityId + vendors : typing.Optional[SyncType] + Sync vendors from external accounting system. Default is to pull vendors from external system. + + bills : typing.Optional[SyncType] + Sync bills from external accounting system. Default is to not sync bills. + + gl_accounts : typing.Optional[SyncType] + Sync GL accounts from external accounting system. Default is to pull GL accounts from external system. Pushing GL accounts is not supported. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -210,6 +233,9 @@ def sync(self, entity_id: EntityId, *, request_options: typing.Optional[RequestO ) client.entity.external_accounting_system.sync( entity_id="string", + vendors="none", + bills="none", + gl_accounts="none", ) """ _response = self._client_wrapper.httpx_client.request( @@ -219,7 +245,18 @@ def sync(self, entity_id: EntityId, *, request_options: typing.Optional[RequestO f"entity/{jsonable_encoder(entity_id)}/external-accounting-system/sync", ), params=jsonable_encoder( - request_options.get("additional_query_parameters") if request_options is not None else None + remove_none_from_dict( + { + "vendors": vendors, + "bills": bills, + "glAccounts": gl_accounts, + **( + request_options.get("additional_query_parameters", {}) + if request_options is not None + else {} + ), + } + ) ), headers=jsonable_encoder( remove_none_from_dict( @@ -242,16 +279,18 @@ def sync(self, entity_id: EntityId, *, request_options: typing.Optional[RequestO except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -335,16 +374,18 @@ async def create( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(ExternalAccountingSystemCompanyResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -405,21 +446,31 @@ async def connect(self, entity_id: EntityId, *, request_options: typing.Optional if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(str, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) - async def sync(self, entity_id: EntityId, *, request_options: typing.Optional[RequestOptions] = None) -> None: + async def sync( + self, + entity_id: EntityId, + *, + vendors: typing.Optional[SyncType] = None, + bills: typing.Optional[SyncType] = None, + gl_accounts: typing.Optional[SyncType] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: """ Sync an entity with an external accounting system. Will sync customers/vendors and invoices. @@ -427,6 +478,15 @@ async def sync(self, entity_id: EntityId, *, request_options: typing.Optional[Re ---------- entity_id : EntityId + vendors : typing.Optional[SyncType] + Sync vendors from external accounting system. Default is to pull vendors from external system. + + bills : typing.Optional[SyncType] + Sync bills from external accounting system. Default is to not sync bills. + + gl_accounts : typing.Optional[SyncType] + Sync GL accounts from external accounting system. Default is to pull GL accounts from external system. Pushing GL accounts is not supported. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -443,6 +503,9 @@ async def sync(self, entity_id: EntityId, *, request_options: typing.Optional[Re ) await client.entity.external_accounting_system.sync( entity_id="string", + vendors="none", + bills="none", + gl_accounts="none", ) """ _response = await self._client_wrapper.httpx_client.request( @@ -452,7 +515,18 @@ async def sync(self, entity_id: EntityId, *, request_options: typing.Optional[Re f"entity/{jsonable_encoder(entity_id)}/external-accounting-system/sync", ), params=jsonable_encoder( - request_options.get("additional_query_parameters") if request_options is not None else None + remove_none_from_dict( + { + "vendors": vendors, + "bills": bills, + "glAccounts": gl_accounts, + **( + request_options.get("additional_query_parameters", {}) + if request_options is not None + else {} + ), + } + ) ), headers=jsonable_encoder( remove_none_from_dict( @@ -475,16 +549,18 @@ async def sync(self, entity_id: EntityId, *, request_options: typing.Optional[Re except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/mercoa/entity/external_accounting_system/types/__init__.py b/src/mercoa/entity/external_accounting_system/types/__init__.py index eba8def..63e8c4c 100644 --- a/src/mercoa/entity/external_accounting_system/types/__init__.py +++ b/src/mercoa/entity/external_accounting_system/types/__init__.py @@ -14,6 +14,7 @@ ) from .rutter_company_creation_request import RutterCompanyCreationRequest from .rutter_company_response import RutterCompanyResponse +from .sync_type import SyncType __all__ = [ "CodatCompanyCreationRequest", @@ -26,4 +27,5 @@ "ExternalAccountingSystemCompanyResponse_Rutter", "RutterCompanyCreationRequest", "RutterCompanyResponse", + "SyncType", ] diff --git a/src/mercoa/entity/external_accounting_system/types/sync_type.py b/src/mercoa/entity/external_accounting_system/types/sync_type.py new file mode 100644 index 0000000..d27ffee --- /dev/null +++ b/src/mercoa/entity/external_accounting_system/types/sync_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SyncType = typing.Union[typing.Literal["none", "push", "pull", "both"], typing.Any] diff --git a/src/mercoa/entity/invoice/client.py b/src/mercoa/entity/invoice/client.py index 4215d89..9f09e6c 100644 --- a/src/mercoa/entity/invoice/client.py +++ b/src/mercoa/entity/invoice/client.py @@ -5,9 +5,10 @@ import urllib.parse from json.decoder import JSONDecodeError -from ...commons.errors.auth_header_malformed_error import AuthHeaderMalformedError -from ...commons.errors.auth_header_missing_error import AuthHeaderMissingError +from ...commons.errors.bad_request import BadRequest +from ...commons.errors.conflict import Conflict from ...commons.errors.forbidden import Forbidden +from ...commons.errors.internal_server_error import InternalServerError from ...commons.errors.not_found import NotFound from ...commons.errors.unauthorized import Unauthorized from ...commons.errors.unimplemented import Unimplemented @@ -21,7 +22,6 @@ from ...core.request_options import RequestOptions from ...entity_types.types.entity_id import EntityId from ...entity_types.types.entity_user_id import EntityUserId -from ...invoice_types.errors.invoice_query_error import InvoiceQueryError from ...invoice_types.types.approver_action import ApproverAction from ...invoice_types.types.find_invoice_response import FindInvoiceResponse from ...invoice_types.types.invoice_id import InvoiceId @@ -218,18 +218,18 @@ def find( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(FindInvoiceResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "InvoiceQueryError": - raise InvoiceQueryError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -312,16 +312,18 @@ def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(InvoiceResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -492,18 +494,18 @@ def metrics( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(typing.List[InvoiceMetricsResponse], _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "InvoiceQueryError": - raise InvoiceQueryError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -693,18 +695,18 @@ async def find( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(FindInvoiceResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "InvoiceQueryError": - raise InvoiceQueryError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -787,16 +789,18 @@ async def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(InvoiceResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -967,18 +971,18 @@ async def metrics( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(typing.List[InvoiceMetricsResponse], _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "InvoiceQueryError": - raise InvoiceQueryError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/mercoa/entity/metadata/client.py b/src/mercoa/entity/metadata/client.py index c5a95b0..89ce648 100644 --- a/src/mercoa/entity/metadata/client.py +++ b/src/mercoa/entity/metadata/client.py @@ -4,9 +4,10 @@ import urllib.parse from json.decoder import JSONDecodeError -from ...commons.errors.auth_header_malformed_error import AuthHeaderMalformedError -from ...commons.errors.auth_header_missing_error import AuthHeaderMissingError +from ...commons.errors.bad_request import BadRequest +from ...commons.errors.conflict import Conflict from ...commons.errors.forbidden import Forbidden +from ...commons.errors.internal_server_error import InternalServerError from ...commons.errors.not_found import NotFound from ...commons.errors.unauthorized import Unauthorized from ...commons.errors.unimplemented import Unimplemented @@ -84,16 +85,18 @@ def get_all( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(typing.List[EntityMetadataResponse], _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -159,16 +162,18 @@ def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(typing.List[str], _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -248,16 +253,18 @@ def update( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(typing.List[str], _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -321,16 +328,18 @@ def delete(self, entity_id: EntityId, key: str, *, request_options: typing.Optio except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -397,16 +406,18 @@ async def get_all( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(typing.List[EntityMetadataResponse], _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -472,16 +483,18 @@ async def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(typing.List[str], _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -561,16 +574,18 @@ async def update( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(typing.List[str], _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -636,16 +651,18 @@ async def delete( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/mercoa/entity/notification_policy/client.py b/src/mercoa/entity/notification_policy/client.py index e254362..66c0686 100644 --- a/src/mercoa/entity/notification_policy/client.py +++ b/src/mercoa/entity/notification_policy/client.py @@ -4,9 +4,10 @@ import urllib.parse from json.decoder import JSONDecodeError -from ...commons.errors.auth_header_malformed_error import AuthHeaderMalformedError -from ...commons.errors.auth_header_missing_error import AuthHeaderMissingError +from ...commons.errors.bad_request import BadRequest +from ...commons.errors.conflict import Conflict from ...commons.errors.forbidden import Forbidden +from ...commons.errors.internal_server_error import InternalServerError from ...commons.errors.not_found import NotFound from ...commons.errors.unauthorized import Unauthorized from ...commons.errors.unimplemented import Unimplemented @@ -86,16 +87,18 @@ def get_all( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(typing.List[NotificationPolicyResponse], _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -165,16 +168,18 @@ def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(NotificationPolicyResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -258,16 +263,18 @@ def update( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(NotificationPolicyResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -334,16 +341,18 @@ async def get_all( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(typing.List[NotificationPolicyResponse], _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -413,16 +422,18 @@ async def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(NotificationPolicyResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -506,16 +517,18 @@ async def update( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(NotificationPolicyResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/mercoa/entity/payment_method/client.py b/src/mercoa/entity/payment_method/client.py index c83c376..7bf7b5b 100644 --- a/src/mercoa/entity/payment_method/client.py +++ b/src/mercoa/entity/payment_method/client.py @@ -4,9 +4,10 @@ import urllib.parse from json.decoder import JSONDecodeError -from ...commons.errors.auth_header_malformed_error import AuthHeaderMalformedError -from ...commons.errors.auth_header_missing_error import AuthHeaderMissingError +from ...commons.errors.bad_request import BadRequest +from ...commons.errors.conflict import Conflict from ...commons.errors.forbidden import Forbidden +from ...commons.errors.internal_server_error import InternalServerError from ...commons.errors.not_found import NotFound from ...commons.errors.unauthorized import Unauthorized from ...commons.errors.unimplemented import Unimplemented @@ -17,7 +18,6 @@ from ...core.remove_none_from_dict import remove_none_from_dict from ...core.request_options import RequestOptions from ...entity_types.types.entity_id import EntityId -from ...payment_method_types.errors.payment_method_error import PaymentMethodError from ...payment_method_types.types.payment_method_balance_response import PaymentMethodBalanceResponse from ...payment_method_types.types.payment_method_id import PaymentMethodId from ...payment_method_types.types.payment_method_request import PaymentMethodRequest @@ -104,18 +104,18 @@ def get_all( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(typing.List[PaymentMethodResponse], _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "PaymentMethodError": - raise PaymentMethodError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -194,18 +194,18 @@ def create( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(PaymentMethodResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "PaymentMethodError": - raise PaymentMethodError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -273,18 +273,18 @@ def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(PaymentMethodResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "PaymentMethodError": - raise PaymentMethodError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -368,18 +368,18 @@ def update( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(PaymentMethodResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "PaymentMethodError": - raise PaymentMethodError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -449,18 +449,18 @@ def delete( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "PaymentMethodError": - raise PaymentMethodError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -533,18 +533,18 @@ def initiate_micro_deposits( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(PaymentMethodResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "PaymentMethodError": - raise PaymentMethodError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -625,18 +625,18 @@ def complete_micro_deposits( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(PaymentMethodResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "PaymentMethodError": - raise PaymentMethodError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -706,18 +706,18 @@ def get_balance( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(PaymentMethodBalanceResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "PaymentMethodError": - raise PaymentMethodError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -798,18 +798,18 @@ async def get_all( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(typing.List[PaymentMethodResponse], _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "PaymentMethodError": - raise PaymentMethodError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -888,18 +888,18 @@ async def create( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(PaymentMethodResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "PaymentMethodError": - raise PaymentMethodError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -967,18 +967,18 @@ async def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(PaymentMethodResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "PaymentMethodError": - raise PaymentMethodError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -1062,18 +1062,18 @@ async def update( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(PaymentMethodResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "PaymentMethodError": - raise PaymentMethodError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -1143,18 +1143,18 @@ async def delete( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "PaymentMethodError": - raise PaymentMethodError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -1227,18 +1227,18 @@ async def initiate_micro_deposits( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(PaymentMethodResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "PaymentMethodError": - raise PaymentMethodError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -1319,18 +1319,18 @@ async def complete_micro_deposits( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(PaymentMethodResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "PaymentMethodError": - raise PaymentMethodError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -1400,18 +1400,18 @@ async def get_balance( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(PaymentMethodBalanceResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "PaymentMethodError": - raise PaymentMethodError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/mercoa/entity/representative/client.py b/src/mercoa/entity/representative/client.py index 3d3cf5a..d7ab9c7 100644 --- a/src/mercoa/entity/representative/client.py +++ b/src/mercoa/entity/representative/client.py @@ -4,11 +4,10 @@ import urllib.parse from json.decoder import JSONDecodeError -from ...commons.errors.auth_header_malformed_error import AuthHeaderMalformedError -from ...commons.errors.auth_header_missing_error import AuthHeaderMissingError +from ...commons.errors.bad_request import BadRequest +from ...commons.errors.conflict import Conflict from ...commons.errors.forbidden import Forbidden -from ...commons.errors.invalid_postal_code import InvalidPostalCode -from ...commons.errors.invalid_state_or_province import InvalidStateOrProvince +from ...commons.errors.internal_server_error import InternalServerError from ...commons.errors.not_found import NotFound from ...commons.errors.unauthorized import Unauthorized from ...commons.errors.unimplemented import Unimplemented @@ -18,8 +17,6 @@ from ...core.pydantic_utilities import pydantic_v1 from ...core.remove_none_from_dict import remove_none_from_dict from ...core.request_options import RequestOptions -from ...entity_types.errors.entity_error import EntityError -from ...entity_types.errors.invalid_tax_id import InvalidTaxId from ...entity_types.types.entity_id import EntityId from ...entity_types.types.representative_id import RepresentativeId from ...entity_types.types.representative_request import RepresentativeRequest @@ -90,16 +87,18 @@ def get_all( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(typing.List[RepresentativeResponse], _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -214,24 +213,18 @@ def create( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(RepresentativeResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "InvalidTaxId": - raise InvalidTaxId(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "EntityError": - raise EntityError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "InvalidPostalCode": - raise InvalidPostalCode(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "InvalidStateOrProvince": - raise InvalidStateOrProvince(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -299,16 +292,18 @@ def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(RepresentativeResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -376,16 +371,18 @@ def delete( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -452,16 +449,18 @@ async def get_all( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(typing.List[RepresentativeResponse], _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -576,24 +575,18 @@ async def create( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(RepresentativeResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "InvalidTaxId": - raise InvalidTaxId(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "EntityError": - raise EntityError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "InvalidPostalCode": - raise InvalidPostalCode(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "InvalidStateOrProvince": - raise InvalidStateOrProvince(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -661,16 +654,18 @@ async def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(RepresentativeResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -738,16 +733,18 @@ async def delete( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/mercoa/entity/user/client.py b/src/mercoa/entity/user/client.py index 4c9d44c..aca5592 100644 --- a/src/mercoa/entity/user/client.py +++ b/src/mercoa/entity/user/client.py @@ -4,9 +4,10 @@ import urllib.parse from json.decoder import JSONDecodeError -from ...commons.errors.auth_header_malformed_error import AuthHeaderMalformedError -from ...commons.errors.auth_header_missing_error import AuthHeaderMissingError +from ...commons.errors.bad_request import BadRequest +from ...commons.errors.conflict import Conflict from ...commons.errors.forbidden import Forbidden +from ...commons.errors.internal_server_error import InternalServerError from ...commons.errors.not_found import NotFound from ...commons.errors.unauthorized import Unauthorized from ...commons.errors.unimplemented import Unimplemented @@ -16,7 +17,6 @@ from ...core.pydantic_utilities import pydantic_v1 from ...core.remove_none_from_dict import remove_none_from_dict from ...core.request_options import RequestOptions -from ...entity_types.errors.token_generation_failed import TokenGenerationFailed from ...entity_types.types.entity_id import EntityId from ...entity_types.types.entity_user_id import EntityUserId from ...entity_types.types.entity_user_request import EntityUserRequest @@ -92,16 +92,18 @@ def get_all( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(typing.List[EntityUserResponse], _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -180,16 +182,18 @@ def create( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(EntityUserResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -255,16 +259,18 @@ def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(EntityUserResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -350,16 +356,18 @@ def update( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(EntityUserResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -425,16 +433,18 @@ def delete( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -517,18 +527,18 @@ def get_token( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(str, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "TokenGenerationFailed": - raise TokenGenerationFailed(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -597,16 +607,18 @@ async def get_all( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(typing.List[EntityUserResponse], _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -685,16 +697,18 @@ async def create( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(EntityUserResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -760,16 +774,18 @@ async def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(EntityUserResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -855,16 +871,18 @@ async def update( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(EntityUserResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -930,16 +948,18 @@ async def delete( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -1022,18 +1042,18 @@ async def get_token( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(str, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "TokenGenerationFailed": - raise TokenGenerationFailed(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/mercoa/entity/user/notification_policy/client.py b/src/mercoa/entity/user/notification_policy/client.py index afc83fb..b99bbef 100644 --- a/src/mercoa/entity/user/notification_policy/client.py +++ b/src/mercoa/entity/user/notification_policy/client.py @@ -4,9 +4,10 @@ import urllib.parse from json.decoder import JSONDecodeError -from ....commons.errors.auth_header_malformed_error import AuthHeaderMalformedError -from ....commons.errors.auth_header_missing_error import AuthHeaderMissingError +from ....commons.errors.bad_request import BadRequest +from ....commons.errors.conflict import Conflict from ....commons.errors.forbidden import Forbidden +from ....commons.errors.internal_server_error import InternalServerError from ....commons.errors.not_found import NotFound from ....commons.errors.unauthorized import Unauthorized from ....commons.errors.unimplemented import Unimplemented @@ -91,16 +92,18 @@ def get_all( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(typing.List[UserNotificationPolicyResponse], _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -174,16 +177,18 @@ def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(UserNotificationPolicyResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -272,16 +277,18 @@ def update( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(UserNotificationPolicyResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -352,16 +359,18 @@ async def get_all( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(typing.List[UserNotificationPolicyResponse], _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -435,16 +444,18 @@ async def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(UserNotificationPolicyResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -533,16 +544,18 @@ async def update( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(UserNotificationPolicyResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/mercoa/entity/user/notifications/client.py b/src/mercoa/entity/user/notifications/client.py index abf3f09..a84eccf 100644 --- a/src/mercoa/entity/user/notifications/client.py +++ b/src/mercoa/entity/user/notifications/client.py @@ -5,9 +5,10 @@ import urllib.parse from json.decoder import JSONDecodeError -from ....commons.errors.auth_header_malformed_error import AuthHeaderMalformedError -from ....commons.errors.auth_header_missing_error import AuthHeaderMissingError +from ....commons.errors.bad_request import BadRequest +from ....commons.errors.conflict import Conflict from ....commons.errors.forbidden import Forbidden +from ....commons.errors.internal_server_error import InternalServerError from ....commons.errors.not_found import NotFound from ....commons.errors.unauthorized import Unauthorized from ....commons.errors.unimplemented import Unimplemented @@ -144,16 +145,18 @@ def find( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(FindNotificationResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -225,16 +228,18 @@ def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(NotificationResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -357,16 +362,18 @@ async def find( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(FindNotificationResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -438,16 +445,18 @@ async def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(NotificationResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/mercoa/entity_types/__init__.py b/src/mercoa/entity_types/__init__.py index c182711..36e87d5 100644 --- a/src/mercoa/entity_types/__init__.py +++ b/src/mercoa/entity_types/__init__.py @@ -70,7 +70,6 @@ VendorNetwork, VendorTrigger, ) -from .errors import EntityError, EntityForeignIdAlreadyExists, InvalidTaxId, TokenGenerationFailed __all__ = [ "AccountType", @@ -90,8 +89,6 @@ "Ein", "EntityAddPayeesRequest", "EntityAddPayorsRequest", - "EntityError", - "EntityForeignIdAlreadyExists", "EntityHidePayeesRequest", "EntityHidePayorsRequest", "EntityId", @@ -113,7 +110,6 @@ "IdentifierList_UserList", "IndividualProfileRequest", "IndividualProfileResponse", - "InvalidTaxId", "LineItemAvailabilities", "MetadataTrigger", "NotificationId", @@ -131,7 +127,6 @@ "Rule_Approver", "TaxId", "TokenGenerationEntityOptions", - "TokenGenerationFailed", "TokenGenerationInvoiceOptions", "TokenGenerationOptions", "TokenGenerationPagesOptions", diff --git a/src/mercoa/entity_types/errors/__init__.py b/src/mercoa/entity_types/errors/__init__.py deleted file mode 100644 index 1907679..0000000 --- a/src/mercoa/entity_types/errors/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from .entity_error import EntityError -from .entity_foreign_id_already_exists import EntityForeignIdAlreadyExists -from .invalid_tax_id import InvalidTaxId -from .token_generation_failed import TokenGenerationFailed - -__all__ = ["EntityError", "EntityForeignIdAlreadyExists", "InvalidTaxId", "TokenGenerationFailed"] diff --git a/src/mercoa/entity_types/errors/entity_foreign_id_already_exists.py b/src/mercoa/entity_types/errors/entity_foreign_id_already_exists.py deleted file mode 100644 index c166d96..0000000 --- a/src/mercoa/entity_types/errors/entity_foreign_id_already_exists.py +++ /dev/null @@ -1,8 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ...core.api_error import ApiError - - -class EntityForeignIdAlreadyExists(ApiError): - def __init__(self, body: str): - super().__init__(status_code=409, body=body) diff --git a/src/mercoa/entity_types/errors/invalid_tax_id.py b/src/mercoa/entity_types/errors/invalid_tax_id.py deleted file mode 100644 index dde2534..0000000 --- a/src/mercoa/entity_types/errors/invalid_tax_id.py +++ /dev/null @@ -1,8 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ...core.api_error import ApiError - - -class InvalidTaxId(ApiError): - def __init__(self, body: str): - super().__init__(status_code=400, body=body) diff --git a/src/mercoa/entity_types/errors/token_generation_failed.py b/src/mercoa/entity_types/errors/token_generation_failed.py deleted file mode 100644 index f45ef5b..0000000 --- a/src/mercoa/entity_types/errors/token_generation_failed.py +++ /dev/null @@ -1,8 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ...core.api_error import ApiError - - -class TokenGenerationFailed(ApiError): - def __init__(self, body: str): - super().__init__(status_code=400, body=body) diff --git a/src/mercoa/fees/client.py b/src/mercoa/fees/client.py index c7c9988..8a8cdc6 100644 --- a/src/mercoa/fees/client.py +++ b/src/mercoa/fees/client.py @@ -4,9 +4,10 @@ import urllib.parse from json.decoder import JSONDecodeError -from ..commons.errors.auth_header_malformed_error import AuthHeaderMalformedError -from ..commons.errors.auth_header_missing_error import AuthHeaderMissingError +from ..commons.errors.bad_request import BadRequest +from ..commons.errors.conflict import Conflict from ..commons.errors.forbidden import Forbidden +from ..commons.errors.internal_server_error import InternalServerError from ..commons.errors.not_found import NotFound from ..commons.errors.unauthorized import Unauthorized from ..commons.errors.unimplemented import Unimplemented @@ -97,16 +98,18 @@ def calculate( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(InvoiceFeesResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -186,16 +189,18 @@ async def calculate( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(InvoiceFeesResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/mercoa/invoice/approval/client.py b/src/mercoa/invoice/approval/client.py index f4816a5..585bc44 100644 --- a/src/mercoa/invoice/approval/client.py +++ b/src/mercoa/invoice/approval/client.py @@ -4,9 +4,10 @@ import urllib.parse from json.decoder import JSONDecodeError -from ...commons.errors.auth_header_malformed_error import AuthHeaderMalformedError -from ...commons.errors.auth_header_missing_error import AuthHeaderMissingError +from ...commons.errors.bad_request import BadRequest +from ...commons.errors.conflict import Conflict from ...commons.errors.forbidden import Forbidden +from ...commons.errors.internal_server_error import InternalServerError from ...commons.errors.not_found import NotFound from ...commons.errors.unauthorized import Unauthorized from ...commons.errors.unimplemented import Unimplemented @@ -16,8 +17,6 @@ from ...core.pydantic_utilities import pydantic_v1 from ...core.remove_none_from_dict import remove_none_from_dict from ...core.request_options import RequestOptions -from ...invoice_types.errors.invoice_error import InvoiceError -from ...invoice_types.errors.invoice_status_error import InvoiceStatusError from ...invoice_types.types.add_approver_request import AddApproverRequest from ...invoice_types.types.approval_request import ApprovalRequest from ...invoice_types.types.invoice_id import InvoiceId @@ -104,20 +103,18 @@ def add_approver( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "InvoiceError": - raise InvoiceError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "InvoiceStatusError": - raise InvoiceStatusError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -194,20 +191,18 @@ def approve( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "InvoiceError": - raise InvoiceError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "InvoiceStatusError": - raise InvoiceStatusError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -284,20 +279,18 @@ def reject( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "InvoiceError": - raise InvoiceError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "InvoiceStatusError": - raise InvoiceStatusError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -381,20 +374,18 @@ async def add_approver( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "InvoiceError": - raise InvoiceError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "InvoiceStatusError": - raise InvoiceStatusError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -471,20 +462,18 @@ async def approve( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "InvoiceError": - raise InvoiceError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "InvoiceStatusError": - raise InvoiceStatusError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -561,20 +550,18 @@ async def reject( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "InvoiceError": - raise InvoiceError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "InvoiceStatusError": - raise InvoiceStatusError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/mercoa/invoice/client.py b/src/mercoa/invoice/client.py index 15600d3..71e69f4 100644 --- a/src/mercoa/invoice/client.py +++ b/src/mercoa/invoice/client.py @@ -5,9 +5,10 @@ import urllib.parse from json.decoder import JSONDecodeError -from ..commons.errors.auth_header_malformed_error import AuthHeaderMalformedError -from ..commons.errors.auth_header_missing_error import AuthHeaderMissingError +from ..commons.errors.bad_request import BadRequest +from ..commons.errors.conflict import Conflict from ..commons.errors.forbidden import Forbidden +from ..commons.errors.internal_server_error import InternalServerError from ..commons.errors.not_found import NotFound from ..commons.errors.unauthorized import Unauthorized from ..commons.errors.unimplemented import Unimplemented @@ -21,19 +22,15 @@ from ..core.request_options import RequestOptions from ..entity_types.types.entity_id import EntityId from ..entity_types.types.entity_user_id import EntityUserId -from ..invoice_types.errors.duplicate_invoice_number import DuplicateInvoiceNumber -from ..invoice_types.errors.invoice_error import InvoiceError -from ..invoice_types.errors.invoice_query_error import InvoiceQueryError -from ..invoice_types.errors.invoice_status_error import InvoiceStatusError from ..invoice_types.types.approver_action import ApproverAction from ..invoice_types.types.find_invoice_response import FindInvoiceResponse from ..invoice_types.types.invoice_creation_request import InvoiceCreationRequest from ..invoice_types.types.invoice_id import InvoiceId from ..invoice_types.types.invoice_metadata_filter import InvoiceMetadataFilter from ..invoice_types.types.invoice_order_by_field import InvoiceOrderByField -from ..invoice_types.types.invoice_request import InvoiceRequest from ..invoice_types.types.invoice_response import InvoiceResponse from ..invoice_types.types.invoice_status import InvoiceStatus +from ..invoice_types.types.invoice_update_request import InvoiceUpdateRequest from .approval.client import ApprovalClient, AsyncApprovalClient from .comment.client import AsyncCommentClient, CommentClient from .document.client import AsyncDocumentClient, DocumentClient @@ -194,18 +191,18 @@ def find( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(FindInvoiceResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "InvoiceQueryError": - raise InvoiceQueryError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -227,14 +224,65 @@ def create( Examples -------- - from mercoa import InvoiceCreationRequest + import datetime + + from mercoa import ( + InvoiceCreationRequest, + InvoiceLineItemRequest, + PaymentDestinationOptions_Check, + ) from mercoa.client import Mercoa client = Mercoa( token="YOUR_TOKEN", ) client.invoice.create( - request=InvoiceCreationRequest(), + request=InvoiceCreationRequest( + status="DRAFT", + amount=100.0, + currency="USD", + invoice_date=datetime.datetime.fromisoformat( + "2021-01-01 00:00:00+00:00", + ), + due_date=datetime.datetime.fromisoformat( + "2021-01-31 00:00:00+00:00", + ), + invoice_number="INV-123", + note_to_self="For the month of January", + service_start_date=datetime.datetime.fromisoformat( + "2021-01-01 00:00:00+00:00", + ), + service_end_date=datetime.datetime.fromisoformat( + "2021-01-31 00:00:00+00:00", + ), + payer_id="ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", + payment_source_id="pm_4794d597-70dc-4fec-b6ec-c5988e759769", + vendor_id="ent_21661ac1-a2a8-4465-a6c0-64474ba8181d", + payment_destination_id="pm_5fde2f4a-facc-48ef-8f0d-6b7d087c7b18", + payment_destination_options=PaymentDestinationOptions_Check( + delivery="MAIL", + ), + line_items=[ + InvoiceLineItemRequest( + amount=100.0, + currency="USD", + description="Product A", + name="Product A", + quantity=1, + unit_price=100.0, + service_start_date=datetime.datetime.fromisoformat( + "2021-01-01 00:00:00+00:00", + ), + service_end_date=datetime.datetime.fromisoformat( + "2021-01-31 00:00:00+00:00", + ), + metadata={"key1": "value1", "key2": "value2"}, + gl_account_id="600394", + ) + ], + creator_entity_id="ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", + creator_user_id="user_e24fc81c-c5ee-47e8-af42-4fe29d895506", + ), ) """ _response = self._client_wrapper.httpx_client.request( @@ -270,20 +318,18 @@ def create( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(InvoiceResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "DuplicateInvoiceNumber": - raise DuplicateInvoiceNumber(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "InvoiceError": - raise InvoiceError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -359,29 +405,35 @@ def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(InvoiceResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) def update( - self, invoice_id: InvoiceId, *, request: InvoiceRequest, request_options: typing.Optional[RequestOptions] = None + self, + invoice_id: InvoiceId, + *, + request: InvoiceUpdateRequest, + request_options: typing.Optional[RequestOptions] = None, ) -> InvoiceResponse: """ Parameters ---------- invoice_id : InvoiceId - request : InvoiceRequest + request : InvoiceUpdateRequest request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -396,7 +448,7 @@ def update( from mercoa import ( InvoiceLineItemRequest, - InvoiceRequest, + InvoiceUpdateRequest, PaymentDestinationOptions_Check, ) from mercoa.client import Mercoa @@ -406,7 +458,7 @@ def update( ) client.invoice.update( invoice_id="inv_8545a84e-a45f-41bf-bdf1-33b42a55812c", - request=InvoiceRequest( + request=InvoiceUpdateRequest( status="DRAFT", amount=100.0, currency="USD", @@ -489,20 +541,18 @@ def update( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(InvoiceResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "DuplicateInvoiceNumber": - raise DuplicateInvoiceNumber(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "InvoiceError": - raise InvoiceError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -562,18 +612,18 @@ def delete(self, invoice_id: InvoiceId, *, request_options: typing.Optional[Requ except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "InvoiceStatusError": - raise InvoiceStatusError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -730,18 +780,18 @@ async def find( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(FindInvoiceResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "InvoiceQueryError": - raise InvoiceQueryError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -763,14 +813,65 @@ async def create( Examples -------- - from mercoa import InvoiceCreationRequest + import datetime + + from mercoa import ( + InvoiceCreationRequest, + InvoiceLineItemRequest, + PaymentDestinationOptions_Check, + ) from mercoa.client import AsyncMercoa client = AsyncMercoa( token="YOUR_TOKEN", ) await client.invoice.create( - request=InvoiceCreationRequest(), + request=InvoiceCreationRequest( + status="DRAFT", + amount=100.0, + currency="USD", + invoice_date=datetime.datetime.fromisoformat( + "2021-01-01 00:00:00+00:00", + ), + due_date=datetime.datetime.fromisoformat( + "2021-01-31 00:00:00+00:00", + ), + invoice_number="INV-123", + note_to_self="For the month of January", + service_start_date=datetime.datetime.fromisoformat( + "2021-01-01 00:00:00+00:00", + ), + service_end_date=datetime.datetime.fromisoformat( + "2021-01-31 00:00:00+00:00", + ), + payer_id="ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", + payment_source_id="pm_4794d597-70dc-4fec-b6ec-c5988e759769", + vendor_id="ent_21661ac1-a2a8-4465-a6c0-64474ba8181d", + payment_destination_id="pm_5fde2f4a-facc-48ef-8f0d-6b7d087c7b18", + payment_destination_options=PaymentDestinationOptions_Check( + delivery="MAIL", + ), + line_items=[ + InvoiceLineItemRequest( + amount=100.0, + currency="USD", + description="Product A", + name="Product A", + quantity=1, + unit_price=100.0, + service_start_date=datetime.datetime.fromisoformat( + "2021-01-01 00:00:00+00:00", + ), + service_end_date=datetime.datetime.fromisoformat( + "2021-01-31 00:00:00+00:00", + ), + metadata={"key1": "value1", "key2": "value2"}, + gl_account_id="600394", + ) + ], + creator_entity_id="ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", + creator_user_id="user_e24fc81c-c5ee-47e8-af42-4fe29d895506", + ), ) """ _response = await self._client_wrapper.httpx_client.request( @@ -806,20 +907,18 @@ async def create( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(InvoiceResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "DuplicateInvoiceNumber": - raise DuplicateInvoiceNumber(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "InvoiceError": - raise InvoiceError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -895,29 +994,35 @@ async def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(InvoiceResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) async def update( - self, invoice_id: InvoiceId, *, request: InvoiceRequest, request_options: typing.Optional[RequestOptions] = None + self, + invoice_id: InvoiceId, + *, + request: InvoiceUpdateRequest, + request_options: typing.Optional[RequestOptions] = None, ) -> InvoiceResponse: """ Parameters ---------- invoice_id : InvoiceId - request : InvoiceRequest + request : InvoiceUpdateRequest request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -932,7 +1037,7 @@ async def update( from mercoa import ( InvoiceLineItemRequest, - InvoiceRequest, + InvoiceUpdateRequest, PaymentDestinationOptions_Check, ) from mercoa.client import AsyncMercoa @@ -942,7 +1047,7 @@ async def update( ) await client.invoice.update( invoice_id="inv_8545a84e-a45f-41bf-bdf1-33b42a55812c", - request=InvoiceRequest( + request=InvoiceUpdateRequest( status="DRAFT", amount=100.0, currency="USD", @@ -1025,20 +1130,18 @@ async def update( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(InvoiceResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "DuplicateInvoiceNumber": - raise DuplicateInvoiceNumber(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "InvoiceError": - raise InvoiceError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -1098,18 +1201,18 @@ async def delete(self, invoice_id: InvoiceId, *, request_options: typing.Optiona except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "InvoiceStatusError": - raise InvoiceStatusError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/mercoa/invoice/comment/client.py b/src/mercoa/invoice/comment/client.py index 91b054c..5aab8fd 100644 --- a/src/mercoa/invoice/comment/client.py +++ b/src/mercoa/invoice/comment/client.py @@ -4,9 +4,10 @@ import urllib.parse from json.decoder import JSONDecodeError -from ...commons.errors.auth_header_malformed_error import AuthHeaderMalformedError -from ...commons.errors.auth_header_missing_error import AuthHeaderMissingError +from ...commons.errors.bad_request import BadRequest +from ...commons.errors.conflict import Conflict from ...commons.errors.forbidden import Forbidden +from ...commons.errors.internal_server_error import InternalServerError from ...commons.errors.not_found import NotFound from ...commons.errors.unauthorized import Unauthorized from ...commons.errors.unimplemented import Unimplemented @@ -86,16 +87,18 @@ def get_all( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(typing.List[CommentResponse], _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -170,16 +173,18 @@ def create( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(CommentResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -243,16 +248,18 @@ def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(CommentResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -336,16 +343,18 @@ def update( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(CommentResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -411,16 +420,18 @@ def delete( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -487,16 +498,18 @@ async def get_all( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(typing.List[CommentResponse], _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -571,16 +584,18 @@ async def create( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(CommentResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -644,16 +659,18 @@ async def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(CommentResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -737,16 +754,18 @@ async def update( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(CommentResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -812,16 +831,18 @@ async def delete( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/mercoa/invoice/document/client.py b/src/mercoa/invoice/document/client.py index 3d95afe..432a24c 100644 --- a/src/mercoa/invoice/document/client.py +++ b/src/mercoa/invoice/document/client.py @@ -4,9 +4,10 @@ import urllib.parse from json.decoder import JSONDecodeError -from ...commons.errors.auth_header_malformed_error import AuthHeaderMalformedError -from ...commons.errors.auth_header_missing_error import AuthHeaderMissingError +from ...commons.errors.bad_request import BadRequest +from ...commons.errors.conflict import Conflict from ...commons.errors.forbidden import Forbidden +from ...commons.errors.internal_server_error import InternalServerError from ...commons.errors.not_found import NotFound from ...commons.errors.unauthorized import Unauthorized from ...commons.errors.unimplemented import Unimplemented @@ -17,7 +18,6 @@ from ...core.remove_none_from_dict import remove_none_from_dict from ...core.request_options import RequestOptions from ...email_log_types.types.email_log_response import EmailLogResponse -from ...invoice_types.errors.invoice_error import InvoiceError from ...invoice_types.types.document_response import DocumentResponse from ...invoice_types.types.invoice_id import InvoiceId @@ -86,16 +86,18 @@ def get_all( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(typing.List[DocumentResponse], _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -174,16 +176,18 @@ def upload( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -249,16 +253,18 @@ def delete( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -321,18 +327,18 @@ def generate_invoice_pdf( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(DocumentResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "InvoiceError": - raise InvoiceError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -395,18 +401,18 @@ def generate_check_pdf( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(DocumentResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "InvoiceError": - raise InvoiceError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -468,18 +474,18 @@ def get_source_email( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(EmailLogResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "InvoiceError": - raise InvoiceError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -546,16 +552,18 @@ async def get_all( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(typing.List[DocumentResponse], _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -634,16 +642,18 @@ async def upload( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -709,16 +719,18 @@ async def delete( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -781,18 +793,18 @@ async def generate_invoice_pdf( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(DocumentResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "InvoiceError": - raise InvoiceError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -855,18 +867,18 @@ async def generate_check_pdf( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(DocumentResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "InvoiceError": - raise InvoiceError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -928,18 +940,18 @@ async def get_source_email( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(EmailLogResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "InvoiceError": - raise InvoiceError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/mercoa/invoice/payment_links/client.py b/src/mercoa/invoice/payment_links/client.py index cf17d58..7987f20 100644 --- a/src/mercoa/invoice/payment_links/client.py +++ b/src/mercoa/invoice/payment_links/client.py @@ -4,9 +4,10 @@ import urllib.parse from json.decoder import JSONDecodeError -from ...commons.errors.auth_header_malformed_error import AuthHeaderMalformedError -from ...commons.errors.auth_header_missing_error import AuthHeaderMissingError +from ...commons.errors.bad_request import BadRequest +from ...commons.errors.conflict import Conflict from ...commons.errors.forbidden import Forbidden +from ...commons.errors.internal_server_error import InternalServerError from ...commons.errors.not_found import NotFound from ...commons.errors.unauthorized import Unauthorized from ...commons.errors.unimplemented import Unimplemented @@ -16,8 +17,6 @@ from ...core.pydantic_utilities import pydantic_v1 from ...core.remove_none_from_dict import remove_none_from_dict from ...core.request_options import RequestOptions -from ...invoice_types.errors.invoice_error import InvoiceError -from ...invoice_types.errors.vendor_not_found import VendorNotFound from ...invoice_types.types.invoice_id import InvoiceId @@ -80,18 +79,18 @@ def get_payer_link(self, invoice_id: InvoiceId, *, request_options: typing.Optio if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(str, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "VendorNotFound": - raise VendorNotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -173,18 +172,18 @@ def send_payer_email( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "InvoiceError": - raise InvoiceError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -244,18 +243,18 @@ def get_vendor_link(self, invoice_id: InvoiceId, *, request_options: typing.Opti if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(str, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "VendorNotFound": - raise VendorNotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -320,18 +319,18 @@ def send_vendor_email( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "InvoiceError": - raise InvoiceError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -398,18 +397,18 @@ async def get_payer_link( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(str, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "VendorNotFound": - raise VendorNotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -491,18 +490,18 @@ async def send_payer_email( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "InvoiceError": - raise InvoiceError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -564,18 +563,18 @@ async def get_vendor_link( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(str, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "VendorNotFound": - raise VendorNotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -640,18 +639,18 @@ async def send_vendor_email( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "InvoiceError": - raise InvoiceError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/mercoa/invoice_types/__init__.py b/src/mercoa/invoice_types/__init__.py index 6449b8b..a4f03b8 100644 --- a/src/mercoa/invoice_types/__init__.py +++ b/src/mercoa/invoice_types/__init__.py @@ -28,14 +28,14 @@ InvoiceMetricsPerDateResponse, InvoiceMetricsResponse, InvoiceOrderByField, - InvoiceRequest, + InvoiceRequestBase, InvoiceResponse, InvoiceStatus, + InvoiceUpdateRequest, PaymentDestinationOptions, PaymentDestinationOptions_BankAccount, PaymentDestinationOptions_Check, ) -from .errors import DuplicateInvoiceNumber, InvoiceError, InvoiceQueryError, InvoiceStatusError, VendorNotFound __all__ = [ "AddApproverRequest", @@ -53,10 +53,8 @@ "CommentRequest", "CommentResponse", "DocumentResponse", - "DuplicateInvoiceNumber", "FindInvoiceResponse", "InvoiceCreationRequest", - "InvoiceError", "InvoiceFailureType", "InvoiceFeesResponse", "InvoiceId", @@ -67,13 +65,11 @@ "InvoiceMetricsPerDateResponse", "InvoiceMetricsResponse", "InvoiceOrderByField", - "InvoiceQueryError", - "InvoiceRequest", + "InvoiceRequestBase", "InvoiceResponse", "InvoiceStatus", - "InvoiceStatusError", + "InvoiceUpdateRequest", "PaymentDestinationOptions", "PaymentDestinationOptions_BankAccount", "PaymentDestinationOptions_Check", - "VendorNotFound", ] diff --git a/src/mercoa/invoice_types/errors/__init__.py b/src/mercoa/invoice_types/errors/__init__.py deleted file mode 100644 index 4c07e5a..0000000 --- a/src/mercoa/invoice_types/errors/__init__.py +++ /dev/null @@ -1,9 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from .duplicate_invoice_number import DuplicateInvoiceNumber -from .invoice_error import InvoiceError -from .invoice_query_error import InvoiceQueryError -from .invoice_status_error import InvoiceStatusError -from .vendor_not_found import VendorNotFound - -__all__ = ["DuplicateInvoiceNumber", "InvoiceError", "InvoiceQueryError", "InvoiceStatusError", "VendorNotFound"] diff --git a/src/mercoa/invoice_types/errors/invoice_error.py b/src/mercoa/invoice_types/errors/invoice_error.py deleted file mode 100644 index 117a04c..0000000 --- a/src/mercoa/invoice_types/errors/invoice_error.py +++ /dev/null @@ -1,8 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ...core.api_error import ApiError - - -class InvoiceError(ApiError): - def __init__(self, body: str): - super().__init__(status_code=400, body=body) diff --git a/src/mercoa/invoice_types/errors/invoice_query_error.py b/src/mercoa/invoice_types/errors/invoice_query_error.py deleted file mode 100644 index 0fa328d..0000000 --- a/src/mercoa/invoice_types/errors/invoice_query_error.py +++ /dev/null @@ -1,8 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ...core.api_error import ApiError - - -class InvoiceQueryError(ApiError): - def __init__(self, body: str): - super().__init__(status_code=400, body=body) diff --git a/src/mercoa/invoice_types/errors/invoice_status_error.py b/src/mercoa/invoice_types/errors/invoice_status_error.py deleted file mode 100644 index 521d8d0..0000000 --- a/src/mercoa/invoice_types/errors/invoice_status_error.py +++ /dev/null @@ -1,8 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ...core.api_error import ApiError - - -class InvoiceStatusError(ApiError): - def __init__(self, body: str): - super().__init__(status_code=422, body=body) diff --git a/src/mercoa/invoice_types/errors/vendor_not_found.py b/src/mercoa/invoice_types/errors/vendor_not_found.py deleted file mode 100644 index ccd1041..0000000 --- a/src/mercoa/invoice_types/errors/vendor_not_found.py +++ /dev/null @@ -1,8 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ...core.api_error import ApiError - - -class VendorNotFound(ApiError): - def __init__(self, body: str): - super().__init__(status_code=404, body=body) diff --git a/src/mercoa/invoice_types/types/__init__.py b/src/mercoa/invoice_types/types/__init__.py index d8eede5..19499a6 100644 --- a/src/mercoa/invoice_types/types/__init__.py +++ b/src/mercoa/invoice_types/types/__init__.py @@ -27,9 +27,10 @@ from .invoice_metrics_per_date_response import InvoiceMetricsPerDateResponse from .invoice_metrics_response import InvoiceMetricsResponse from .invoice_order_by_field import InvoiceOrderByField -from .invoice_request import InvoiceRequest +from .invoice_request_base import InvoiceRequestBase from .invoice_response import InvoiceResponse from .invoice_status import InvoiceStatus +from .invoice_update_request import InvoiceUpdateRequest from .payment_destination_options import ( PaymentDestinationOptions, PaymentDestinationOptions_BankAccount, @@ -64,9 +65,10 @@ "InvoiceMetricsPerDateResponse", "InvoiceMetricsResponse", "InvoiceOrderByField", - "InvoiceRequest", + "InvoiceRequestBase", "InvoiceResponse", "InvoiceStatus", + "InvoiceUpdateRequest", "PaymentDestinationOptions", "PaymentDestinationOptions_BankAccount", "PaymentDestinationOptions_Check", diff --git a/src/mercoa/invoice_types/types/invoice_creation_request.py b/src/mercoa/invoice_types/types/invoice_creation_request.py index 5b56d1c..1614b86 100644 --- a/src/mercoa/invoice_types/types/invoice_creation_request.py +++ b/src/mercoa/invoice_types/types/invoice_creation_request.py @@ -5,16 +5,73 @@ from ...core.datetime_utils import serialize_datetime from ...core.pydantic_utilities import pydantic_v1 -from .invoice_request import InvoiceRequest +from ...entity_types.types.entity_id import EntityId +from .invoice_request_base import InvoiceRequestBase -class InvoiceCreationRequest(InvoiceRequest): +class InvoiceCreationRequest(InvoiceRequestBase): """ Examples -------- - from mercoa import InvoiceCreationRequest + import datetime - InvoiceCreationRequest() + from mercoa import ( + InvoiceCreationRequest, + InvoiceLineItemRequest, + PaymentDestinationOptions_Check, + ) + + InvoiceCreationRequest( + status="DRAFT", + amount=100.0, + currency="USD", + invoice_date=datetime.datetime.fromisoformat( + "2021-01-01 00:00:00+00:00", + ), + due_date=datetime.datetime.fromisoformat( + "2021-01-31 00:00:00+00:00", + ), + invoice_number="INV-123", + note_to_self="For the month of January", + service_start_date=datetime.datetime.fromisoformat( + "2021-01-01 00:00:00+00:00", + ), + service_end_date=datetime.datetime.fromisoformat( + "2021-01-31 00:00:00+00:00", + ), + payer_id="ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", + payment_source_id="pm_4794d597-70dc-4fec-b6ec-c5988e759769", + vendor_id="ent_21661ac1-a2a8-4465-a6c0-64474ba8181d", + payment_destination_id="pm_5fde2f4a-facc-48ef-8f0d-6b7d087c7b18", + payment_destination_options=PaymentDestinationOptions_Check( + delivery="MAIL", + ), + line_items=[ + InvoiceLineItemRequest( + amount=100.0, + currency="USD", + description="Product A", + name="Product A", + quantity=1, + unit_price=100.0, + service_start_date=datetime.datetime.fromisoformat( + "2021-01-01 00:00:00+00:00", + ), + service_end_date=datetime.datetime.fromisoformat( + "2021-01-31 00:00:00+00:00", + ), + metadata={"key1": "value1", "key2": "value2"}, + gl_account_id="600394", + ) + ], + creator_entity_id="ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", + creator_user_id="user_e24fc81c-c5ee-47e8-af42-4fe29d895506", + ) + """ + + creator_entity_id: EntityId = pydantic_v1.Field(alias="creatorEntityId") + """ + ID of entity who created this invoice. """ def json(self, **kwargs: typing.Any) -> str: diff --git a/src/mercoa/invoice_types/types/invoice_request.py b/src/mercoa/invoice_types/types/invoice_request_base.py similarity index 70% rename from src/mercoa/invoice_types/types/invoice_request.py rename to src/mercoa/invoice_types/types/invoice_request_base.py index 0a95c29..fd3a8d0 100644 --- a/src/mercoa/invoice_types/types/invoice_request.py +++ b/src/mercoa/invoice_types/types/invoice_request_base.py @@ -15,66 +15,7 @@ from .payment_destination_options import PaymentDestinationOptions -class InvoiceRequest(pydantic_v1.BaseModel): - """ - Examples - -------- - import datetime - - from mercoa import ( - InvoiceLineItemRequest, - InvoiceRequest, - PaymentDestinationOptions_Check, - ) - - InvoiceRequest( - status="DRAFT", - amount=100.0, - currency="USD", - invoice_date=datetime.datetime.fromisoformat( - "2021-01-01 00:00:00+00:00", - ), - due_date=datetime.datetime.fromisoformat( - "2021-01-31 00:00:00+00:00", - ), - invoice_number="INV-123", - note_to_self="For the month of January", - service_start_date=datetime.datetime.fromisoformat( - "2021-01-01 00:00:00+00:00", - ), - service_end_date=datetime.datetime.fromisoformat( - "2021-01-31 00:00:00+00:00", - ), - payer_id="ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", - payment_source_id="pm_4794d597-70dc-4fec-b6ec-c5988e759769", - vendor_id="ent_21661ac1-a2a8-4465-a6c0-64474ba8181d", - payment_destination_id="pm_5fde2f4a-facc-48ef-8f0d-6b7d087c7b18", - payment_destination_options=PaymentDestinationOptions_Check( - delivery="MAIL", - ), - line_items=[ - InvoiceLineItemRequest( - amount=100.0, - currency="USD", - description="Product A", - name="Product A", - quantity=1, - unit_price=100.0, - service_start_date=datetime.datetime.fromisoformat( - "2021-01-01 00:00:00+00:00", - ), - service_end_date=datetime.datetime.fromisoformat( - "2021-01-31 00:00:00+00:00", - ), - metadata={"key1": "value1", "key2": "value2"}, - gl_account_id="600394", - ) - ], - creator_entity_id="ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", - creator_user_id="user_e24fc81c-c5ee-47e8-af42-4fe29d895506", - ) - """ - +class InvoiceRequestBase(pydantic_v1.BaseModel): status: typing.Optional[InvoiceStatus] = None amount: typing.Optional[float] = pydantic_v1.Field(default=None) """ @@ -163,11 +104,6 @@ class InvoiceRequest(pydantic_v1.BaseModel): DEPRECATED. Use document field instead. """ - creator_entity_id: typing.Optional[EntityId] = pydantic_v1.Field(alias="creatorEntityId", default=None) - """ - ID of entity who created this invoice. If creating a payable invoice (AP), this must be the same as the payerId. If creating a receivable invoice (AR), this must be the same as the vendorId. - """ - creator_user_id: typing.Optional[EntityUserId] = pydantic_v1.Field(alias="creatorUserId", default=None) """ ID of entity user who created this invoice. diff --git a/src/mercoa/invoice_types/types/invoice_update_request.py b/src/mercoa/invoice_types/types/invoice_update_request.py new file mode 100644 index 0000000..a0169ba --- /dev/null +++ b/src/mercoa/invoice_types/types/invoice_update_request.py @@ -0,0 +1,91 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ...core.datetime_utils import serialize_datetime +from ...core.pydantic_utilities import pydantic_v1 +from ...entity_types.types.entity_id import EntityId +from .invoice_request_base import InvoiceRequestBase + + +class InvoiceUpdateRequest(InvoiceRequestBase): + """ + Examples + -------- + import datetime + + from mercoa import ( + InvoiceLineItemRequest, + InvoiceUpdateRequest, + PaymentDestinationOptions_Check, + ) + + InvoiceUpdateRequest( + status="DRAFT", + amount=100.0, + currency="USD", + invoice_date=datetime.datetime.fromisoformat( + "2021-01-01 00:00:00+00:00", + ), + due_date=datetime.datetime.fromisoformat( + "2021-01-31 00:00:00+00:00", + ), + invoice_number="INV-123", + note_to_self="For the month of January", + service_start_date=datetime.datetime.fromisoformat( + "2021-01-01 00:00:00+00:00", + ), + service_end_date=datetime.datetime.fromisoformat( + "2021-01-31 00:00:00+00:00", + ), + payer_id="ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", + payment_source_id="pm_4794d597-70dc-4fec-b6ec-c5988e759769", + vendor_id="ent_21661ac1-a2a8-4465-a6c0-64474ba8181d", + payment_destination_id="pm_5fde2f4a-facc-48ef-8f0d-6b7d087c7b18", + payment_destination_options=PaymentDestinationOptions_Check( + delivery="MAIL", + ), + line_items=[ + InvoiceLineItemRequest( + amount=100.0, + currency="USD", + description="Product A", + name="Product A", + quantity=1, + unit_price=100.0, + service_start_date=datetime.datetime.fromisoformat( + "2021-01-01 00:00:00+00:00", + ), + service_end_date=datetime.datetime.fromisoformat( + "2021-01-31 00:00:00+00:00", + ), + metadata={"key1": "value1", "key2": "value2"}, + gl_account_id="600394", + ) + ], + creator_entity_id="ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", + creator_user_id="user_e24fc81c-c5ee-47e8-af42-4fe29d895506", + ) + """ + + creator_entity_id: typing.Optional[EntityId] = pydantic_v1.Field(alias="creatorEntityId", default=None) + """ + ID of entity who created this invoice. If creating a payable invoice (AP), this must be the same as the payerId. If creating a receivable invoice (AR), this must be the same as the vendorId. + """ + + 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 + populate_by_name = True + extra = pydantic_v1.Extra.allow + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/mercoa/ocr/__init__.py b/src/mercoa/ocr/__init__.py index fdccd07..48af959 100644 --- a/src/mercoa/ocr/__init__.py +++ b/src/mercoa/ocr/__init__.py @@ -1,6 +1,5 @@ # This file was auto-generated by Fern from our API Definition. from .types import OcrAsyncResponse, OcrJobResponse, OcrJobStatus, OcrResponse -from .errors import OcrFailure -__all__ = ["OcrAsyncResponse", "OcrFailure", "OcrJobResponse", "OcrJobStatus", "OcrResponse"] +__all__ = ["OcrAsyncResponse", "OcrJobResponse", "OcrJobStatus", "OcrResponse"] diff --git a/src/mercoa/ocr/client.py b/src/mercoa/ocr/client.py index 9af8a59..a54d022 100644 --- a/src/mercoa/ocr/client.py +++ b/src/mercoa/ocr/client.py @@ -4,9 +4,10 @@ import urllib.parse from json.decoder import JSONDecodeError -from ..commons.errors.auth_header_malformed_error import AuthHeaderMalformedError -from ..commons.errors.auth_header_missing_error import AuthHeaderMissingError +from ..commons.errors.bad_request import BadRequest +from ..commons.errors.conflict import Conflict from ..commons.errors.forbidden import Forbidden +from ..commons.errors.internal_server_error import InternalServerError from ..commons.errors.not_found import NotFound from ..commons.errors.unauthorized import Unauthorized from ..commons.errors.unimplemented import Unimplemented @@ -18,7 +19,6 @@ from ..core.request_options import RequestOptions from ..entity_types.types.entity_id import EntityId from ..entity_types.types.vendor_network import VendorNetwork -from .errors.ocr_failure import OcrFailure from .types.ocr_async_response import OcrAsyncResponse from .types.ocr_job_response import OcrJobResponse from .types.ocr_response import OcrResponse @@ -121,18 +121,18 @@ def ocr( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(OcrResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "OcrFailure": - raise OcrFailure(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -227,18 +227,18 @@ def run_async_ocr( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(OcrAsyncResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "OcrFailure": - raise OcrFailure(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -298,18 +298,18 @@ def get_async_ocr(self, job_id: str, *, request_options: typing.Optional[Request if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(OcrJobResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "OcrFailure": - raise OcrFailure(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -409,18 +409,18 @@ async def ocr( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(OcrResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "OcrFailure": - raise OcrFailure(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -515,18 +515,18 @@ async def run_async_ocr( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(OcrAsyncResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "OcrFailure": - raise OcrFailure(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -588,18 +588,18 @@ async def get_async_ocr( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(OcrJobResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "OcrFailure": - raise OcrFailure(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/mercoa/ocr/errors/__init__.py b/src/mercoa/ocr/errors/__init__.py deleted file mode 100644 index 5e4508d..0000000 --- a/src/mercoa/ocr/errors/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from .ocr_failure import OcrFailure - -__all__ = ["OcrFailure"] diff --git a/src/mercoa/organization/client.py b/src/mercoa/organization/client.py index 5b61836..4702af6 100644 --- a/src/mercoa/organization/client.py +++ b/src/mercoa/organization/client.py @@ -5,9 +5,10 @@ import urllib.parse from json.decoder import JSONDecodeError -from ..commons.errors.auth_header_malformed_error import AuthHeaderMalformedError -from ..commons.errors.auth_header_missing_error import AuthHeaderMissingError +from ..commons.errors.bad_request import BadRequest +from ..commons.errors.conflict import Conflict from ..commons.errors.forbidden import Forbidden +from ..commons.errors.internal_server_error import InternalServerError from ..commons.errors.not_found import NotFound from ..commons.errors.unauthorized import Unauthorized from ..commons.errors.unimplemented import Unimplemented @@ -136,16 +137,18 @@ def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(OrganizationResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -232,16 +235,18 @@ def update( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(OrganizationResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -336,16 +341,18 @@ def email_log( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(EmailLogResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -460,16 +467,18 @@ async def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(OrganizationResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -556,16 +565,18 @@ async def update( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(OrganizationResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -660,16 +671,18 @@ async def email_log( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(EmailLogResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/mercoa/organization/notification_configuration/client.py b/src/mercoa/organization/notification_configuration/client.py index b021ca6..5767ecf 100644 --- a/src/mercoa/organization/notification_configuration/client.py +++ b/src/mercoa/organization/notification_configuration/client.py @@ -4,9 +4,10 @@ import urllib.parse from json.decoder import JSONDecodeError -from ...commons.errors.auth_header_malformed_error import AuthHeaderMalformedError -from ...commons.errors.auth_header_missing_error import AuthHeaderMissingError +from ...commons.errors.bad_request import BadRequest +from ...commons.errors.conflict import Conflict from ...commons.errors.forbidden import Forbidden +from ...commons.errors.internal_server_error import InternalServerError from ...commons.errors.not_found import NotFound from ...commons.errors.unauthorized import Unauthorized from ...commons.errors.unimplemented import Unimplemented @@ -81,16 +82,18 @@ def get_all( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(typing.List[NotificationConfigurationResponse], _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -153,16 +156,18 @@ def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(NotificationConfigurationResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -241,16 +246,18 @@ def update( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(NotificationConfigurationResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -313,16 +320,18 @@ def reset( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -385,16 +394,18 @@ async def get_all( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(typing.List[NotificationConfigurationResponse], _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -457,16 +468,18 @@ async def get( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(NotificationConfigurationResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -545,16 +558,18 @@ async def update( if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(NotificationConfigurationResponse, _response_json) # type: ignore if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) @@ -617,16 +632,18 @@ async def reset( except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) if "errorName" in _response_json: - if _response_json["errorName"] == "AuthHeaderMissingError": - raise AuthHeaderMissingError() - if _response_json["errorName"] == "AuthHeaderMalformedError": - raise AuthHeaderMalformedError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "BadRequest": + raise BadRequest(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unauthorized": raise Unauthorized(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Forbidden": raise Forbidden(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "NotFound": raise NotFound(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "Conflict": + raise Conflict(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore + if _response_json["errorName"] == "InternalServerError": + raise InternalServerError(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore if _response_json["errorName"] == "Unimplemented": raise Unimplemented(pydantic_v1.parse_obj_as(str, _response_json["content"])) # type: ignore raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/mercoa/organization_types/__init__.py b/src/mercoa/organization_types/__init__.py index 53d839b..c1600d3 100644 --- a/src/mercoa/organization_types/__init__.py +++ b/src/mercoa/organization_types/__init__.py @@ -22,9 +22,12 @@ IndividualOnboardingOptions, InvoiceNotificationConfigurationRequest, InvoiceNotificationConfigurationResponse, + MetadataRegexValidationRule, MetadataSchema, MetadataShowConditions, MetadataType, + MetadataValidationRule, + MetadataValidationRule_Regex, NotificationConfigurationRequest, NotificationConfigurationRequest_Invoice, NotificationConfigurationResponse, @@ -67,9 +70,12 @@ "IndividualOnboardingOptions", "InvoiceNotificationConfigurationRequest", "InvoiceNotificationConfigurationResponse", + "MetadataRegexValidationRule", "MetadataSchema", "MetadataShowConditions", "MetadataType", + "MetadataValidationRule", + "MetadataValidationRule_Regex", "NotificationConfigurationRequest", "NotificationConfigurationRequest_Invoice", "NotificationConfigurationResponse", diff --git a/src/mercoa/organization_types/types/__init__.py b/src/mercoa/organization_types/types/__init__.py index 80dddab..9854d6f 100644 --- a/src/mercoa/organization_types/types/__init__.py +++ b/src/mercoa/organization_types/types/__init__.py @@ -25,9 +25,11 @@ from .individual_onboarding_options import IndividualOnboardingOptions from .invoice_notification_configuration_request import InvoiceNotificationConfigurationRequest from .invoice_notification_configuration_response import InvoiceNotificationConfigurationResponse +from .metadata_regex_validation_rule import MetadataRegexValidationRule from .metadata_schema import MetadataSchema from .metadata_show_conditions import MetadataShowConditions from .metadata_type import MetadataType +from .metadata_validation_rule import MetadataValidationRule, MetadataValidationRule_Regex from .notification_configuration_request import ( NotificationConfigurationRequest, NotificationConfigurationRequest_Invoice, @@ -73,9 +75,12 @@ "IndividualOnboardingOptions", "InvoiceNotificationConfigurationRequest", "InvoiceNotificationConfigurationResponse", + "MetadataRegexValidationRule", "MetadataSchema", "MetadataShowConditions", "MetadataType", + "MetadataValidationRule", + "MetadataValidationRule_Regex", "NotificationConfigurationRequest", "NotificationConfigurationRequest_Invoice", "NotificationConfigurationResponse", diff --git a/src/mercoa/organization_types/types/metadata_regex_validation_rule.py b/src/mercoa/organization_types/types/metadata_regex_validation_rule.py new file mode 100644 index 0000000..b651890 --- /dev/null +++ b/src/mercoa/organization_types/types/metadata_regex_validation_rule.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ...core.datetime_utils import serialize_datetime +from ...core.pydantic_utilities import pydantic_v1 + + +class MetadataRegexValidationRule(pydantic_v1.BaseModel): + regex: str = pydantic_v1.Field() + """ + A regular expression that the value must match. + """ + + error_message: str = pydantic_v1.Field(alias="errorMessage") + """ + The error message to display if the value does not match the regular expression. + """ + + 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 + populate_by_name = True + extra = pydantic_v1.Extra.allow + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/mercoa/organization_types/types/metadata_schema.py b/src/mercoa/organization_types/types/metadata_schema.py index 0ef3085..88020da 100644 --- a/src/mercoa/organization_types/types/metadata_schema.py +++ b/src/mercoa/organization_types/types/metadata_schema.py @@ -7,6 +7,7 @@ from ...core.pydantic_utilities import pydantic_v1 from .metadata_show_conditions import MetadataShowConditions from .metadata_type import MetadataType +from .metadata_validation_rule import MetadataValidationRule class MetadataSchema(pydantic_v1.BaseModel): @@ -24,6 +25,11 @@ class MetadataSchema(pydantic_v1.BaseModel): Whether or not multiple values are allowed for this field. Defaults to false. If true, the value will be a list of the specified type. """ + validation_rules: typing.Optional[MetadataValidationRule] = pydantic_v1.Field(alias="validationRules", default=None) + """ + Validation rules are currently only supported for STRING types. + """ + show_conditions: typing.Optional[MetadataShowConditions] = pydantic_v1.Field(alias="showConditions", default=None) """ A list of conditional rules that determine whether or not this field should be shown. The field will only be shown if all of the conditions are met. If no conditions are specified, the field will always be shown. diff --git a/src/mercoa/organization_types/types/metadata_validation_rule.py b/src/mercoa/organization_types/types/metadata_validation_rule.py new file mode 100644 index 0000000..cf889ba --- /dev/null +++ b/src/mercoa/organization_types/types/metadata_validation_rule.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ...core.pydantic_utilities import pydantic_v1 + + +class MetadataValidationRule_Regex(pydantic_v1.BaseModel): + type: typing.Literal["regex"] = "regex" + regex: str + error_message: str = pydantic_v1.Field(alias="errorMessage") + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + populate_by_name = True + + +MetadataValidationRule = typing.Union[MetadataValidationRule_Regex] diff --git a/src/mercoa/payment_method_types/__init__.py b/src/mercoa/payment_method_types/__init__.py index 693d907..f42b23a 100644 --- a/src/mercoa/payment_method_types/__init__.py +++ b/src/mercoa/payment_method_types/__init__.py @@ -48,7 +48,6 @@ PaymentMethodUpdateRequest_OffPlatform, PlaidLinkRequest, ) -from .errors import PaymentMethodError __all__ = [ "BankAccountCheckOptions", @@ -76,7 +75,6 @@ "PaymentMethodBalanceStatus", "PaymentMethodBaseRequest", "PaymentMethodBaseResponse", - "PaymentMethodError", "PaymentMethodId", "PaymentMethodRequest", "PaymentMethodRequest_BankAccount", diff --git a/src/mercoa/payment_method_types/errors/__init__.py b/src/mercoa/payment_method_types/errors/__init__.py deleted file mode 100644 index d9a4889..0000000 --- a/src/mercoa/payment_method_types/errors/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from .payment_method_error import PaymentMethodError - -__all__ = ["PaymentMethodError"] diff --git a/src/mercoa/payment_method_types/errors/payment_method_error.py b/src/mercoa/payment_method_types/errors/payment_method_error.py deleted file mode 100644 index 318ca7f..0000000 --- a/src/mercoa/payment_method_types/errors/payment_method_error.py +++ /dev/null @@ -1,8 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ...core.api_error import ApiError - - -class PaymentMethodError(ApiError): - def __init__(self, body: str): - super().__init__(status_code=400, body=body)