From 569e05c3bb6811a50dc27da9629b8943d1b27dba Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Mon, 21 Oct 2024 16:11:27 +0000 Subject: [PATCH] ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.420.0 --- .speakeasy/workflow.lock | 14 + .speakeasy/workflow.yaml | 2 + sync-for-payables/.gitattributes | 2 + sync-for-payables/.gitignore | 9 + sync-for-payables/.speakeasy/gen.lock | 926 +++++++++++ sync-for-payables/.speakeasy/gen.yaml | 9 +- sync-for-payables/.vscode/settings.json | 6 + sync-for-payables/CONTRIBUTING.md | 26 + sync-for-payables/README.md | 535 ++++++- sync-for-payables/RELEASES.md | 11 + sync-for-payables/USAGE.md | 52 + .../docs/models/errors/errormessage.md | 16 + .../operations/createbankaccountrequest.md | 11 + .../operations/createbillpaymentrequest.md | 12 + .../models/operations/createbillrequest.md | 11 + .../operations/createconnectionrequest.md | 9 + .../operations/createconnectionrequestbody.md | 8 + .../operations/createsupplierrequest.md | 11 + .../models/operations/deletecompanyrequest.md | 8 + .../operations/deleteconnectionrequest.md | 9 + .../downloadbillattachmentrequest.md | 11 + .../getcompanyinformationrequest.md | 9 + .../models/operations/getcompanyrequest.md | 8 + .../models/operations/getconnectionrequest.md | 9 + .../getmappingoptionsbillsrequest.md | 11 + .../getmappingoptionspaymentsrequest.md | 11 + .../operations/listbillattachmentsrequest.md | 10 + .../models/operations/listbillsrequest.md | 11 + .../models/operations/listcompaniesrequest.md | 11 + .../operations/listconnectionsrequest.md | 12 + .../models/operations/listsuppliersrequest.md | 11 + .../operations/unlinkconnectionrequest.md | 10 + .../unlinkconnectionupdateconnection.md | 8 + .../models/operations/updatecompanyrequest.md | 9 + .../operations/uploadbillattachmentrequest.md | 11 + .../models/shared/accountmappingoption.md | 14 + .../docs/models/shared/accountstatus.md | 11 + .../docs/models/shared/accounttype.md | 14 + .../docs/models/shared/address.md | 14 + .../docs/models/shared/addresstype.md | 12 + .../docs/models/shared/attachment.md | 31 + .../docs/models/shared/attachmentupload.md | 8 + .../docs/models/shared/bankaccount.md | 16 + .../models/shared/bankaccountmappingoption.md | 16 + .../models/shared/bankaccountprototype.md | 13 + .../docs/models/shared/bankaccountstatus.md | 11 + .../docs/models/shared/bankaccounttype.md | 14 + sync-for-payables/docs/models/shared/bill.md | 21 + .../docs/models/shared/billaccountref.md | 10 + .../docs/models/shared/billlineitem.md | 14 + .../docs/models/shared/billmappingoptions.md | 12 + .../docs/models/shared/billpayment.md | 13 + .../models/shared/billpaymentaccountref.md | 10 + .../models/shared/billpaymentprototype.md | 12 + .../docs/models/shared/billprototype.md | 15 + sync-for-payables/docs/models/shared/bills.md | 9 + .../docs/models/shared/billstatus.md | 15 + .../docs/models/shared/billtaxrateref.md | 10 + .../shared/clientratelimitreachedwebhook.md | 16 + .../clientratelimitreachedwebhookdata.md | 9 + .../shared/clientratelimitresetwebhook.md | 16 + .../shared/clientratelimitresetwebhookdata.md | 11 + .../models/shared/clientratelimitwebhook.md | 11 + .../shared/clientratelimitwebhookpayload.md | 10 + .../docs/models/shared/codatfile.md | 10 + .../docs/models/shared/companies.md | 12 + .../docs/models/shared/company.md | 23 + .../docs/models/shared/companyinformation.md | 11 + .../docs/models/shared/companyrequestbody.md | 10 + .../docs/models/shared/companytags.md | 9 + .../docs/models/shared/connection.md | 30 + .../docs/models/shared/connections.md | 12 + .../docs/models/shared/dataconnectionerror.md | 13 + .../models/shared/dataconnectionstatus.md | 13 + .../docs/models/shared/errorstatus.md | 11 + .../docs/models/shared/errorvalidation.md | 11 + .../docs/models/shared/errorvalidationitem.md | 10 + .../docs/models/shared/halref.md | 8 + sync-for-payables/docs/models/shared/links.md | 11 + .../docs/models/shared/pagination.md | 8 + .../models/shared/paymentmappingoptions.md | 11 + .../docs/models/shared/security.md | 8 + .../docs/models/shared/sourcetype.md | 16 + .../docs/models/shared/supplier.md | 22 + .../docs/models/shared/supplierprototype.md | 15 + .../docs/models/shared/supplierref.md | 11 + .../docs/models/shared/suppliers.md | 9 + .../docs/models/shared/supplierstatus.md | 12 + sync-for-payables/docs/models/shared/tags.md | 9 + .../models/shared/taxratemappingoption.md | 13 + .../docs/models/shared/taxratestatus.md | 13 + .../docs/models/utils/retryconfig.md | 24 + .../docs/sdks/bankaccounts/README.md | 65 + .../docs/sdks/billpayments/README.md | 120 ++ sync-for-payables/docs/sdks/bills/README.md | 360 +++++ .../docs/sdks/codatsyncpayables/README.md | 24 + .../docs/sdks/companies/README.md | 255 ++++ .../docs/sdks/companyinformation/README.md | 57 + .../docs/sdks/connections/README.md | 244 +++ .../docs/sdks/suppliers/README.md | 131 ++ sync-for-payables/poetry.lock | 551 +++++++ sync-for-payables/poetry.toml | 2 + sync-for-payables/py.typed | 1 + sync-for-payables/pylintrc | 658 ++++++++ sync-for-payables/pyproject.toml | 55 + sync-for-payables/scripts/compile.sh | 85 ++ sync-for-payables/scripts/prepare-readme.py | 33 + sync-for-payables/scripts/publish.sh | 7 + .../src/codat_sync_for_payables/__init__.py | 8 + .../_hooks/__init__.py | 5 + .../_hooks/registration.py | 13 + .../_hooks/sdkhooks.py | 76 + .../codat_sync_for_payables/_hooks/types.py | 94 ++ .../src/codat_sync_for_payables/_version.py | 12 + .../codat_sync_for_payables/bank_accounts.py | 242 +++ .../src/codat_sync_for_payables/basesdk.py | 343 +++++ .../codat_sync_for_payables/bill_payments.py | 468 ++++++ .../src/codat_sync_for_payables/bills.py | 1353 +++++++++++++++++ .../src/codat_sync_for_payables/companies.py | 1112 ++++++++++++++ .../company_information.py | 228 +++ .../codat_sync_for_payables/connections.py | 1096 +++++++++++++ .../src/codat_sync_for_payables/httpclient.py | 78 + .../models/errors/__init__.py | 6 + .../models/errors/errormessage.py | 52 + .../models/errors/sdkerror.py | 22 + .../models/operations/__init__.py | 106 ++ .../models/operations/create_bank_account.py | 56 + .../models/operations/create_bill.py | 52 + .../models/operations/create_bill_payment.py | 65 + .../models/operations/create_connection.py | 42 + .../models/operations/create_supplier.py | 54 + .../models/operations/delete_company.py | 21 + .../models/operations/delete_connection.py | 30 + .../operations/download_bill_attachment.py | 48 + .../models/operations/get_company.py | 21 + .../operations/get_company_information.py | 30 + .../models/operations/get_connection.py | 30 + .../operations/get_mapping_options_bills.py | 53 + .../get_mapping_options_payments.py | 53 + .../operations/list_bill_attachments.py | 39 + .../models/operations/list_bills.py | 52 + .../models/operations/list_companies.py | 47 + .../models/operations/list_connections.py | 60 + .../models/operations/list_suppliers.py | 52 + .../models/operations/unlink_connection.py | 54 + .../models/operations/update_company.py | 37 + .../operations/upload_bill_attachment.py | 53 + .../models/shared/__init__.py | 186 +++ .../models/shared/accountmappingoption.py | 109 ++ .../models/shared/accountstatus.py | 11 + .../models/shared/accounttype.py | 15 + .../models/shared/address.py | 95 ++ .../models/shared/addresstype.py | 12 + .../models/shared/attachment.py | 178 +++ .../models/shared/attachmentupload.py | 22 + .../models/shared/bankaccount.py | 161 ++ .../models/shared/bankaccountmappingoption.py | 142 ++ .../models/shared/bankaccountprototype.py | 119 ++ .../models/shared/bankaccountstatus.py | 11 + .../models/shared/bill.py | 225 +++ .../models/shared/billaccountref.py | 20 + .../models/shared/billlineitem.py | 115 ++ .../models/shared/billmappingoptions.py | 30 + .../models/shared/billpayment.py | 166 ++ .../models/shared/billpaymentaccountref.py | 19 + .../models/shared/billpaymentprototype.py | 151 ++ .../models/shared/billprototype.py | 179 +++ .../models/shared/bills.py | 19 + .../models/shared/billstatus.py | 15 + .../models/shared/billtaxrateref.py | 20 + .../shared/clientratelimitreachedwebhook.py | 61 + .../clientratelimitreachedwebhookdata.py | 60 + .../shared/clientratelimitresetwebhook.py | 61 + .../shared/clientratelimitresetwebhookdata.py | 109 ++ .../models/shared/clientratelimitwebhook.py | 74 + .../shared/clientratelimitwebhookpayload.py | 67 + .../models/shared/codatfile.py | 33 + .../models/shared/companies.py | 35 + .../models/shared/company.py | 208 +++ .../models/shared/companyinformation.py | 66 + .../models/shared/companyrequestbody.py | 27 + .../models/shared/connection.py | 225 +++ .../models/shared/connections.py | 35 + .../models/shared/dataconnectionerror.py | 174 +++ .../models/shared/dataconnectionstatus.py | 13 + .../models/shared/errorvalidation.py | 59 + .../models/shared/errorvalidationitem.py | 65 + .../models/shared/halref.py | 16 + .../models/shared/links.py | 25 + .../models/shared/pagination.py | 19 + .../models/shared/paymentmappingoptions.py | 29 + .../models/shared/security.py | 24 + .../models/shared/supplier.py | 145 ++ .../models/shared/supplierprototype.py | 119 ++ .../models/shared/supplierref.py | 64 + .../models/shared/suppliers.py | 19 + .../models/shared/supplierstatus.py | 12 + .../models/shared/tags.py | 13 + .../models/shared/taxratemappingoption.py | 121 ++ .../src/codat_sync_for_payables/py.typed | 1 + .../src/codat_sync_for_payables/sdk.py | 140 ++ .../sdkconfiguration.py | 50 + .../src/codat_sync_for_payables/suppliers.py | 466 ++++++ .../codat_sync_for_payables/types/__init__.py | 21 + .../types/basemodel.py | 39 + .../codat_sync_for_payables/utils/__init__.py | 97 ++ .../utils/annotations.py | 30 + .../codat_sync_for_payables/utils/enums.py | 34 + .../utils/eventstreaming.py | 178 +++ .../codat_sync_for_payables/utils/forms.py | 208 +++ .../codat_sync_for_payables/utils/headers.py | 136 ++ .../codat_sync_for_payables/utils/logger.py | 22 + .../codat_sync_for_payables/utils/metadata.py | 118 ++ .../utils/queryparams.py | 205 +++ .../utils/requestbodies.py | 66 + .../codat_sync_for_payables/utils/retries.py | 217 +++ .../codat_sync_for_payables/utils/security.py | 174 +++ .../utils/serializers.py | 215 +++ .../src/codat_sync_for_payables/utils/url.py | 155 ++ .../codat_sync_for_payables/utils/values.py | 134 ++ 220 files changed, 18196 insertions(+), 11 deletions(-) create mode 100644 sync-for-payables/.gitattributes create mode 100644 sync-for-payables/.gitignore create mode 100644 sync-for-payables/.speakeasy/gen.lock create mode 100644 sync-for-payables/.vscode/settings.json create mode 100644 sync-for-payables/CONTRIBUTING.md create mode 100644 sync-for-payables/RELEASES.md create mode 100644 sync-for-payables/USAGE.md create mode 100644 sync-for-payables/docs/models/errors/errormessage.md create mode 100644 sync-for-payables/docs/models/operations/createbankaccountrequest.md create mode 100644 sync-for-payables/docs/models/operations/createbillpaymentrequest.md create mode 100644 sync-for-payables/docs/models/operations/createbillrequest.md create mode 100644 sync-for-payables/docs/models/operations/createconnectionrequest.md create mode 100644 sync-for-payables/docs/models/operations/createconnectionrequestbody.md create mode 100644 sync-for-payables/docs/models/operations/createsupplierrequest.md create mode 100644 sync-for-payables/docs/models/operations/deletecompanyrequest.md create mode 100644 sync-for-payables/docs/models/operations/deleteconnectionrequest.md create mode 100644 sync-for-payables/docs/models/operations/downloadbillattachmentrequest.md create mode 100644 sync-for-payables/docs/models/operations/getcompanyinformationrequest.md create mode 100644 sync-for-payables/docs/models/operations/getcompanyrequest.md create mode 100644 sync-for-payables/docs/models/operations/getconnectionrequest.md create mode 100644 sync-for-payables/docs/models/operations/getmappingoptionsbillsrequest.md create mode 100644 sync-for-payables/docs/models/operations/getmappingoptionspaymentsrequest.md create mode 100644 sync-for-payables/docs/models/operations/listbillattachmentsrequest.md create mode 100644 sync-for-payables/docs/models/operations/listbillsrequest.md create mode 100644 sync-for-payables/docs/models/operations/listcompaniesrequest.md create mode 100644 sync-for-payables/docs/models/operations/listconnectionsrequest.md create mode 100644 sync-for-payables/docs/models/operations/listsuppliersrequest.md create mode 100644 sync-for-payables/docs/models/operations/unlinkconnectionrequest.md create mode 100644 sync-for-payables/docs/models/operations/unlinkconnectionupdateconnection.md create mode 100644 sync-for-payables/docs/models/operations/updatecompanyrequest.md create mode 100644 sync-for-payables/docs/models/operations/uploadbillattachmentrequest.md create mode 100644 sync-for-payables/docs/models/shared/accountmappingoption.md create mode 100644 sync-for-payables/docs/models/shared/accountstatus.md create mode 100644 sync-for-payables/docs/models/shared/accounttype.md create mode 100644 sync-for-payables/docs/models/shared/address.md create mode 100644 sync-for-payables/docs/models/shared/addresstype.md create mode 100644 sync-for-payables/docs/models/shared/attachment.md create mode 100644 sync-for-payables/docs/models/shared/attachmentupload.md create mode 100644 sync-for-payables/docs/models/shared/bankaccount.md create mode 100644 sync-for-payables/docs/models/shared/bankaccountmappingoption.md create mode 100644 sync-for-payables/docs/models/shared/bankaccountprototype.md create mode 100644 sync-for-payables/docs/models/shared/bankaccountstatus.md create mode 100644 sync-for-payables/docs/models/shared/bankaccounttype.md create mode 100644 sync-for-payables/docs/models/shared/bill.md create mode 100644 sync-for-payables/docs/models/shared/billaccountref.md create mode 100644 sync-for-payables/docs/models/shared/billlineitem.md create mode 100644 sync-for-payables/docs/models/shared/billmappingoptions.md create mode 100644 sync-for-payables/docs/models/shared/billpayment.md create mode 100644 sync-for-payables/docs/models/shared/billpaymentaccountref.md create mode 100644 sync-for-payables/docs/models/shared/billpaymentprototype.md create mode 100644 sync-for-payables/docs/models/shared/billprototype.md create mode 100644 sync-for-payables/docs/models/shared/bills.md create mode 100644 sync-for-payables/docs/models/shared/billstatus.md create mode 100644 sync-for-payables/docs/models/shared/billtaxrateref.md create mode 100644 sync-for-payables/docs/models/shared/clientratelimitreachedwebhook.md create mode 100644 sync-for-payables/docs/models/shared/clientratelimitreachedwebhookdata.md create mode 100644 sync-for-payables/docs/models/shared/clientratelimitresetwebhook.md create mode 100644 sync-for-payables/docs/models/shared/clientratelimitresetwebhookdata.md create mode 100644 sync-for-payables/docs/models/shared/clientratelimitwebhook.md create mode 100644 sync-for-payables/docs/models/shared/clientratelimitwebhookpayload.md create mode 100644 sync-for-payables/docs/models/shared/codatfile.md create mode 100644 sync-for-payables/docs/models/shared/companies.md create mode 100644 sync-for-payables/docs/models/shared/company.md create mode 100644 sync-for-payables/docs/models/shared/companyinformation.md create mode 100644 sync-for-payables/docs/models/shared/companyrequestbody.md create mode 100644 sync-for-payables/docs/models/shared/companytags.md create mode 100644 sync-for-payables/docs/models/shared/connection.md create mode 100644 sync-for-payables/docs/models/shared/connections.md create mode 100644 sync-for-payables/docs/models/shared/dataconnectionerror.md create mode 100644 sync-for-payables/docs/models/shared/dataconnectionstatus.md create mode 100644 sync-for-payables/docs/models/shared/errorstatus.md create mode 100644 sync-for-payables/docs/models/shared/errorvalidation.md create mode 100644 sync-for-payables/docs/models/shared/errorvalidationitem.md create mode 100644 sync-for-payables/docs/models/shared/halref.md create mode 100644 sync-for-payables/docs/models/shared/links.md create mode 100644 sync-for-payables/docs/models/shared/pagination.md create mode 100644 sync-for-payables/docs/models/shared/paymentmappingoptions.md create mode 100644 sync-for-payables/docs/models/shared/security.md create mode 100644 sync-for-payables/docs/models/shared/sourcetype.md create mode 100644 sync-for-payables/docs/models/shared/supplier.md create mode 100644 sync-for-payables/docs/models/shared/supplierprototype.md create mode 100644 sync-for-payables/docs/models/shared/supplierref.md create mode 100644 sync-for-payables/docs/models/shared/suppliers.md create mode 100644 sync-for-payables/docs/models/shared/supplierstatus.md create mode 100644 sync-for-payables/docs/models/shared/tags.md create mode 100644 sync-for-payables/docs/models/shared/taxratemappingoption.md create mode 100644 sync-for-payables/docs/models/shared/taxratestatus.md create mode 100644 sync-for-payables/docs/models/utils/retryconfig.md create mode 100644 sync-for-payables/docs/sdks/bankaccounts/README.md create mode 100644 sync-for-payables/docs/sdks/billpayments/README.md create mode 100644 sync-for-payables/docs/sdks/bills/README.md create mode 100644 sync-for-payables/docs/sdks/codatsyncpayables/README.md create mode 100644 sync-for-payables/docs/sdks/companies/README.md create mode 100644 sync-for-payables/docs/sdks/companyinformation/README.md create mode 100644 sync-for-payables/docs/sdks/connections/README.md create mode 100644 sync-for-payables/docs/sdks/suppliers/README.md create mode 100644 sync-for-payables/poetry.lock create mode 100644 sync-for-payables/poetry.toml create mode 100644 sync-for-payables/py.typed create mode 100644 sync-for-payables/pylintrc create mode 100644 sync-for-payables/pyproject.toml create mode 100755 sync-for-payables/scripts/compile.sh create mode 100644 sync-for-payables/scripts/prepare-readme.py create mode 100755 sync-for-payables/scripts/publish.sh create mode 100644 sync-for-payables/src/codat_sync_for_payables/__init__.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/_hooks/__init__.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/_hooks/registration.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/_hooks/sdkhooks.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/_hooks/types.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/_version.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/bank_accounts.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/basesdk.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/bill_payments.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/bills.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/companies.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/company_information.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/connections.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/httpclient.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/errors/__init__.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/errors/errormessage.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/errors/sdkerror.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/operations/__init__.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/operations/create_bank_account.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/operations/create_bill.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/operations/create_bill_payment.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/operations/create_connection.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/operations/create_supplier.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/operations/delete_company.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/operations/delete_connection.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/operations/download_bill_attachment.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/operations/get_company.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/operations/get_company_information.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/operations/get_connection.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/operations/get_mapping_options_bills.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/operations/get_mapping_options_payments.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/operations/list_bill_attachments.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/operations/list_bills.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/operations/list_companies.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/operations/list_connections.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/operations/list_suppliers.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/operations/unlink_connection.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/operations/update_company.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/operations/upload_bill_attachment.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/__init__.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/accountmappingoption.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/accountstatus.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/accounttype.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/address.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/addresstype.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/attachment.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/attachmentupload.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/bankaccount.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/bankaccountmappingoption.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/bankaccountprototype.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/bankaccountstatus.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/bill.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/billaccountref.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/billlineitem.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/billmappingoptions.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/billpayment.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/billpaymentaccountref.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/billpaymentprototype.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/billprototype.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/bills.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/billstatus.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/billtaxrateref.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/clientratelimitreachedwebhook.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/clientratelimitreachedwebhookdata.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/clientratelimitresetwebhook.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/clientratelimitresetwebhookdata.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/clientratelimitwebhook.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/clientratelimitwebhookpayload.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/codatfile.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/companies.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/company.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/companyinformation.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/companyrequestbody.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/connection.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/connections.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/dataconnectionerror.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/dataconnectionstatus.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/errorvalidation.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/errorvalidationitem.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/halref.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/links.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/pagination.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/paymentmappingoptions.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/security.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/supplier.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/supplierprototype.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/supplierref.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/suppliers.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/supplierstatus.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/tags.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/models/shared/taxratemappingoption.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/py.typed create mode 100644 sync-for-payables/src/codat_sync_for_payables/sdk.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/sdkconfiguration.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/suppliers.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/types/__init__.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/types/basemodel.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/utils/__init__.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/utils/annotations.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/utils/enums.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/utils/eventstreaming.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/utils/forms.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/utils/headers.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/utils/logger.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/utils/metadata.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/utils/queryparams.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/utils/requestbodies.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/utils/retries.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/utils/security.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/utils/serializers.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/utils/url.py create mode 100644 sync-for-payables/src/codat_sync_for_payables/utils/values.py diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index adc7423b7..bc2083281 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -63,6 +63,13 @@ sources: tags: - latest - main + sync-for-payables-source: + sourceNamespace: sync-for-payables-source + sourceRevisionDigest: sha256:7c3fb539b32980f17c61cbe8bbe409b4057d4716e8cef551dd8ec88317143f70 + sourceBlobDigest: sha256:8df2e8138c36c7caf1549554e034c740c7e5b0250b1b001e86cb5fb1b9377447 + tags: + - latest + - main sync-for-payables-version-1-source: sourceNamespace: sync-for-payables-version-1-source sourceRevisionDigest: sha256:ab9717c986622b855c68e2ef2fb6e08f3a7ae563776e008d8bd9ab73ebe19508 @@ -116,6 +123,11 @@ targets: sourceNamespace: sync-for-commerce-source sourceRevisionDigest: sha256:6a62a3d9d65254b83a8e6afa5ea2e9d287076520c057bf8a1b60e42ebbdc815e sourceBlobDigest: sha256:2e0d6f59d01a5896709430e1e05d725b88ca088e959502f216a39b23ccab77ec + sync-for-payables-library: + source: sync-for-payables-source + sourceNamespace: sync-for-payables-source + sourceRevisionDigest: sha256:7c3fb539b32980f17c61cbe8bbe409b4057d4716e8cef551dd8ec88317143f70 + sourceBlobDigest: sha256:8df2e8138c36c7caf1549554e034c740c7e5b0250b1b001e86cb5fb1b9377447 sync-for-payables-version-1-library: source: sync-for-payables-version-1-source sourceNamespace: sync-for-payables-version-1-source @@ -189,6 +201,8 @@ workflow: sync-for-payables-source: inputs: - location: https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Sync-Payables.yaml + registry: + location: registry.speakeasyapi.dev/codat/codat/sync-for-payables-source sync-for-payables-version-1-source: inputs: - location: https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Sync-Payables-v1.yaml diff --git a/.speakeasy/workflow.yaml b/.speakeasy/workflow.yaml index e188f6681..8fdbd31ed 100644 --- a/.speakeasy/workflow.yaml +++ b/.speakeasy/workflow.yaml @@ -65,6 +65,8 @@ sources: sync-for-payables-source: inputs: - location: https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Sync-Payables.yaml + registry: + location: registry.speakeasyapi.dev/codat/codat/sync-for-payables-source sync-for-payables-version-1-source: inputs: - location: https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Sync-Payables-v1.yaml diff --git a/sync-for-payables/.gitattributes b/sync-for-payables/.gitattributes new file mode 100644 index 000000000..4d75d5900 --- /dev/null +++ b/sync-for-payables/.gitattributes @@ -0,0 +1,2 @@ +# This allows generated code to be indexed correctly +*.py linguist-generated=false \ No newline at end of file diff --git a/sync-for-payables/.gitignore b/sync-for-payables/.gitignore new file mode 100644 index 000000000..65eb1caeb --- /dev/null +++ b/sync-for-payables/.gitignore @@ -0,0 +1,9 @@ +.venv/ +venv/ +src/*.egg-info/ +__pycache__/ +.pytest_cache/ +.python-version +.DS_Store +pyrightconfig.json +README-PYPI.md diff --git a/sync-for-payables/.speakeasy/gen.lock b/sync-for-payables/.speakeasy/gen.lock new file mode 100644 index 000000000..6e359f8da --- /dev/null +++ b/sync-for-payables/.speakeasy/gen.lock @@ -0,0 +1,926 @@ +lockVersion: 2.0.0 +id: 0722f07c-657c-4062-93f1-39ee3fe757d0 +management: + docChecksum: 5d8ab43ac5cb4826a302caff35118eeb + docVersion: 3.0.0 + speakeasyVersion: 1.420.0 + generationVersion: 2.438.15 + releaseVersion: 4.0.0 + configChecksum: 5e8fc9efa052592f604ba3772ffa47df + repoURL: https://github.com/codatio/client-sdk-python.git + repoSubDirectory: sync-for-payables + installationURL: https://github.com/codatio/client-sdk-python.git#subdirectory=sync-for-payables + published: true +features: + python: + additionalDependencies: 1.0.0 + constsAndDefaults: 1.0.4 + core: 5.6.0 + decimal: 1.0.0 + defaultEnabledRetries: 0.2.0 + deprecations: 3.0.0 + downloadStreams: 1.0.1 + enumUnions: 0.1.0 + envVarSecurityUsage: 0.3.1 + examples: 3.0.0 + globalSecurity: 3.0.2 + globalSecurityCallbacks: 1.0.0 + globalServerURLs: 3.0.0 + methodArguments: 1.0.2 + multipartFileContentType: 1.0.0 + nameOverrides: 3.0.0 + nullables: 1.0.0 + responseFormat: 1.0.1 + retries: 3.0.2 + sdkHooks: 1.0.0 + serverEventsSentinels: 0.1.0 + uploadStreams: 1.0.0 + webhooks: 2.0.0 +generatedFiles: + - .gitattributes + - .python-version + - .vscode/settings.json + - CONTRIBUTING.md + - USAGE.md + - docs/models/errors/errormessage.md + - docs/models/operations/createbankaccountrequest.md + - docs/models/operations/createbillpaymentrequest.md + - docs/models/operations/createbillrequest.md + - docs/models/operations/createconnectionrequest.md + - docs/models/operations/createconnectionrequestbody.md + - docs/models/operations/createsupplierrequest.md + - docs/models/operations/deletecompanyrequest.md + - docs/models/operations/deleteconnectionrequest.md + - docs/models/operations/downloadbillattachmentrequest.md + - docs/models/operations/getcompanyinformationrequest.md + - docs/models/operations/getcompanyrequest.md + - docs/models/operations/getconnectionrequest.md + - docs/models/operations/getmappingoptionsbillsrequest.md + - docs/models/operations/getmappingoptionspaymentsrequest.md + - docs/models/operations/listbillattachmentsrequest.md + - docs/models/operations/listbillsrequest.md + - docs/models/operations/listcompaniesrequest.md + - docs/models/operations/listconnectionsrequest.md + - docs/models/operations/listsuppliersrequest.md + - docs/models/operations/unlinkconnectionrequest.md + - docs/models/operations/unlinkconnectionupdateconnection.md + - docs/models/operations/updatecompanyrequest.md + - docs/models/operations/uploadbillattachmentrequest.md + - docs/models/shared/accountmappingoption.md + - docs/models/shared/accountstatus.md + - docs/models/shared/accounttype.md + - docs/models/shared/address.md + - docs/models/shared/addresstype.md + - docs/models/shared/attachment.md + - docs/models/shared/attachmentupload.md + - docs/models/shared/bankaccount.md + - docs/models/shared/bankaccountmappingoption.md + - docs/models/shared/bankaccountprototype.md + - docs/models/shared/bankaccountstatus.md + - docs/models/shared/bankaccounttype.md + - docs/models/shared/bill.md + - docs/models/shared/billaccountref.md + - docs/models/shared/billlineitem.md + - docs/models/shared/billmappingoptions.md + - docs/models/shared/billpayment.md + - docs/models/shared/billpaymentaccountref.md + - docs/models/shared/billpaymentprototype.md + - docs/models/shared/billprototype.md + - docs/models/shared/bills.md + - docs/models/shared/billstatus.md + - docs/models/shared/billtaxrateref.md + - docs/models/shared/clientratelimitreachedwebhook.md + - docs/models/shared/clientratelimitreachedwebhookdata.md + - docs/models/shared/clientratelimitresetwebhook.md + - docs/models/shared/clientratelimitresetwebhookdata.md + - docs/models/shared/clientratelimitwebhook.md + - docs/models/shared/clientratelimitwebhookpayload.md + - docs/models/shared/codatfile.md + - docs/models/shared/companies.md + - docs/models/shared/company.md + - docs/models/shared/companyinformation.md + - docs/models/shared/companyrequestbody.md + - docs/models/shared/companytags.md + - docs/models/shared/connection.md + - docs/models/shared/connections.md + - docs/models/shared/dataconnectionerror.md + - docs/models/shared/dataconnectionstatus.md + - docs/models/shared/errorstatus.md + - docs/models/shared/errorvalidation.md + - docs/models/shared/errorvalidationitem.md + - docs/models/shared/halref.md + - docs/models/shared/links.md + - docs/models/shared/pagination.md + - docs/models/shared/paymentmappingoptions.md + - docs/models/shared/security.md + - docs/models/shared/sourcetype.md + - docs/models/shared/supplier.md + - docs/models/shared/supplierprototype.md + - docs/models/shared/supplierref.md + - docs/models/shared/suppliers.md + - docs/models/shared/supplierstatus.md + - docs/models/shared/tags.md + - docs/models/shared/taxratemappingoption.md + - docs/models/shared/taxratestatus.md + - docs/models/utils/retryconfig.md + - docs/sdks/bankaccounts/README.md + - docs/sdks/billpayments/README.md + - docs/sdks/bills/README.md + - docs/sdks/codatsyncpayables/README.md + - docs/sdks/companies/README.md + - docs/sdks/companyinformation/README.md + - docs/sdks/connections/README.md + - docs/sdks/suppliers/README.md + - poetry.toml + - py.typed + - pylintrc + - pyproject.toml + - scripts/compile.sh + - scripts/prepare-readme.py + - scripts/publish.sh + - src/codat_sync_for_payables/__init__.py + - src/codat_sync_for_payables/_hooks/__init__.py + - src/codat_sync_for_payables/_hooks/sdkhooks.py + - src/codat_sync_for_payables/_hooks/types.py + - src/codat_sync_for_payables/_version.py + - src/codat_sync_for_payables/bank_accounts.py + - src/codat_sync_for_payables/basesdk.py + - src/codat_sync_for_payables/bill_payments.py + - src/codat_sync_for_payables/bills.py + - src/codat_sync_for_payables/companies.py + - src/codat_sync_for_payables/company_information.py + - src/codat_sync_for_payables/connections.py + - src/codat_sync_for_payables/httpclient.py + - src/codat_sync_for_payables/models/errors/__init__.py + - src/codat_sync_for_payables/models/errors/errormessage.py + - src/codat_sync_for_payables/models/errors/sdkerror.py + - src/codat_sync_for_payables/models/operations/__init__.py + - src/codat_sync_for_payables/models/operations/create_bank_account.py + - src/codat_sync_for_payables/models/operations/create_bill.py + - src/codat_sync_for_payables/models/operations/create_bill_payment.py + - src/codat_sync_for_payables/models/operations/create_connection.py + - src/codat_sync_for_payables/models/operations/create_supplier.py + - src/codat_sync_for_payables/models/operations/delete_company.py + - src/codat_sync_for_payables/models/operations/delete_connection.py + - src/codat_sync_for_payables/models/operations/download_bill_attachment.py + - src/codat_sync_for_payables/models/operations/get_company.py + - src/codat_sync_for_payables/models/operations/get_company_information.py + - src/codat_sync_for_payables/models/operations/get_connection.py + - src/codat_sync_for_payables/models/operations/get_mapping_options_bills.py + - src/codat_sync_for_payables/models/operations/get_mapping_options_payments.py + - src/codat_sync_for_payables/models/operations/list_bill_attachments.py + - src/codat_sync_for_payables/models/operations/list_bills.py + - src/codat_sync_for_payables/models/operations/list_companies.py + - src/codat_sync_for_payables/models/operations/list_connections.py + - src/codat_sync_for_payables/models/operations/list_suppliers.py + - src/codat_sync_for_payables/models/operations/unlink_connection.py + - src/codat_sync_for_payables/models/operations/update_company.py + - src/codat_sync_for_payables/models/operations/upload_bill_attachment.py + - src/codat_sync_for_payables/models/shared/__init__.py + - src/codat_sync_for_payables/models/shared/accountmappingoption.py + - src/codat_sync_for_payables/models/shared/accountstatus.py + - src/codat_sync_for_payables/models/shared/accounttype.py + - src/codat_sync_for_payables/models/shared/address.py + - src/codat_sync_for_payables/models/shared/addresstype.py + - src/codat_sync_for_payables/models/shared/attachment.py + - src/codat_sync_for_payables/models/shared/attachmentupload.py + - src/codat_sync_for_payables/models/shared/bankaccount.py + - src/codat_sync_for_payables/models/shared/bankaccountmappingoption.py + - src/codat_sync_for_payables/models/shared/bankaccountprototype.py + - src/codat_sync_for_payables/models/shared/bankaccountstatus.py + - src/codat_sync_for_payables/models/shared/bill.py + - src/codat_sync_for_payables/models/shared/billaccountref.py + - src/codat_sync_for_payables/models/shared/billlineitem.py + - src/codat_sync_for_payables/models/shared/billmappingoptions.py + - src/codat_sync_for_payables/models/shared/billpayment.py + - src/codat_sync_for_payables/models/shared/billpaymentaccountref.py + - src/codat_sync_for_payables/models/shared/billpaymentprototype.py + - src/codat_sync_for_payables/models/shared/billprototype.py + - src/codat_sync_for_payables/models/shared/bills.py + - src/codat_sync_for_payables/models/shared/billstatus.py + - src/codat_sync_for_payables/models/shared/billtaxrateref.py + - src/codat_sync_for_payables/models/shared/clientratelimitreachedwebhook.py + - src/codat_sync_for_payables/models/shared/clientratelimitreachedwebhookdata.py + - src/codat_sync_for_payables/models/shared/clientratelimitresetwebhook.py + - src/codat_sync_for_payables/models/shared/clientratelimitresetwebhookdata.py + - src/codat_sync_for_payables/models/shared/clientratelimitwebhook.py + - src/codat_sync_for_payables/models/shared/clientratelimitwebhookpayload.py + - src/codat_sync_for_payables/models/shared/codatfile.py + - src/codat_sync_for_payables/models/shared/companies.py + - src/codat_sync_for_payables/models/shared/company.py + - src/codat_sync_for_payables/models/shared/companyinformation.py + - src/codat_sync_for_payables/models/shared/companyrequestbody.py + - src/codat_sync_for_payables/models/shared/connection.py + - src/codat_sync_for_payables/models/shared/connections.py + - src/codat_sync_for_payables/models/shared/dataconnectionerror.py + - src/codat_sync_for_payables/models/shared/dataconnectionstatus.py + - src/codat_sync_for_payables/models/shared/errorvalidation.py + - src/codat_sync_for_payables/models/shared/errorvalidationitem.py + - src/codat_sync_for_payables/models/shared/halref.py + - src/codat_sync_for_payables/models/shared/links.py + - src/codat_sync_for_payables/models/shared/pagination.py + - src/codat_sync_for_payables/models/shared/paymentmappingoptions.py + - src/codat_sync_for_payables/models/shared/security.py + - src/codat_sync_for_payables/models/shared/supplier.py + - src/codat_sync_for_payables/models/shared/supplierprototype.py + - src/codat_sync_for_payables/models/shared/supplierref.py + - src/codat_sync_for_payables/models/shared/suppliers.py + - src/codat_sync_for_payables/models/shared/supplierstatus.py + - src/codat_sync_for_payables/models/shared/tags.py + - src/codat_sync_for_payables/models/shared/taxratemappingoption.py + - src/codat_sync_for_payables/py.typed + - src/codat_sync_for_payables/sdk.py + - src/codat_sync_for_payables/sdkconfiguration.py + - src/codat_sync_for_payables/suppliers.py + - src/codat_sync_for_payables/types/__init__.py + - src/codat_sync_for_payables/types/basemodel.py + - src/codat_sync_for_payables/utils/__init__.py + - src/codat_sync_for_payables/utils/annotations.py + - src/codat_sync_for_payables/utils/enums.py + - src/codat_sync_for_payables/utils/eventstreaming.py + - src/codat_sync_for_payables/utils/forms.py + - src/codat_sync_for_payables/utils/headers.py + - src/codat_sync_for_payables/utils/logger.py + - src/codat_sync_for_payables/utils/metadata.py + - src/codat_sync_for_payables/utils/queryparams.py + - src/codat_sync_for_payables/utils/requestbodies.py + - src/codat_sync_for_payables/utils/retries.py + - src/codat_sync_for_payables/utils/security.py + - src/codat_sync_for_payables/utils/serializers.py + - src/codat_sync_for_payables/utils/url.py + - src/codat_sync_for_payables/utils/values.py +examples: + list-companies: + "": + parameters: + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"results": [{"id": "0498e921-9b53-4396-a412-4f2f5983b0a2", "name": "string", "description": "Requested early access to the new financing scheme.", "redirect": "https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739", "lastSync": "2022-01-01T12:00:00.000Z", "created": "2022-01-01T12:00:00.000Z", "createdByUserName": "string", "dataConnections": [{"id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd", "integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c", "integrationKey": "dfxm", "sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee", "sourceType": "Banking", "platformName": "Basiq", "linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start", "status": "Linked", "lastSync": "2022-10-27T10:22:43.6464237Z", "created": "2022-10-27T09:53:29Z", "dataConnectionErrors": [{"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}, {"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}, {"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}]}]}], "pageNumber": 1, "pageSize": 10, "totalResults": 1, "_links": {"self": {"href": "/companies/{id}/data/{dataType}"}, "current": {"href": "/companies/{id}/data/{dataType}?page=1&pageSize=10"}}} + "400": {} + One company: + parameters: + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"results": [{"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "name": "My Test Company", "description": "My Test Company make testing software", "redirect": "https://link.codat.io/company/3fa85f64-5717-4562-b3fc-2c963f66afa6", "lastSync": "2022-01-01T12:30:00.000Z", "created": "2022-01-01T11:30:00Z", "createdByUserName": "Mike Smith", "dataConnections": [{"id": "51baa045-4836-4317-a42e-3542e991e581", "integrationId": "1c312d69-e638-46d4-ad31-72e6c3ba8390", "integrationKey": "vjms", "sourceId": "396c3158-5dd7-481b-a7c4-a795ca31792b", "sourceType": "Accounting", "platformName": "Pandle", "linkUrl": "https://link-api.codat.io/companies/3fa85f64-5717-4562-b3fc-2c963f66afa6/connections/51baa045-4836-4317-a42e-3542e991e581/start", "status": "Linked", "lastSync": "2022-01-01T12:30:00.000Z", "created": "2022-01-01T11:30:00Z", "dataConnectionErrors": [{"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}, {"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}]}]}], "pageNumber": 1, "pageSize": 100, "totalResults": 1, "_links": {"self": {"href": "/companies"}, "current": {"href": "/companies?page=1&pageSize=100"}}} + List of Companies: + parameters: + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"results": [{"id": "d1568dde-adf6-11ed-afa1-0242ac120002", "name": "Technicalium", "description": "Technology services, including web and app design and development", "redirect": "https://link.codat.io/company/d1568dde-adf6-11ed-afa1-0242ac120002", "lastSync": "2022-01-01T12:30:00.000Z", "created": "2022-01-01T11:30:00Z", "createdByUserName": "Joe Bloggs", "dataConnections": [{"id": "51baa045-4836-4317-a42e-3542e991e581", "integrationId": "1c312d69-e638-46d4-ad31-72e6c3ba8390", "integrationKey": "vjms", "sourceId": "396c3158-5dd7-481b-a7c4-a795ca31792b", "sourceType": "Accounting", "platformName": "Pandle", "linkUrl": "https://link-api.codat.io/companies/d1568dde-adf6-11ed-afa1-0242ac120002/connections/51baa045-4836-4317-a42e-3542e991e581/start", "status": "Linked", "lastSync": "2022-01-01T12:30:00.000Z", "created": "2022-01-01T11:30:00Z", "dataConnectionErrors": [{"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}, {"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}]}]}, {"id": "096db70b-78de-4ff0-aa98-299cb5fe17a0", "name": "Godata", "description": "A new digital agency with a passion for creating amazing digital experiences", "redirect": "https://link.codat.io/company/096db70b-78de-4ff0-aa98-299cb5fe17a0", "lastSync": "2022-01-01T12:30:00.000Z", "created": "2022-01-01T11:30:00Z", "createdByUserName": "Mike Smith", "dataConnections": [{"id": "a70bc148-dc21-46b2-a257-d9c58ac15cbb", "integrationId": "1c312d69-e638-46d4-ad31-72e6c3ba8390", "integrationKey": "vjms", "sourceId": "396c3158-5dd7-481b-a7c4-a795ca31792b", "sourceType": "Accounting", "platformName": "Pandle", "linkUrl": "https://link-api.codat.io/companies/096db70b-78de-4ff0-aa98-299cb5fe17a0/connections/a70bc148-dc21-46b2-a257-d9c58ac15cbb/start", "status": "Linked", "lastSync": "2022-01-01T12:30:00.000Z", "created": "2022-01-01T11:30:00Z", "dataConnectionErrors": [{"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}]}]}], "pageNumber": 1, "pageSize": 100, "totalResults": 2, "_links": {"self": {"href": "/companies"}, "current": {"href": "/companies?page=1&pageSize=100"}}} + Malformed query: + parameters: + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "400": + application/json: {"statusCode": 400, "service": "ClientsApi", "error": "Error parsing query - Malformed query.", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "canBeRetried": "Unknown", "detailedErrorCode": 0} + Unresolved property: + parameters: + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "400": + application/json: {"statusCode": 400, "service": "PullApi", "error": "Error parsing query - Could not resolve property isCompleted on Dataset", "correlationId": "98457fb9956b7f9b4b2fd4f6e23bb5c8", "canBeRetried": "Unknown", "detailedErrorCode": 0} + create-company: + With no description: + requestBody: + application/json: {"name": "Technicalium", "description": "Requested early access to the new financing scheme."} + responses: + "200": + application/json: {"id": "ab12c58d-a678-4ebf-a159-ae99e1807bd0", "name": "Technicalium", "description": "", "redirect": "https://link.codat.io/company/ab12c58d-a678-4ebf-a159-ae99e1807bd0", "lastSync": "2022-10-23T00:00:00Z", "created": "2022-11-10T10:45:18.1950523Z", "createdByUserName": "Dan Tzabar", "dataConnections": []} + With a description: + requestBody: + application/json: {"name": "Technicalium", "description": "Technology services, including web and app design and development"} + responses: + "200": + application/json: {"id": "ab12c58d-a678-4ebf-a159-ae99e1807bd0", "name": "Technicalium", "description": "Technology services, including web and app design and development", "redirect": "https://link.codat.io/company/ab12c58d-a678-4ebf-a159-ae99e1807bd0", "lastSync": "2022-10-23T00:00:00Z", "created": "2022-11-10T10:45:18.1950523Z", "createdByUserName": "Dan Tzabar", "dataConnections": []} + With a tag: + requestBody: + application/json: {"name": "Bank of Dave", "description": "Requested early access to the new financing scheme."} + responses: + "200": + application/json: {"id": "ab12c58d-a678-4ebf-a159-ae99e1807bd0", "name": "Technicalium", "description": "", "redirect": "https://link.codat.io/company/ab12c58d-a678-4ebf-a159-ae99e1807bd0", "lastSync": "2022-10-23T00:00:00Z", "created": "2022-11-10T10:45:18.1950523Z", "createdByUserName": "Dan Tzabar", "dataConnections": []} + Malformed query: + requestBody: + application/json: {"name": "Bank of Dave", "description": "Requested early access to the new financing scheme."} + responses: + "400": + application/json: {"statusCode": 400, "service": "PublicApi", "error": "Error processing request - not valid.", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "canBeRetried": "Unknown", "detailedErrorCode": 0} + update-company: + Update name: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + requestBody: + application/json: {"name": "New Name", "description": "Requested early access to the new financing scheme."} + responses: + "200": + application/json: {"id": "0498e921-9b53-4396-a412-4f2f5983b0a2", "name": "string", "description": "Requested early access to the new financing scheme.", "redirect": "https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739", "lastSync": "2022-01-01T12:00:00.000Z", "created": "2022-01-01T12:00:00.000Z", "createdByUserName": "string", "dataConnections": [{"id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd", "integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c", "integrationKey": "dfxm", "sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee", "sourceType": "Banking", "platformName": "Basiq", "linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start", "status": "Linked", "lastSync": "2022-10-27T10:22:43.6464237Z", "created": "2022-10-27T09:53:29Z", "dataConnectionErrors": [{"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}, {"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}, {"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}]}]} + "401": {} + Update description: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + requestBody: + application/json: {"name": "Same name", "description": "Additional documents required"} + responses: + "200": + application/json: {"id": "0498e921-9b53-4396-a412-4f2f5983b0a2", "name": "string", "description": "Requested early access to the new financing scheme.", "redirect": "https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739", "lastSync": "2022-01-01T12:00:00.000Z", "created": "2022-01-01T12:00:00.000Z", "createdByUserName": "string", "dataConnections": [{"id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd", "integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c", "integrationKey": "dfxm", "sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee", "sourceType": "Banking", "platformName": "Basiq", "linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start", "status": "Linked", "lastSync": "2022-10-27T10:22:43.6464237Z", "created": "2022-10-27T09:53:29Z", "dataConnectionErrors": []}]} + "401": {} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + requestBody: + application/json: {"name": "Bank of Dave", "description": "Requested early access to the new financing scheme."} + responses: + "401": + application/json: {"statusCode": 401, "service": "PublicApi", "error": "Unauthorized", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "canBeRetried": "Unknown", "detailedErrorCode": 0} + delete-company: + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + responses: + "401": + application/json: {"statusCode": 401, "service": "PublicApi", "error": "Unauthorized", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "canBeRetried": "Unknown", "detailedErrorCode": 0} + get-company: + Simple company: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + responses: + "200": + application/json: {"id": "ab12c58d-a678-4ebf-a159-ae99e1807bd0", "name": "My First Company", "description": "", "redirect": "https://link.codat.io/company/ab12c58d-a678-4ebf-a159-ae99e1807bd0", "lastSync": "2022-10-23T00:00:00Z", "created": "2022-11-10T10:45:18Z", "createdByUserName": "Dan Tzabar", "dataConnections": []} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + responses: + "401": + application/json: {"statusCode": 401, "service": "PublicApi", "error": "Unauthorized", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "canBeRetried": "Unknown", "detailedErrorCode": 0} + list-connections: + "": + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"results": [{"id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd", "integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c", "integrationKey": "dfxm", "sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee", "sourceType": "Banking", "platformName": "Basiq", "linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start", "status": "Linked", "lastSync": "2022-10-27T10:22:43.6464237Z", "created": "2022-10-27T09:53:29Z", "dataConnectionErrors": [{"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}, {"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}, {"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}]}], "pageNumber": 1, "pageSize": 10, "totalResults": 1, "_links": {"self": {"href": "/companies/{id}/data/{dataType}"}, "current": {"href": "/companies/{id}/data/{dataType}?page=1&pageSize=10"}}} + "400": {} + Connections: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"results": [{"id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd", "integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c", "integrationKey": "dfxm", "sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee", "sourceType": "Banking", "platformName": "Basiq", "linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start", "status": "Linked", "lastSync": "2022-10-27T10:22:43.6464237Z", "created": "2022-10-27T09:53:29Z", "dataConnectionErrors": [{"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}, {"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}]}], "pageNumber": 0, "pageSize": 0, "totalResults": 0, "_links": {"self": {"href": "string"}, "current": {"href": "string"}, "next": {"href": "string"}, "previous": {"href": "string"}}} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "400": + application/json: {"statusCode": 400, "service": "ClientsApi", "error": "Error parsing query - Malformed query.", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "canBeRetried": "Unknown", "detailedErrorCode": 0} + Unresolved property: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "400": + application/json: {"statusCode": 400, "service": "PullApi", "error": "Error parsing query - Could not resolve property isCompleted on Dataset", "correlationId": "98457fb9956b7f9b4b2fd4f6e23bb5c8", "canBeRetried": "Unknown", "detailedErrorCode": 0} + create-connection: + Connection: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + requestBody: + application/json: {"platformKey": "gbol"} + responses: + "200": + application/json: {"id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd", "integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c", "integrationKey": "dfxm", "sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee", "sourceType": "Banking", "platformName": "Basiq", "linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start", "status": "Linked", "lastSync": "2022-10-27T10:22:43.6464237Z", "created": "2022-10-27T09:53:29Z", "dataConnectionErrors": [{"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}]} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + requestBody: + application/json: {"platformKey": "gbol"} + responses: + "401": + application/json: {"statusCode": 401, "service": "PublicApi", "error": "Unauthorized", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "canBeRetried": "Unknown", "detailedErrorCode": 0} + get-connection: + Connection: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd", "integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c", "integrationKey": "dfxm", "sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee", "sourceType": "Banking", "platformName": "Basiq", "linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start", "status": "Linked", "lastSync": "2022-10-27T10:22:43.6464237Z", "created": "2022-10-27T09:53:29Z", "dataConnectionErrors": [{"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}, {"erroredOnUtc": "2022-10-23T00:00:00Z", "resolvedOnUtc": "2022-10-23T00:00:00Z"}]} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "401": + application/json: {"statusCode": 401, "service": "PublicApi", "error": "Unauthorized", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "canBeRetried": "Unknown", "detailedErrorCode": 0} + delete-connection: + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "401": + application/json: {"statusCode": 401, "service": "PublicApi", "error": "Unauthorized", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "canBeRetried": "Unknown", "detailedErrorCode": 0} + unlink-connection: + Example: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + requestBody: + application/json: {"status": "Unlinked"} + responses: + "200": + application/json: {"id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd", "integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c", "integrationKey": "dfxm", "sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee", "sourceType": "Banking", "platformName": "Basiq", "linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start", "status": "Linked", "lastSync": "2022-10-27T10:22:43.6464237Z", "created": "2022-10-27T09:53:29Z", "dataConnectionErrors": []} + "401": {} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "401": + application/json: {"statusCode": 401, "service": "PublicApi", "error": "Unauthorized", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "canBeRetried": "Unknown", "detailedErrorCode": 0} + get-company-information: + Company information: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"companyName": "Bank of Dave", "baseCurrency": "GBP"} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "400": + application/json: {"statusCode": 400, "service": "PublicApi", "error": "Error processing request - not valid.", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "canBeRetried": "Unknown", "detailedErrorCode": 0} + get-mapping-options-bills: + "": + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + continuationToken: "continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ==" + statusQuery: "status=Archived" + responses: + "200": + application/json: {"accounts": [], "taxRate": [{"id": "d2939064-dd3a-4c0f-9865-a238c2193515"}]} + "400": {} + Mapping options: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + continuationToken: "continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ==" + statusQuery: "status=Archived" + responses: + "200": + application/json: {"accounts": [{"id": "1b6266d1-1e44-46c5-8eb5-a8f98e03124e", "nominalCode": "879-i", "name": "Accounts payable", "type": "Liability", "currency": "GBP", "status": "Active", "sourceModifiedDate": "2022-10-23T00:00:00Z"}], "taxRate": [{"id": "d2939064-dd3a-4c0f-9865-a238c2193515"}], "pagination": {"continuationToken": "eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ=="}} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + continuationToken: "continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ==" + statusQuery: "status=Archived" + responses: + "400": + application/json: {"statusCode": 400, "service": "PublicApi", "error": "Error processing request - not valid.", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "canBeRetried": "Unknown", "detailedErrorCode": 0} + list-bills: + Status (open): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + continuationToken: "continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ==" + query: "status=Open" + responses: + "200": + application/json: {"results": [{"supplierRef": {"id": ""}, "issueDate": "2022-10-23T00:00:00Z", "dueDate": "2022-10-23T00:00:00Z", "currency": "GBP", "status": "Open", "sourceModifiedDate": "2022-10-23T00:00:00Z"}, {"supplierRef": {"id": ""}, "issueDate": "2022-10-23T00:00:00Z", "dueDate": "2022-10-23T00:00:00Z", "currency": "USD", "status": "Open", "sourceModifiedDate": "2022-10-23T00:00:00Z"}, {"supplierRef": {"id": ""}, "issueDate": "2022-10-23T00:00:00Z", "dueDate": "2022-10-23T00:00:00Z", "currency": "GBP", "status": "Open", "sourceModifiedDate": "2022-10-23T00:00:00Z"}]} + "400": {} + Status (partially paid): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + continuationToken: "continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ==" + query: "status=PartiallyPaid" + responses: + "200": + application/json: {"results": [{"supplierRef": {"id": ""}, "issueDate": "2022-10-23T00:00:00Z", "dueDate": "2022-10-23T00:00:00Z", "currency": "GBP", "status": "Open", "sourceModifiedDate": "2022-10-23T00:00:00Z"}, {"supplierRef": {"id": ""}, "issueDate": "2022-10-23T00:00:00Z", "dueDate": "2022-10-23T00:00:00Z", "currency": "EUR", "status": "Open", "sourceModifiedDate": "2022-10-23T00:00:00Z"}]} + "400": {} + Source modified date: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + continuationToken: "continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ==" + query: "sourceModifiedDate>2023-12-15T00:00:00.000Z" + responses: + "200": + application/json: {"results": [{"supplierRef": {"id": ""}, "issueDate": "2022-10-23T00:00:00Z", "dueDate": "2022-10-23T00:00:00Z", "currency": "GBP", "status": "Open", "sourceModifiedDate": "2022-10-23T00:00:00Z"}, {"supplierRef": {"id": ""}, "issueDate": "2022-10-23T00:00:00Z", "dueDate": "2022-10-23T00:00:00Z", "currency": "USD", "status": "Open", "sourceModifiedDate": "2022-10-23T00:00:00Z"}, {"supplierRef": {"id": ""}, "issueDate": "2022-10-23T00:00:00Z", "dueDate": "2022-10-23T00:00:00Z", "currency": "EUR", "status": "Open", "sourceModifiedDate": "2022-10-23T00:00:00Z"}]} + "400": {} + Status (open) & source modified date: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + continuationToken: "continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ==" + query: "sourceModifiedDate>2023-12-15T00:00:00.000Z&&status=Open" + responses: + "200": + application/json: {"results": [{"supplierRef": {"id": ""}, "issueDate": "2022-10-23T00:00:00Z", "dueDate": "2022-10-23T00:00:00Z", "currency": "USD", "status": "Open", "sourceModifiedDate": "2022-10-23T00:00:00Z"}]} + "400": {} + Status (partially paid) & source modified date: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + continuationToken: "continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ==" + query: "sourceModifiedDate>2023-12-15T00:00:00.000Z&&status=PartiallyPaid" + responses: + "200": + application/json: {"results": [{"supplierRef": {"id": ""}, "issueDate": "2022-10-23T00:00:00Z", "dueDate": "2022-10-23T00:00:00Z", "currency": "EUR", "status": "Open", "sourceModifiedDate": "2022-10-23T00:00:00Z"}, {"supplierRef": {"id": ""}, "issueDate": "2022-10-23T00:00:00Z", "dueDate": "2022-10-23T00:00:00Z", "currency": "GBP", "status": "Open", "sourceModifiedDate": "2022-10-23T00:00:00Z"}]} + "400": {} + Bills: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + continuationToken: "continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ==" + responses: + "200": + application/json: {"results": [{"id": "18", "reference": "12", "supplierRef": {"id": "4", "supplierName": "BILLy elliot"}, "issueDate": "2019-05-13T00:00:00", "dueDate": "2019-05-13T00:00:00", "currency": "GBP", "currencyRate": "1,", "lineItems": [{"description": "Dance shoes", "unitAmount": 5, "quantity": 1, "taxAmount": 0, "accountRef": {"id": "16"}, "totalAmount": 5, "taxRateRef": {"id": "NON"}}], "status": "Open", "totalAmount": 5, "amountDue": 0, "sourceModifiedDate": "2022-05-26T10:34:10Z"}, {"id": "22", "reference": "12", "supplierRef": {"id": "4", "supplierName": "BILLy elliot"}, "issueDate": "2019-05-13T00:00:00", "dueDate": "2019-05-13T00:00:00", "currency": "GBP", "currencyRate": 1, "lineItems": [{"description": "Dance shoes", "unitAmount": 5, "quantity": 1, "taxAmount": 0, "accountRef": {"id": "16"}, "totalAmount": 5, "taxRateRef": {"id": "NON"}}], "status": "Paid", "totalAmount": 5, "amountDue": 0, "sourceModifiedDate": "2022-05-26T10:34:10Z"}], "pagination": {"continuationToken": "eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ=="}} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + continuationToken: "continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ==" + responses: + "400": + application/json: {"statusCode": 400, "service": "ClientsApi", "error": "Error parsing query - Malformed query.", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "canBeRetried": "Unknown", "detailedErrorCode": 0} + Unresolved property: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + continuationToken: "continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ==" + responses: + "400": + application/json: {"statusCode": 400, "service": "PullApi", "error": "Error parsing query - Could not resolve property isCompleted on Dataset", "correlationId": "98457fb9956b7f9b4b2fd4f6e23bb5c8", "canBeRetried": "Unknown", "detailedErrorCode": 0} + create-bill: + Create bill: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + header: {} + requestBody: + application/json: {"reference": "bill_b8qmmj4ksf1suax", "supplierRef": {"id": "1262c350-fe0f-40ec-aeff-41c95b4a45af", "supplierName": "DIISR - Small Business Services"}, "issueDate": "2023-04-23T00:00:00", "dueDate": "2023-04-23T00:00:00", "currency": "GBP", "currencyRate": 1, "lineItems": [{"description": "Half day training - Microsoft Office", "unitAmount": 1800, "quantity": 1, "taxAmount": 360, "accountRef": {"id": "46f9461e-788b-4906-8b74-d1ea17f6dc10"}, "totalAmount": 2160, "taxRateRef": {"id": "INPUT2"}}, {"description": "Desktop/network support via email & phone.Per month fixed fee for minimum 20 hours/month.", "unitAmount": 4000, "quantity": 1, "taxAmount": 800, "accountRef": {"id": "f96c9458-d724-47bf-8f74-a9d5726465ce"}, "totalAmount": 4800, "taxRateRef": {"id": "INPUT2"}}, {"description": "Stationery charges", "unitAmount": 32, "quantity": 8, "taxAmount": 51.2, "accountRef": {"id": "cba6527d-f102-4538-b421-e483233e9d5a"}, "totalAmount": 307.2, "taxRateRef": {"id": "INPUT2"}}], "status": "Open"} + responses: + "201": + application/json: {"supplierRef": {"id": ""}, "issueDate": "2022-10-23T00:00:00Z", "dueDate": "2022-10-23T00:00:00Z", "currency": "USD", "status": "Open", "sourceModifiedDate": "2022-10-23T00:00:00Z"} + "400": {} + Created bill: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + header: {} + requestBody: + application/json: {"supplierRef": {"id": ""}, "issueDate": "2022-10-23T00:00:00Z", "dueDate": "2022-10-23T00:00:00Z", "currency": "EUR", "status": "Open"} + responses: + "201": + application/json: {"id": "bill-1029932", "reference": "bill_b8qmmj4ksf1suax", "supplierRef": {"id": "1262c350-fe0f-40ec-aeff-41c95b4a45af", "supplierName": "DIISR - Small Business Services"}, "issueDate": "2023-04-23T00:00:00", "dueDate": "2023-04-23T00:00:00", "currency": "GBP", "lineItems": [{"description": "Half day training - Microsoft Office", "unitAmount": 1800, "quantity": 1, "taxAmount": 360, "accountRef": {"id": "46f9461e-788b-4906-8b74-d1ea17f6dc10"}, "totalAmount": 2160, "taxRateRef": {"id": "INPUT2"}}, {"description": "Desktop/network support via email & phone.Per month fixed fee for minimum 20 hours/month.", "unitAmount": 4000, "quantity": 1, "taxAmount": 800, "accountRef": {"id": "f96c9458-d724-47bf-8f74-a9d5726465ce"}, "totalAmount": 4800, "taxRateRef": {"id": "INPUT2"}}, {"description": "Stationery charges", "unitAmount": 32, "quantity": 8, "taxAmount": 51.2, "accountRef": {"id": "cba6527d-f102-4538-b421-e483233e9d5a"}, "totalAmount": 307.2, "taxRateRef": {"id": "INPUT2"}}], "status": "Open", "totalAmount": 7267.2, "amountDue": 7267.2, "sourceModifiedDate": "2022-10-23T00:00:00Z"} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + header: {} + requestBody: + application/json: {"supplierRef": {"id": ""}, "issueDate": "2022-10-23T00:00:00Z", "dueDate": "2022-10-23T00:00:00Z", "currency": "EUR", "status": "Open"} + responses: + "400": + application/json: {"statusCode": 400, "service": "PublicApi", "error": "Error processing request - not valid.", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "canBeRetried": "Unknown", "detailedErrorCode": 0} + upload-bill-attachment: + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + billId: "EILBDVJVNUAGVKRQ" + responses: + "400": + application/json: {"statusCode": 400, "service": "PublicApi", "error": "Error processing request - not valid.", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "canBeRetried": "Unknown", "detailedErrorCode": 0} + list-bill-attachments: + Info: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + billId: "EILBDVJVNUAGVKRQ" + responses: + "200": + application/json: {"id": "422f093f-e556-4bf3-91c0-93af70c3e850", "name": "receipt.png", "contentType": "image/png", "dateCreated": "2022-10-23T00:00:00.000Z", "fileSize": 100, "includeWhenSent": true, "sourceModifiedDate": "2022-05-26T10:34:10Z"} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + billId: "13d946f0-c5d5-42bc-b092-97ece17923ab" + responses: + "401": + application/json: {"statusCode": 401, "service": "PublicApi", "error": "Unauthorized", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "canBeRetried": "Unknown", "detailedErrorCode": 0} + download-bill-attachment: + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + billId: "EILBDVJVNUAGVKRQ" + attachmentId: "8a210b68-6988-11ed-a1eb-0242ac120002" + responses: + "401": + application/json: {"statusCode": 401, "service": "PublicApi", "error": "Unauthorized", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "canBeRetried": "Unknown", "detailedErrorCode": 0} + get-mapping-options-payments: + "": + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + continuationToken: "continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ==" + statusQuery: "status=Archived" + responses: + "200": + application/json: {"bankAccounts": [{"id": "3d5a8e00-d108-4045-8823-7f342676cffa", "name": "Bank of Dave current account", "status": "Active", "sourceModifiedDate": "2022-10-23T00:00:00Z"}, {"id": "3d5a8e00-d108-4045-8823-7f342676cffa", "name": "Bank of Dave current account", "status": "Active", "sourceModifiedDate": "2022-10-23T00:00:00Z"}]} + "400": {} + Mapping options: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + continuationToken: "continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ==" + statusQuery: "status=Archived" + responses: + "200": + application/json: {"bankAccounts": [{"id": "3d5a8e00-d108-4045-8823-7f342676cffa", "name": "Bank of Dave current account", "accountNumber": "12345678", "nominalCode": "1234567", "sortCode": "123456", "currency": "GBP", "status": "Active", "accountType": "Debit", "sourceModifiedDate": "2022-10-23T00:00:00Z"}], "pagination": {"continuationToken": "eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ=="}} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + continuationToken: "continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ==" + statusQuery: "status=Archived" + responses: + "400": + application/json: {"statusCode": 400, "service": "PublicApi", "error": "Error processing request - not valid.", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "canBeRetried": "Unknown", "detailedErrorCode": 0} + create-bill-payment: + Bill payment example: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + billId: "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2" + header: {} + requestBody: + application/json: {"amount": 22, "date": "2022-10-23T00:00:00.000Z", "reference": "Bill Payment against bill c13e37b6 dfaa-4894-b3be-9fe97bda9f44", "accountRef": {"id": "7bda9f44sr56"}, "currencyRate": 1} + responses: + "201": + application/json: {"amount": 22, "date": "2022-10-23T00:00:00.000Z", "reference": "Bill Payment against bill c13e37b6 dfaa-4894-b3be-9fe97bda9f44", "accountRef": {"id": "9e32cbf8-e7d5-4d4d-a593-08d550682aab"}, "currencyRate": 1} + "400": {} + Bill payment: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + billId: "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2" + header: {} + requestBody: + application/json: {"amount": 1329.54, "date": "2022-10-23T00:00:00Z", "reference": "Bill Payment against bill c13e37b6-dfaa-4894-b3be-9fe97bda9f44", "accountRef": {"id": ""}} + responses: + "201": + application/json: {"id": "billPayment-1029932", "amount": 22, "date": "2022-10-23T00:00:00.000Z", "reference": "Bill Payment against bill c13e37b6 dfaa-4894-b3be-9fe97bda9f44", "accountRef": {"id": "7bda9f44sr56"}, "currencyRate": 1} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + billId: "13d946f0-c5d5-42bc-b092-97ece17923ab" + header: {} + requestBody: + application/json: {"amount": 1329.54, "date": "2022-10-23T00:00:00Z", "reference": "Bill Payment against bill c13e37b6-dfaa-4894-b3be-9fe97bda9f44", "accountRef": {"id": ""}} + responses: + "400": + application/json: {"statusCode": 400, "service": "PublicApi", "error": "Error processing request - not valid.", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "canBeRetried": "Unknown", "detailedErrorCode": 0} + list-suppliers: + Source modified date: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + continuationToken: "continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ==" + query: "sourceModifiedDate>2023-12-15T00:00:00.000Z" + responses: + "200": + application/json: {"results": [{"id": "C520FFD4-F6F6-4FC2-A6D2-5D7088B2B14F", "supplierName": "Kelly's Industrial Supplies", "contactName": "Kelly Ipsum", "emailAddress": "sales@kellysupplies.com", "phone": "07999 999999", "addresses": [{"type": "Billing", "line1": "Unit 51", "line2": "Bakersfield Industrial Estate", "city": "Bakersfield", "region": "California", "country": "USA"}], "status": "Active", "defaultCurrency": "GBP", "sourceModifiedDate": "2022-10-23T00:00:00Z"}]} + "400": {} + Status (active): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + continuationToken: "continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ==" + query: "status=Active" + responses: + "200": + application/json: {"results": [{"id": "C520FFD4-F6F6-4FC2-A6D2-5D7088B2B14F", "supplierName": "Kelly's Industrial Supplies", "contactName": "Kelly Ipsum", "emailAddress": "sales@kellysupplies.com", "phone": "07999 999999", "addresses": [{"type": "Billing", "line1": "Unit 51", "line2": "Bakersfield Industrial Estate", "city": "Bakersfield", "region": "California", "country": "USA"}], "status": "Active", "defaultCurrency": "GBP", "sourceModifiedDate": "2022-10-23T00:00:00Z"}]} + "400": {} + Status (archived): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + continuationToken: "continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ==" + query: "status=Archived" + responses: + "200": + application/json: {"results": [{"id": "C520FFD4-F6F6-4FC2-A6D2-5D7088B2B14F", "supplierName": "Kelly's Industrial Supplies", "contactName": "Kelly Ipsum", "emailAddress": "sales@kellysupplies.com", "phone": "07999 999999", "addresses": [{"type": "Billing", "line1": "Unit 51", "line2": "Bakersfield Industrial Estate", "city": "Bakersfield", "region": "California", "country": "USA"}], "status": "Active", "defaultCurrency": "GBP", "sourceModifiedDate": "2022-10-23T00:00:00Z"}]} + "400": {} + Status (active) & source modified date: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + continuationToken: "continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ==" + query: "sourceModifiedDate>2023-12-15T00:00:00.000Z&&status=Active" + responses: + "200": + application/json: {"results": [{"id": "C520FFD4-F6F6-4FC2-A6D2-5D7088B2B14F", "supplierName": "Kelly's Industrial Supplies", "contactName": "Kelly Ipsum", "emailAddress": "sales@kellysupplies.com", "phone": "07999 999999", "addresses": [{"type": "Billing", "line1": "Unit 51", "line2": "Bakersfield Industrial Estate", "city": "Bakersfield", "region": "California", "country": "USA"}], "status": "Active", "defaultCurrency": "GBP", "sourceModifiedDate": "2022-10-23T00:00:00Z"}]} + "400": {} + Status (archived) & source modified date: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + continuationToken: "continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ==" + query: "sourceModifiedDate>2023-12-15T00:00:00.000Z&&status=Archived" + responses: + "200": + application/json: {"results": [{"id": "C520FFD4-F6F6-4FC2-A6D2-5D7088B2B14F", "supplierName": "Kelly's Industrial Supplies", "contactName": "Kelly Ipsum", "emailAddress": "sales@kellysupplies.com", "phone": "07999 999999", "addresses": [{"type": "Billing", "line1": "Unit 51", "line2": "Bakersfield Industrial Estate", "city": "Bakersfield", "region": "California", "country": "USA"}], "status": "Active", "defaultCurrency": "GBP", "sourceModifiedDate": "2022-10-23T00:00:00Z"}]} + "400": {} + Suppliers: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + continuationToken: "continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ==" + responses: + "200": + application/json: {"results": [{"id": "c523e12f-8b74-4d3a-bbd8-32d7a2f598b4", "supplierName": "City Limousines", "contactName": "Martin Dale", "emailAddress": "martyd@citylim.co", "phone": "07999 999999", "addresses": [{"type": "Billing", "line1": "Unit 51", "line2": "Bakersfield Industrial Estate", "city": "Bakersfield", "region": "California", "country": "USA"}], "status": "Active", "balance": 100, "defaultCurrency": "GBP", "sourceModifiedDate": "2022-10-23T00:00:00Z"}, {"id": "41", "supplierName": "AI Support", "contactName": "AI Support", "phone": "01224 658 999", "addresses": [{"type": "Billing", "line1": "test", "region": "string", "country": "Djibouti"}], "status": "Active", "defaultCurrency": "GBP", "sourceModifiedDate": "2022-12-07T10:48:18Z"}], "pagination": {"continuationToken": "eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ=="}} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + continuationToken: "continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ==" + responses: + "400": + application/json: {"statusCode": 400, "service": "ClientsApi", "error": "Error parsing query - Malformed query.", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "canBeRetried": "Unknown", "detailedErrorCode": 0} + Unresolved property: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: + continuationToken: "continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ==" + responses: + "400": + application/json: {"statusCode": 400, "service": "PullApi", "error": "Error parsing query - Could not resolve property isCompleted on Dataset", "correlationId": "98457fb9956b7f9b4b2fd4f6e23bb5c8", "canBeRetried": "Unknown", "detailedErrorCode": 0} + create-supplier: + Suppliers: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + header: {} + requestBody: + application/json: {"supplierName": "Greggs", "contactName": "Greg Greggs", "emailAddress": "greg@greggs.com", "phone": "+44 (0)1223 322410", "addresses": [{"type": "Billing", "line1": "Flat 1", "line2": "2 Dennis Avenue", "city": "London", "region": "Camden", "country": "GBR", "postalCode": "EC1N 7TE"}], "status": "Active", "defaultCurrency": "GBP"} + responses: + "201": + application/json: {"id": "sup-10933920", "supplierName": "Greggs", "contactName": "Greg Greggs", "emailAddress": "greg@greggs.com", "phone": "+44 (0)1223 322410", "status": "Active", "defaultCurrency": "GBP", "sourceModifiedDate": "2022-10-23T00:00:00Z"} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + header: {} + requestBody: + application/json: {"supplierName": "", "phone": "(877) 492-8687", "status": "Active"} + responses: + "400": + application/json: {"statusCode": 400, "service": "PublicApi", "error": "Error processing request - not valid.", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "canBeRetried": "Unknown", "detailedErrorCode": 0} + create-bank-account: + Bank account example: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + header: {} + requestBody: + application/json: {"nominalCode": "22", "name": "Plutus - Payables - Bank Account 12", "accountType": "Debit", "accountNumber": "0120 0440", "sortCode": "50-50-50", "currency": "GBP"} + responses: + "201": + application/json: {"currency": "USD", "status": "Active", "sourceModifiedDate": "2022-10-23T00:00:00Z"} + "400": {} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + header: {} + requestBody: + application/json: {"name": "", "accountType": "Credit", "accountNumber": "", "currency": "GBP"} + responses: + "400": + application/json: {"statusCode": 400, "service": "PublicApi", "error": "Error processing request - not valid.", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "canBeRetried": "Unknown", "detailedErrorCode": 0} diff --git a/sync-for-payables/.speakeasy/gen.yaml b/sync-for-payables/.speakeasy/gen.yaml index 9dd00e182..1d679a1c7 100644 --- a/sync-for-payables/.speakeasy/gen.yaml +++ b/sync-for-payables/.speakeasy/gen.yaml @@ -1,8 +1,10 @@ configVersion: 2.0.0 generation: sdkClassName: CodatSyncPayables + maintainOpenAPIOrder: true usageSnippets: optionalPropertyRendering: withExample + useClassNamesForArrayFields: true fixes: nameResolutionDec2023: false parameterOrderingFeb2024: false @@ -10,18 +12,21 @@ generation: auth: oAuth2ClientCredentialsEnabled: false python: - version: 0.0.0 + version: 4.0.0 additionalDependencies: dev: {} main: {} author: Codat authors: - - Speakeasy + - Speakeasy clientServerStatusCodesAsErrors: true description: Streamline your customers' accounts payable workflow. enumFormat: enum + fixFlags: + responseRequiredSep2024: true flattenGlobalSecurity: false flattenRequests: false + flatteningOrder: parameters-first imports: option: openapi paths: diff --git a/sync-for-payables/.vscode/settings.json b/sync-for-payables/.vscode/settings.json new file mode 100644 index 000000000..8d79f0abb --- /dev/null +++ b/sync-for-payables/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "python.testing.pytestArgs": ["tests", "-vv"], + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true, + "pylint.args": ["--rcfile=pylintrc"] +} diff --git a/sync-for-payables/CONTRIBUTING.md b/sync-for-payables/CONTRIBUTING.md new file mode 100644 index 000000000..d585717fc --- /dev/null +++ b/sync-for-payables/CONTRIBUTING.md @@ -0,0 +1,26 @@ +# Contributing to This Repository + +Thank you for your interest in contributing to this repository. Please note that this repository contains generated code. As such, we do not accept direct changes or pull requests. Instead, we encourage you to follow the guidelines below to report issues and suggest improvements. + +## How to Report Issues + +If you encounter any bugs or have suggestions for improvements, please open an issue on GitHub. When reporting an issue, please provide as much detail as possible to help us reproduce the problem. This includes: + +- A clear and descriptive title +- Steps to reproduce the issue +- Expected and actual behavior +- Any relevant logs, screenshots, or error messages +- Information about your environment (e.g., operating system, software versions) + - For example can be collected using the `npx envinfo` command from your terminal if you have Node.js installed + +## Issue Triage and Upstream Fixes + +We will review and triage issues as quickly as possible. Our goal is to address bugs and incorporate improvements in the upstream source code. Fixes will be included in the next generation of the generated code. + +## Contact + +If you have any questions or need further assistance, please feel free to reach out by opening an issue. + +Thank you for your understanding and cooperation! + +The Maintainers diff --git a/sync-for-payables/README.md b/sync-for-payables/README.md index 36748b42b..88af92955 100644 --- a/sync-for-payables/README.md +++ b/sync-for-payables/README.md @@ -4,18 +4,535 @@ Streamline your customers' accounts payable workflow. - -replace me - + +## SDK Installation + +The SDK can be installed with either *pip* or *poetry* package managers. + +### PIP + +*PIP* is the default package installer for Python, enabling easy installation and management of packages from PyPI via the command line. + +```bash +pip install codat-sync-for-payables +``` + +### Poetry + +*Poetry* is a modern tool that simplifies dependency management and package publishing by using a single `pyproject.toml` file to handle project metadata and dependencies. + +```bash +poetry add codat-sync-for-payables +``` + ## Example Usage - -replace me - + +## SDK Example Usage + +### Example + +```python +# Synchronous Example +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared + +s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +res = s.companies.list(request={ + "page": 1, + "page_size": 100, + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + "order_by": "-modifiedDate", +}) + +if res is not None: + # handle response + pass +``` + +
+ +The same SDK client can also be used to make asychronous requests by importing asyncio. +```python +# Asynchronous Example +import asyncio +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared + +async def main(): + s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), + ) + res = await s.companies.list_async(request={ + "page": 1, + "page_size": 100, + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + "order_by": "-modifiedDate", + }) + if res is not None: + # handle response + pass + +asyncio.run(main()) +``` + + + +## Available Resources and Operations + +
+Available methods + +### [bank_accounts](docs/sdks/bankaccounts/README.md) + +* [create](docs/sdks/bankaccounts/README.md#create) - Create bank account + +### [bill_payments](docs/sdks/billpayments/README.md) + +* [get_payment_options](docs/sdks/billpayments/README.md#get_payment_options) - Get payment mapping options +* [create](docs/sdks/billpayments/README.md#create) - Create bill payment + +### [bills](docs/sdks/bills/README.md) + +* [get_bill_options](docs/sdks/bills/README.md#get_bill_options) - Get bill mapping options +* [list](docs/sdks/bills/README.md#list) - List bills +* [create](docs/sdks/bills/README.md#create) - Create bill +* [upload_attachment](docs/sdks/bills/README.md#upload_attachment) - Upload bill attachment +* [list_attachments](docs/sdks/bills/README.md#list_attachments) - List bill attachments +* [download_attachment](docs/sdks/bills/README.md#download_attachment) - Download bill attachment + + +### [companies](docs/sdks/companies/README.md) + +* [list](docs/sdks/companies/README.md#list) - List companies +* [create](docs/sdks/companies/README.md#create) - Create company +* [update](docs/sdks/companies/README.md#update) - Update company +* [delete](docs/sdks/companies/README.md#delete) - Delete a company +* [get](docs/sdks/companies/README.md#get) - Get company + +### [company_information](docs/sdks/companyinformation/README.md) + +* [get](docs/sdks/companyinformation/README.md#get) - Get company information + +### [connections](docs/sdks/connections/README.md) + +* [list](docs/sdks/connections/README.md#list) - List connections +* [create](docs/sdks/connections/README.md#create) - Create connection +* [get](docs/sdks/connections/README.md#get) - Get connection +* [delete](docs/sdks/connections/README.md#delete) - Delete connection +* [unlink](docs/sdks/connections/README.md#unlink) - Unlink connection + +### [suppliers](docs/sdks/suppliers/README.md) + +* [list](docs/sdks/suppliers/README.md#list) - List suppliers +* [create](docs/sdks/suppliers/README.md#create) - Create supplier + +
+ + + +## Summary + +Bill pay kit: The API reference for the Bill Pay kit. + +The bill pay kit is an API and a set of supporting tools designed to integrate a bill pay flow into your app as quickly as possible. It's ideal for facilitating essential bill payment processes within your SMB's accounting software. + +[Explore product](https://docs.codat.io/payables/bill-pay-kit) | [See OpenAPI spec](https://github.com/codatio/oas) + +--- + +## Endpoints + +| Endpoints | Description | +| :- |:- | +| Companies | Create and manage your SMB users' companies. | +| Connections | Create new and manage existing data connections for a company. | +| Company information | View company profile from the source platform. | +| Bills | Get, create, and update Bills. | +| Bill payments | Get, create, and update Bill payments. | +| Suppliers | Get, create, and update Suppliers. | +| Bank accounts | Create a bank account for a given company's connection. | + + + + +## Table of Contents + +* [SDK Installation](#sdk-installation) +* [IDE Support](#ide-support) +* [SDK Example Usage](#sdk-example-usage) +* [Available Resources and Operations](#available-resources-and-operations) +* [File uploads](#file-uploads) +* [Retries](#retries) +* [Error Handling](#error-handling) +* [Server Selection](#server-selection) +* [Custom HTTP Client](#custom-http-client) +* [Authentication](#authentication) +* [Debugging](#debugging) + + + +## IDE Support + +### PyCharm + +Generally, the SDK will work well with most IDEs out of the box. However, when using PyCharm, you can enjoy much better integration with Pydantic by installing an additional plugin. + +- [PyCharm Pydantic Plugin](https://docs.pydantic.dev/latest/integrations/pycharm/) + + + +## File uploads + +Certain SDK methods accept file objects as part of a request body or multi-part request. It is possible and typically recommended to upload files as a stream rather than reading the entire contents into memory. This avoids excessive memory consumption and potentially crashing with out-of-memory errors when working with very large files. The following example demonstrates how to attach a file stream to a request. + +> [!TIP] +> +> For endpoints that handle file uploads bytes arrays can also be used. However, using streams is recommended for large files. +> + +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared + +s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +s.bills.upload_attachment(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "bill_id": "EILBDVJVNUAGVKRQ", +}) + +# Use the SDK ... + +``` + + + +## Retries + +Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK. + +To change the default retry strategy for a single API call, simply provide a `RetryConfig` object to the call: +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared +from codatsyncpayables.utils import BackoffStrategy, RetryConfig + +s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +res = s.companies.list(request={ + "page": 1, + "page_size": 100, + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + "order_by": "-modifiedDate", +}, + RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False)) + +if res is not None: + # handle response + pass + +``` + +If you'd like to override the default retry strategy for all operations that support retries, you can use the `retry_config` optional parameter when initializing the SDK: +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared +from codatsyncpayables.utils import BackoffStrategy, RetryConfig + +s = CodatSyncPayables( + retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False), + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +res = s.companies.list(request={ + "page": 1, + "page_size": 100, + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + "order_by": "-modifiedDate", +}) + +if res is not None: + # handle response + pass + +``` + + + +## Error Handling + +Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an exception. + +By default, an API error will raise a errors.SDKError exception, which has the following properties: + +| Property | Type | Description | +|-----------------|------------------|-----------------------| +| `.status_code` | *int* | The HTTP status code | +| `.message` | *str* | The error message | +| `.raw_response` | *httpx.Response* | The raw HTTP response | +| `.body` | *str* | The response content | + +When custom error responses are specified for an operation, the SDK may also raise their associated exceptions. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `list_async` method may raise the following exceptions: + +| Error Type | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +### Example + +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import errors, shared + +s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +res = None +try: + res = s.companies.list(request={ + "page": 1, + "page_size": 100, + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + "order_by": "-modifiedDate", + }) + + if res is not None: + # handle response + pass + +except errors.ErrorMessage as e: + # handle e.data: errors.ErrorMessageData + raise(e) +except errors.SDKError as e: + # handle exception + raise(e) +``` + + + +## Server Selection + +### Select Server by Index + +You can override the default server globally by passing a server index to the `server_idx: int` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers: + +| # | Server | Variables | +| - | ------ | --------- | +| 0 | `https://api.codat.io` | None | + +#### Example + +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared + +s = CodatSyncPayables( + server_idx=0, + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +res = s.companies.list(request={ + "page": 1, + "page_size": 100, + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + "order_by": "-modifiedDate", +}) + +if res is not None: + # handle response + pass + +``` + + +### Override Server URL Per-Client + +The default server can also be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example: +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared + +s = CodatSyncPayables( + server_url="https://api.codat.io", + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +res = s.companies.list(request={ + "page": 1, + "page_size": 100, + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + "order_by": "-modifiedDate", +}) + +if res is not None: + # handle response + pass + +``` + + + +## Custom HTTP Client + +The Python SDK makes API calls using the [httpx](https://www.python-httpx.org/) HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with your own HTTP client instance. +Depending on whether you are using the sync or async version of the SDK, you can pass an instance of `HttpClient` or `AsyncHttpClient` respectively, which are Protocol's ensuring that the client has the necessary methods to make API calls. +This allows you to wrap the client with your own custom logic, such as adding custom headers, logging, or error handling, or you can just pass an instance of `httpx.Client` or `httpx.AsyncClient` directly. + +For example, you could specify a header for every request that this sdk makes as follows: +```python +from codat_sync_for_payables import CodatSyncPayables +import httpx + +http_client = httpx.Client(headers={"x-custom-header": "someValue"}) +s = CodatSyncPayables(client=http_client) +``` + +or you could wrap the client with your own custom logic: +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.httpclient import AsyncHttpClient +import httpx + +class CustomClient(AsyncHttpClient): + client: AsyncHttpClient + + def __init__(self, client: AsyncHttpClient): + self.client = client + + async def send( + self, + request: httpx.Request, + *, + stream: bool = False, + auth: Union[ + httpx._types.AuthTypes, httpx._client.UseClientDefault, None + ] = httpx.USE_CLIENT_DEFAULT, + follow_redirects: Union[ + bool, httpx._client.UseClientDefault + ] = httpx.USE_CLIENT_DEFAULT, + ) -> httpx.Response: + request.headers["Client-Level-Header"] = "added by client" + + return await self.client.send( + request, stream=stream, auth=auth, follow_redirects=follow_redirects + ) + + def build_request( + self, + method: str, + url: httpx._types.URLTypes, + *, + content: Optional[httpx._types.RequestContent] = None, + data: Optional[httpx._types.RequestData] = None, + files: Optional[httpx._types.RequestFiles] = None, + json: Optional[Any] = None, + params: Optional[httpx._types.QueryParamTypes] = None, + headers: Optional[httpx._types.HeaderTypes] = None, + cookies: Optional[httpx._types.CookieTypes] = None, + timeout: Union[ + httpx._types.TimeoutTypes, httpx._client.UseClientDefault + ] = httpx.USE_CLIENT_DEFAULT, + extensions: Optional[httpx._types.RequestExtensions] = None, + ) -> httpx.Request: + return self.client.build_request( + method, + url, + content=content, + data=data, + files=files, + json=json, + params=params, + headers=headers, + cookies=cookies, + timeout=timeout, + extensions=extensions, + ) + +s = CodatSyncPayables(async_client=CustomClient(httpx.AsyncClient())) +``` + + + +## Authentication + +### Per-Client Security Schemes + +This SDK supports the following security scheme globally: + +| Name | Type | Scheme | +| ------------- | ------------- | ------------- | +| `auth_header` | apiKey | API key | + +You can set the security parameters through the `security` optional parameter when initializing the SDK client instance. For example: +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared + +s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +res = s.companies.list(request={ + "page": 1, + "page_size": 100, + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + "order_by": "-modifiedDate", +}) + +if res is not None: + # handle response + pass + +``` + + + +## Debugging + +You can setup your SDK to emit debug logs for SDK requests and responses. + +You can pass your own logger class directly into your SDK. +```python +from codat_sync_for_payables import CodatSyncPayables +import logging + +logging.basicConfig(level=logging.DEBUG) +s = CodatSyncPayables(debug_logger=logging.getLogger("codat_sync_for_payables")) +``` + + + + - -replace me - ## Support diff --git a/sync-for-payables/RELEASES.md b/sync-for-payables/RELEASES.md new file mode 100644 index 000000000..04ba433fb --- /dev/null +++ b/sync-for-payables/RELEASES.md @@ -0,0 +1,11 @@ + + +## 2024-10-21 16:10:41 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.420.0 (2.438.15) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v4.0.0] sync-for-payables +### Releases +- [PyPI v4.0.0] https://pypi.org/project/codat-sync-for-payables/4.0.0 - sync-for-payables \ No newline at end of file diff --git a/sync-for-payables/USAGE.md b/sync-for-payables/USAGE.md new file mode 100644 index 000000000..d04f929c6 --- /dev/null +++ b/sync-for-payables/USAGE.md @@ -0,0 +1,52 @@ + +```python +# Synchronous Example +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared + +s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +res = s.companies.list(request={ + "page": 1, + "page_size": 100, + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + "order_by": "-modifiedDate", +}) + +if res is not None: + # handle response + pass +``` + +
+ +The same SDK client can also be used to make asychronous requests by importing asyncio. +```python +# Asynchronous Example +import asyncio +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared + +async def main(): + s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), + ) + res = await s.companies.list_async(request={ + "page": 1, + "page_size": 100, + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + "order_by": "-modifiedDate", + }) + if res is not None: + # handle response + pass + +asyncio.run(main()) +``` + \ No newline at end of file diff --git a/sync-for-payables/docs/models/errors/errormessage.md b/sync-for-payables/docs/models/errors/errormessage.md new file mode 100644 index 000000000..752db0013 --- /dev/null +++ b/sync-for-payables/docs/models/errors/errormessage.md @@ -0,0 +1,16 @@ +# ErrorMessage + +Your `query` parameter was not correctly formed + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `status_code` | *Optional[int]* | :heavy_minus_sign: | The HTTP status code returned by the error. | +| `service` | *Optional[str]* | :heavy_minus_sign: | Codat's service the returned the error. | +| `error` | *Optional[str]* | :heavy_minus_sign: | A brief description of the error. | +| `correlation_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier used to propagate to all downstream services and determine the source of the error. | +| `validation` | [OptionalNullable[shared.ErrorValidation]](../../models/shared/errorvalidation.md) | :heavy_minus_sign: | A human-readable object describing validation decisions Codat has made. If an operation has failed because of validation errors, they will be detailed here. | +| `can_be_retried` | *Optional[str]* | :heavy_minus_sign: | `True` if the error occurred transiently and can be retried. | +| `detailed_error_code` | *Optional[int]* | :heavy_minus_sign: | Machine readable error code used to automate processes based on the code returned. | \ No newline at end of file diff --git a/sync-for-payables/docs/models/operations/createbankaccountrequest.md b/sync-for-payables/docs/models/operations/createbankaccountrequest.md new file mode 100644 index 000000000..3a74ffd7c --- /dev/null +++ b/sync-for-payables/docs/models/operations/createbankaccountrequest.md @@ -0,0 +1,11 @@ +# CreateBankAccountRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `connection_id` | *str* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `idempotency_key` | *Optional[str]* | :heavy_minus_sign: | A unique identifier to ensure idempotent behaviour for subsequent requests. | | +| `bank_account_prototype` | [Optional[shared.BankAccountPrototype]](../../models/shared/bankaccountprototype.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/sync-for-payables/docs/models/operations/createbillpaymentrequest.md b/sync-for-payables/docs/models/operations/createbillpaymentrequest.md new file mode 100644 index 000000000..653913bcc --- /dev/null +++ b/sync-for-payables/docs/models/operations/createbillpaymentrequest.md @@ -0,0 +1,12 @@ +# CreateBillPaymentRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `connection_id` | *str* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `bill_id` | *str* | :heavy_check_mark: | Unique identifier for a bill. | 13d946f0-c5d5-42bc-b092-97ece17923ab | +| `idempotency_key` | *Optional[str]* | :heavy_minus_sign: | A unique identifier to ensure idempotent behaviour for subsequent requests. | | +| `bill_payment_prototype` | [Optional[shared.BillPaymentPrototype]](../../models/shared/billpaymentprototype.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/sync-for-payables/docs/models/operations/createbillrequest.md b/sync-for-payables/docs/models/operations/createbillrequest.md new file mode 100644 index 000000000..6b83a39bc --- /dev/null +++ b/sync-for-payables/docs/models/operations/createbillrequest.md @@ -0,0 +1,11 @@ +# CreateBillRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `connection_id` | *str* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `idempotency_key` | *Optional[str]* | :heavy_minus_sign: | A unique identifier to ensure idempotent behaviour for subsequent requests. | | +| `bill_prototype` | [Optional[shared.BillPrototype]](../../models/shared/billprototype.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/sync-for-payables/docs/models/operations/createconnectionrequest.md b/sync-for-payables/docs/models/operations/createconnectionrequest.md new file mode 100644 index 000000000..ff26e52b6 --- /dev/null +++ b/sync-for-payables/docs/models/operations/createconnectionrequest.md @@ -0,0 +1,9 @@ +# CreateConnectionRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `request_body` | [Optional[operations.CreateConnectionRequestBody]](../../models/operations/createconnectionrequestbody.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/sync-for-payables/docs/models/operations/createconnectionrequestbody.md b/sync-for-payables/docs/models/operations/createconnectionrequestbody.md new file mode 100644 index 000000000..891314d08 --- /dev/null +++ b/sync-for-payables/docs/models/operations/createconnectionrequestbody.md @@ -0,0 +1,8 @@ +# CreateConnectionRequestBody + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `platform_key` | *Optional[str]* | :heavy_minus_sign: | A unique 4-letter key to represent a platform in each integration. View [accounting](https://docs.codat.io/integrations/accounting/overview#platform-keys), [banking](https://docs.codat.io/integrations/banking/overview#platform-keys), and [commerce](https://docs.codat.io/integrations/commerce/overview#platform-keys) platform keys. | gbol | \ No newline at end of file diff --git a/sync-for-payables/docs/models/operations/createsupplierrequest.md b/sync-for-payables/docs/models/operations/createsupplierrequest.md new file mode 100644 index 000000000..b820d5d6f --- /dev/null +++ b/sync-for-payables/docs/models/operations/createsupplierrequest.md @@ -0,0 +1,11 @@ +# CreateSupplierRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `connection_id` | *str* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `idempotency_key` | *Optional[str]* | :heavy_minus_sign: | A unique identifier to ensure idempotent behaviour for subsequent requests. | | +| `supplier_prototype` | [Optional[shared.SupplierPrototype]](../../models/shared/supplierprototype.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/sync-for-payables/docs/models/operations/deletecompanyrequest.md b/sync-for-payables/docs/models/operations/deletecompanyrequest.md new file mode 100644 index 000000000..338ee40e5 --- /dev/null +++ b/sync-for-payables/docs/models/operations/deletecompanyrequest.md @@ -0,0 +1,8 @@ +# DeleteCompanyRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | \ No newline at end of file diff --git a/sync-for-payables/docs/models/operations/deleteconnectionrequest.md b/sync-for-payables/docs/models/operations/deleteconnectionrequest.md new file mode 100644 index 000000000..9650dc387 --- /dev/null +++ b/sync-for-payables/docs/models/operations/deleteconnectionrequest.md @@ -0,0 +1,9 @@ +# DeleteConnectionRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `connection_id` | *str* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | \ No newline at end of file diff --git a/sync-for-payables/docs/models/operations/downloadbillattachmentrequest.md b/sync-for-payables/docs/models/operations/downloadbillattachmentrequest.md new file mode 100644 index 000000000..947d1e4bf --- /dev/null +++ b/sync-for-payables/docs/models/operations/downloadbillattachmentrequest.md @@ -0,0 +1,11 @@ +# DownloadBillAttachmentRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `connection_id` | *str* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `bill_id` | *str* | :heavy_check_mark: | Unique identifier for a bill. | 13d946f0-c5d5-42bc-b092-97ece17923ab | +| `attachment_id` | *str* | :heavy_check_mark: | Unique identifier for an attachment. | 8a210b68-6988-11ed-a1eb-0242ac120002 | \ No newline at end of file diff --git a/sync-for-payables/docs/models/operations/getcompanyinformationrequest.md b/sync-for-payables/docs/models/operations/getcompanyinformationrequest.md new file mode 100644 index 000000000..657eb5cde --- /dev/null +++ b/sync-for-payables/docs/models/operations/getcompanyinformationrequest.md @@ -0,0 +1,9 @@ +# GetCompanyInformationRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `connection_id` | *str* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | \ No newline at end of file diff --git a/sync-for-payables/docs/models/operations/getcompanyrequest.md b/sync-for-payables/docs/models/operations/getcompanyrequest.md new file mode 100644 index 000000000..240b811b6 --- /dev/null +++ b/sync-for-payables/docs/models/operations/getcompanyrequest.md @@ -0,0 +1,8 @@ +# GetCompanyRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | \ No newline at end of file diff --git a/sync-for-payables/docs/models/operations/getconnectionrequest.md b/sync-for-payables/docs/models/operations/getconnectionrequest.md new file mode 100644 index 000000000..6e9f3d18b --- /dev/null +++ b/sync-for-payables/docs/models/operations/getconnectionrequest.md @@ -0,0 +1,9 @@ +# GetConnectionRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `connection_id` | *str* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | \ No newline at end of file diff --git a/sync-for-payables/docs/models/operations/getmappingoptionsbillsrequest.md b/sync-for-payables/docs/models/operations/getmappingoptionsbillsrequest.md new file mode 100644 index 000000000..901f6cec7 --- /dev/null +++ b/sync-for-payables/docs/models/operations/getmappingoptionsbillsrequest.md @@ -0,0 +1,11 @@ +# GetMappingOptionsBillsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `connection_id` | *str* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `continuation_token` | *Optional[str]* | :heavy_minus_sign: | Retrieve the next page of results using the continuation token from the previous response. | continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ== | +| `status_query` | *Optional[str]* | :heavy_minus_sign: | Codat query string allows you to filter by `status` (`status=Active\|\|status=Archived`). [Learn more](https://docs.codat.io/using-the-api/querying) about Codat's query string. | status=Archived | \ No newline at end of file diff --git a/sync-for-payables/docs/models/operations/getmappingoptionspaymentsrequest.md b/sync-for-payables/docs/models/operations/getmappingoptionspaymentsrequest.md new file mode 100644 index 000000000..3ae09265f --- /dev/null +++ b/sync-for-payables/docs/models/operations/getmappingoptionspaymentsrequest.md @@ -0,0 +1,11 @@ +# GetMappingOptionsPaymentsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `connection_id` | *str* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `continuation_token` | *Optional[str]* | :heavy_minus_sign: | Retrieve the next page of results using the continuation token from the previous response. | continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ== | +| `status_query` | *Optional[str]* | :heavy_minus_sign: | Codat query string allows you to filter by `status` (`status=Active\|\|status=Archived`). [Learn more](https://docs.codat.io/using-the-api/querying) about Codat's query string. | status=Archived | \ No newline at end of file diff --git a/sync-for-payables/docs/models/operations/listbillattachmentsrequest.md b/sync-for-payables/docs/models/operations/listbillattachmentsrequest.md new file mode 100644 index 000000000..c2b960e31 --- /dev/null +++ b/sync-for-payables/docs/models/operations/listbillattachmentsrequest.md @@ -0,0 +1,10 @@ +# ListBillAttachmentsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `connection_id` | *str* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `bill_id` | *str* | :heavy_check_mark: | Unique identifier for a bill. | 13d946f0-c5d5-42bc-b092-97ece17923ab | \ No newline at end of file diff --git a/sync-for-payables/docs/models/operations/listbillsrequest.md b/sync-for-payables/docs/models/operations/listbillsrequest.md new file mode 100644 index 000000000..cd5209d7e --- /dev/null +++ b/sync-for-payables/docs/models/operations/listbillsrequest.md @@ -0,0 +1,11 @@ +# ListBillsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `connection_id` | *str* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `continuation_token` | *Optional[str]* | :heavy_minus_sign: | Retrieve the next page of results using the continuation token from the previous response. | continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ== | +| `query` | *Optional[str]* | :heavy_minus_sign: | Codat query string allows you to filter by `status` and `sourceModifiedDate`. Learn more about Codat's query string [here](https://docs.codat.io/using-the-api/querying). Platfrom specfic statuses: Xero supports Open \| PartiallyPaid \| Paid \| Void \| Draft. Qbo supports Open \| PartiallyPaid \| Paid. FreeAgent supports Open \| PartiallyPaid \| Paid. | | \ No newline at end of file diff --git a/sync-for-payables/docs/models/operations/listcompaniesrequest.md b/sync-for-payables/docs/models/operations/listcompaniesrequest.md new file mode 100644 index 000000000..d0f262cbd --- /dev/null +++ b/sync-for-payables/docs/models/operations/listcompaniesrequest.md @@ -0,0 +1,11 @@ +# ListCompaniesRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | +| `page` | *Optional[int]* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | +| `page_size` | *Optional[int]* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | +| `query` | *Optional[str]* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | id=e3334455-1aed-4e71-ab43-6bccf12092ee | +| `order_by` | *Optional[str]* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | \ No newline at end of file diff --git a/sync-for-payables/docs/models/operations/listconnectionsrequest.md b/sync-for-payables/docs/models/operations/listconnectionsrequest.md new file mode 100644 index 000000000..1d852c6cd --- /dev/null +++ b/sync-for-payables/docs/models/operations/listconnectionsrequest.md @@ -0,0 +1,12 @@ +# ListConnectionsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `page` | *Optional[int]* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | +| `page_size` | *Optional[int]* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | +| `query` | *Optional[str]* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | id=e3334455-1aed-4e71-ab43-6bccf12092ee | +| `order_by` | *Optional[str]* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | \ No newline at end of file diff --git a/sync-for-payables/docs/models/operations/listsuppliersrequest.md b/sync-for-payables/docs/models/operations/listsuppliersrequest.md new file mode 100644 index 000000000..faf0d748f --- /dev/null +++ b/sync-for-payables/docs/models/operations/listsuppliersrequest.md @@ -0,0 +1,11 @@ +# ListSuppliersRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `connection_id` | *str* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `continuation_token` | *Optional[str]* | :heavy_minus_sign: | Retrieve the next page of results using the continuation token from the previous response. | continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ== | +| `query` | *Optional[str]* | :heavy_minus_sign: | Codat query string allows you to filter by `sourceModifiedDate` or if a supplier is `Active` or `Archived` in the accounting software. Learn more about Codat's query string [here](https://docs.codat.io/using-the-api/querying). | | \ No newline at end of file diff --git a/sync-for-payables/docs/models/operations/unlinkconnectionrequest.md b/sync-for-payables/docs/models/operations/unlinkconnectionrequest.md new file mode 100644 index 000000000..79d8b2072 --- /dev/null +++ b/sync-for-payables/docs/models/operations/unlinkconnectionrequest.md @@ -0,0 +1,10 @@ +# UnlinkConnectionRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `connection_id` | *str* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `request_body` | [Optional[operations.UnlinkConnectionUpdateConnection]](../../models/operations/unlinkconnectionupdateconnection.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/sync-for-payables/docs/models/operations/unlinkconnectionupdateconnection.md b/sync-for-payables/docs/models/operations/unlinkconnectionupdateconnection.md new file mode 100644 index 000000000..5a5f2911b --- /dev/null +++ b/sync-for-payables/docs/models/operations/unlinkconnectionupdateconnection.md @@ -0,0 +1,8 @@ +# UnlinkConnectionUpdateConnection + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `status` | [Optional[shared.DataConnectionStatus]](../../models/shared/dataconnectionstatus.md) | :heavy_minus_sign: | The current authorization status of the data connection. | \ No newline at end of file diff --git a/sync-for-payables/docs/models/operations/updatecompanyrequest.md b/sync-for-payables/docs/models/operations/updatecompanyrequest.md new file mode 100644 index 000000000..8ee99180f --- /dev/null +++ b/sync-for-payables/docs/models/operations/updatecompanyrequest.md @@ -0,0 +1,9 @@ +# UpdateCompanyRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `company_request_body` | [Optional[shared.CompanyRequestBody]](../../models/shared/companyrequestbody.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/sync-for-payables/docs/models/operations/uploadbillattachmentrequest.md b/sync-for-payables/docs/models/operations/uploadbillattachmentrequest.md new file mode 100644 index 000000000..37e393217 --- /dev/null +++ b/sync-for-payables/docs/models/operations/uploadbillattachmentrequest.md @@ -0,0 +1,11 @@ +# UploadBillAttachmentRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `connection_id` | *str* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `bill_id` | *str* | :heavy_check_mark: | Unique identifier for a bill. | 13d946f0-c5d5-42bc-b092-97ece17923ab | +| `attachment_upload` | [Optional[shared.AttachmentUpload]](../../models/shared/attachmentupload.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/accountmappingoption.md b/sync-for-payables/docs/models/shared/accountmappingoption.md new file mode 100644 index 000000000..b04ac5177 --- /dev/null +++ b/sync-for-payables/docs/models/shared/accountmappingoption.md @@ -0,0 +1,14 @@ +# AccountMappingOption + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the account, unique for the company. | 1b6266d1-1e44-46c5-8eb5-a8f98e03124e | +| `nominal_code` | *OptionalNullable[str]* | :heavy_minus_sign: | Reference given to each nominal account for a business. It ensures money is allocated to the correct account. This code isn't a unique identifier in the Codat system. | 610 | +| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the account. | Accounts Payable | +| `type` | *OptionalNullable[str]* | :heavy_minus_sign: | Type of account. | Liability | +| `currency` | *Optional[str]* | :heavy_minus_sign: | The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_.

## Unknown currencies

In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction.

There are only a very small number of edge cases where this currency code is returned by the Codat system. | GBP | +| `status` | [Optional[shared.AccountStatus]](../../models/shared/accountstatus.md) | :heavy_minus_sign: | The current status of the account. | Active | +| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/accountstatus.md b/sync-for-payables/docs/models/shared/accountstatus.md new file mode 100644 index 000000000..25850a47c --- /dev/null +++ b/sync-for-payables/docs/models/shared/accountstatus.md @@ -0,0 +1,11 @@ +# AccountStatus + +The current status of the account. + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `ACTIVE` | Active | +| `ARCHIVED` | Archived | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/accounttype.md b/sync-for-payables/docs/models/shared/accounttype.md new file mode 100644 index 000000000..7bd354c56 --- /dev/null +++ b/sync-for-payables/docs/models/shared/accounttype.md @@ -0,0 +1,14 @@ +# AccountType + +The type of transactions and balances on the account. +For Credit accounts, positive balances are liabilities, and positive transactions **reduce** liabilities. +For Debit accounts, positive balances are assets, and positive transactions **increase** assets. + + +## Values + +| Name | Value | +| --------- | --------- | +| `UNKNOWN` | Unknown | +| `CREDIT` | Credit | +| `DEBIT` | Debit | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/address.md b/sync-for-payables/docs/models/shared/address.md new file mode 100644 index 000000000..5772213eb --- /dev/null +++ b/sync-for-payables/docs/models/shared/address.md @@ -0,0 +1,14 @@ +# Address + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `type` | [Optional[shared.AddressType]](../../models/shared/addresstype.md) | :heavy_minus_sign: | The type of the address | +| `line1` | *OptionalNullable[str]* | :heavy_minus_sign: | Line 1 of the customer address. | +| `line2` | *OptionalNullable[str]* | :heavy_minus_sign: | Line 2 of the customer address. | +| `city` | *OptionalNullable[str]* | :heavy_minus_sign: | City of the customer address. | +| `region` | *OptionalNullable[str]* | :heavy_minus_sign: | Region of the customer address. | +| `country` | *OptionalNullable[str]* | :heavy_minus_sign: | Country of the customer's address. For NetSuite, use the 2-digit [ISO 3166](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes) country code. | +| `postal_code` | *OptionalNullable[str]* | :heavy_minus_sign: | Postal code or zip code. | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/addresstype.md b/sync-for-payables/docs/models/shared/addresstype.md new file mode 100644 index 000000000..5de1e6e1a --- /dev/null +++ b/sync-for-payables/docs/models/shared/addresstype.md @@ -0,0 +1,12 @@ +# AddressType + +The type of the address + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `UNKNOWN` | Unknown | +| `BILLING` | Billing | +| `DELIVERY` | Delivery | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/attachment.md b/sync-for-payables/docs/models/shared/attachment.md new file mode 100644 index 000000000..d1aaf1306 --- /dev/null +++ b/sync-for-payables/docs/models/shared/attachment.md @@ -0,0 +1,31 @@ +# Attachment + + The Codat API supports pulling and pushing of file attachments for invoices, bills, direct costs, and direct incomes. + + > **Retrieving attachments** + > + > If a company is authorized, you can query the Codat API to read, download, and upload attachments without requiring a fresh sync of data. + + Unlike other data types, Codat doesn't support [sync settings](https://docs.codat.io/knowledge-base/advanced-sync-settings) for attachments. + + Note that different integrations have different requirements for file size and extension of attachments. + + | Integration | File size | File extension | + |-------------------|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Xero | 4 MB | 7Z, BMP, CSV, DOC, DOCX, EML, GIF, JPEG, JPG, KEYNOTE, MSG, NUMBERS, ODF, ODS, ODT, PAGES, PDF, PNG, PPT, PPTX, RAR, RTF, TIF, TIFF, TXT, XLS, XLSX, ZIP | + | QuickBooks Online | 100 MB | AI, CSV, DOC, DOCX, EPS, GIF, JPEG, JPG, ODS, PAGES, PDF, PNG, RTF, TIF, TXT, XLS, XLSX, XML | + | NetSuite | 100 MB | BMP, CSV, XLS, XLSX, JSON, PDF, PJPG, PJPEG, PNG, TXT, SVG, TIF, TIFF, DOC, DOCX, ZIP | + | Dynamics 365 Business Central | 350 MB | Dynamics do not explicitly outline which file types are supported but they do state here that "You can attach any type of file, such as text, image, or video files". | + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the attachment, unique for the company in the accounting software. | | +| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the attachment file. | | +| `content_type` | *OptionalNullable[str]* | :heavy_minus_sign: | File type of the attachment. This is represented by appending the file type to the [IETF standard file naming requirements](https://tools.ietf.org/html/rfc6838). For example, for a jpeg file the output is **image/jpeg**.

Supported file types vary per platform. | | +| `date_created` | *Optional[str]* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

```
2020-10-08T22:40:50Z
2021-01-01T00:00:00
```



When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information:

- Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z`
- Unqualified local time: `2021-11-15T01:00:00`
- UTC time offsets: `2021-11-15T01:00:00-05:00`

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | +| `file_size` | *OptionalNullable[int]* | :heavy_minus_sign: | File size in bytes. For example, if this reads **46153**, then the file size is 46kb. | | +| `include_when_sent` | *Optional[bool]* | :heavy_minus_sign: | If `true`, then the attachment is included with the associated invoice, bill or direct costs when it is printed, emailed, or sent to a customer, if the underlying accounting software allows this. | | +| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/attachmentupload.md b/sync-for-payables/docs/models/shared/attachmentupload.md new file mode 100644 index 000000000..02d7ac41a --- /dev/null +++ b/sync-for-payables/docs/models/shared/attachmentupload.md @@ -0,0 +1,8 @@ +# AttachmentUpload + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | +| `file` | [shared.CodatFile](../../models/shared/codatfile.md) | :heavy_check_mark: | The file to be uploaded as an attachment. | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/bankaccount.md b/sync-for-payables/docs/models/shared/bankaccount.md new file mode 100644 index 000000000..fff4281b4 --- /dev/null +++ b/sync-for-payables/docs/models/shared/bankaccount.md @@ -0,0 +1,16 @@ +# BankAccount + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the bank account, unique for the company in the accounting software. | | +| `nominal_code` | *OptionalNullable[str]* | :heavy_minus_sign: | Code used to identify each nominal account for a business. | | +| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the bank account in the accounting software. | | +| `account_type` | [Optional[shared.BankAccountType]](../../models/shared/bankaccounttype.md) | :heavy_minus_sign: | The type of transactions and balances on the account.
For Credit accounts, positive balances are liabilities, and positive transactions **reduce** liabilities.
For Debit accounts, positive balances are assets, and positive transactions **increase** assets. | | +| `account_number` | *OptionalNullable[str]* | :heavy_minus_sign: | Account number for the bank account.

Xero integrations
Only a UK account number shows for bank accounts with GBP currency and a combined total of sort code and account number that equals 14 digits, For non-GBP accounts, the full bank account number is populated. | | +| `sort_code` | *OptionalNullable[str]* | :heavy_minus_sign: | Sort code for the bank account. This is relevant to UK bank accounts.

Xero integrations
The sort code is only displayed when the currency = GBP and the sort code and account number sum to 14 digits. For non-GBP accounts, this field is not populated. | | +| `currency` | *Optional[str]* | :heavy_minus_sign: | The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_.

## Unknown currencies

In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction.

There are only a very small number of edge cases where this currency code is returned by the Codat system. | GBP | +| `status` | [Optional[shared.BankAccountStatus]](../../models/shared/bankaccountstatus.md) | :heavy_minus_sign: | The current status of the bank account. | Active | +| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/bankaccountmappingoption.md b/sync-for-payables/docs/models/shared/bankaccountmappingoption.md new file mode 100644 index 000000000..ea834e398 --- /dev/null +++ b/sync-for-payables/docs/models/shared/bankaccountmappingoption.md @@ -0,0 +1,16 @@ +# BankAccountMappingOption + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the account, unique for the company in the accounting software. | 3d5a8e00-d108-4045-8823-7f342676cffa | +| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the bank account in the accounting software. | Bank of Dave current account | +| `account_number` | *OptionalNullable[str]* | :heavy_minus_sign: | Account number for the bank account.

Xero integrations
Only a UK account number shows for bank accounts with GBP currency and a combined total of sort code and account number that equals 14 digits, For non-GBP accounts, the full bank account number is populated. | | +| `nominal_code` | *OptionalNullable[str]* | :heavy_minus_sign: | Code used to identify each nominal account for a business. | | +| `sort_code` | *OptionalNullable[str]* | :heavy_minus_sign: | Sort code for the bank account.

Xero integrations
The sort code is only displayed when the currency = GBP and the sort code and account number sum to 14 digits. For non-GBP accounts, this field is not populated. | | +| `currency` | *OptionalNullable[str]* | :heavy_minus_sign: | The bank account's base currency. | | +| `status` | [Optional[shared.BankAccountStatus]](../../models/shared/bankaccountstatus.md) | :heavy_minus_sign: | The current status of the bank account. | Active | +| `account_type` | [Optional[shared.AccountType]](../../models/shared/accounttype.md) | :heavy_minus_sign: | The type of transactions and balances on the account.
For Credit accounts, positive balances are liabilities, and positive transactions **reduce** liabilities.
For Debit accounts, positive balances are assets, and positive transactions **increase** assets. | | +| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/bankaccountprototype.md b/sync-for-payables/docs/models/shared/bankaccountprototype.md new file mode 100644 index 000000000..cb2e349ea --- /dev/null +++ b/sync-for-payables/docs/models/shared/bankaccountprototype.md @@ -0,0 +1,13 @@ +# BankAccountPrototype + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `name` | *Nullable[str]* | :heavy_check_mark: | Name of the bank account in the accounting software. | | +| `account_type` | [shared.AccountType](../../models/shared/accounttype.md) | :heavy_check_mark: | The type of transactions and balances on the account.
For Credit accounts, positive balances are liabilities, and positive transactions **reduce** liabilities.
For Debit accounts, positive balances are assets, and positive transactions **increase** assets. | | +| `account_number` | *Nullable[str]* | :heavy_check_mark: | Account number for the bank account.

Xero integrations
Only a UK account number shows for bank accounts with GBP currency and a combined total of sort code and account number that equals 14 digits, For non-GBP accounts, the full bank account number is populated. | | +| `currency` | *str* | :heavy_check_mark: | The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_.

## Unknown currencies

In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction.

There are only a very small number of edge cases where this currency code is returned by the Codat system. | GBP | +| `nominal_code` | *OptionalNullable[str]* | :heavy_minus_sign: | Code used to identify each nominal account for a business. | | +| `sort_code` | *OptionalNullable[str]* | :heavy_minus_sign: | Sort code for the bank account. This is relevant to UK bank accounts.

Xero integrations
The sort code is only displayed when the currency = GBP and the sort code and account number sum to 14 digits. For non-GBP accounts, this field is not populated. | | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/bankaccountstatus.md b/sync-for-payables/docs/models/shared/bankaccountstatus.md new file mode 100644 index 000000000..86abe214a --- /dev/null +++ b/sync-for-payables/docs/models/shared/bankaccountstatus.md @@ -0,0 +1,11 @@ +# BankAccountStatus + +The current status of the bank account. + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `ACTIVE` | Active | +| `ARCHIVED` | Archived | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/bankaccounttype.md b/sync-for-payables/docs/models/shared/bankaccounttype.md new file mode 100644 index 000000000..a995a4e52 --- /dev/null +++ b/sync-for-payables/docs/models/shared/bankaccounttype.md @@ -0,0 +1,14 @@ +# BankAccountType + +The type of transactions and balances on the account. +For Credit accounts, positive balances are liabilities, and positive transactions **reduce** liabilities. +For Debit accounts, positive balances are assets, and positive transactions **increase** assets. + + +## Values + +| Name | Value | +| --------- | --------- | +| `UNKNOWN` | Unknown | +| `CREDIT` | Credit | +| `DEBIT` | Debit | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/bill.md b/sync-for-payables/docs/models/shared/bill.md new file mode 100644 index 000000000..4a726f32a --- /dev/null +++ b/sync-for-payables/docs/models/shared/bill.md @@ -0,0 +1,21 @@ +# Bill + +Bills are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `supplier_ref` | [shared.SupplierRef](../../models/shared/supplierref.md) | :heavy_check_mark: | Reference to the supplier the record relates to. | | +| `issue_date` | *str* | :heavy_check_mark: | N/A | 2022-10-23 00:00:00 +0000 UTC | +| `due_date` | *str* | :heavy_check_mark: | N/A | 2022-10-23 00:00:00 +0000 UTC | +| `currency` | *str* | :heavy_check_mark: | The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_.

## Unknown currencies

In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction.

There are only a very small number of edge cases where this currency code is returned by the Codat system. | GBP | +| `status` | [shared.BillStatus](../../models/shared/billstatus.md) | :heavy_check_mark: | Current state of the bill. If creating a bill the status must be `Open`. | Open | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the bill, unique for the company in the accounting software. | | +| `reference` | *OptionalNullable[str]* | :heavy_minus_sign: | User-friendly reference for the bill. | | +| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit.

It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR.

Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places).

For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places.

## Examples with base currency of GBP

\| Foreign Currency \| Foreign Amount \| Currency Rate \| Base Currency Amount (GBP) \|
\| :--------------- \| :------------- \| :------------ \| :------------------------- \|
\| **USD** \| $20 \| 0.781 \| £15.62 \|
\| **EUR** \| €20 \| 0.885 \| £17.70 \|
\| **RUB** \| ₽20 \| 0.011 \| £0.22 \|

## Examples with base currency of USD

\| Foreign Currency \| Foreign Amount \| Currency Rate \| Base Currency Amount (USD) \|
\| :--------------- \| :------------- \| :------------ \| :------------------------- \|
\| **GBP** \| £20 \| 1.277 \| $25.54 \|
\| **EUR** \| €20 \| 1.134 \| $22.68 \|
\| **RUB** \| ₽20 \| 0.015 \| $0.30 \|


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | +| `line_items` | List[[shared.BillLineItem](../../models/shared/billlineitem.md)] | :heavy_minus_sign: | Array of Bill line items. | | +| `total_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Amount of the bill, including tax. | | +| `amount_due` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount outstanding on the bill. | | +| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/billaccountref.md b/sync-for-payables/docs/models/shared/billaccountref.md new file mode 100644 index 000000000..77f0c8d04 --- /dev/null +++ b/sync-for-payables/docs/models/shared/billaccountref.md @@ -0,0 +1,10 @@ +# BillAccountRef + +Reference to the account to which the line item is linked. + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------- | --------------------------------- | --------------------------------- | --------------------------------- | +| `id` | *Optional[str]* | :heavy_minus_sign: | 'id' from the Accounts data type. | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/billlineitem.md b/sync-for-payables/docs/models/shared/billlineitem.md new file mode 100644 index 000000000..529becc44 --- /dev/null +++ b/sync-for-payables/docs/models/shared/billlineitem.md @@ -0,0 +1,14 @@ +# BillLineItem + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | +| `unit_amount` | *Decimal* | :heavy_check_mark: | Unit price of the goods or service. | +| `quantity` | *Decimal* | :heavy_check_mark: | Number of units of goods or services received. | +| `account_ref` | [shared.BillAccountRef](../../models/shared/billaccountref.md) | :heavy_check_mark: | Reference to the account to which the line item is linked. | +| `tax_rate_ref` | [shared.BillTaxRateRef](../../models/shared/billtaxrateref.md) | :heavy_check_mark: | Reference to the tax rate to which the line item is linked. | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Friendly name of the goods or services received. | +| `tax_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Amount of tax applied to the line item. | +| `total_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Total amount of the line, including tax. | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/billmappingoptions.md b/sync-for-payables/docs/models/shared/billmappingoptions.md new file mode 100644 index 000000000..0dbd7d502 --- /dev/null +++ b/sync-for-payables/docs/models/shared/billmappingoptions.md @@ -0,0 +1,12 @@ +# BillMappingOptions + +The bill mapping options for a company's accounting software. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `accounts` | List[[shared.AccountMappingOption](../../models/shared/accountmappingoption.md)] | :heavy_minus_sign: | N/A | +| `tax_rate` | List[[shared.TaxRateMappingOption](../../models/shared/taxratemappingoption.md)] | :heavy_minus_sign: | N/A | +| `pagination` | [Optional[shared.Pagination]](../../models/shared/pagination.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/billpayment.md b/sync-for-payables/docs/models/shared/billpayment.md new file mode 100644 index 000000000..24849d839 --- /dev/null +++ b/sync-for-payables/docs/models/shared/billpayment.md @@ -0,0 +1,13 @@ +# BillPayment + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the bill payment, unique for the company in the accounting software. | | +| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | Amount of the payment in the bill currency. | 1329.54 | +| `date_` | *Optional[str]* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | +| `reference` | *OptionalNullable[str]* | :heavy_minus_sign: | Additional information associated with the payment. | Bill Payment against bill c13e37b6-dfaa-4894-b3be-9fe97bda9f44 | +| `account_ref` | [Optional[shared.BillPaymentAccountRef]](../../models/shared/billpaymentaccountref.md) | :heavy_minus_sign: | Reference to the bank account / credit card which you are using to pay the bill. | | +| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit.

It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR.

Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places).

For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places.

## Examples with base currency of GBP

\| Foreign Currency \| Foreign Amount \| Currency Rate \| Base Currency Amount (GBP) \|
\| :--------------- \| :------------- \| :------------ \| :------------------------- \|
\| **USD** \| $20 \| 0.781 \| £15.62 \|
\| **EUR** \| €20 \| 0.885 \| £17.70 \|
\| **RUB** \| ₽20 \| 0.011 \| £0.22 \|

## Examples with base currency of USD

\| Foreign Currency \| Foreign Amount \| Currency Rate \| Base Currency Amount (USD) \|
\| :--------------- \| :------------- \| :------------ \| :------------------------- \|
\| **GBP** \| £20 \| 1.277 \| $25.54 \|
\| **EUR** \| €20 \| 1.134 \| $22.68 \|
\| **RUB** \| ₽20 \| 0.015 \| $0.30 \|


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/billpaymentaccountref.md b/sync-for-payables/docs/models/shared/billpaymentaccountref.md new file mode 100644 index 000000000..b8c1a4317 --- /dev/null +++ b/sync-for-payables/docs/models/shared/billpaymentaccountref.md @@ -0,0 +1,10 @@ +# BillPaymentAccountRef + +Reference to the bank account / credit card which you are using to pay the bill. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | Unique ID of the bank account / credit card | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/billpaymentprototype.md b/sync-for-payables/docs/models/shared/billpaymentprototype.md new file mode 100644 index 000000000..949edfe96 --- /dev/null +++ b/sync-for-payables/docs/models/shared/billpaymentprototype.md @@ -0,0 +1,12 @@ +# BillPaymentPrototype + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `amount` | *Decimal* | :heavy_check_mark: | Amount of the payment in the bill currency. | 1329.54 | +| `date_` | *str* | :heavy_check_mark: | N/A | 2022-10-23 00:00:00 +0000 UTC | +| `account_ref` | [shared.BillPaymentAccountRef](../../models/shared/billpaymentaccountref.md) | :heavy_check_mark: | Reference to the bank account / credit card which you are using to pay the bill. | | +| `reference` | *OptionalNullable[str]* | :heavy_minus_sign: | Additional information associated with the payment. | Bill Payment against bill c13e37b6-dfaa-4894-b3be-9fe97bda9f44 | +| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit.

It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR.

Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places).

For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places.

## Examples with base currency of GBP

\| Foreign Currency \| Foreign Amount \| Currency Rate \| Base Currency Amount (GBP) \|
\| :--------------- \| :------------- \| :------------ \| :------------------------- \|
\| **USD** \| $20 \| 0.781 \| £15.62 \|
\| **EUR** \| €20 \| 0.885 \| £17.70 \|
\| **RUB** \| ₽20 \| 0.011 \| £0.22 \|

## Examples with base currency of USD

\| Foreign Currency \| Foreign Amount \| Currency Rate \| Base Currency Amount (USD) \|
\| :--------------- \| :------------- \| :------------ \| :------------------------- \|
\| **GBP** \| £20 \| 1.277 \| $25.54 \|
\| **EUR** \| €20 \| 1.134 \| $22.68 \|
\| **RUB** \| ₽20 \| 0.015 \| $0.30 \|


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/billprototype.md b/sync-for-payables/docs/models/shared/billprototype.md new file mode 100644 index 000000000..5e68bf6a7 --- /dev/null +++ b/sync-for-payables/docs/models/shared/billprototype.md @@ -0,0 +1,15 @@ +# BillPrototype + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `supplier_ref` | [shared.SupplierRef](../../models/shared/supplierref.md) | :heavy_check_mark: | Reference to the supplier the record relates to. | | +| `issue_date` | *str* | :heavy_check_mark: | N/A | 2022-10-23 00:00:00 +0000 UTC | +| `due_date` | *str* | :heavy_check_mark: | N/A | 2022-10-23 00:00:00 +0000 UTC | +| `currency` | *str* | :heavy_check_mark: | The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_.

## Unknown currencies

In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction.

There are only a very small number of edge cases where this currency code is returned by the Codat system. | GBP | +| `status` | [shared.BillStatus](../../models/shared/billstatus.md) | :heavy_check_mark: | Current state of the bill. If creating a bill the status must be `Open`. | Open | +| `reference` | *OptionalNullable[str]* | :heavy_minus_sign: | User-friendly reference for the bill. | | +| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit.

It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR.

Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places).

For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places.

## Examples with base currency of GBP

\| Foreign Currency \| Foreign Amount \| Currency Rate \| Base Currency Amount (GBP) \|
\| :--------------- \| :------------- \| :------------ \| :------------------------- \|
\| **USD** \| $20 \| 0.781 \| £15.62 \|
\| **EUR** \| €20 \| 0.885 \| £17.70 \|
\| **RUB** \| ₽20 \| 0.011 \| £0.22 \|

## Examples with base currency of USD

\| Foreign Currency \| Foreign Amount \| Currency Rate \| Base Currency Amount (USD) \|
\| :--------------- \| :------------- \| :------------ \| :------------------------- \|
\| **GBP** \| £20 \| 1.277 \| $25.54 \|
\| **EUR** \| €20 \| 1.134 \| $22.68 \|
\| **RUB** \| ₽20 \| 0.015 \| $0.30 \|


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | +| `line_items` | List[[shared.BillLineItem](../../models/shared/billlineitem.md)] | :heavy_minus_sign: | Array of Bill line items. | | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/bills.md b/sync-for-payables/docs/models/shared/bills.md new file mode 100644 index 000000000..58122acd2 --- /dev/null +++ b/sync-for-payables/docs/models/shared/bills.md @@ -0,0 +1,9 @@ +# Bills + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | +| `results` | List[[shared.Bill](../../models/shared/bill.md)] | :heavy_minus_sign: | N/A | +| `pagination` | [Optional[shared.Pagination]](../../models/shared/pagination.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/billstatus.md b/sync-for-payables/docs/models/shared/billstatus.md new file mode 100644 index 000000000..61bf740c2 --- /dev/null +++ b/sync-for-payables/docs/models/shared/billstatus.md @@ -0,0 +1,15 @@ +# BillStatus + +Current state of the bill. If creating a bill the status must be `Open`. + + +## Values + +| Name | Value | +| ---------------- | ---------------- | +| `UNKNOWN` | Unknown | +| `OPEN` | Open | +| `PARTIALLY_PAID` | PartiallyPaid | +| `PAID` | Paid | +| `VOID` | Void | +| `DRAFT` | Draft | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/billtaxrateref.md b/sync-for-payables/docs/models/shared/billtaxrateref.md new file mode 100644 index 000000000..28d67e255 --- /dev/null +++ b/sync-for-payables/docs/models/shared/billtaxrateref.md @@ -0,0 +1,10 @@ +# BillTaxRateRef + +Reference to the tax rate to which the line item is linked. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | +| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for the tax rate in the accounting software. | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/clientratelimitreachedwebhook.md b/sync-for-payables/docs/models/shared/clientratelimitreachedwebhook.md new file mode 100644 index 000000000..4ebcb4a09 --- /dev/null +++ b/sync-for-payables/docs/models/shared/clientratelimitreachedwebhook.md @@ -0,0 +1,16 @@ +# ClientRateLimitReachedWebhook + +Webhook request body for a client that has reached their rate limit. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `client_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for your client in Codat. | +| `client_name` | *Optional[str]* | :heavy_minus_sign: | Name of your client in Codat. | +| ~~`rule_id`~~ | *Optional[str]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Unique identifier for the rule. | +| `rule_type` | *Optional[str]* | :heavy_minus_sign: | The type of rule. | +| `alert_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the webhook event. | +| `message` | *Optional[str]* | :heavy_minus_sign: | A human-readable message about the webhook. | +| `data` | [Optional[shared.ClientRateLimitReachedWebhookData]](../../models/shared/clientratelimitreachedwebhookdata.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/clientratelimitreachedwebhookdata.md b/sync-for-payables/docs/models/shared/clientratelimitreachedwebhookdata.md new file mode 100644 index 000000000..bab6ec72f --- /dev/null +++ b/sync-for-payables/docs/models/shared/clientratelimitreachedwebhookdata.md @@ -0,0 +1,9 @@ +# ClientRateLimitReachedWebhookData + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `daily_quota` | *Optional[int]* | :heavy_minus_sign: | The number of available requests per day. | | +| `expires_utc` | *Optional[str]* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

```
2020-10-08T22:40:50Z
2021-01-01T00:00:00
```



When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information:

- Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z`
- Unqualified local time: `2021-11-15T01:00:00`
- UTC time offsets: `2021-11-15T01:00:00-05:00`

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/clientratelimitresetwebhook.md b/sync-for-payables/docs/models/shared/clientratelimitresetwebhook.md new file mode 100644 index 000000000..27b096317 --- /dev/null +++ b/sync-for-payables/docs/models/shared/clientratelimitresetwebhook.md @@ -0,0 +1,16 @@ +# ClientRateLimitResetWebhook + +Webhook request body for a client that has had their rate limit reset. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `client_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for your client in Codat. | +| `client_name` | *Optional[str]* | :heavy_minus_sign: | Name of your client in Codat. | +| ~~`rule_id`~~ | *Optional[str]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Unique identifier for the rule. | +| `rule_type` | *Optional[str]* | :heavy_minus_sign: | The type of rule. | +| `alert_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the webhook event. | +| `message` | *Optional[str]* | :heavy_minus_sign: | A human-readable message about the webhook. | +| `data` | [Optional[shared.ClientRateLimitResetWebhookData]](../../models/shared/clientratelimitresetwebhookdata.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/clientratelimitresetwebhookdata.md b/sync-for-payables/docs/models/shared/clientratelimitresetwebhookdata.md new file mode 100644 index 000000000..1f7c3b56e --- /dev/null +++ b/sync-for-payables/docs/models/shared/clientratelimitresetwebhookdata.md @@ -0,0 +1,11 @@ +# ClientRateLimitResetWebhookData + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `quota_remaining` | *OptionalNullable[int]* | :heavy_minus_sign: | Total number of requests remaining for your client. | | +| `reset_reason` | *Optional[str]* | :heavy_minus_sign: | The reason for your rate limit quota being reset. | | +| `daily_quota` | *Optional[int]* | :heavy_minus_sign: | The number of available requests per day. | | +| `expires_utc` | *Optional[str]* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

```
2020-10-08T22:40:50Z
2021-01-01T00:00:00
```



When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information:

- Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z`
- Unqualified local time: `2021-11-15T01:00:00`
- UTC time offsets: `2021-11-15T01:00:00-05:00`

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/clientratelimitwebhook.md b/sync-for-payables/docs/models/shared/clientratelimitwebhook.md new file mode 100644 index 000000000..6b719bbcb --- /dev/null +++ b/sync-for-payables/docs/models/shared/clientratelimitwebhook.md @@ -0,0 +1,11 @@ +# ClientRateLimitWebhook + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the event. | 743ec94a-8aa4-44bb-8bd4-e1855ee0e74b | +| `event_type` | *Optional[str]* | :heavy_minus_sign: | The type of event. | client.rateLimit.reset | +| `generated_date` | *Optional[str]* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

```
2020-10-08T22:40:50Z
2021-01-01T00:00:00
```



When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information:

- Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z`
- Unqualified local time: `2021-11-15T01:00:00`
- UTC time offsets: `2021-11-15T01:00:00-05:00`

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | +| `payload` | [Optional[shared.ClientRateLimitWebhookPayload]](../../models/shared/clientratelimitwebhookpayload.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/clientratelimitwebhookpayload.md b/sync-for-payables/docs/models/shared/clientratelimitwebhookpayload.md new file mode 100644 index 000000000..fe976f75c --- /dev/null +++ b/sync-for-payables/docs/models/shared/clientratelimitwebhookpayload.md @@ -0,0 +1,10 @@ +# ClientRateLimitWebhookPayload + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `daily_quota` | *Optional[int]* | :heavy_minus_sign: | The number of available requests per day. | | +| `quota_remaining` | *Optional[int]* | :heavy_minus_sign: | Total number of requests remaining for your client. | | +| `expiry_date` | *Optional[str]* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

```
2020-10-08T22:40:50Z
2021-01-01T00:00:00
```



When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information:

- Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z`
- Unqualified local time: `2021-11-15T01:00:00`
- UTC time offsets: `2021-11-15T01:00:00-05:00`

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/codatfile.md b/sync-for-payables/docs/models/shared/codatfile.md new file mode 100644 index 000000000..891a552ad --- /dev/null +++ b/sync-for-payables/docs/models/shared/codatfile.md @@ -0,0 +1,10 @@ +# CodatFile + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | +| `file_name` | *str* | :heavy_check_mark: | N/A | +| `content` | *Union[bytes, IO[bytes], io.BufferedReader]* | :heavy_check_mark: | N/A | +| `content_type` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/companies.md b/sync-for-payables/docs/models/shared/companies.md new file mode 100644 index 000000000..e20255422 --- /dev/null +++ b/sync-for-payables/docs/models/shared/companies.md @@ -0,0 +1,12 @@ +# Companies + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `page_number` | *int* | :heavy_check_mark: | Current page number. | | +| `page_size` | *int* | :heavy_check_mark: | Number of items to return in results array. | | +| `total_results` | *int* | :heavy_check_mark: | Total number of items. | | +| `links` | [shared.Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} | +| `results` | List[[shared.Company](../../models/shared/company.md)] | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/company.md b/sync-for-payables/docs/models/shared/company.md new file mode 100644 index 000000000..a7867fe28 --- /dev/null +++ b/sync-for-payables/docs/models/shared/company.md @@ -0,0 +1,23 @@ +# Company + +In Codat, a company represents a business sharing access to their data. Each company can have multiple [connections](https://docs.codat.io/sync-for-payables-api#/schemas/Connection) to different data sources such as one connection to [Xero](https://docs.codat.io/integrations/accounting/xero/accounting-xero) for accounting data, two connections to [Plaid](https://docs.codat.io/integrations/banking/plaid/banking-plaid) for two bank accounts and a connection to [Zettle](https://docs.codat.io/integrations/commerce/zettle/commerce-zettle) for POS data. + +Typically each company is one of your customers. + +When you create a company, you can specify a `name` and we will automatically generate a unique `id` for the company. You can also add a `description` to store any additional information about the company. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `name` | *str* | :heavy_check_mark: | The name of the company | Codat Ltd. | +| `redirect` | *str* | :heavy_check_mark: | The `redirect` [Link URL](https://docs.codat.io/auth-flow/authorize-hosted-link) enabling the customer to start their auth flow journey for the company. | https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739 | +| `description` | *Optional[str]* | :heavy_minus_sign: | Additional information about the company. This can be used to store foreign IDs, references, etc. | Requested early access to the new financing scheme. | +| `last_sync` | *Optional[str]* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

```
2020-10-08T22:40:50Z
2021-01-01T00:00:00
```



When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information:

- Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z`
- Unqualified local time: `2021-11-15T01:00:00`
- UTC time offsets: `2021-11-15T01:00:00-05:00`

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | +| `created` | *Optional[str]* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

```
2020-10-08T22:40:50Z
2021-01-01T00:00:00
```



When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information:

- Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z`
- Unqualified local time: `2021-11-15T01:00:00`
- UTC time offsets: `2021-11-15T01:00:00-05:00`

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | +| `created_by_user_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of user that created the company in Codat. | | +| `products` | List[*str*] | :heavy_minus_sign: | An array of products that are currently enabled for the company. | | +| `tags` | [Optional[shared.CompanyTags]](../../models/shared/companytags.md) | :heavy_minus_sign: | A collection of user-defined key-value pairs that store custom metadata against the company. | | +| `data_connections` | List[[shared.Connection](../../models/shared/connection.md)] | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/companyinformation.md b/sync-for-payables/docs/models/shared/companyinformation.md new file mode 100644 index 000000000..387fdc506 --- /dev/null +++ b/sync-for-payables/docs/models/shared/companyinformation.md @@ -0,0 +1,11 @@ +# CompanyInformation + +Gets the latest basic info for a company. + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | +| `company_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the linked company. | +| `base_currency` | *OptionalNullable[str]* | :heavy_minus_sign: | Currency set in the accounting software of the linked company. Used by the currency rate. | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/companyrequestbody.md b/sync-for-payables/docs/models/shared/companyrequestbody.md new file mode 100644 index 000000000..22fb289bc --- /dev/null +++ b/sync-for-payables/docs/models/shared/companyrequestbody.md @@ -0,0 +1,10 @@ +# CompanyRequestBody + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `name` | *str* | :heavy_check_mark: | Name of company being connected. | Bank of Dave | +| `description` | *Optional[str]* | :heavy_minus_sign: | Additional information about the company. This can be used to store foreign IDs, references, etc. | Requested early access to the new financing scheme. | +| `tags` | [Optional[shared.Tags]](../../models/shared/tags.md) | :heavy_minus_sign: | A collection of user-defined key-value pairs that store custom metadata against the company. | | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/companytags.md b/sync-for-payables/docs/models/shared/companytags.md new file mode 100644 index 000000000..cbbb3f90f --- /dev/null +++ b/sync-for-payables/docs/models/shared/companytags.md @@ -0,0 +1,9 @@ +# CompanyTags + +A collection of user-defined key-value pairs that store custom metadata against the company. + + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/connection.md b/sync-for-payables/docs/models/shared/connection.md new file mode 100644 index 000000000..e4b303afe --- /dev/null +++ b/sync-for-payables/docs/models/shared/connection.md @@ -0,0 +1,30 @@ +# Connection + +A connection represents a [company's](https://docs.codat.io/sync-for-payables-api#/schemas/Company) connection to a data source and allows you to synchronize data (pull and/or push) with that source. + +A company can have multiple data connections depending on the type of data source it is connecting to. For example, a single company can link to: + +- [Accounting data](https://docs.codat.io/accounting-api/overview) - 1 active connection. +- [Banking data](https://docs.codat.io/banking-api/overview) - Multiple active connections. +- [Commerce data](https://docs.codat.io/commerce-api/overview) - Multiple active connections. +Any combination of accounting, banking, and commerce data connections is allowed. + +Before you can use a data connection to pull or push data, the company must grant you access to their business data by [linking the connection](https://docs.codat.io/auth-flow/overview). + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | Unique identifier for a company's data connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `integration_id` | *str* | :heavy_check_mark: | A Codat ID representing the integration. | fd321cb6-7963-4506-b873-e99593a45e30 | +| `integration_key` | *str* | :heavy_check_mark: | A unique four-character ID that identifies the platform of the company's data connection. This ensures continuity if the platform changes its name in the future. | | +| `source_id` | *str* | :heavy_check_mark: | A source-specific ID used to distinguish between different sources originating from the same data connection. In general, a data connection is a single data source. However, for TrueLayer, `sourceId` is associated with a specific bank and has a many-to-one relationship with the `integrationId`. | 35b92968-9851-4095-ad60-395c95cbcba4 | +| `source_type` | [shared.SourceType](../../models/shared/sourcetype.md) | :heavy_check_mark: | The type of platform of the connection. | Accounting | +| `platform_name` | *str* | :heavy_check_mark: | Name of integration connected to company. | | +| `link_url` | *str* | :heavy_check_mark: | The link URL your customers can use to authorize access to their business application. | https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/2e2eb431-c1fa-4dc9-93fa-d29781c12bcd/start | +| `status` | [shared.DataConnectionStatus](../../models/shared/dataconnectionstatus.md) | :heavy_check_mark: | The current authorization status of the data connection. | | +| `created` | *str* | :heavy_check_mark: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

```
2020-10-08T22:40:50Z
2021-01-01T00:00:00
```



When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information:

- Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z`
- Unqualified local time: `2021-11-15T01:00:00`
- UTC time offsets: `2021-11-15T01:00:00-05:00`

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | +| `last_sync` | *Optional[str]* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

```
2020-10-08T22:40:50Z
2021-01-01T00:00:00
```



When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information:

- Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z`
- Unqualified local time: `2021-11-15T01:00:00`
- UTC time offsets: `2021-11-15T01:00:00-05:00`

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | +| `data_connection_errors` | List[[shared.DataConnectionError](../../models/shared/dataconnectionerror.md)] | :heavy_minus_sign: | N/A | | +| `connection_info` | Dict[str, *str*] | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/connections.md b/sync-for-payables/docs/models/shared/connections.md new file mode 100644 index 000000000..c46f06c8b --- /dev/null +++ b/sync-for-payables/docs/models/shared/connections.md @@ -0,0 +1,12 @@ +# Connections + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `page_number` | *int* | :heavy_check_mark: | Current page number. | | +| `page_size` | *int* | :heavy_check_mark: | Number of items to return in results array. | | +| `total_results` | *int* | :heavy_check_mark: | Total number of items. | | +| `links` | [shared.Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} | +| `results` | List[[shared.Connection](../../models/shared/connection.md)] | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/dataconnectionerror.md b/sync-for-payables/docs/models/shared/dataconnectionerror.md new file mode 100644 index 000000000..32a286044 --- /dev/null +++ b/sync-for-payables/docs/models/shared/dataconnectionerror.md @@ -0,0 +1,13 @@ +# DataConnectionError + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `status_code` | *Optional[str]* | :heavy_minus_sign: | The HTTP status code returned by the source platform when the error occurred. | | +| `status_text` | *Optional[str]* | :heavy_minus_sign: | A non-numeric status code/text returned by the source platform when the error occurred. | | +| `error_message` | *Optional[str]* | :heavy_minus_sign: | A message about a error returned by Codat. | | +| `errored_on_utc` | *Optional[str]* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

```
2020-10-08T22:40:50Z
2021-01-01T00:00:00
```



When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information:

- Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z`
- Unqualified local time: `2021-11-15T01:00:00`
- UTC time offsets: `2021-11-15T01:00:00-05:00`

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | +| `status` | [OptionalNullable[shared.ErrorStatus]](../../models/shared/errorstatus.md) | :heavy_minus_sign: | The current status of a transient error. Null statuses indicate that the error is not transient. | | +| `resolved_on_utc` | *Optional[str]* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

```
2020-10-08T22:40:50Z
2021-01-01T00:00:00
```



When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information:

- Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z`
- Unqualified local time: `2021-11-15T01:00:00`
- UTC time offsets: `2021-11-15T01:00:00-05:00`

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/dataconnectionstatus.md b/sync-for-payables/docs/models/shared/dataconnectionstatus.md new file mode 100644 index 000000000..4e79f5d5a --- /dev/null +++ b/sync-for-payables/docs/models/shared/dataconnectionstatus.md @@ -0,0 +1,13 @@ +# DataConnectionStatus + +The current authorization status of the data connection. + + +## Values + +| Name | Value | +| -------------- | -------------- | +| `PENDING_AUTH` | PendingAuth | +| `LINKED` | Linked | +| `UNLINKED` | Unlinked | +| `DEAUTHORIZED` | Deauthorized | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/errorstatus.md b/sync-for-payables/docs/models/shared/errorstatus.md new file mode 100644 index 000000000..02c0ec3d9 --- /dev/null +++ b/sync-for-payables/docs/models/shared/errorstatus.md @@ -0,0 +1,11 @@ +# ErrorStatus + +The current status of a transient error. Null statuses indicate that the error is not transient. + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `ACTIVE` | Active | +| `RESOLVED` | Resolved | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/errorvalidation.md b/sync-for-payables/docs/models/shared/errorvalidation.md new file mode 100644 index 000000000..122badd9d --- /dev/null +++ b/sync-for-payables/docs/models/shared/errorvalidation.md @@ -0,0 +1,11 @@ +# ErrorValidation + +A human-readable object describing validation decisions Codat has made. If an operation has failed because of validation errors, they will be detailed here. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `errors` | List[[shared.ErrorValidationItem](../../models/shared/errorvalidationitem.md)] | :heavy_minus_sign: | N/A | +| `warnings` | List[[shared.ErrorValidationItem](../../models/shared/errorvalidationitem.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/errorvalidationitem.md b/sync-for-payables/docs/models/shared/errorvalidationitem.md new file mode 100644 index 000000000..fca2ef14a --- /dev/null +++ b/sync-for-payables/docs/models/shared/errorvalidationitem.md @@ -0,0 +1,10 @@ +# ErrorValidationItem + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | +| `item_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Unique identifier for a validation item. | +| `message` | *OptionalNullable[str]* | :heavy_minus_sign: | A message outlining validation item's issue. | +| `validator_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of validator. | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/halref.md b/sync-for-payables/docs/models/shared/halref.md new file mode 100644 index 000000000..94c6476ff --- /dev/null +++ b/sync-for-payables/docs/models/shared/halref.md @@ -0,0 +1,8 @@ +# HalRef + + +## Fields + +| Field | Type | Required | Description | +| ------------------------ | ------------------------ | ------------------------ | ------------------------ | +| `href` | *Optional[str]* | :heavy_minus_sign: | Uri hypertext reference. | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/links.md b/sync-for-payables/docs/models/shared/links.md new file mode 100644 index 000000000..6bbcdd92a --- /dev/null +++ b/sync-for-payables/docs/models/shared/links.md @@ -0,0 +1,11 @@ +# Links + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `self_` | [shared.HalRef](../../models/shared/halref.md) | :heavy_check_mark: | N/A | +| `current` | [shared.HalRef](../../models/shared/halref.md) | :heavy_check_mark: | N/A | +| `next` | [Optional[shared.HalRef]](../../models/shared/halref.md) | :heavy_minus_sign: | N/A | +| `previous` | [Optional[shared.HalRef]](../../models/shared/halref.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/pagination.md b/sync-for-payables/docs/models/shared/pagination.md new file mode 100644 index 000000000..efde183b2 --- /dev/null +++ b/sync-for-payables/docs/models/shared/pagination.md @@ -0,0 +1,8 @@ +# Pagination + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `continuation_token` | *Optional[str]* | :heavy_minus_sign: | A continuation token indicating there are more results to be fetched. Supply this value in the `continuationToken` query parameter in the next request to fetch the next set of results. Once no more results are available, the continuation token will not be present in the response. | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/paymentmappingoptions.md b/sync-for-payables/docs/models/shared/paymentmappingoptions.md new file mode 100644 index 000000000..9a75848b1 --- /dev/null +++ b/sync-for-payables/docs/models/shared/paymentmappingoptions.md @@ -0,0 +1,11 @@ +# PaymentMappingOptions + +Gets the bill payments mapping options for a company's accounting software + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `bank_accounts` | List[[shared.BankAccountMappingOption](../../models/shared/bankaccountmappingoption.md)] | :heavy_minus_sign: | N/A | +| `pagination` | [Optional[shared.Pagination]](../../models/shared/pagination.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/security.md b/sync-for-payables/docs/models/shared/security.md new file mode 100644 index 000000000..2b68bd0e7 --- /dev/null +++ b/sync-for-payables/docs/models/shared/security.md @@ -0,0 +1,8 @@ +# Security + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------ | ------------------------------ | ------------------------------ | ------------------------------ | ------------------------------ | +| `auth_header` | *str* | :heavy_check_mark: | N/A | Basic BASE_64_ENCODED(API_KEY) | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/sourcetype.md b/sync-for-payables/docs/models/shared/sourcetype.md new file mode 100644 index 000000000..2daec8ef3 --- /dev/null +++ b/sync-for-payables/docs/models/shared/sourcetype.md @@ -0,0 +1,16 @@ +# SourceType + +The type of platform of the connection. + + +## Values + +| Name | Value | +| ------------ | ------------ | +| `ACCOUNTING` | Accounting | +| `BANKING` | Banking | +| `BANK_FEED` | BankFeed | +| `COMMERCE` | Commerce | +| `EXPENSE` | Expense | +| `OTHER` | Other | +| `UNKNOWN` | Unknown | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/supplier.md b/sync-for-payables/docs/models/shared/supplier.md new file mode 100644 index 000000000..d6ed6d8d3 --- /dev/null +++ b/sync-for-payables/docs/models/shared/supplier.md @@ -0,0 +1,22 @@ +# Supplier + +Suppliers are people or organizations that provide something, such as a product or service. Use the [List suppliers](https://docs.codat.io/sync-for-payables-v2-api#/operations/list-suppliers) endpoint to retrieve a list of all suppliers for a company. + +Suppliers' data links to accounts payable [bills](https://docs.codat.io/sync-for-payables-v2-api#/schemas/Bill). + + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the supplier, unique to the company in the accounting software. | | +| `supplier_name` | *Optional[str]* | :heavy_minus_sign: | Name of the supplier as recorded in the accounting system, typically the company name. | | +| `contact_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the main contact for the supplier. | | +| `email_address` | *OptionalNullable[str]* | :heavy_minus_sign: | Email address that the supplier may be contacted on. | | +| `phone` | *OptionalNullable[str]* | :heavy_minus_sign: | Phone number that the supplier may be contacted on. | +44 25691 154789 | +| `addresses` | List[[shared.Address](../../models/shared/address.md)] | :heavy_minus_sign: | An array of Addresses. | | +| `status` | [Optional[shared.SupplierStatus]](../../models/shared/supplierstatus.md) | :heavy_minus_sign: | Status of the supplier. | | +| `balance` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount outstanding against the supplier. | | +| `default_currency` | *OptionalNullable[str]* | :heavy_minus_sign: | Default currency the supplier's transactional data is recorded in. | | +| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/supplierprototype.md b/sync-for-payables/docs/models/shared/supplierprototype.md new file mode 100644 index 000000000..2e549e1b4 --- /dev/null +++ b/sync-for-payables/docs/models/shared/supplierprototype.md @@ -0,0 +1,15 @@ +# SupplierPrototype + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `supplier_name` | *str* | :heavy_check_mark: | Name of the supplier as recorded in the accounting system, typically the company name. | | +| `status` | [shared.SupplierStatus](../../models/shared/supplierstatus.md) | :heavy_check_mark: | Status of the supplier. | | +| `contact_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the main contact for the supplier. | | +| `email_address` | *OptionalNullable[str]* | :heavy_minus_sign: | Email address that the supplier may be contacted on. | | +| `phone` | *OptionalNullable[str]* | :heavy_minus_sign: | Phone number that the supplier may be contacted on. | +44 25691 154789 | +| `addresses` | List[[shared.Address](../../models/shared/address.md)] | :heavy_minus_sign: | An array of Addresses. | | +| `balance` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount outstanding against the supplier. | | +| `default_currency` | *OptionalNullable[str]* | :heavy_minus_sign: | Default currency the supplier's transactional data is recorded in. | | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/supplierref.md b/sync-for-payables/docs/models/shared/supplierref.md new file mode 100644 index 000000000..9ac54781a --- /dev/null +++ b/sync-for-payables/docs/models/shared/supplierref.md @@ -0,0 +1,11 @@ +# SupplierRef + +Reference to the supplier the record relates to. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------ | ------------------------ | ------------------------ | ------------------------ | +| `id` | *str* | :heavy_check_mark: | The supplier's unique ID | +| `supplier_name` | *OptionalNullable[str]* | :heavy_minus_sign: | The supplier's name | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/suppliers.md b/sync-for-payables/docs/models/shared/suppliers.md new file mode 100644 index 000000000..e7cd13438 --- /dev/null +++ b/sync-for-payables/docs/models/shared/suppliers.md @@ -0,0 +1,9 @@ +# Suppliers + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | +| `results` | List[[shared.Supplier](../../models/shared/supplier.md)] | :heavy_minus_sign: | N/A | +| `pagination` | [Optional[shared.Pagination]](../../models/shared/pagination.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/supplierstatus.md b/sync-for-payables/docs/models/shared/supplierstatus.md new file mode 100644 index 000000000..0374ea9e0 --- /dev/null +++ b/sync-for-payables/docs/models/shared/supplierstatus.md @@ -0,0 +1,12 @@ +# SupplierStatus + +Status of the supplier. + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `UNKNOWN` | Unknown | +| `ACTIVE` | Active | +| `ARCHIVED` | Archived | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/tags.md b/sync-for-payables/docs/models/shared/tags.md new file mode 100644 index 000000000..6de993aa8 --- /dev/null +++ b/sync-for-payables/docs/models/shared/tags.md @@ -0,0 +1,9 @@ +# Tags + +A collection of user-defined key-value pairs that store custom metadata against the company. + + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/taxratemappingoption.md b/sync-for-payables/docs/models/shared/taxratemappingoption.md new file mode 100644 index 000000000..3d41d0365 --- /dev/null +++ b/sync-for-payables/docs/models/shared/taxratemappingoption.md @@ -0,0 +1,13 @@ +# TaxRateMappingOption + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the tax rate, unique for the company in the accounting software. | d2939064-dd3a-4c0f-9865-a238c2193515 | +| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Codat-augmented name of the tax rate in the accounting software. | | +| `code` | *OptionalNullable[str]* | :heavy_minus_sign: | Code for the tax rate from the accounting software. | | +| `effective_tax_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | See Effective tax rates description. | | +| `total_tax_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Total (not compounded) sum of the components of a tax rate. | | +| `status` | [Optional[shared.TaxRateStatus]](../../models/shared/taxratestatus.md) | :heavy_minus_sign: | Status of the tax rate in the accounting software.
- `Active` - An active tax rate in use by a company.
- `Archived` - A tax rate that has been archived or is inactive in the accounting software. | | \ No newline at end of file diff --git a/sync-for-payables/docs/models/shared/taxratestatus.md b/sync-for-payables/docs/models/shared/taxratestatus.md new file mode 100644 index 000000000..dbdebfe1b --- /dev/null +++ b/sync-for-payables/docs/models/shared/taxratestatus.md @@ -0,0 +1,13 @@ +# TaxRateStatus + +Status of the tax rate in the accounting software. +- `Active` - An active tax rate in use by a company. +- `Archived` - A tax rate that has been archived or is inactive in the accounting software. + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `ACTIVE` | Active | +| `ARCHIVED` | Archived | \ No newline at end of file diff --git a/sync-for-payables/docs/models/utils/retryconfig.md b/sync-for-payables/docs/models/utils/retryconfig.md new file mode 100644 index 000000000..69dd549ec --- /dev/null +++ b/sync-for-payables/docs/models/utils/retryconfig.md @@ -0,0 +1,24 @@ +# RetryConfig + +Allows customizing the default retry configuration. Only usable with methods that mention they support retries. + +## Fields + +| Name | Type | Description | Example | +| ------------------------- | ----------------------------------- | --------------------------------------- | --------- | +| `strategy` | `*str*` | The retry strategy to use. | `backoff` | +| `backoff` | [BackoffStrategy](#backoffstrategy) | Configuration for the backoff strategy. | | +| `retry_connection_errors` | `*bool*` | Whether to retry on connection errors. | `true` | + +## BackoffStrategy + +The backoff strategy allows retrying a request with an exponential backoff between each retry. + +### Fields + +| Name | Type | Description | Example | +| ------------------ | --------- | ----------------------------------------- | -------- | +| `initial_interval` | `*int*` | The initial interval in milliseconds. | `500` | +| `max_interval` | `*int*` | The maximum interval in milliseconds. | `60000` | +| `exponent` | `*float*` | The exponent to use for the backoff. | `1.5` | +| `max_elapsed_time` | `*int*` | The maximum elapsed time in milliseconds. | `300000` | \ No newline at end of file diff --git a/sync-for-payables/docs/sdks/bankaccounts/README.md b/sync-for-payables/docs/sdks/bankaccounts/README.md new file mode 100644 index 000000000..c9e3c4613 --- /dev/null +++ b/sync-for-payables/docs/sdks/bankaccounts/README.md @@ -0,0 +1,65 @@ +# BankAccounts +(*bank_accounts*) + +## Overview + +Create a bank account for a given company's connection. + +### Available Operations + +* [create](#create) - Create bank account + +## create + +The *Create bank account* endpoint creates a new [bank account](https://docs.codat.io/sync-for-payables-api#/schemas/BankAccount) for a given company's connection. + +[Bank accounts](https://docs.codat.io/sync-for-payables-api#/schemas/BankAccount) are financial accounts maintained by a bank or other financial institution. + +### Example Usage + +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared + +s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +res = s.bank_accounts.create(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "bank_account_prototype": { + "name": "Plutus - Payables - Bank Account 12", + "account_type": shared.AccountType.DEBIT, + "account_number": "0120 0440", + "currency": "GBP", + "nominal_code": "22", + "sort_code": "50-50-50", + }, +}) + +if res is not None: + # handle response + pass + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `request` | [operations.CreateBankAccountRequest](../../models/operations/createbankaccountrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[shared.BankAccount](../../models/shared/bankaccount.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/sync-for-payables/docs/sdks/billpayments/README.md b/sync-for-payables/docs/sdks/billpayments/README.md new file mode 100644 index 000000000..693147336 --- /dev/null +++ b/sync-for-payables/docs/sdks/billpayments/README.md @@ -0,0 +1,120 @@ +# BillPayments +(*bill_payments*) + +## Overview + +Get, create, and update Bill payments. + +### Available Operations + +* [get_payment_options](#get_payment_options) - Get payment mapping options +* [create](#create) - Create bill payment + +## get_payment_options + +Use the *Get mapping options - Payments* endpoint to return a list of available mapping options for a given company's connection ID. + +By default, this endpoint returns a list of active bank accounts. You can use [querying](https://docs.codat.io/using-the-api/querying) to change that. + +Mapping options are a set of bank accounts used to configure the SMB's payables integration. + +### Example Usage + +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared + +s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +res = s.bill_payments.get_payment_options(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "continuation_token": "continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ==", + "status_query": "status=Archived", +}) + +if res is not None: + # handle response + pass + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | +| `request` | [operations.GetMappingOptionsPaymentsRequest](../../models/operations/getmappingoptionspaymentsrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[shared.PaymentMappingOptions](../../models/shared/paymentmappingoptions.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## create + +The *Create bill payment* endpoint creates a new [bill payment](https://docs.codat.io/sync-for-payables-api#/schemas/BillPayment) for a given company's connection. + +[Bill payments](https://docs.codat.io/sync-for-payables-api#/schemas/BillPayment) are an allocation of money within any Accounts Payable account. + +### Example Usage + +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared +from decimal import Decimal + +s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +res = s.bill_payments.create(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "bill_id": "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2", + "bill_payment_prototype": { + "amount": Decimal("22"), + "date_": "2022-10-23T00:00:00.000Z", + "account_ref": { + "id": "7bda9f44sr56", + }, + "reference": "Bill Payment against bill c13e37b6 dfaa-4894-b3be-9fe97bda9f44", + "currency_rate": Decimal("1"), + }, +}) + +if res is not None: + # handle response + pass + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `request` | [operations.CreateBillPaymentRequest](../../models/operations/createbillpaymentrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[shared.BillPayment](../../models/shared/billpayment.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 409, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/sync-for-payables/docs/sdks/bills/README.md b/sync-for-payables/docs/sdks/bills/README.md new file mode 100644 index 000000000..33e8090ca --- /dev/null +++ b/sync-for-payables/docs/sdks/bills/README.md @@ -0,0 +1,360 @@ +# Bills +(*bills*) + +## Overview + +Get, create, and update Bills. + +### Available Operations + +* [get_bill_options](#get_bill_options) - Get bill mapping options +* [list](#list) - List bills +* [create](#create) - Create bill +* [upload_attachment](#upload_attachment) - Upload bill attachment +* [list_attachments](#list_attachments) - List bill attachments +* [download_attachment](#download_attachment) - Download bill attachment + +## get_bill_options + +Use the *Get mapping options - Bills* endpoint to return a list of available mapping options for a given company's connection ID. + +By default, this endpoint returns a list of active accounts and tax rates. You can use [querying](https://docs.codat.io/using-the-api/querying) to change that. + +Mapping options are a set of accounts and tax rates used to configure the SMB's payables integration. + +### Example Usage + +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared + +s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +res = s.bills.get_bill_options(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "continuation_token": "continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ==", + "status_query": "status=Archived", +}) + +if res is not None: + # handle response + pass + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `request` | [operations.GetMappingOptionsBillsRequest](../../models/operations/getmappingoptionsbillsrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[shared.BillMappingOptions](../../models/shared/billmappingoptions.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## list + +The *List bills* endpoint returns a list of [bills](https://docs.codat.io/sync-for-payables-api#/schemas/Bill) for a given company's connection. + +[Bills](https://docs.codat.io/sync-for-payables-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. + +By default, the endpoint will return all bills with a status of 'Open' & 'PartiallyPaid' to show all oustanding bills. + +### Example Usage + +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared + +s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +res = s.bills.list(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "continuation_token": "continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ==", + "query": "status=Open", +}) + +if res is not None: + # handle response + pass + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `request` | [operations.ListBillsRequest](../../models/operations/listbillsrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[shared.Bills](../../models/shared/bills.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 409, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## create + +The *Create bill* endpoint creates a new [bill](https://docs.codat.io/sync-for-payables-api#/schemas/Bill) for a given company's connection. + +[Bills](https://docs.codat.io/sync-for-payables-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. + +### Example Usage + +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared +from decimal import Decimal + +s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +res = s.bills.create(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "bill_prototype": { + "supplier_ref": { + "id": "1262c350-fe0f-40ec-aeff-41c95b4a45af", + "supplier_name": "DIISR - Small Business Services", + }, + "issue_date": "2023-04-23T00:00:00", + "due_date": "2023-04-23T00:00:00", + "currency": "GBP", + "status": shared.BillStatus.OPEN, + "reference": "bill_b8qmmj4ksf1suax", + "currency_rate": Decimal("1"), + "line_items": [ + { + "unit_amount": Decimal("1800"), + "quantity": Decimal("1"), + "account_ref": { + "id": "46f9461e-788b-4906-8b74-d1ea17f6dc10", + }, + "tax_rate_ref": { + "id": "INPUT2", + }, + "description": "Half day training - Microsoft Office", + "tax_amount": Decimal("360"), + "total_amount": Decimal("2160"), + }, + { + "unit_amount": Decimal("4000"), + "quantity": Decimal("1"), + "account_ref": { + "id": "f96c9458-d724-47bf-8f74-a9d5726465ce", + }, + "tax_rate_ref": { + "id": "INPUT2", + }, + "description": "Desktop/network support via email & phone.Per month fixed fee for minimum 20 hours/month.", + "tax_amount": Decimal("800"), + "total_amount": Decimal("4800"), + }, + { + "unit_amount": Decimal("32"), + "quantity": Decimal("8"), + "account_ref": { + "id": "cba6527d-f102-4538-b421-e483233e9d5a", + }, + "tax_rate_ref": { + "id": "INPUT2", + }, + "description": "Stationery charges", + "tax_amount": Decimal("51.2"), + "total_amount": Decimal("307.2"), + }, + ], + }, +}) + +if res is not None: + # handle response + pass + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `request` | [operations.CreateBillRequest](../../models/operations/createbillrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[shared.Bill](../../models/shared/bill.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 409, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## upload_attachment + +The *Upload bill attachment* endpoint uploads an attachment and assigns it against a specific `billId`. + +[Bills](https://docs.codat.io/sync-for-payables-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. + +### Example Usage + +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared + +s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +s.bills.upload_attachment(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "bill_id": "EILBDVJVNUAGVKRQ", +}) + +# Use the SDK ... + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `request` | [operations.UploadBillAttachmentRequest](../../models/operations/uploadbillattachmentrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## list_attachments + +The *List bill attachments* endpoint returns a list of attachments available to download for a given `billId`. + +[Bills](https://docs.codat.io/sync-for-payables-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. + +### Example Usage + +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared + +s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +res = s.bills.list_attachments(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "bill_id": "EILBDVJVNUAGVKRQ", +}) + +if res is not None: + # handle response + pass + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `request` | [operations.ListBillAttachmentsRequest](../../models/operations/listbillattachmentsrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[shared.Attachment](../../models/shared/attachment.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 409, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## download_attachment + +The *Download bill attachment* endpoint downloads a specific attachment for a given `billId` and `attachmentId`. + +[Bills](https://docs.codat.io/sync-for-payables-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. + +Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=bills) for integrations that support downloading a bill attachment. + + +### Example Usage + +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared + +s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +res = s.bills.download_attachment(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "bill_id": "EILBDVJVNUAGVKRQ", + "attachment_id": "8a210b68-6988-11ed-a1eb-0242ac120002", +}) + +if res is not None: + # handle response + pass + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `request` | [operations.DownloadBillAttachmentRequest](../../models/operations/downloadbillattachmentrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[httpx.Response](../../models/.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/sync-for-payables/docs/sdks/codatsyncpayables/README.md b/sync-for-payables/docs/sdks/codatsyncpayables/README.md new file mode 100644 index 000000000..c26eaa375 --- /dev/null +++ b/sync-for-payables/docs/sdks/codatsyncpayables/README.md @@ -0,0 +1,24 @@ +# CodatSyncPayables SDK + +## Overview + +Bill pay kit: The API reference for the Bill Pay kit. + +The bill pay kit is an API and a set of supporting tools designed to integrate a bill pay flow into your app as quickly as possible. It's ideal for facilitating essential bill payment processes within your SMB's accounting software. + +[Explore product](https://docs.codat.io/payables/bill-pay-kit) | [See OpenAPI spec](https://github.com/codatio/oas) + +--- + +## Endpoints + +| Endpoints | Description | +| :- |:- | +| Companies | Create and manage your SMB users' companies. | +| Connections | Create new and manage existing data connections for a company. | +| Company information | View company profile from the source platform. | +| Bills | Get, create, and update Bills. | +| Bill payments | Get, create, and update Bill payments. | +| Suppliers | Get, create, and update Suppliers. | +| Bank accounts | Create a bank account for a given company's connection. | + \ No newline at end of file diff --git a/sync-for-payables/docs/sdks/companies/README.md b/sync-for-payables/docs/sdks/companies/README.md new file mode 100644 index 000000000..87ba4180c --- /dev/null +++ b/sync-for-payables/docs/sdks/companies/README.md @@ -0,0 +1,255 @@ +# Companies +(*companies*) + +## Overview + +Create and manage your SMB users' companies. + +### Available Operations + +* [list](#list) - List companies +* [create](#create) - Create company +* [update](#update) - Update company +* [delete](#delete) - Delete a company +* [get](#get) - Get company + +## list + +The *List companies* endpoint returns a list of [companies] associated to your instances. + +A [company](https://docs.codat.io/sync-for-payables-api#/schemas/Company) represents a business sharing access to their data. +Each company can have multiple [connections](https://docs.codat.io/sync-for-payables-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data. + +### Example Usage + +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared + +s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +res = s.companies.list(request={ + "page": 1, + "page_size": 100, + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + "order_by": "-modifiedDate", +}) + +if res is not None: + # handle response + pass + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `request` | [operations.ListCompaniesRequest](../../models/operations/listcompaniesrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[shared.Companies](../../models/shared/companies.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## create + +Use the *Create company* endpoint to create a new [company](https://docs.codat.io/sync-for-payables-api#/schemas/Company) that represents your customer in Codat. + +A [company](https://docs.codat.io/sync-for-payables-api#/schemas/Company) represents a business sharing access to their data. +Each company can have multiple [connections](https://docs.codat.io/sync-for-payables-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data. + +If forbidden characters (see `name` pattern) are present in the request, a company will be created with the forbidden characters removed. For example, `Company (Codat[1])` with be created as `Company Codat1`. + +### Example Usage + +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared + +s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +res = s.companies.create(request={ + "name": "Technicalium", + "description": "Requested early access to the new financing scheme.", +}) + +if res is not None: + # handle response + pass + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `request` | [shared.CompanyRequestBody](../../models/shared/companyrequestbody.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[shared.Company](../../models/shared/company.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## update + +Use the *Update company* endpoint to update both the name and description of the company. + +A [company](https://docs.codat.io/sync-for-payables-api#/schemas/Company) represents a business sharing access to their data. +Each company can have multiple [connections](https://docs.codat.io/sync-for-payables-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data. + +### Example Usage + +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared + +s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +res = s.companies.update(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "company_request_body": { + "name": "New Name", + "description": "Requested early access to the new financing scheme.", + }, +}) + +if res is not None: + # handle response + pass + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `request` | [operations.UpdateCompanyRequest](../../models/operations/updatecompanyrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[shared.Company](../../models/shared/company.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## delete + +The *Delete company* endpoint permanently deletes a [company](https://docs.codat.io/sync-for-payables-api#/schemas/Company), its [connections](https://docs.codat.io/sync-for-payables-api#/schemas/Connection) and any cached data. This operation is irreversible. + +A [company](https://docs.codat.io/sync-for-payables-api#/schemas/Company) represents a business sharing access to their data. +Each company can have multiple [connections](https://docs.codat.io/sync-for-payables-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data. + + +### Example Usage + +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared + +s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +s.companies.delete(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", +}) + +# Use the SDK ... + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `request` | [operations.DeleteCompanyRequest](../../models/operations/deletecompanyrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## get + +The *Get company* endpoint returns a single company for a given `companyId`. + +A [company](https://docs.codat.io/sync-for-payables-api#/schemas/Company) represents a business sharing access to their data. +Each company can have multiple [connections](https://docs.codat.io/sync-for-payables-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data. + + +### Example Usage + +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared + +s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +res = s.companies.get(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", +}) + +if res is not None: + # handle response + pass + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `request` | [operations.GetCompanyRequest](../../models/operations/getcompanyrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[shared.Company](../../models/shared/company.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/sync-for-payables/docs/sdks/companyinformation/README.md b/sync-for-payables/docs/sdks/companyinformation/README.md new file mode 100644 index 000000000..83422c631 --- /dev/null +++ b/sync-for-payables/docs/sdks/companyinformation/README.md @@ -0,0 +1,57 @@ +# CompanyInformation +(*company_information*) + +## Overview + +View company profile from the source platform. + +### Available Operations + +* [get](#get) - Get company information + +## get + +Use the *Get company information* endpoint to return information about the company available from the underlying accounting software. + + + +### Example Usage + +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared + +s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +res = s.company_information.get(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", +}) + +if res is not None: + # handle response + pass + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `request` | [operations.GetCompanyInformationRequest](../../models/operations/getcompanyinformationrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[shared.CompanyInformation](../../models/shared/companyinformation.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/sync-for-payables/docs/sdks/connections/README.md b/sync-for-payables/docs/sdks/connections/README.md new file mode 100644 index 000000000..50aaf68da --- /dev/null +++ b/sync-for-payables/docs/sdks/connections/README.md @@ -0,0 +1,244 @@ +# Connections +(*connections*) + +## Overview + +Create new and manage existing data connections for a company. + +### Available Operations + +* [list](#list) - List connections +* [create](#create) - Create connection +* [get](#get) - Get connection +* [delete](#delete) - Delete connection +* [unlink](#unlink) - Unlink connection + +## list + +List the connections for a company. + +### Example Usage + +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared + +s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +res = s.connections.list(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "page": 1, + "page_size": 100, + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + "order_by": "-modifiedDate", +}) + +if res is not None: + # handle response + pass + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `request` | [operations.ListConnectionsRequest](../../models/operations/listconnectionsrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[shared.Connections](../../models/shared/connections.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## create + +Creates a connection for the company by providing a valid `platformKey`. + +Use the [List Integrations](https://docs.codat.io/sync-for-payables-api#/operations/list-integrations) endpoint to access valid platform keys. + +### Example Usage + +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared + +s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +res = s.connections.create(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "request_body": { + "platform_key": "gbol", + }, +}) + +if res is not None: + # handle response + pass + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `request` | [operations.CreateConnectionRequest](../../models/operations/createconnectionrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[shared.Connection](../../models/shared/connection.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## get + +Returns a specific connection for a company when valid identifiers are provided. If the identifiers are for a deleted company and/or connection, a not found response is returned. + +### Example Usage + +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared + +s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +res = s.connections.get(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", +}) + +if res is not None: + # handle response + pass + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `request` | [operations.GetConnectionRequest](../../models/operations/getconnectionrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[shared.Connection](../../models/shared/connection.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## delete + +Revoke and remove a connection from a company. +This operation is not reversible. The end user would need to reauthorize a new data connection if you wish to view new data for this company. + +### Example Usage + +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared + +s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +s.connections.delete(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", +}) + +# Use the SDK ... + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `request` | [operations.DeleteConnectionRequest](../../models/operations/deleteconnectionrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## unlink + +This allows you to deauthorize a connection, without deleting it from Codat. This means you can still view any data that has previously been pulled into Codat, and also lets you re-authorize in future if your customer wishes to resume sharing their data. + +### Example Usage + +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared + +s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +res = s.connections.unlink(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "request_body": { + "status": shared.DataConnectionStatus.UNLINKED, + }, +}) + +if res is not None: + # handle response + pass + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `request` | [operations.UnlinkConnectionRequest](../../models/operations/unlinkconnectionrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[shared.Connection](../../models/shared/connection.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/sync-for-payables/docs/sdks/suppliers/README.md b/sync-for-payables/docs/sdks/suppliers/README.md new file mode 100644 index 000000000..f88db33b2 --- /dev/null +++ b/sync-for-payables/docs/sdks/suppliers/README.md @@ -0,0 +1,131 @@ +# Suppliers +(*suppliers*) + +## Overview + +Get, create, and update Suppliers. + +### Available Operations + +* [list](#list) - List suppliers +* [create](#create) - Create supplier + +## list + +The *List suppliers* endpoint returns a list of [suppliers](https://docs.codat.io/sync-for-payables-api#/schemas/Supplier) for a given company's connection. + +[Suppliers](https://docs.codat.io/sync-for-payables-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service. + +By default, this endpoint returns a list of active and archived suppliers. You can use [querying](https://docs.codat.io/using-the-api/querying) to change that. + +For example, to retrieve only active suppliers (i.e. `status=Active`) or suppliers created within the specified number of days (e.g. `sourceModifiedDate>2023-12-15T00:00:00.000Z`), query the endpoint as follows: `/payables/suppliers?query=sourceModifiedDate>2023-12-15T00:00:00.000Z&&status=Active`.For example, to retrieve active suppliers modified after a particular date use `query=sourceModifiedDate>2023-12-15T00:00:00.000Z&&status=Active`. + +### Example Usage + +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared + +s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +res = s.suppliers.list(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "continuation_token": "continuationToken=eyJwYWdlIjoyLCJwYWdlU2l6ZSI6MTAwLCJwYWdlQ291bnQiOjExfQ==", + "query": "sourceModifiedDate>2023-12-15T00:00:00.000Z", +}) + +if res is not None: + # handle response + pass + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `request` | [operations.ListSuppliersRequest](../../models/operations/listsuppliersrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[shared.Suppliers](../../models/shared/suppliers.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 409, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## create + +The *Create supplier* endpoint creates a new [supplier](https://docs.codat.io/sync-for-payables-api#/schemas/Supplier) for a given company's connection. + +[Suppliers](https://docs.codat.io/sync-for-payables-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service. + + +### Example Usage + +```python +from codat_sync_for_payables import CodatSyncPayables +from codat_sync_for_payables.models import shared + +s = CodatSyncPayables( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) + +res = s.suppliers.create(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "supplier_prototype": { + "supplier_name": "Greggs", + "status": shared.SupplierStatus.ACTIVE, + "contact_name": "Greg Greggs", + "email_address": "greg@greggs.com", + "phone": "+44 (0)1223 322410", + "addresses": [ + { + "type": shared.AddressType.BILLING, + "line1": "Flat 1", + "line2": "2 Dennis Avenue", + "city": "London", + "region": "Camden", + "country": "GBR", + "postal_code": "EC1N 7TE", + }, + ], + "default_currency": "GBP", + }, +}) + +if res is not None: + # handle response + pass + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `request` | [operations.CreateSupplierRequest](../../models/operations/createsupplierrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[shared.Supplier](../../models/shared/supplier.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 429, 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/sync-for-payables/poetry.lock b/sync-for-payables/poetry.lock new file mode 100644 index 000000000..2b38ecfe5 --- /dev/null +++ b/sync-for-payables/poetry.lock @@ -0,0 +1,551 @@ +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. + +[[package]] +name = "annotated-types" +version = "0.7.0" +description = "Reusable constraint types to use with typing.Annotated" +optional = false +python-versions = ">=3.8" +files = [ + {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] +typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.9\""} + +[[package]] +name = "anyio" +version = "4.5.2" +description = "High level compatibility layer for multiple asynchronous event loop implementations" +optional = false +python-versions = ">=3.8" +files = [ + {file = "anyio-4.5.2-py3-none-any.whl", hash = "sha256:c011ee36bc1e8ba40e5a81cb9df91925c218fe9b778554e0b56a21e1b5d4716f"}, + {file = "anyio-4.5.2.tar.gz", hash = "sha256:23009af4ed04ce05991845451e11ef02fc7c5ed29179ac9a420e5ad0ac7ddc5b"}, +] + +[package.dependencies] +exceptiongroup = {version = ">=1.0.2", markers = "python_version < \"3.11\""} +idna = ">=2.8" +sniffio = ">=1.1" +typing-extensions = {version = ">=4.1", markers = "python_version < \"3.11\""} + +[package.extras] +doc = ["Sphinx (>=7.4,<8.0)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"] +test = ["anyio[trio]", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "truststore (>=0.9.1)", "uvloop (>=0.21.0b1)"] +trio = ["trio (>=0.26.1)"] + +[[package]] +name = "astroid" +version = "3.2.4" +description = "An abstract syntax tree for Python with inference support." +optional = false +python-versions = ">=3.8.0" +files = [ + {file = "astroid-3.2.4-py3-none-any.whl", hash = "sha256:413658a61eeca6202a59231abb473f932038fbcbf1666587f66d482083413a25"}, + {file = "astroid-3.2.4.tar.gz", hash = "sha256:0e14202810b30da1b735827f78f5157be2bbd4a7a59b7707ca0bfc2fb4c0063a"}, +] + +[package.dependencies] +typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.11\""} + +[[package]] +name = "certifi" +version = "2024.8.30" +description = "Python package for providing Mozilla's CA Bundle." +optional = false +python-versions = ">=3.6" +files = [ + {file = "certifi-2024.8.30-py3-none-any.whl", hash = "sha256:922820b53db7a7257ffbda3f597266d435245903d80737e34f8a45ff3e3230d8"}, + {file = "certifi-2024.8.30.tar.gz", hash = "sha256:bec941d2aa8195e248a60b31ff9f0558284cf01a52591ceda73ea9afffd69fd9"}, +] + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +files = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] + +[[package]] +name = "dill" +version = "0.3.9" +description = "serialize all of Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "dill-0.3.9-py3-none-any.whl", hash = "sha256:468dff3b89520b474c0397703366b7b95eebe6303f108adf9b19da1f702be87a"}, + {file = "dill-0.3.9.tar.gz", hash = "sha256:81aa267dddf68cbfe8029c42ca9ec6a4ab3b22371d1c450abc54422577b4512c"}, +] + +[package.extras] +graph = ["objgraph (>=1.7.2)"] +profile = ["gprof2dot (>=2022.7.29)"] + +[[package]] +name = "eval-type-backport" +version = "0.2.0" +description = "Like `typing._eval_type`, but lets older Python versions use newer typing features." +optional = false +python-versions = ">=3.8" +files = [ + {file = "eval_type_backport-0.2.0-py3-none-any.whl", hash = "sha256:ac2f73d30d40c5a30a80b8739a789d6bb5e49fdffa66d7912667e2015d9c9933"}, + {file = "eval_type_backport-0.2.0.tar.gz", hash = "sha256:68796cfbc7371ebf923f03bdf7bef415f3ec098aeced24e054b253a0e78f7b37"}, +] + +[package.extras] +tests = ["pytest"] + +[[package]] +name = "exceptiongroup" +version = "1.2.2" +description = "Backport of PEP 654 (exception groups)" +optional = false +python-versions = ">=3.7" +files = [ + {file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"}, + {file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"}, +] + +[package.extras] +test = ["pytest (>=6)"] + +[[package]] +name = "h11" +version = "0.14.0" +description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1" +optional = false +python-versions = ">=3.7" +files = [ + {file = "h11-0.14.0-py3-none-any.whl", hash = "sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761"}, + {file = "h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d"}, +] + +[[package]] +name = "httpcore" +version = "1.0.6" +description = "A minimal low-level HTTP client." +optional = false +python-versions = ">=3.8" +files = [ + {file = "httpcore-1.0.6-py3-none-any.whl", hash = "sha256:27b59625743b85577a8c0e10e55b50b5368a4f2cfe8cc7bcfa9cf00829c2682f"}, + {file = "httpcore-1.0.6.tar.gz", hash = "sha256:73f6dbd6eb8c21bbf7ef8efad555481853f5f6acdeaff1edb0694289269ee17f"}, +] + +[package.dependencies] +certifi = "*" +h11 = ">=0.13,<0.15" + +[package.extras] +asyncio = ["anyio (>=4.0,<5.0)"] +http2 = ["h2 (>=3,<5)"] +socks = ["socksio (==1.*)"] +trio = ["trio (>=0.22.0,<1.0)"] + +[[package]] +name = "httpx" +version = "0.27.2" +description = "The next generation HTTP client." +optional = false +python-versions = ">=3.8" +files = [ + {file = "httpx-0.27.2-py3-none-any.whl", hash = "sha256:7bb2708e112d8fdd7829cd4243970f0c223274051cb35ee80c03301ee29a3df0"}, + {file = "httpx-0.27.2.tar.gz", hash = "sha256:f7c2be1d2f3c3c3160d441802406b206c2b76f5947b11115e6df10c6c65e66c2"}, +] + +[package.dependencies] +anyio = "*" +certifi = "*" +httpcore = "==1.*" +idna = "*" +sniffio = "*" + +[package.extras] +brotli = ["brotli", "brotlicffi"] +cli = ["click (==8.*)", "pygments (==2.*)", "rich (>=10,<14)"] +http2 = ["h2 (>=3,<5)"] +socks = ["socksio (==1.*)"] +zstd = ["zstandard (>=0.18.0)"] + +[[package]] +name = "idna" +version = "3.10" +description = "Internationalized Domain Names in Applications (IDNA)" +optional = false +python-versions = ">=3.6" +files = [ + {file = "idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3"}, + {file = "idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9"}, +] + +[package.extras] +all = ["flake8 (>=7.1.1)", "mypy (>=1.11.2)", "pytest (>=8.3.2)", "ruff (>=0.6.2)"] + +[[package]] +name = "isort" +version = "5.13.2" +description = "A Python utility / library to sort Python imports." +optional = false +python-versions = ">=3.8.0" +files = [ + {file = "isort-5.13.2-py3-none-any.whl", hash = "sha256:8ca5e72a8d85860d5a3fa69b8745237f2939afe12dbf656afbcb47fe72d947a6"}, + {file = "isort-5.13.2.tar.gz", hash = "sha256:48fdfcb9face5d58a4f6dde2e72a1fb8dcaf8ab26f95ab49fab84c2ddefb0109"}, +] + +[package.extras] +colors = ["colorama (>=0.4.6)"] + +[[package]] +name = "jsonpath-python" +version = "1.0.6" +description = "A more powerful JSONPath implementation in modern python" +optional = false +python-versions = ">=3.6" +files = [ + {file = "jsonpath-python-1.0.6.tar.gz", hash = "sha256:dd5be4a72d8a2995c3f583cf82bf3cd1a9544cfdabf2d22595b67aff07349666"}, + {file = "jsonpath_python-1.0.6-py3-none-any.whl", hash = "sha256:1e3b78df579f5efc23565293612decee04214609208a2335884b3ee3f786b575"}, +] + +[[package]] +name = "mccabe" +version = "0.7.0" +description = "McCabe checker, plugin for flake8" +optional = false +python-versions = ">=3.6" +files = [ + {file = "mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e"}, + {file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"}, +] + +[[package]] +name = "mypy" +version = "1.10.1" +description = "Optional static typing for Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "mypy-1.10.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e36f229acfe250dc660790840916eb49726c928e8ce10fbdf90715090fe4ae02"}, + {file = "mypy-1.10.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:51a46974340baaa4145363b9e051812a2446cf583dfaeba124af966fa44593f7"}, + {file = "mypy-1.10.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:901c89c2d67bba57aaaca91ccdb659aa3a312de67f23b9dfb059727cce2e2e0a"}, + {file = "mypy-1.10.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:0cd62192a4a32b77ceb31272d9e74d23cd88c8060c34d1d3622db3267679a5d9"}, + {file = "mypy-1.10.1-cp310-cp310-win_amd64.whl", hash = "sha256:a2cbc68cb9e943ac0814c13e2452d2046c2f2b23ff0278e26599224cf164e78d"}, + {file = "mypy-1.10.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:bd6f629b67bb43dc0d9211ee98b96d8dabc97b1ad38b9b25f5e4c4d7569a0c6a"}, + {file = "mypy-1.10.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a1bbb3a6f5ff319d2b9d40b4080d46cd639abe3516d5a62c070cf0114a457d84"}, + {file = "mypy-1.10.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b8edd4e9bbbc9d7b79502eb9592cab808585516ae1bcc1446eb9122656c6066f"}, + {file = "mypy-1.10.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:6166a88b15f1759f94a46fa474c7b1b05d134b1b61fca627dd7335454cc9aa6b"}, + {file = "mypy-1.10.1-cp311-cp311-win_amd64.whl", hash = "sha256:5bb9cd11c01c8606a9d0b83ffa91d0b236a0e91bc4126d9ba9ce62906ada868e"}, + {file = "mypy-1.10.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:d8681909f7b44d0b7b86e653ca152d6dff0eb5eb41694e163c6092124f8246d7"}, + {file = "mypy-1.10.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:378c03f53f10bbdd55ca94e46ec3ba255279706a6aacaecac52ad248f98205d3"}, + {file = "mypy-1.10.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6bacf8f3a3d7d849f40ca6caea5c055122efe70e81480c8328ad29c55c69e93e"}, + {file = "mypy-1.10.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:701b5f71413f1e9855566a34d6e9d12624e9e0a8818a5704d74d6b0402e66c04"}, + {file = "mypy-1.10.1-cp312-cp312-win_amd64.whl", hash = "sha256:3c4c2992f6ea46ff7fce0072642cfb62af7a2484efe69017ed8b095f7b39ef31"}, + {file = "mypy-1.10.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:604282c886497645ffb87b8f35a57ec773a4a2721161e709a4422c1636ddde5c"}, + {file = "mypy-1.10.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:37fd87cab83f09842653f08de066ee68f1182b9b5282e4634cdb4b407266bade"}, + {file = "mypy-1.10.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8addf6313777dbb92e9564c5d32ec122bf2c6c39d683ea64de6a1fd98b90fe37"}, + {file = "mypy-1.10.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:5cc3ca0a244eb9a5249c7c583ad9a7e881aa5d7b73c35652296ddcdb33b2b9c7"}, + {file = "mypy-1.10.1-cp38-cp38-win_amd64.whl", hash = "sha256:1b3a2ffce52cc4dbaeee4df762f20a2905aa171ef157b82192f2e2f368eec05d"}, + {file = "mypy-1.10.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:fe85ed6836165d52ae8b88f99527d3d1b2362e0cb90b005409b8bed90e9059b3"}, + {file = "mypy-1.10.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:c2ae450d60d7d020d67ab440c6e3fae375809988119817214440033f26ddf7bf"}, + {file = "mypy-1.10.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6be84c06e6abd72f960ba9a71561c14137a583093ffcf9bbfaf5e613d63fa531"}, + {file = "mypy-1.10.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:2189ff1e39db399f08205e22a797383613ce1cb0cb3b13d8bcf0170e45b96cc3"}, + {file = "mypy-1.10.1-cp39-cp39-win_amd64.whl", hash = "sha256:97a131ee36ac37ce9581f4220311247ab6cba896b4395b9c87af0675a13a755f"}, + {file = "mypy-1.10.1-py3-none-any.whl", hash = "sha256:71d8ac0b906354ebda8ef1673e5fde785936ac1f29ff6987c7483cfbd5a4235a"}, + {file = "mypy-1.10.1.tar.gz", hash = "sha256:1f8f492d7db9e3593ef42d4f115f04e556130f2819ad33ab84551403e97dd4c0"}, +] + +[package.dependencies] +mypy-extensions = ">=1.0.0" +tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} +typing-extensions = ">=4.1.0" + +[package.extras] +dmypy = ["psutil (>=4.0)"] +install-types = ["pip"] +mypyc = ["setuptools (>=50)"] +reports = ["lxml"] + +[[package]] +name = "mypy-extensions" +version = "1.0.0" +description = "Type system extensions for programs checked with the mypy type checker." +optional = false +python-versions = ">=3.5" +files = [ + {file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"}, + {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, +] + +[[package]] +name = "platformdirs" +version = "4.3.6" +description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`." +optional = false +python-versions = ">=3.8" +files = [ + {file = "platformdirs-4.3.6-py3-none-any.whl", hash = "sha256:73e575e1408ab8103900836b97580d5307456908a03e92031bab39e4554cc3fb"}, + {file = "platformdirs-4.3.6.tar.gz", hash = "sha256:357fb2acbc885b0419afd3ce3ed34564c13c9b95c89360cd9563f73aa5e2b907"}, +] + +[package.extras] +docs = ["furo (>=2024.8.6)", "proselint (>=0.14)", "sphinx (>=8.0.2)", "sphinx-autodoc-typehints (>=2.4)"] +test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=8.3.2)", "pytest-cov (>=5)", "pytest-mock (>=3.14)"] +type = ["mypy (>=1.11.2)"] + +[[package]] +name = "pydantic" +version = "2.9.2" +description = "Data validation using Python type hints" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pydantic-2.9.2-py3-none-any.whl", hash = "sha256:f048cec7b26778210e28a0459867920654d48e5e62db0958433636cde4254f12"}, + {file = "pydantic-2.9.2.tar.gz", hash = "sha256:d155cef71265d1e9807ed1c32b4c8deec042a44a50a4188b25ac67ecd81a9c0f"}, +] + +[package.dependencies] +annotated-types = ">=0.6.0" +pydantic-core = "2.23.4" +typing-extensions = [ + {version = ">=4.6.1", markers = "python_version < \"3.13\""}, + {version = ">=4.12.2", markers = "python_version >= \"3.13\""}, +] + +[package.extras] +email = ["email-validator (>=2.0.0)"] +timezone = ["tzdata"] + +[[package]] +name = "pydantic-core" +version = "2.23.4" +description = "Core functionality for Pydantic validation and serialization" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pydantic_core-2.23.4-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:b10bd51f823d891193d4717448fab065733958bdb6a6b351967bd349d48d5c9b"}, + {file = "pydantic_core-2.23.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:4fc714bdbfb534f94034efaa6eadd74e5b93c8fa6315565a222f7b6f42ca1166"}, + {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:63e46b3169866bd62849936de036f901a9356e36376079b05efa83caeaa02ceb"}, + {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ed1a53de42fbe34853ba90513cea21673481cd81ed1be739f7f2efb931b24916"}, + {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:cfdd16ab5e59fc31b5e906d1a3f666571abc367598e3e02c83403acabc092e07"}, + {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:255a8ef062cbf6674450e668482456abac99a5583bbafb73f9ad469540a3a232"}, + {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4a7cd62e831afe623fbb7aabbb4fe583212115b3ef38a9f6b71869ba644624a2"}, + {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f09e2ff1f17c2b51f2bc76d1cc33da96298f0a036a137f5440ab3ec5360b624f"}, + {file = "pydantic_core-2.23.4-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:e38e63e6f3d1cec5a27e0afe90a085af8b6806ee208b33030e65b6516353f1a3"}, + {file = "pydantic_core-2.23.4-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:0dbd8dbed2085ed23b5c04afa29d8fd2771674223135dc9bc937f3c09284d071"}, + {file = "pydantic_core-2.23.4-cp310-none-win32.whl", hash = "sha256:6531b7ca5f951d663c339002e91aaebda765ec7d61b7d1e3991051906ddde119"}, + {file = "pydantic_core-2.23.4-cp310-none-win_amd64.whl", hash = "sha256:7c9129eb40958b3d4500fa2467e6a83356b3b61bfff1b414c7361d9220f9ae8f"}, + {file = "pydantic_core-2.23.4-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:77733e3892bb0a7fa797826361ce8a9184d25c8dffaec60b7ffe928153680ba8"}, + {file = "pydantic_core-2.23.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:1b84d168f6c48fabd1f2027a3d1bdfe62f92cade1fb273a5d68e621da0e44e6d"}, + {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:df49e7a0861a8c36d089c1ed57d308623d60416dab2647a4a17fe050ba85de0e"}, + {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ff02b6d461a6de369f07ec15e465a88895f3223eb75073ffea56b84d9331f607"}, + {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:996a38a83508c54c78a5f41456b0103c30508fed9abcad0a59b876d7398f25fd"}, + {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d97683ddee4723ae8c95d1eddac7c192e8c552da0c73a925a89fa8649bf13eea"}, + {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:216f9b2d7713eb98cb83c80b9c794de1f6b7e3145eef40400c62e86cee5f4e1e"}, + {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:6f783e0ec4803c787bcea93e13e9932edab72068f68ecffdf86a99fd5918878b"}, + {file = "pydantic_core-2.23.4-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:d0776dea117cf5272382634bd2a5c1b6eb16767c223c6a5317cd3e2a757c61a0"}, + {file = "pydantic_core-2.23.4-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:d5f7a395a8cf1621939692dba2a6b6a830efa6b3cee787d82c7de1ad2930de64"}, + {file = "pydantic_core-2.23.4-cp311-none-win32.whl", hash = "sha256:74b9127ffea03643e998e0c5ad9bd3811d3dac8c676e47db17b0ee7c3c3bf35f"}, + {file = "pydantic_core-2.23.4-cp311-none-win_amd64.whl", hash = "sha256:98d134c954828488b153d88ba1f34e14259284f256180ce659e8d83e9c05eaa3"}, + {file = "pydantic_core-2.23.4-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:f3e0da4ebaef65158d4dfd7d3678aad692f7666877df0002b8a522cdf088f231"}, + {file = "pydantic_core-2.23.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:f69a8e0b033b747bb3e36a44e7732f0c99f7edd5cea723d45bc0d6e95377ffee"}, + {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:723314c1d51722ab28bfcd5240d858512ffd3116449c557a1336cbe3919beb87"}, + {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:bb2802e667b7051a1bebbfe93684841cc9351004e2badbd6411bf357ab8d5ac8"}, + {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d18ca8148bebe1b0a382a27a8ee60350091a6ddaf475fa05ef50dc35b5df6327"}, + {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:33e3d65a85a2a4a0dc3b092b938a4062b1a05f3a9abde65ea93b233bca0e03f2"}, + {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:128585782e5bfa515c590ccee4b727fb76925dd04a98864182b22e89a4e6ed36"}, + {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:68665f4c17edcceecc112dfed5dbe6f92261fb9d6054b47d01bf6371a6196126"}, + {file = "pydantic_core-2.23.4-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:20152074317d9bed6b7a95ade3b7d6054845d70584216160860425f4fbd5ee9e"}, + {file = "pydantic_core-2.23.4-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:9261d3ce84fa1d38ed649c3638feefeae23d32ba9182963e465d58d62203bd24"}, + {file = "pydantic_core-2.23.4-cp312-none-win32.whl", hash = "sha256:4ba762ed58e8d68657fc1281e9bb72e1c3e79cc5d464be146e260c541ec12d84"}, + {file = "pydantic_core-2.23.4-cp312-none-win_amd64.whl", hash = "sha256:97df63000f4fea395b2824da80e169731088656d1818a11b95f3b173747b6cd9"}, + {file = "pydantic_core-2.23.4-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:7530e201d10d7d14abce4fb54cfe5b94a0aefc87da539d0346a484ead376c3cc"}, + {file = "pydantic_core-2.23.4-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:df933278128ea1cd77772673c73954e53a1c95a4fdf41eef97c2b779271bd0bd"}, + {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0cb3da3fd1b6a5d0279a01877713dbda118a2a4fc6f0d821a57da2e464793f05"}, + {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:42c6dcb030aefb668a2b7009c85b27f90e51e6a3b4d5c9bc4c57631292015b0d"}, + {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:696dd8d674d6ce621ab9d45b205df149399e4bb9aa34102c970b721554828510"}, + {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2971bb5ffe72cc0f555c13e19b23c85b654dd2a8f7ab493c262071377bfce9f6"}, + {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8394d940e5d400d04cad4f75c0598665cbb81aecefaca82ca85bd28264af7f9b"}, + {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:0dff76e0602ca7d4cdaacc1ac4c005e0ce0dcfe095d5b5259163a80d3a10d327"}, + {file = "pydantic_core-2.23.4-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:7d32706badfe136888bdea71c0def994644e09fff0bfe47441deaed8e96fdbc6"}, + {file = "pydantic_core-2.23.4-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:ed541d70698978a20eb63d8c5d72f2cc6d7079d9d90f6b50bad07826f1320f5f"}, + {file = "pydantic_core-2.23.4-cp313-none-win32.whl", hash = "sha256:3d5639516376dce1940ea36edf408c554475369f5da2abd45d44621cb616f769"}, + {file = "pydantic_core-2.23.4-cp313-none-win_amd64.whl", hash = "sha256:5a1504ad17ba4210df3a045132a7baeeba5a200e930f57512ee02909fc5c4cb5"}, + {file = "pydantic_core-2.23.4-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:d4488a93b071c04dc20f5cecc3631fc78b9789dd72483ba15d423b5b3689b555"}, + {file = "pydantic_core-2.23.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:81965a16b675b35e1d09dd14df53f190f9129c0202356ed44ab2728b1c905658"}, + {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4ffa2ebd4c8530079140dd2d7f794a9d9a73cbb8e9d59ffe24c63436efa8f271"}, + {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:61817945f2fe7d166e75fbfb28004034b48e44878177fc54d81688e7b85a3665"}, + {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:29d2c342c4bc01b88402d60189f3df065fb0dda3654744d5a165a5288a657368"}, + {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5e11661ce0fd30a6790e8bcdf263b9ec5988e95e63cf901972107efc49218b13"}, + {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9d18368b137c6295db49ce7218b1a9ba15c5bc254c96d7c9f9e924a9bc7825ad"}, + {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:ec4e55f79b1c4ffb2eecd8a0cfba9955a2588497d96851f4c8f99aa4a1d39b12"}, + {file = "pydantic_core-2.23.4-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:374a5e5049eda9e0a44c696c7ade3ff355f06b1fe0bb945ea3cac2bc336478a2"}, + {file = "pydantic_core-2.23.4-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:5c364564d17da23db1106787675fc7af45f2f7b58b4173bfdd105564e132e6fb"}, + {file = "pydantic_core-2.23.4-cp38-none-win32.whl", hash = "sha256:d7a80d21d613eec45e3d41eb22f8f94ddc758a6c4720842dc74c0581f54993d6"}, + {file = "pydantic_core-2.23.4-cp38-none-win_amd64.whl", hash = "sha256:5f5ff8d839f4566a474a969508fe1c5e59c31c80d9e140566f9a37bba7b8d556"}, + {file = "pydantic_core-2.23.4-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:a4fa4fc04dff799089689f4fd502ce7d59de529fc2f40a2c8836886c03e0175a"}, + {file = "pydantic_core-2.23.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:0a7df63886be5e270da67e0966cf4afbae86069501d35c8c1b3b6c168f42cb36"}, + {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dcedcd19a557e182628afa1d553c3895a9f825b936415d0dbd3cd0bbcfd29b4b"}, + {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5f54b118ce5de9ac21c363d9b3caa6c800341e8c47a508787e5868c6b79c9323"}, + {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:86d2f57d3e1379a9525c5ab067b27dbb8a0642fb5d454e17a9ac434f9ce523e3"}, + {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:de6d1d1b9e5101508cb37ab0d972357cac5235f5c6533d1071964c47139257df"}, + {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1278e0d324f6908e872730c9102b0112477a7f7cf88b308e4fc36ce1bdb6d58c"}, + {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:9a6b5099eeec78827553827f4c6b8615978bb4b6a88e5d9b93eddf8bb6790f55"}, + {file = "pydantic_core-2.23.4-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:e55541f756f9b3ee346b840103f32779c695a19826a4c442b7954550a0972040"}, + {file = "pydantic_core-2.23.4-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:a5c7ba8ffb6d6f8f2ab08743be203654bb1aaa8c9dcb09f82ddd34eadb695605"}, + {file = "pydantic_core-2.23.4-cp39-none-win32.whl", hash = "sha256:37b0fe330e4a58d3c58b24d91d1eb102aeec675a3db4c292ec3928ecd892a9a6"}, + {file = "pydantic_core-2.23.4-cp39-none-win_amd64.whl", hash = "sha256:1498bec4c05c9c787bde9125cfdcc63a41004ff167f495063191b863399b1a29"}, + {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:f455ee30a9d61d3e1a15abd5068827773d6e4dc513e795f380cdd59932c782d5"}, + {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:1e90d2e3bd2c3863d48525d297cd143fe541be8bbf6f579504b9712cb6b643ec"}, + {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2e203fdf807ac7e12ab59ca2bfcabb38c7cf0b33c41efeb00f8e5da1d86af480"}, + {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e08277a400de01bc72436a0ccd02bdf596631411f592ad985dcee21445bd0068"}, + {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f220b0eea5965dec25480b6333c788fb72ce5f9129e8759ef876a1d805d00801"}, + {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:d06b0c8da4f16d1d1e352134427cb194a0a6e19ad5db9161bf32b2113409e728"}, + {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:ba1a0996f6c2773bd83e63f18914c1de3c9dd26d55f4ac302a7efe93fb8e7433"}, + {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:9a5bce9d23aac8f0cf0836ecfc033896aa8443b501c58d0602dbfd5bd5b37753"}, + {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:78ddaaa81421a29574a682b3179d4cf9e6d405a09b99d93ddcf7e5239c742e21"}, + {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:883a91b5dd7d26492ff2f04f40fbb652de40fcc0afe07e8129e8ae779c2110eb"}, + {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:88ad334a15b32a791ea935af224b9de1bf99bcd62fabf745d5f3442199d86d59"}, + {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:233710f069d251feb12a56da21e14cca67994eab08362207785cf8c598e74577"}, + {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:19442362866a753485ba5e4be408964644dd6a09123d9416c54cd49171f50744"}, + {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:624e278a7d29b6445e4e813af92af37820fafb6dcc55c012c834f9e26f9aaaef"}, + {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:f5ef8f42bec47f21d07668a043f077d507e5bf4e668d5c6dfe6aaba89de1a5b8"}, + {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:aea443fffa9fbe3af1a9ba721a87f926fe548d32cab71d188a6ede77d0ff244e"}, + {file = "pydantic_core-2.23.4.tar.gz", hash = "sha256:2584f7cf844ac4d970fba483a717dbe10c1c1c96a969bf65d61ffe94df1b2863"}, +] + +[package.dependencies] +typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0" + +[[package]] +name = "pylint" +version = "3.2.3" +description = "python code static checker" +optional = false +python-versions = ">=3.8.0" +files = [ + {file = "pylint-3.2.3-py3-none-any.whl", hash = "sha256:b3d7d2708a3e04b4679e02d99e72329a8b7ee8afb8d04110682278781f889fa8"}, + {file = "pylint-3.2.3.tar.gz", hash = "sha256:02f6c562b215582386068d52a30f520d84fdbcf2a95fc7e855b816060d048b60"}, +] + +[package.dependencies] +astroid = ">=3.2.2,<=3.3.0-dev0" +colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} +dill = [ + {version = ">=0.2", markers = "python_version < \"3.11\""}, + {version = ">=0.3.7", markers = "python_version >= \"3.12\""}, + {version = ">=0.3.6", markers = "python_version >= \"3.11\" and python_version < \"3.12\""}, +] +isort = ">=4.2.5,<5.13.0 || >5.13.0,<6" +mccabe = ">=0.6,<0.8" +platformdirs = ">=2.2.0" +tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} +tomlkit = ">=0.10.1" +typing-extensions = {version = ">=3.10.0", markers = "python_version < \"3.10\""} + +[package.extras] +spelling = ["pyenchant (>=3.2,<4.0)"] +testutils = ["gitpython (>3)"] + +[[package]] +name = "python-dateutil" +version = "2.8.2" +description = "Extensions to the standard Python datetime module" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" +files = [ + {file = "python-dateutil-2.8.2.tar.gz", hash = "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86"}, + {file = "python_dateutil-2.8.2-py2.py3-none-any.whl", hash = "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"}, +] + +[package.dependencies] +six = ">=1.5" + +[[package]] +name = "six" +version = "1.16.0" +description = "Python 2 and 3 compatibility utilities" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" +files = [ + {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, + {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, +] + +[[package]] +name = "sniffio" +version = "1.3.1" +description = "Sniff out which async library your code is running under" +optional = false +python-versions = ">=3.7" +files = [ + {file = "sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2"}, + {file = "sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc"}, +] + +[[package]] +name = "tomli" +version = "2.0.2" +description = "A lil' TOML parser" +optional = false +python-versions = ">=3.8" +files = [ + {file = "tomli-2.0.2-py3-none-any.whl", hash = "sha256:2ebe24485c53d303f690b0ec092806a085f07af5a5aa1464f3931eec36caaa38"}, + {file = "tomli-2.0.2.tar.gz", hash = "sha256:d46d457a85337051c36524bc5349dd91b1877838e2979ac5ced3e710ed8a60ed"}, +] + +[[package]] +name = "tomlkit" +version = "0.13.2" +description = "Style preserving TOML library" +optional = false +python-versions = ">=3.8" +files = [ + {file = "tomlkit-0.13.2-py3-none-any.whl", hash = "sha256:7a974427f6e119197f670fbbbeae7bef749a6c14e793db934baefc1b5f03efde"}, + {file = "tomlkit-0.13.2.tar.gz", hash = "sha256:fff5fe59a87295b278abd31bec92c15d9bc4a06885ab12bcea52c71119392e79"}, +] + +[[package]] +name = "types-python-dateutil" +version = "2.9.0.20241003" +description = "Typing stubs for python-dateutil" +optional = false +python-versions = ">=3.8" +files = [ + {file = "types-python-dateutil-2.9.0.20241003.tar.gz", hash = "sha256:58cb85449b2a56d6684e41aeefb4c4280631246a0da1a719bdbe6f3fb0317446"}, + {file = "types_python_dateutil-2.9.0.20241003-py3-none-any.whl", hash = "sha256:250e1d8e80e7bbc3a6c99b907762711d1a1cdd00e978ad39cb5940f6f0a87f3d"}, +] + +[[package]] +name = "typing-extensions" +version = "4.12.2" +description = "Backported and Experimental Type Hints for Python 3.8+" +optional = false +python-versions = ">=3.8" +files = [ + {file = "typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d"}, + {file = "typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8"}, +] + +[[package]] +name = "typing-inspect" +version = "0.9.0" +description = "Runtime inspection utilities for typing module." +optional = false +python-versions = "*" +files = [ + {file = "typing_inspect-0.9.0-py3-none-any.whl", hash = "sha256:9ee6fc59062311ef8547596ab6b955e1b8aa46242d854bfc78f4f6b0eff35f9f"}, + {file = "typing_inspect-0.9.0.tar.gz", hash = "sha256:b23fc42ff6f6ef6954e4852c1fb512cdd18dbea03134f91f856a95ccc9461f78"}, +] + +[package.dependencies] +mypy-extensions = ">=0.3.0" +typing-extensions = ">=3.7.4" + +[metadata] +lock-version = "2.0" +python-versions = "^3.8" +content-hash = "6bb5f77afb8fcbe7327ccd1fcc33f5c279c6a2582d43be73b69c2a94b836b85d" diff --git a/sync-for-payables/poetry.toml b/sync-for-payables/poetry.toml new file mode 100644 index 000000000..ab1033bd3 --- /dev/null +++ b/sync-for-payables/poetry.toml @@ -0,0 +1,2 @@ +[virtualenvs] +in-project = true diff --git a/sync-for-payables/py.typed b/sync-for-payables/py.typed new file mode 100644 index 000000000..3e38f1a92 --- /dev/null +++ b/sync-for-payables/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. The package enables type hints. diff --git a/sync-for-payables/pylintrc b/sync-for-payables/pylintrc new file mode 100644 index 000000000..508003862 --- /dev/null +++ b/sync-for-payables/pylintrc @@ -0,0 +1,658 @@ +[MAIN] + +# Analyse import fallback blocks. This can be used to support both Python 2 and +# 3 compatible code, which means that the block might have code that exists +# only in one or another interpreter, leading to false positives when analysed. +analyse-fallback-blocks=no + +# Clear in-memory caches upon conclusion of linting. Useful if running pylint +# in a server-like mode. +clear-cache-post-run=no + +# Load and enable all available extensions. Use --list-extensions to see a list +# all available extensions. +#enable-all-extensions= + +# In error mode, messages with a category besides ERROR or FATAL are +# suppressed, and no reports are done by default. Error mode is compatible with +# disabling specific errors. +#errors-only= + +# Always return a 0 (non-error) status code, even if lint errors are found. +# This is primarily useful in continuous integration scripts. +#exit-zero= + +# A comma-separated list of package or module names from where C extensions may +# be loaded. Extensions are loading into the active Python interpreter and may +# run arbitrary code. +extension-pkg-allow-list= + +# A comma-separated list of package or module names from where C extensions may +# be loaded. Extensions are loading into the active Python interpreter and may +# run arbitrary code. (This is an alternative name to extension-pkg-allow-list +# for backward compatibility.) +extension-pkg-whitelist= + +# Return non-zero exit code if any of these messages/categories are detected, +# even if score is above --fail-under value. Syntax same as enable. Messages +# specified are enabled, while categories only check already-enabled messages. +fail-on= + +# Specify a score threshold under which the program will exit with error. +fail-under=10 + +# Interpret the stdin as a python script, whose filename needs to be passed as +# the module_or_package argument. +#from-stdin= + +# Files or directories to be skipped. They should be base names, not paths. +ignore=CVS + +# Add files or directories matching the regular expressions patterns to the +# ignore-list. The regex matches against paths and can be in Posix or Windows +# format. Because '\\' represents the directory delimiter on Windows systems, +# it can't be used as an escape character. +ignore-paths= + +# Files or directories matching the regular expression patterns are skipped. +# The regex matches against base names, not paths. The default value ignores +# Emacs file locks +ignore-patterns=^\.# + +# List of module names for which member attributes should not be checked and +# will not be imported (useful for modules/projects where namespaces are +# manipulated during runtime and thus existing member attributes cannot be +# deduced by static analysis). It supports qualified module names, as well as +# Unix pattern matching. +ignored-modules= + +# Python code to execute, usually for sys.path manipulation such as +# pygtk.require(). +#init-hook= + +# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the +# number of processors available to use, and will cap the count on Windows to +# avoid hangs. +jobs=1 + +# Control the amount of potential inferred values when inferring a single +# object. This can help the performance when dealing with large functions or +# complex, nested conditions. +limit-inference-results=100 + +# List of plugins (as comma separated values of python module names) to load, +# usually to register additional checkers. +load-plugins= + +# Pickle collected data for later comparisons. +persistent=yes + +# Minimum Python version to use for version dependent checks. Will default to +# the version used to run pylint. +py-version=3.8 + +# Discover python modules and packages in the file system subtree. +recursive=no + +# Add paths to the list of the source roots. Supports globbing patterns. The +# source root is an absolute path or a path relative to the current working +# directory used to determine a package namespace for modules located under the +# source root. +source-roots=src + +# When enabled, pylint would attempt to guess common misconfiguration and emit +# user-friendly hints instead of false-positive error messages. +suggestion-mode=yes + +# Allow loading of arbitrary C extensions. Extensions are imported into the +# active Python interpreter and may run arbitrary code. +unsafe-load-any-extension=no + +# In verbose mode, extra non-checker-related info will be displayed. +#verbose= + + +[BASIC] + +# Naming style matching correct argument names. +argument-naming-style=snake_case + +# Regular expression matching correct argument names. Overrides argument- +# naming-style. If left empty, argument names will be checked with the set +# naming style. +#argument-rgx= + +# Naming style matching correct attribute names. +#attr-naming-style=snake_case + +# Regular expression matching correct attribute names. Overrides attr-naming- +# style. If left empty, attribute names will be checked with the set naming +# style. +attr-rgx=[^\W\d][^\W]*|__.*__$ + +# Bad variable names which should always be refused, separated by a comma. +bad-names= + +# Bad variable names regexes, separated by a comma. If names match any regex, +# they will always be refused +bad-names-rgxs= + +# Naming style matching correct class attribute names. +class-attribute-naming-style=any + +# Regular expression matching correct class attribute names. Overrides class- +# attribute-naming-style. If left empty, class attribute names will be checked +# with the set naming style. +#class-attribute-rgx= + +# Naming style matching correct class constant names. +class-const-naming-style=UPPER_CASE + +# Regular expression matching correct class constant names. Overrides class- +# const-naming-style. If left empty, class constant names will be checked with +# the set naming style. +#class-const-rgx= + +# Naming style matching correct class names. +class-naming-style=PascalCase + +# Regular expression matching correct class names. Overrides class-naming- +# style. If left empty, class names will be checked with the set naming style. +#class-rgx= + +# Naming style matching correct constant names. +const-naming-style=UPPER_CASE + +# Regular expression matching correct constant names. Overrides const-naming- +# style. If left empty, constant names will be checked with the set naming +# style. +#const-rgx= + +# Minimum line length for functions/classes that require docstrings, shorter +# ones are exempt. +docstring-min-length=-1 + +# Naming style matching correct function names. +function-naming-style=snake_case + +# Regular expression matching correct function names. Overrides function- +# naming-style. If left empty, function names will be checked with the set +# naming style. +#function-rgx= + +# Good variable names which should always be accepted, separated by a comma. +good-names=i, + j, + k, + ex, + Run, + _, + e, + id + +# Good variable names regexes, separated by a comma. If names match any regex, +# they will always be accepted +good-names-rgxs= + +# Include a hint for the correct naming format with invalid-name. +include-naming-hint=no + +# Naming style matching correct inline iteration names. +inlinevar-naming-style=any + +# Regular expression matching correct inline iteration names. Overrides +# inlinevar-naming-style. If left empty, inline iteration names will be checked +# with the set naming style. +#inlinevar-rgx= + +# Naming style matching correct method names. +method-naming-style=snake_case + +# Regular expression matching correct method names. Overrides method-naming- +# style. If left empty, method names will be checked with the set naming style. +#method-rgx= + +# Naming style matching correct module names. +module-naming-style=snake_case + +# Regular expression matching correct module names. Overrides module-naming- +# style. If left empty, module names will be checked with the set naming style. +#module-rgx= + +# Colon-delimited sets of names that determine each other's naming style when +# the name regexes allow several styles. +name-group= + +# Regular expression which should only match function or class names that do +# not require a docstring. +no-docstring-rgx=^_ + +# List of decorators that produce properties, such as abc.abstractproperty. Add +# to this list to register other decorators that produce valid properties. +# These decorators are taken in consideration only for invalid-name. +property-classes=abc.abstractproperty + +# Regular expression matching correct type alias names. If left empty, type +# alias names will be checked with the set naming style. +typealias-rgx=.* + +# Regular expression matching correct type variable names. If left empty, type +# variable names will be checked with the set naming style. +#typevar-rgx= + +# Naming style matching correct variable names. +variable-naming-style=snake_case + +# Regular expression matching correct variable names. Overrides variable- +# naming-style. If left empty, variable names will be checked with the set +# naming style. +#variable-rgx= + + +[CLASSES] + +# Warn about protected attribute access inside special methods +check-protected-access-in-special-methods=no + +# List of method names used to declare (i.e. assign) instance attributes. +defining-attr-methods=__init__, + __new__, + setUp, + asyncSetUp, + __post_init__ + +# List of member names, which should be excluded from the protected access +# warning. +exclude-protected=_asdict,_fields,_replace,_source,_make,os._exit + +# List of valid names for the first argument in a class method. +valid-classmethod-first-arg=cls + +# List of valid names for the first argument in a metaclass class method. +valid-metaclass-classmethod-first-arg=mcs + + +[DESIGN] + +# List of regular expressions of class ancestor names to ignore when counting +# public methods (see R0903) +exclude-too-few-public-methods= + +# List of qualified class names to ignore when counting class parents (see +# R0901) +ignored-parents= + +# Maximum number of arguments for function / method. +max-args=5 + +# Maximum number of attributes for a class (see R0902). +max-attributes=7 + +# Maximum number of boolean expressions in an if statement (see R0916). +max-bool-expr=5 + +# Maximum number of branch for function / method body. +max-branches=12 + +# Maximum number of locals for function / method body. +max-locals=15 + +# Maximum number of parents for a class (see R0901). +max-parents=7 + +# Maximum number of public methods for a class (see R0904). +max-public-methods=25 + +# Maximum number of return / yield for function / method body. +max-returns=6 + +# Maximum number of statements in function / method body. +max-statements=50 + +# Minimum number of public methods for a class (see R0903). +min-public-methods=2 + + +[EXCEPTIONS] + +# Exceptions that will emit a warning when caught. +overgeneral-exceptions=builtins.BaseException,builtins.Exception + + +[FORMAT] + +# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. +expected-line-ending-format= + +# Regexp for a line that is allowed to be longer than the limit. +ignore-long-lines=^\s*(# )??$ + +# Number of spaces of indent required inside a hanging or continued line. +indent-after-paren=4 + +# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 +# tab). +indent-string=' ' + +# Maximum number of characters on a single line. +max-line-length=100 + +# Maximum number of lines in a module. +max-module-lines=1000 + +# Allow the body of a class to be on the same line as the declaration if body +# contains single statement. +single-line-class-stmt=no + +# Allow the body of an if to be on the same line as the test if there is no +# else. +single-line-if-stmt=no + + +[IMPORTS] + +# List of modules that can be imported at any level, not just the top level +# one. +allow-any-import-level= + +# Allow explicit reexports by alias from a package __init__. +allow-reexport-from-package=no + +# Allow wildcard imports from modules that define __all__. +allow-wildcard-with-all=no + +# Deprecated modules which should not be used, separated by a comma. +deprecated-modules= + +# Output a graph (.gv or any supported image format) of external dependencies +# to the given file (report RP0402 must not be disabled). +ext-import-graph= + +# Output a graph (.gv or any supported image format) of all (i.e. internal and +# external) dependencies to the given file (report RP0402 must not be +# disabled). +import-graph= + +# Output a graph (.gv or any supported image format) of internal dependencies +# to the given file (report RP0402 must not be disabled). +int-import-graph= + +# Force import order to recognize a module as part of the standard +# compatibility libraries. +known-standard-library= + +# Force import order to recognize a module as part of a third party library. +known-third-party=enchant + +# Couples of modules and preferred modules, separated by a comma. +preferred-modules= + + +[LOGGING] + +# The type of string formatting that logging methods do. `old` means using % +# formatting, `new` is for `{}` formatting. +logging-format-style=old + +# Logging modules to check that the string format arguments are in logging +# function parameter format. +logging-modules=logging + + +[MESSAGES CONTROL] + +# Only show warnings with the listed confidence levels. Leave empty to show +# all. Valid levels: HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE, +# UNDEFINED. +confidence=HIGH, + CONTROL_FLOW, + INFERENCE, + INFERENCE_FAILURE, + UNDEFINED + +# Disable the message, report, category or checker with the given id(s). You +# can either give multiple identifiers separated by comma (,) or put this +# option multiple times (only on the command line, not in the configuration +# file where it should appear only once). You can also use "--disable=all" to +# disable everything first and then re-enable specific checks. For example, if +# you want to run only the similarities checker, you can use "--disable=all +# --enable=similarities". If you want to run only the classes checker, but have +# no Warning level messages displayed, use "--disable=all --enable=classes +# --disable=W". +disable=raw-checker-failed, + bad-inline-option, + locally-disabled, + file-ignored, + suppressed-message, + useless-suppression, + deprecated-pragma, + use-implicit-booleaness-not-comparison-to-string, + use-implicit-booleaness-not-comparison-to-zero, + use-symbolic-message-instead, + trailing-whitespace, + line-too-long, + missing-class-docstring, + missing-module-docstring, + missing-function-docstring, + too-many-instance-attributes, + wrong-import-order, + too-many-arguments, + broad-exception-raised, + too-few-public-methods, + too-many-branches, + duplicate-code, + trailing-newlines, + too-many-public-methods, + too-many-locals, + too-many-lines, + using-constant-test, + too-many-statements, + cyclic-import, + too-many-nested-blocks, + too-many-boolean-expressions, + no-else-raise, + bare-except, + broad-exception-caught, + fixme, + relative-beyond-top-level + +# Enable the message, report, category or checker with the given id(s). You can +# either give multiple identifier separated by comma (,) or put this option +# multiple time (only on the command line, not in the configuration file where +# it should appear only once). See also the "--disable" option for examples. +enable= + + +[METHOD_ARGS] + +# List of qualified names (i.e., library.method) which require a timeout +# parameter e.g. 'requests.api.get,requests.api.post' +timeout-methods=requests.api.delete,requests.api.get,requests.api.head,requests.api.options,requests.api.patch,requests.api.post,requests.api.put,requests.api.request + + +[MISCELLANEOUS] + +# List of note tags to take in consideration, separated by a comma. +notes=FIXME, + XXX, + TODO + +# Regular expression of note tags to take in consideration. +notes-rgx= + + +[REFACTORING] + +# Maximum number of nested blocks for function / method body +max-nested-blocks=5 + +# Complete name of functions that never returns. When checking for +# inconsistent-return-statements if a never returning function is called then +# it will be considered as an explicit return statement and no message will be +# printed. +never-returning-functions=sys.exit,argparse.parse_error + + +[REPORTS] + +# Python expression which should return a score less than or equal to 10. You +# have access to the variables 'fatal', 'error', 'warning', 'refactor', +# 'convention', and 'info' which contain the number of messages in each +# category, as well as 'statement' which is the total number of statements +# analyzed. This score is used by the global evaluation report (RP0004). +evaluation=max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)) + +# Template used to display messages. This is a python new-style format string +# used to format the message information. See doc for all details. +msg-template= + +# Set the output format. Available formats are: text, parseable, colorized, +# json2 (improved json format), json (old json format) and msvs (visual +# studio). You can also give a reporter class, e.g. +# mypackage.mymodule.MyReporterClass. +#output-format= + +# Tells whether to display a full report or only the messages. +reports=no + +# Activate the evaluation score. +score=yes + + +[SIMILARITIES] + +# Comments are removed from the similarity computation +ignore-comments=yes + +# Docstrings are removed from the similarity computation +ignore-docstrings=yes + +# Imports are removed from the similarity computation +ignore-imports=yes + +# Signatures are removed from the similarity computation +ignore-signatures=yes + +# Minimum lines number of a similarity. +min-similarity-lines=4 + + +[SPELLING] + +# Limits count of emitted suggestions for spelling mistakes. +max-spelling-suggestions=4 + +# Spelling dictionary name. No available dictionaries : You need to install +# both the python package and the system dependency for enchant to work. +spelling-dict= + +# List of comma separated words that should be considered directives if they +# appear at the beginning of a comment and should not be checked. +spelling-ignore-comment-directives=fmt: on,fmt: off,noqa:,noqa,nosec,isort:skip,mypy: + +# List of comma separated words that should not be checked. +spelling-ignore-words= + +# A path to a file that contains the private dictionary; one word per line. +spelling-private-dict-file= + +# Tells whether to store unknown words to the private dictionary (see the +# --spelling-private-dict-file option) instead of raising a message. +spelling-store-unknown-words=no + + +[STRING] + +# This flag controls whether inconsistent-quotes generates a warning when the +# character used as a quote delimiter is used inconsistently within a module. +check-quote-consistency=no + +# This flag controls whether the implicit-str-concat should generate a warning +# on implicit string concatenation in sequences defined over several lines. +check-str-concat-over-line-jumps=no + + +[TYPECHECK] + +# List of decorators that produce context managers, such as +# contextlib.contextmanager. Add to this list to register other decorators that +# produce valid context managers. +contextmanager-decorators=contextlib.contextmanager + +# List of members which are set dynamically and missed by pylint inference +# system, and so shouldn't trigger E1101 when accessed. Python regular +# expressions are accepted. +generated-members= + +# Tells whether to warn about missing members when the owner of the attribute +# is inferred to be None. +ignore-none=yes + +# This flag controls whether pylint should warn about no-member and similar +# checks whenever an opaque object is returned when inferring. The inference +# can return multiple potential results while evaluating a Python object, but +# some branches might not be evaluated, which results in partial inference. In +# that case, it might be useful to still emit no-member and other checks for +# the rest of the inferred objects. +ignore-on-opaque-inference=yes + +# List of symbolic message names to ignore for Mixin members. +ignored-checks-for-mixins=no-member, + not-async-context-manager, + not-context-manager, + attribute-defined-outside-init + +# List of class names for which member attributes should not be checked (useful +# for classes with dynamically set attributes). This supports the use of +# qualified names. +ignored-classes=optparse.Values,thread._local,_thread._local,argparse.Namespace + +# Show a hint with possible names when a member name was not found. The aspect +# of finding the hint is based on edit distance. +missing-member-hint=yes + +# The minimum edit distance a name should have in order to be considered a +# similar match for a missing member name. +missing-member-hint-distance=1 + +# The total number of similar names that should be taken in consideration when +# showing a hint for a missing member. +missing-member-max-choices=1 + +# Regex pattern to define which classes are considered mixins. +mixin-class-rgx=.*[Mm]ixin + +# List of decorators that change the signature of a decorated function. +signature-mutators= + + +[VARIABLES] + +# List of additional names supposed to be defined in builtins. Remember that +# you should avoid defining new builtins when possible. +additional-builtins= + +# Tells whether unused global variables should be treated as a violation. +allow-global-unused-variables=yes + +# List of names allowed to shadow builtins +allowed-redefined-builtins=id,object + +# List of strings which can identify a callback function by name. A callback +# name must start or end with one of those strings. +callbacks=cb_, + _cb + +# A regular expression matching the name of dummy variables (i.e. expected to +# not be used). +dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ + +# Argument names that match this expression will be ignored. +ignored-argument-names=_.*|^ignored_|^unused_ + +# Tells whether we should check for unused import in __init__ files. +init-import=no + +# List of qualified module names which can have objects that can redefine +# builtins. +redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io diff --git a/sync-for-payables/pyproject.toml b/sync-for-payables/pyproject.toml new file mode 100644 index 000000000..e8acce141 --- /dev/null +++ b/sync-for-payables/pyproject.toml @@ -0,0 +1,55 @@ +[tool.poetry] +name = "codat-sync-for-payables" +version = "4.0.0" +description = "Streamline your customers' accounts payable workflow." +authors = ["Speakeasy",] +readme = "README-PYPI.md" +repository = "https://github.com/codatio/client-sdk-python.git" +packages = [ + { include = "codat_sync_for_payables", from = "src" } +] +include = ["py.typed", "src/codat_sync_for_payables/py.typed"] + +[tool.setuptools.package-data] +"*" = ["py.typed", "src/codat_sync_for_payables/py.typed"] + +[virtualenvs] +in-project = true + +[tool.poetry.dependencies] +python = "^3.8" +eval-type-backport = "^0.2.0" +httpx = "^0.27.0" +jsonpath-python = "^1.0.6" +pydantic = "~2.9.0" +python-dateutil = "2.8.2" +typing-inspect = "^0.9.0" + +[tool.poetry.group.dev.dependencies] +mypy = "==1.10.1" +pylint = "==3.2.3" +types-python-dateutil = "^2.9.0.20240316" + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" + +[tool.pytest.ini_options] +pythonpath = ["src"] + +[tool.mypy] +disable_error_code = "misc" + +[[tool.mypy.overrides]] +module = "typing_inspect" +ignore_missing_imports = true + +[[tool.mypy.overrides]] +module = "jsonpath" +ignore_missing_imports = true + +[tool.pyright] +venvPath = "." +venv = ".venv" + + diff --git a/sync-for-payables/scripts/compile.sh b/sync-for-payables/scripts/compile.sh new file mode 100755 index 000000000..fafe635b2 --- /dev/null +++ b/sync-for-payables/scripts/compile.sh @@ -0,0 +1,85 @@ +#!/usr/bin/env bash + +set -o pipefail # Ensure pipeline failures are propagated + +# Use temporary files to store outputs and exit statuses +declare -A output_files +declare -A status_files + +# Function to run a command with temporary output and status files +run_command() { + local cmd="$1" + local key="$2" + local output_file="$3" + local status_file="$4" + + # Run the command and store output and exit status + { + eval "$cmd" + echo $? > "$status_file" + } &> "$output_file" & +} + +poetry run python scripts/prepare-readme.py + +# Create temporary files for outputs and statuses +for cmd in compileall pylint mypy pyright; do + output_files[$cmd]=$(mktemp) + status_files[$cmd]=$(mktemp) +done + +# Collect PIDs for background processes +declare -a pids + +# Run commands in parallel using temporary files +echo "Running python -m compileall" +run_command 'poetry run python -m compileall -q . && echo "Success"' 'compileall' "${output_files[compileall]}" "${status_files[compileall]}" +pids+=($!) + +echo "Running pylint" +run_command 'poetry run pylint src' 'pylint' "${output_files[pylint]}" "${status_files[pylint]}" +pids+=($!) + +echo "Running mypy" +run_command 'poetry run mypy src' 'mypy' "${output_files[mypy]}" "${status_files[mypy]}" +pids+=($!) + +echo "Running pyright (optional)" +run_command 'if command -v pyright > /dev/null 2>&1; then pyright src; else echo "pyright not found, skipping"; fi' 'pyright' "${output_files[pyright]}" "${status_files[pyright]}" +pids+=($!) + +# Wait for all processes to complete +echo "Waiting for processes to complete" +for pid in "${pids[@]}"; do + wait "$pid" +done + +# Print output sequentially and check for failures +failed=false +for key in "${!output_files[@]}"; do + echo "--- Output from Command: $key ---" + echo + cat "${output_files[$key]}" + echo # Empty line for separation + echo "--- End of Output from Command: $key ---" + echo + + exit_status=$(cat "${status_files[$key]}") + if [ "$exit_status" -ne 0 ]; then + echo "Command $key failed with exit status $exit_status" >&2 + failed=true + fi +done + +# Clean up temporary files +for tmp_file in "${output_files[@]}" "${status_files[@]}"; do + rm -f "$tmp_file" +done + +if $failed; then + echo "One or more commands failed." >&2 + exit 1 +else + echo "All commands completed successfully." + exit 0 +fi diff --git a/sync-for-payables/scripts/prepare-readme.py b/sync-for-payables/scripts/prepare-readme.py new file mode 100644 index 000000000..7c07cddd7 --- /dev/null +++ b/sync-for-payables/scripts/prepare-readme.py @@ -0,0 +1,33 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +import re +import shutil + +try: + with open("README.md", "r") as rh: + readme_contents = rh.read() + GITHUB_URL = "https://github.com/codatio/client-sdk-python.git" + GITHUB_URL = ( + GITHUB_URL[: -len(".git")] if GITHUB_URL.endswith(".git") else GITHUB_URL + ) + # links on PyPI should have absolute URLs + readme_contents = re.sub( + r"(\[[^\]]+\]\()((?!https?:)[^\)]+)(\))", + lambda m: m.group(1) + + GITHUB_URL + + "/blob/master/" + + m.group(2) + + m.group(3), + readme_contents, + ) + + with open("README-PYPI.md", "w") as wh: + wh.write(readme_contents) +except Exception as e: + try: + print("Failed to rewrite README.md to README-PYPI.md, copying original instead") + print(e) + shutil.copyfile("README.md", "README-PYPI.md") + except Exception as e: + print("Failed to copy README.md to README-PYPI.md") + print(e) diff --git a/sync-for-payables/scripts/publish.sh b/sync-for-payables/scripts/publish.sh new file mode 100755 index 000000000..ab45b1f94 --- /dev/null +++ b/sync-for-payables/scripts/publish.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +export POETRY_PYPI_TOKEN_PYPI=${PYPI_TOKEN} + +poetry run python scripts/prepare-readme.py + +poetry publish --build --skip-existing diff --git a/sync-for-payables/src/codat_sync_for_payables/__init__.py b/sync-for-payables/src/codat_sync_for_payables/__init__.py new file mode 100644 index 000000000..5c3491793 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/__init__.py @@ -0,0 +1,8 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from ._version import __title__, __version__ +from .sdk import * +from .sdkconfiguration import * + + +VERSION: str = __version__ diff --git a/sync-for-payables/src/codat_sync_for_payables/_hooks/__init__.py b/sync-for-payables/src/codat_sync_for_payables/_hooks/__init__.py new file mode 100644 index 000000000..2ee66cdd5 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/_hooks/__init__.py @@ -0,0 +1,5 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .sdkhooks import * +from .types import * +from .registration import * diff --git a/sync-for-payables/src/codat_sync_for_payables/_hooks/registration.py b/sync-for-payables/src/codat_sync_for_payables/_hooks/registration.py new file mode 100644 index 000000000..cab477877 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/_hooks/registration.py @@ -0,0 +1,13 @@ +from .types import Hooks + + +# This file is only ever generated once on the first generation and then is free to be modified. +# Any hooks you wish to add should be registered in the init_hooks function. Feel free to define them +# in this file or in separate files in the hooks folder. + + +def init_hooks(hooks: Hooks): + # pylint: disable=unused-argument + """Add hooks by calling hooks.register{sdk_init/before_request/after_success/after_error}Hook + with an instance of a hook that implements that specific Hook interface + Hooks are registered per SDK instance, and are valid for the lifetime of the SDK instance""" diff --git a/sync-for-payables/src/codat_sync_for_payables/_hooks/sdkhooks.py b/sync-for-payables/src/codat_sync_for_payables/_hooks/sdkhooks.py new file mode 100644 index 000000000..6bc2f2e33 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/_hooks/sdkhooks.py @@ -0,0 +1,76 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +import httpx +from .types import ( + SDKInitHook, + BeforeRequestContext, + BeforeRequestHook, + AfterSuccessContext, + AfterSuccessHook, + AfterErrorContext, + AfterErrorHook, + Hooks, +) +from .registration import init_hooks +from typing import List, Optional, Tuple +from codat_sync_for_payables.httpclient import HttpClient + + +class SDKHooks(Hooks): + def __init__(self) -> None: + self.sdk_init_hooks: List[SDKInitHook] = [] + self.before_request_hooks: List[BeforeRequestHook] = [] + self.after_success_hooks: List[AfterSuccessHook] = [] + self.after_error_hooks: List[AfterErrorHook] = [] + init_hooks(self) + + def register_sdk_init_hook(self, hook: SDKInitHook) -> None: + self.sdk_init_hooks.append(hook) + + def register_before_request_hook(self, hook: BeforeRequestHook) -> None: + self.before_request_hooks.append(hook) + + def register_after_success_hook(self, hook: AfterSuccessHook) -> None: + self.after_success_hooks.append(hook) + + def register_after_error_hook(self, hook: AfterErrorHook) -> None: + self.after_error_hooks.append(hook) + + def sdk_init(self, base_url: str, client: HttpClient) -> Tuple[str, HttpClient]: + for hook in self.sdk_init_hooks: + base_url, client = hook.sdk_init(base_url, client) + return base_url, client + + def before_request( + self, hook_ctx: BeforeRequestContext, request: httpx.Request + ) -> httpx.Request: + for hook in self.before_request_hooks: + out = hook.before_request(hook_ctx, request) + if isinstance(out, Exception): + raise out + request = out + + return request + + def after_success( + self, hook_ctx: AfterSuccessContext, response: httpx.Response + ) -> httpx.Response: + for hook in self.after_success_hooks: + out = hook.after_success(hook_ctx, response) + if isinstance(out, Exception): + raise out + response = out + return response + + def after_error( + self, + hook_ctx: AfterErrorContext, + response: Optional[httpx.Response], + error: Optional[Exception], + ) -> Tuple[Optional[httpx.Response], Optional[Exception]]: + for hook in self.after_error_hooks: + result = hook.after_error(hook_ctx, response, error) + if isinstance(result, Exception): + raise result + response, error = result + return response, error diff --git a/sync-for-payables/src/codat_sync_for_payables/_hooks/types.py b/sync-for-payables/src/codat_sync_for_payables/_hooks/types.py new file mode 100644 index 000000000..3ab046986 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/_hooks/types.py @@ -0,0 +1,94 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from abc import ABC, abstractmethod +from codat_sync_for_payables.httpclient import HttpClient +import httpx +from typing import Any, Callable, List, Optional, Tuple, Union + + +class HookContext: + operation_id: str + oauth2_scopes: Optional[List[str]] = None + security_source: Optional[Union[Any, Callable[[], Any]]] = None + + def __init__( + self, + operation_id: str, + oauth2_scopes: Optional[List[str]], + security_source: Optional[Union[Any, Callable[[], Any]]], + ): + self.operation_id = operation_id + self.oauth2_scopes = oauth2_scopes + self.security_source = security_source + + +class BeforeRequestContext(HookContext): + def __init__(self, hook_ctx: HookContext): + super().__init__( + hook_ctx.operation_id, hook_ctx.oauth2_scopes, hook_ctx.security_source + ) + + +class AfterSuccessContext(HookContext): + def __init__(self, hook_ctx: HookContext): + super().__init__( + hook_ctx.operation_id, hook_ctx.oauth2_scopes, hook_ctx.security_source + ) + + +class AfterErrorContext(HookContext): + def __init__(self, hook_ctx: HookContext): + super().__init__( + hook_ctx.operation_id, hook_ctx.oauth2_scopes, hook_ctx.security_source + ) + + +class SDKInitHook(ABC): + @abstractmethod + def sdk_init(self, base_url: str, client: HttpClient) -> Tuple[str, HttpClient]: + pass + + +class BeforeRequestHook(ABC): + @abstractmethod + def before_request( + self, hook_ctx: BeforeRequestContext, request: httpx.Request + ) -> Union[httpx.Request, Exception]: + pass + + +class AfterSuccessHook(ABC): + @abstractmethod + def after_success( + self, hook_ctx: AfterSuccessContext, response: httpx.Response + ) -> Union[httpx.Response, Exception]: + pass + + +class AfterErrorHook(ABC): + @abstractmethod + def after_error( + self, + hook_ctx: AfterErrorContext, + response: Optional[httpx.Response], + error: Optional[Exception], + ) -> Union[Tuple[Optional[httpx.Response], Optional[Exception]], Exception]: + pass + + +class Hooks(ABC): + @abstractmethod + def register_sdk_init_hook(self, hook: SDKInitHook): + pass + + @abstractmethod + def register_before_request_hook(self, hook: BeforeRequestHook): + pass + + @abstractmethod + def register_after_success_hook(self, hook: AfterSuccessHook): + pass + + @abstractmethod + def register_after_error_hook(self, hook: AfterErrorHook): + pass diff --git a/sync-for-payables/src/codat_sync_for_payables/_version.py b/sync-for-payables/src/codat_sync_for_payables/_version.py new file mode 100644 index 000000000..4101aaaf9 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/_version.py @@ -0,0 +1,12 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +import importlib.metadata + +__title__: str = "codat-sync-for-payables" +__version__: str = "4.0.0" + +try: + if __package__ is not None: + __version__ = importlib.metadata.version(__package__) +except importlib.metadata.PackageNotFoundError: + pass diff --git a/sync-for-payables/src/codat_sync_for_payables/bank_accounts.py b/sync-for-payables/src/codat_sync_for_payables/bank_accounts.py new file mode 100644 index 000000000..60055333d --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/bank_accounts.py @@ -0,0 +1,242 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .basesdk import BaseSDK +from codat_sync_for_payables import utils +from codat_sync_for_payables._hooks import HookContext +from codat_sync_for_payables.models import errors, operations, shared +from codat_sync_for_payables.types import BaseModel, OptionalNullable, UNSET +from typing import Any, Optional, Union, cast + + +class BankAccounts(BaseSDK): + r"""Create a bank account for a given company's connection.""" + + def create( + self, + *, + request: Union[ + operations.CreateBankAccountRequest, + operations.CreateBankAccountRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.BankAccount: + r"""Create bank account + + The *Create bank account* endpoint creates a new [bank account](https://docs.codat.io/sync-for-payables-api#/schemas/BankAccount) for a given company's connection. + + [Bank accounts](https://docs.codat.io/sync-for-payables-api#/schemas/BankAccount) are financial accounts maintained by a bank or other financial institution. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.CreateBankAccountRequest) + request = cast(operations.CreateBankAccountRequest, request) + + req = self.build_request( + method="POST", + path="/companies/{companyId}/connections/{connectionId}/payables/bankAccounts", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.bank_account_prototype, + False, + True, + "json", + Optional[shared.BankAccountPrototype], + ), + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + operation_id="create-bank-account", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "400", + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "201", "application/json"): + return utils.unmarshal_json(http_res.text, shared.BankAccount) + if utils.match_response( + http_res, + ["400", "401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + async def create_async( + self, + *, + request: Union[ + operations.CreateBankAccountRequest, + operations.CreateBankAccountRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.BankAccount: + r"""Create bank account + + The *Create bank account* endpoint creates a new [bank account](https://docs.codat.io/sync-for-payables-api#/schemas/BankAccount) for a given company's connection. + + [Bank accounts](https://docs.codat.io/sync-for-payables-api#/schemas/BankAccount) are financial accounts maintained by a bank or other financial institution. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.CreateBankAccountRequest) + request = cast(operations.CreateBankAccountRequest, request) + + req = self.build_request_async( + method="POST", + path="/companies/{companyId}/connections/{connectionId}/payables/bankAccounts", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.bank_account_prototype, + False, + True, + "json", + Optional[shared.BankAccountPrototype], + ), + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + operation_id="create-bank-account", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "400", + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "201", "application/json"): + return utils.unmarshal_json(http_res.text, shared.BankAccount) + if utils.match_response( + http_res, + ["400", "401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) diff --git a/sync-for-payables/src/codat_sync_for_payables/basesdk.py b/sync-for-payables/src/codat_sync_for_payables/basesdk.py new file mode 100644 index 000000000..b0e7c7d23 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/basesdk.py @@ -0,0 +1,343 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .sdkconfiguration import SDKConfiguration +from codat_sync_for_payables import utils +from codat_sync_for_payables._hooks import ( + AfterErrorContext, + AfterSuccessContext, + BeforeRequestContext, +) +from codat_sync_for_payables.models import errors +from codat_sync_for_payables.utils import ( + RetryConfig, + SerializedRequestBody, + get_body_content, +) +import httpx +from typing import Callable, List, Optional, Tuple + + +class BaseSDK: + sdk_configuration: SDKConfiguration + + def __init__(self, sdk_config: SDKConfiguration) -> None: + self.sdk_configuration = sdk_config + + def get_url(self, base_url, url_variables): + sdk_url, sdk_variables = self.sdk_configuration.get_server_details() + + if base_url is None: + base_url = sdk_url + + if url_variables is None: + url_variables = sdk_variables + + return utils.template_url(base_url, url_variables) + + def build_request_async( + self, + method, + path, + base_url, + url_variables, + request, + request_body_required, + request_has_path_params, + request_has_query_params, + user_agent_header, + accept_header_value, + _globals=None, + security=None, + timeout_ms: Optional[int] = None, + get_serialized_body: Optional[ + Callable[[], Optional[SerializedRequestBody]] + ] = None, + url_override: Optional[str] = None, + ) -> httpx.Request: + client = self.sdk_configuration.async_client + return self.build_request_with_client( + client, + method, + path, + base_url, + url_variables, + request, + request_body_required, + request_has_path_params, + request_has_query_params, + user_agent_header, + accept_header_value, + _globals, + security, + timeout_ms, + get_serialized_body, + url_override, + ) + + def build_request( + self, + method, + path, + base_url, + url_variables, + request, + request_body_required, + request_has_path_params, + request_has_query_params, + user_agent_header, + accept_header_value, + _globals=None, + security=None, + timeout_ms: Optional[int] = None, + get_serialized_body: Optional[ + Callable[[], Optional[SerializedRequestBody]] + ] = None, + url_override: Optional[str] = None, + ) -> httpx.Request: + client = self.sdk_configuration.client + return self.build_request_with_client( + client, + method, + path, + base_url, + url_variables, + request, + request_body_required, + request_has_path_params, + request_has_query_params, + user_agent_header, + accept_header_value, + _globals, + security, + timeout_ms, + get_serialized_body, + url_override, + ) + + def build_request_with_client( + self, + client, + method, + path, + base_url, + url_variables, + request, + request_body_required, + request_has_path_params, + request_has_query_params, + user_agent_header, + accept_header_value, + _globals=None, + security=None, + timeout_ms: Optional[int] = None, + get_serialized_body: Optional[ + Callable[[], Optional[SerializedRequestBody]] + ] = None, + url_override: Optional[str] = None, + ) -> httpx.Request: + query_params = {} + + url = url_override + if url is None: + url = utils.generate_url( + self.get_url(base_url, url_variables), + path, + request if request_has_path_params else None, + _globals if request_has_path_params else None, + ) + + query_params = utils.get_query_params( + request if request_has_query_params else None, + _globals if request_has_query_params else None, + ) + + headers = utils.get_headers(request, _globals) + headers["Accept"] = accept_header_value + headers[user_agent_header] = self.sdk_configuration.user_agent + + if security is not None: + if callable(security): + security = security() + + if security is not None: + security_headers, security_query_params = utils.get_security(security) + headers = {**headers, **security_headers} + query_params = {**query_params, **security_query_params} + + serialized_request_body = SerializedRequestBody("application/octet-stream") + if get_serialized_body is not None: + rb = get_serialized_body() + if request_body_required and rb is None: + raise ValueError("request body is required") + + if rb is not None: + serialized_request_body = rb + + if ( + serialized_request_body.media_type is not None + and serialized_request_body.media_type + not in ( + "multipart/form-data", + "multipart/mixed", + ) + ): + headers["content-type"] = serialized_request_body.media_type + + timeout = timeout_ms / 1000 if timeout_ms is not None else None + + return client.build_request( + method, + url, + params=query_params, + content=serialized_request_body.content, + data=serialized_request_body.data, + files=serialized_request_body.files, + headers=headers, + timeout=timeout, + ) + + def do_request( + self, + hook_ctx, + request, + error_status_codes, + stream=False, + retry_config: Optional[Tuple[RetryConfig, List[str]]] = None, + ) -> httpx.Response: + client = self.sdk_configuration.client + logger = self.sdk_configuration.debug_logger + + def do(): + http_res = None + try: + req = self.sdk_configuration.get_hooks().before_request( + BeforeRequestContext(hook_ctx), request + ) + logger.debug( + "Request:\nMethod: %s\nURL: %s\nHeaders: %s\nBody: %s", + req.method, + req.url, + req.headers, + get_body_content(req), + ) + http_res = client.send(req, stream=stream) + except Exception as e: + _, e = self.sdk_configuration.get_hooks().after_error( + AfterErrorContext(hook_ctx), None, e + ) + if e is not None: + logger.debug("Request Exception", exc_info=True) + raise e + + if http_res is None: + logger.debug("Raising no response SDK error") + raise errors.SDKError("No response received") + + logger.debug( + "Response:\nStatus Code: %s\nURL: %s\nHeaders: %s\nBody: %s", + http_res.status_code, + http_res.url, + http_res.headers, + "" if stream else http_res.text, + ) + + if utils.match_status_codes(error_status_codes, http_res.status_code): + result, err = self.sdk_configuration.get_hooks().after_error( + AfterErrorContext(hook_ctx), http_res, None + ) + if err is not None: + logger.debug("Request Exception", exc_info=True) + raise err + if result is not None: + http_res = result + else: + logger.debug("Raising unexpected SDK error") + raise errors.SDKError("Unexpected error occurred") + + return http_res + + if retry_config is not None: + http_res = utils.retry(do, utils.Retries(retry_config[0], retry_config[1])) + else: + http_res = do() + + if not utils.match_status_codes(error_status_codes, http_res.status_code): + http_res = self.sdk_configuration.get_hooks().after_success( + AfterSuccessContext(hook_ctx), http_res + ) + + return http_res + + async def do_request_async( + self, + hook_ctx, + request, + error_status_codes, + stream=False, + retry_config: Optional[Tuple[RetryConfig, List[str]]] = None, + ) -> httpx.Response: + client = self.sdk_configuration.async_client + logger = self.sdk_configuration.debug_logger + + async def do(): + http_res = None + try: + req = self.sdk_configuration.get_hooks().before_request( + BeforeRequestContext(hook_ctx), request + ) + logger.debug( + "Request:\nMethod: %s\nURL: %s\nHeaders: %s\nBody: %s", + req.method, + req.url, + req.headers, + get_body_content(req), + ) + http_res = await client.send(req, stream=stream) + except Exception as e: + _, e = self.sdk_configuration.get_hooks().after_error( + AfterErrorContext(hook_ctx), None, e + ) + if e is not None: + logger.debug("Request Exception", exc_info=True) + raise e + + if http_res is None: + logger.debug("Raising no response SDK error") + raise errors.SDKError("No response received") + + logger.debug( + "Response:\nStatus Code: %s\nURL: %s\nHeaders: %s\nBody: %s", + http_res.status_code, + http_res.url, + http_res.headers, + "" if stream else http_res.text, + ) + + if utils.match_status_codes(error_status_codes, http_res.status_code): + result, err = self.sdk_configuration.get_hooks().after_error( + AfterErrorContext(hook_ctx), http_res, None + ) + if err is not None: + logger.debug("Request Exception", exc_info=True) + raise err + if result is not None: + http_res = result + else: + logger.debug("Raising unexpected SDK error") + raise errors.SDKError("Unexpected error occurred") + + return http_res + + if retry_config is not None: + http_res = await utils.retry_async( + do, utils.Retries(retry_config[0], retry_config[1]) + ) + else: + http_res = await do() + + if not utils.match_status_codes(error_status_codes, http_res.status_code): + http_res = self.sdk_configuration.get_hooks().after_success( + AfterSuccessContext(hook_ctx), http_res + ) + + return http_res diff --git a/sync-for-payables/src/codat_sync_for_payables/bill_payments.py b/sync-for-payables/src/codat_sync_for_payables/bill_payments.py new file mode 100644 index 000000000..626b54850 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/bill_payments.py @@ -0,0 +1,468 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .basesdk import BaseSDK +from codat_sync_for_payables import utils +from codat_sync_for_payables._hooks import HookContext +from codat_sync_for_payables.models import errors, operations, shared +from codat_sync_for_payables.types import BaseModel, OptionalNullable, UNSET +from typing import Any, Optional, Union, cast + + +class BillPayments(BaseSDK): + r"""Get, create, and update Bill payments.""" + + def get_payment_options( + self, + *, + request: Union[ + operations.GetMappingOptionsPaymentsRequest, + operations.GetMappingOptionsPaymentsRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.PaymentMappingOptions: + r"""Get payment mapping options + + Use the *Get mapping options - Payments* endpoint to return a list of available mapping options for a given company's connection ID. + + By default, this endpoint returns a list of active bank accounts. You can use [querying](https://docs.codat.io/using-the-api/querying) to change that. + + Mapping options are a set of bank accounts used to configure the SMB's payables integration. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal( + request, operations.GetMappingOptionsPaymentsRequest + ) + request = cast(operations.GetMappingOptionsPaymentsRequest, request) + + req = self.build_request( + method="GET", + path="/companies/{companyId}/connections/{connectionId}/payables/mappingOptions/payments", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + operation_id="get-mapping-options-payments", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "400", + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return utils.unmarshal_json(http_res.text, shared.PaymentMappingOptions) + if utils.match_response( + http_res, + ["400", "401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + async def get_payment_options_async( + self, + *, + request: Union[ + operations.GetMappingOptionsPaymentsRequest, + operations.GetMappingOptionsPaymentsRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.PaymentMappingOptions: + r"""Get payment mapping options + + Use the *Get mapping options - Payments* endpoint to return a list of available mapping options for a given company's connection ID. + + By default, this endpoint returns a list of active bank accounts. You can use [querying](https://docs.codat.io/using-the-api/querying) to change that. + + Mapping options are a set of bank accounts used to configure the SMB's payables integration. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal( + request, operations.GetMappingOptionsPaymentsRequest + ) + request = cast(operations.GetMappingOptionsPaymentsRequest, request) + + req = self.build_request_async( + method="GET", + path="/companies/{companyId}/connections/{connectionId}/payables/mappingOptions/payments", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + operation_id="get-mapping-options-payments", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "400", + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return utils.unmarshal_json(http_res.text, shared.PaymentMappingOptions) + if utils.match_response( + http_res, + ["400", "401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + def create( + self, + *, + request: Union[ + operations.CreateBillPaymentRequest, + operations.CreateBillPaymentRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.BillPayment: + r"""Create bill payment + + The *Create bill payment* endpoint creates a new [bill payment](https://docs.codat.io/sync-for-payables-api#/schemas/BillPayment) for a given company's connection. + + [Bill payments](https://docs.codat.io/sync-for-payables-api#/schemas/BillPayment) are an allocation of money within any Accounts Payable account. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.CreateBillPaymentRequest) + request = cast(operations.CreateBillPaymentRequest, request) + + req = self.build_request( + method="POST", + path="/companies/{companyId}/connections/{connectionId}/payables/bills/{billId}/payment", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.bill_payment_prototype, + False, + True, + "json", + Optional[shared.BillPaymentPrototype], + ), + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + operation_id="create-bill-payment", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "400", + "401", + "402", + "403", + "404", + "409", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "201", "application/json"): + return utils.unmarshal_json(http_res.text, shared.BillPayment) + if utils.match_response( + http_res, + ["400", "401", "402", "403", "404", "409", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + async def create_async( + self, + *, + request: Union[ + operations.CreateBillPaymentRequest, + operations.CreateBillPaymentRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.BillPayment: + r"""Create bill payment + + The *Create bill payment* endpoint creates a new [bill payment](https://docs.codat.io/sync-for-payables-api#/schemas/BillPayment) for a given company's connection. + + [Bill payments](https://docs.codat.io/sync-for-payables-api#/schemas/BillPayment) are an allocation of money within any Accounts Payable account. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.CreateBillPaymentRequest) + request = cast(operations.CreateBillPaymentRequest, request) + + req = self.build_request_async( + method="POST", + path="/companies/{companyId}/connections/{connectionId}/payables/bills/{billId}/payment", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.bill_payment_prototype, + False, + True, + "json", + Optional[shared.BillPaymentPrototype], + ), + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + operation_id="create-bill-payment", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "400", + "401", + "402", + "403", + "404", + "409", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "201", "application/json"): + return utils.unmarshal_json(http_res.text, shared.BillPayment) + if utils.match_response( + http_res, + ["400", "401", "402", "403", "404", "409", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) diff --git a/sync-for-payables/src/codat_sync_for_payables/bills.py b/sync-for-payables/src/codat_sync_for_payables/bills.py new file mode 100644 index 000000000..872ed0441 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/bills.py @@ -0,0 +1,1353 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .basesdk import BaseSDK +from codat_sync_for_payables import utils +from codat_sync_for_payables._hooks import HookContext +from codat_sync_for_payables.models import errors, operations, shared +from codat_sync_for_payables.types import BaseModel, OptionalNullable, UNSET +import httpx +from typing import Any, Optional, Union, cast + + +class Bills(BaseSDK): + r"""Get, create, and update Bills.""" + + def get_bill_options( + self, + *, + request: Union[ + operations.GetMappingOptionsBillsRequest, + operations.GetMappingOptionsBillsRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.BillMappingOptions: + r"""Get bill mapping options + + Use the *Get mapping options - Bills* endpoint to return a list of available mapping options for a given company's connection ID. + + By default, this endpoint returns a list of active accounts and tax rates. You can use [querying](https://docs.codat.io/using-the-api/querying) to change that. + + Mapping options are a set of accounts and tax rates used to configure the SMB's payables integration. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.GetMappingOptionsBillsRequest) + request = cast(operations.GetMappingOptionsBillsRequest, request) + + req = self.build_request( + method="GET", + path="/companies/{companyId}/connections/{connectionId}/payables/mappingOptions/bills", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + operation_id="get-mapping-options-bills", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "400", + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return utils.unmarshal_json(http_res.text, shared.BillMappingOptions) + if utils.match_response( + http_res, + ["400", "401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + async def get_bill_options_async( + self, + *, + request: Union[ + operations.GetMappingOptionsBillsRequest, + operations.GetMappingOptionsBillsRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.BillMappingOptions: + r"""Get bill mapping options + + Use the *Get mapping options - Bills* endpoint to return a list of available mapping options for a given company's connection ID. + + By default, this endpoint returns a list of active accounts and tax rates. You can use [querying](https://docs.codat.io/using-the-api/querying) to change that. + + Mapping options are a set of accounts and tax rates used to configure the SMB's payables integration. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.GetMappingOptionsBillsRequest) + request = cast(operations.GetMappingOptionsBillsRequest, request) + + req = self.build_request_async( + method="GET", + path="/companies/{companyId}/connections/{connectionId}/payables/mappingOptions/bills", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + operation_id="get-mapping-options-bills", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "400", + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return utils.unmarshal_json(http_res.text, shared.BillMappingOptions) + if utils.match_response( + http_res, + ["400", "401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + def list( + self, + *, + request: Union[ + operations.ListBillsRequest, operations.ListBillsRequestTypedDict + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.Bills: + r"""List bills + + The *List bills* endpoint returns a list of [bills](https://docs.codat.io/sync-for-payables-api#/schemas/Bill) for a given company's connection. + + [Bills](https://docs.codat.io/sync-for-payables-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. + + By default, the endpoint will return all bills with a status of 'Open' & 'PartiallyPaid' to show all oustanding bills. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.ListBillsRequest) + request = cast(operations.ListBillsRequest, request) + + req = self.build_request( + method="GET", + path="/companies/{companyId}/connections/{connectionId}/payables/bills", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + operation_id="list-bills", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "400", + "401", + "402", + "403", + "404", + "409", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return utils.unmarshal_json(http_res.text, shared.Bills) + if utils.match_response( + http_res, + ["400", "401", "402", "403", "404", "409", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + async def list_async( + self, + *, + request: Union[ + operations.ListBillsRequest, operations.ListBillsRequestTypedDict + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.Bills: + r"""List bills + + The *List bills* endpoint returns a list of [bills](https://docs.codat.io/sync-for-payables-api#/schemas/Bill) for a given company's connection. + + [Bills](https://docs.codat.io/sync-for-payables-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. + + By default, the endpoint will return all bills with a status of 'Open' & 'PartiallyPaid' to show all oustanding bills. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.ListBillsRequest) + request = cast(operations.ListBillsRequest, request) + + req = self.build_request_async( + method="GET", + path="/companies/{companyId}/connections/{connectionId}/payables/bills", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + operation_id="list-bills", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "400", + "401", + "402", + "403", + "404", + "409", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return utils.unmarshal_json(http_res.text, shared.Bills) + if utils.match_response( + http_res, + ["400", "401", "402", "403", "404", "409", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + def create( + self, + *, + request: Union[ + operations.CreateBillRequest, operations.CreateBillRequestTypedDict + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.Bill: + r"""Create bill + + The *Create bill* endpoint creates a new [bill](https://docs.codat.io/sync-for-payables-api#/schemas/Bill) for a given company's connection. + + [Bills](https://docs.codat.io/sync-for-payables-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.CreateBillRequest) + request = cast(operations.CreateBillRequest, request) + + req = self.build_request( + method="POST", + path="/companies/{companyId}/connections/{connectionId}/payables/bills", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.bill_prototype, + False, + True, + "json", + Optional[shared.BillPrototype], + ), + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + operation_id="create-bill", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "400", + "401", + "402", + "403", + "404", + "409", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "201", "application/json"): + return utils.unmarshal_json(http_res.text, shared.Bill) + if utils.match_response( + http_res, + ["400", "401", "402", "403", "404", "409", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + async def create_async( + self, + *, + request: Union[ + operations.CreateBillRequest, operations.CreateBillRequestTypedDict + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.Bill: + r"""Create bill + + The *Create bill* endpoint creates a new [bill](https://docs.codat.io/sync-for-payables-api#/schemas/Bill) for a given company's connection. + + [Bills](https://docs.codat.io/sync-for-payables-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.CreateBillRequest) + request = cast(operations.CreateBillRequest, request) + + req = self.build_request_async( + method="POST", + path="/companies/{companyId}/connections/{connectionId}/payables/bills", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.bill_prototype, + False, + True, + "json", + Optional[shared.BillPrototype], + ), + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + operation_id="create-bill", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "400", + "401", + "402", + "403", + "404", + "409", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "201", "application/json"): + return utils.unmarshal_json(http_res.text, shared.Bill) + if utils.match_response( + http_res, + ["400", "401", "402", "403", "404", "409", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + def upload_attachment( + self, + *, + request: Union[ + operations.UploadBillAttachmentRequest, + operations.UploadBillAttachmentRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ): + r"""Upload bill attachment + + The *Upload bill attachment* endpoint uploads an attachment and assigns it against a specific `billId`. + + [Bills](https://docs.codat.io/sync-for-payables-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.UploadBillAttachmentRequest) + request = cast(operations.UploadBillAttachmentRequest, request) + + req = self.build_request( + method="POST", + path="/companies/{companyId}/connections/{connectionId}/payables/bills/{billId}/attachments", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.attachment_upload, + False, + True, + "multipart", + Optional[shared.AttachmentUpload], + ), + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + operation_id="upload-bill-attachment", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "400", + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "201", "*"): + return + if utils.match_response( + http_res, + ["400", "401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + async def upload_attachment_async( + self, + *, + request: Union[ + operations.UploadBillAttachmentRequest, + operations.UploadBillAttachmentRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ): + r"""Upload bill attachment + + The *Upload bill attachment* endpoint uploads an attachment and assigns it against a specific `billId`. + + [Bills](https://docs.codat.io/sync-for-payables-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.UploadBillAttachmentRequest) + request = cast(operations.UploadBillAttachmentRequest, request) + + req = self.build_request_async( + method="POST", + path="/companies/{companyId}/connections/{connectionId}/payables/bills/{billId}/attachments", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.attachment_upload, + False, + True, + "multipart", + Optional[shared.AttachmentUpload], + ), + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + operation_id="upload-bill-attachment", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "400", + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "201", "*"): + return + if utils.match_response( + http_res, + ["400", "401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + def list_attachments( + self, + *, + request: Union[ + operations.ListBillAttachmentsRequest, + operations.ListBillAttachmentsRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.Attachment: + r"""List bill attachments + + The *List bill attachments* endpoint returns a list of attachments available to download for a given `billId`. + + [Bills](https://docs.codat.io/sync-for-payables-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.ListBillAttachmentsRequest) + request = cast(operations.ListBillAttachmentsRequest, request) + + req = self.build_request( + method="GET", + path="/companies/{companyId}/connections/{connectionId}/bills/{billId}/attachments", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + operation_id="list-bill-attachments", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "401", + "402", + "403", + "404", + "409", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return utils.unmarshal_json(http_res.text, shared.Attachment) + if utils.match_response( + http_res, + ["401", "402", "403", "404", "409", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + async def list_attachments_async( + self, + *, + request: Union[ + operations.ListBillAttachmentsRequest, + operations.ListBillAttachmentsRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.Attachment: + r"""List bill attachments + + The *List bill attachments* endpoint returns a list of attachments available to download for a given `billId`. + + [Bills](https://docs.codat.io/sync-for-payables-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.ListBillAttachmentsRequest) + request = cast(operations.ListBillAttachmentsRequest, request) + + req = self.build_request_async( + method="GET", + path="/companies/{companyId}/connections/{connectionId}/bills/{billId}/attachments", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + operation_id="list-bill-attachments", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "401", + "402", + "403", + "404", + "409", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return utils.unmarshal_json(http_res.text, shared.Attachment) + if utils.match_response( + http_res, + ["401", "402", "403", "404", "409", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + def download_attachment( + self, + *, + request: Union[ + operations.DownloadBillAttachmentRequest, + operations.DownloadBillAttachmentRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> httpx.Response: + r"""Download bill attachment + + The *Download bill attachment* endpoint downloads a specific attachment for a given `billId` and `attachmentId`. + + [Bills](https://docs.codat.io/sync-for-payables-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. + + Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=bills) for integrations that support downloading a bill attachment. + + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.DownloadBillAttachmentRequest) + request = cast(operations.DownloadBillAttachmentRequest, request) + + req = self.build_request( + method="GET", + path="/companies/{companyId}/connections/{connectionId}/payables/bills/{billId}/attachments/{attachmentId}/download", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/octet-stream", + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + operation_id="download-bill-attachment", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + stream=True, + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/octet-stream"): + return http_res + if utils.match_response( + http_res, + ["401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + http_res_text = utils.stream_to_text(http_res) + data = utils.unmarshal_json(http_res_text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + async def download_attachment_async( + self, + *, + request: Union[ + operations.DownloadBillAttachmentRequest, + operations.DownloadBillAttachmentRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> httpx.Response: + r"""Download bill attachment + + The *Download bill attachment* endpoint downloads a specific attachment for a given `billId` and `attachmentId`. + + [Bills](https://docs.codat.io/sync-for-payables-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. + + Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=bills) for integrations that support downloading a bill attachment. + + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.DownloadBillAttachmentRequest) + request = cast(operations.DownloadBillAttachmentRequest, request) + + req = self.build_request_async( + method="GET", + path="/companies/{companyId}/connections/{connectionId}/payables/bills/{billId}/attachments/{attachmentId}/download", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/octet-stream", + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + operation_id="download-bill-attachment", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + stream=True, + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/octet-stream"): + return http_res + if utils.match_response( + http_res, + ["401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + http_res_text = await utils.stream_to_text_async(http_res) + data = utils.unmarshal_json(http_res_text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) diff --git a/sync-for-payables/src/codat_sync_for_payables/companies.py b/sync-for-payables/src/codat_sync_for_payables/companies.py new file mode 100644 index 000000000..1d53ed309 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/companies.py @@ -0,0 +1,1112 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .basesdk import BaseSDK +from codat_sync_for_payables import utils +from codat_sync_for_payables._hooks import HookContext +from codat_sync_for_payables.models import errors, operations, shared +from codat_sync_for_payables.types import BaseModel, OptionalNullable, UNSET +from typing import Any, Optional, Union, cast + + +class Companies(BaseSDK): + r"""Create and manage your SMB users' companies.""" + + def list( + self, + *, + request: Union[ + operations.ListCompaniesRequest, operations.ListCompaniesRequestTypedDict + ] = operations.ListCompaniesRequest(), + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.Companies: + r"""List companies + + The *List companies* endpoint returns a list of [companies] associated to your instances. + + A [company](https://docs.codat.io/sync-for-payables-api#/schemas/Company) represents a business sharing access to their data. + Each company can have multiple [connections](https://docs.codat.io/sync-for-payables-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.ListCompaniesRequest) + request = cast(operations.ListCompaniesRequest, request) + + req = self.build_request( + method="GET", + path="/companies", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + operation_id="list-companies", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "400", + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return utils.unmarshal_json(http_res.text, shared.Companies) + if utils.match_response( + http_res, + ["400", "401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + async def list_async( + self, + *, + request: Union[ + operations.ListCompaniesRequest, operations.ListCompaniesRequestTypedDict + ] = operations.ListCompaniesRequest(), + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.Companies: + r"""List companies + + The *List companies* endpoint returns a list of [companies] associated to your instances. + + A [company](https://docs.codat.io/sync-for-payables-api#/schemas/Company) represents a business sharing access to their data. + Each company can have multiple [connections](https://docs.codat.io/sync-for-payables-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.ListCompaniesRequest) + request = cast(operations.ListCompaniesRequest, request) + + req = self.build_request_async( + method="GET", + path="/companies", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + operation_id="list-companies", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "400", + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return utils.unmarshal_json(http_res.text, shared.Companies) + if utils.match_response( + http_res, + ["400", "401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + def create( + self, + *, + request: Optional[ + Union[shared.CompanyRequestBody, shared.CompanyRequestBodyTypedDict] + ] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.Company: + r"""Create company + + Use the *Create company* endpoint to create a new [company](https://docs.codat.io/sync-for-payables-api#/schemas/Company) that represents your customer in Codat. + + A [company](https://docs.codat.io/sync-for-payables-api#/schemas/Company) represents a business sharing access to their data. + Each company can have multiple [connections](https://docs.codat.io/sync-for-payables-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data. + + If forbidden characters (see `name` pattern) are present in the request, a company will be created with the forbidden characters removed. For example, `Company (Codat[1])` with be created as `Company Codat1`. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, Optional[shared.CompanyRequestBody]) + request = cast(Optional[shared.CompanyRequestBody], request) + + req = self.build_request( + method="POST", + path="/companies", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, True, "json", Optional[shared.CompanyRequestBody] + ), + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + operation_id="create-company", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "400", + "401", + "402", + "403", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return utils.unmarshal_json(http_res.text, shared.Company) + if utils.match_response( + http_res, + ["400", "401", "402", "403", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + async def create_async( + self, + *, + request: Optional[ + Union[shared.CompanyRequestBody, shared.CompanyRequestBodyTypedDict] + ] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.Company: + r"""Create company + + Use the *Create company* endpoint to create a new [company](https://docs.codat.io/sync-for-payables-api#/schemas/Company) that represents your customer in Codat. + + A [company](https://docs.codat.io/sync-for-payables-api#/schemas/Company) represents a business sharing access to their data. + Each company can have multiple [connections](https://docs.codat.io/sync-for-payables-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data. + + If forbidden characters (see `name` pattern) are present in the request, a company will be created with the forbidden characters removed. For example, `Company (Codat[1])` with be created as `Company Codat1`. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, Optional[shared.CompanyRequestBody]) + request = cast(Optional[shared.CompanyRequestBody], request) + + req = self.build_request_async( + method="POST", + path="/companies", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, True, "json", Optional[shared.CompanyRequestBody] + ), + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + operation_id="create-company", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "400", + "401", + "402", + "403", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return utils.unmarshal_json(http_res.text, shared.Company) + if utils.match_response( + http_res, + ["400", "401", "402", "403", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + def update( + self, + *, + request: Union[ + operations.UpdateCompanyRequest, operations.UpdateCompanyRequestTypedDict + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.Company: + r"""Update company + + Use the *Update company* endpoint to update both the name and description of the company. + + A [company](https://docs.codat.io/sync-for-payables-api#/schemas/Company) represents a business sharing access to their data. + Each company can have multiple [connections](https://docs.codat.io/sync-for-payables-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.UpdateCompanyRequest) + request = cast(operations.UpdateCompanyRequest, request) + + req = self.build_request( + method="PUT", + path="/companies/{companyId}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.company_request_body, + False, + True, + "json", + Optional[shared.CompanyRequestBody], + ), + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + operation_id="update-company", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return utils.unmarshal_json(http_res.text, shared.Company) + if utils.match_response( + http_res, + ["401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + async def update_async( + self, + *, + request: Union[ + operations.UpdateCompanyRequest, operations.UpdateCompanyRequestTypedDict + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.Company: + r"""Update company + + Use the *Update company* endpoint to update both the name and description of the company. + + A [company](https://docs.codat.io/sync-for-payables-api#/schemas/Company) represents a business sharing access to their data. + Each company can have multiple [connections](https://docs.codat.io/sync-for-payables-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.UpdateCompanyRequest) + request = cast(operations.UpdateCompanyRequest, request) + + req = self.build_request_async( + method="PUT", + path="/companies/{companyId}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.company_request_body, + False, + True, + "json", + Optional[shared.CompanyRequestBody], + ), + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + operation_id="update-company", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return utils.unmarshal_json(http_res.text, shared.Company) + if utils.match_response( + http_res, + ["401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + def delete( + self, + *, + request: Union[ + operations.DeleteCompanyRequest, operations.DeleteCompanyRequestTypedDict + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ): + r"""Delete a company + + The *Delete company* endpoint permanently deletes a [company](https://docs.codat.io/sync-for-payables-api#/schemas/Company), its [connections](https://docs.codat.io/sync-for-payables-api#/schemas/Connection) and any cached data. This operation is irreversible. + + A [company](https://docs.codat.io/sync-for-payables-api#/schemas/Company) represents a business sharing access to their data. + Each company can have multiple [connections](https://docs.codat.io/sync-for-payables-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data. + + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.DeleteCompanyRequest) + request = cast(operations.DeleteCompanyRequest, request) + + req = self.build_request( + method="DELETE", + path="/companies/{companyId}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + operation_id="delete-company", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "204", "*"): + return + if utils.match_response( + http_res, + ["401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + async def delete_async( + self, + *, + request: Union[ + operations.DeleteCompanyRequest, operations.DeleteCompanyRequestTypedDict + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ): + r"""Delete a company + + The *Delete company* endpoint permanently deletes a [company](https://docs.codat.io/sync-for-payables-api#/schemas/Company), its [connections](https://docs.codat.io/sync-for-payables-api#/schemas/Connection) and any cached data. This operation is irreversible. + + A [company](https://docs.codat.io/sync-for-payables-api#/schemas/Company) represents a business sharing access to their data. + Each company can have multiple [connections](https://docs.codat.io/sync-for-payables-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data. + + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.DeleteCompanyRequest) + request = cast(operations.DeleteCompanyRequest, request) + + req = self.build_request_async( + method="DELETE", + path="/companies/{companyId}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + operation_id="delete-company", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "204", "*"): + return + if utils.match_response( + http_res, + ["401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + def get( + self, + *, + request: Union[ + operations.GetCompanyRequest, operations.GetCompanyRequestTypedDict + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.Company: + r"""Get company + + The *Get company* endpoint returns a single company for a given `companyId`. + + A [company](https://docs.codat.io/sync-for-payables-api#/schemas/Company) represents a business sharing access to their data. + Each company can have multiple [connections](https://docs.codat.io/sync-for-payables-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data. + + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.GetCompanyRequest) + request = cast(operations.GetCompanyRequest, request) + + req = self.build_request( + method="GET", + path="/companies/{companyId}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + operation_id="get-company", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return utils.unmarshal_json(http_res.text, shared.Company) + if utils.match_response( + http_res, + ["401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + async def get_async( + self, + *, + request: Union[ + operations.GetCompanyRequest, operations.GetCompanyRequestTypedDict + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.Company: + r"""Get company + + The *Get company* endpoint returns a single company for a given `companyId`. + + A [company](https://docs.codat.io/sync-for-payables-api#/schemas/Company) represents a business sharing access to their data. + Each company can have multiple [connections](https://docs.codat.io/sync-for-payables-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data. + + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.GetCompanyRequest) + request = cast(operations.GetCompanyRequest, request) + + req = self.build_request_async( + method="GET", + path="/companies/{companyId}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + operation_id="get-company", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return utils.unmarshal_json(http_res.text, shared.Company) + if utils.match_response( + http_res, + ["401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) diff --git a/sync-for-payables/src/codat_sync_for_payables/company_information.py b/sync-for-payables/src/codat_sync_for_payables/company_information.py new file mode 100644 index 000000000..986c47a42 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/company_information.py @@ -0,0 +1,228 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .basesdk import BaseSDK +from codat_sync_for_payables import utils +from codat_sync_for_payables._hooks import HookContext +from codat_sync_for_payables.models import errors, operations, shared +from codat_sync_for_payables.types import BaseModel, OptionalNullable, UNSET +from typing import Any, Optional, Union, cast + + +class CompanyInformation(BaseSDK): + r"""View company profile from the source platform.""" + + def get( + self, + *, + request: Union[ + operations.GetCompanyInformationRequest, + operations.GetCompanyInformationRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.CompanyInformation: + r"""Get company information + + Use the *Get company information* endpoint to return information about the company available from the underlying accounting software. + + + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.GetCompanyInformationRequest) + request = cast(operations.GetCompanyInformationRequest, request) + + req = self.build_request( + method="GET", + path="/companies/{companyId}/connections/{connectionId}/payables/info", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + operation_id="get-company-information", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "400", + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return utils.unmarshal_json(http_res.text, shared.CompanyInformation) + if utils.match_response( + http_res, + ["400", "401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + async def get_async( + self, + *, + request: Union[ + operations.GetCompanyInformationRequest, + operations.GetCompanyInformationRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.CompanyInformation: + r"""Get company information + + Use the *Get company information* endpoint to return information about the company available from the underlying accounting software. + + + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.GetCompanyInformationRequest) + request = cast(operations.GetCompanyInformationRequest, request) + + req = self.build_request_async( + method="GET", + path="/companies/{companyId}/connections/{connectionId}/payables/info", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + operation_id="get-company-information", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "400", + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return utils.unmarshal_json(http_res.text, shared.CompanyInformation) + if utils.match_response( + http_res, + ["400", "401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) diff --git a/sync-for-payables/src/codat_sync_for_payables/connections.py b/sync-for-payables/src/codat_sync_for_payables/connections.py new file mode 100644 index 000000000..91be43ef5 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/connections.py @@ -0,0 +1,1096 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .basesdk import BaseSDK +from codat_sync_for_payables import utils +from codat_sync_for_payables._hooks import HookContext +from codat_sync_for_payables.models import errors, operations, shared +from codat_sync_for_payables.types import BaseModel, OptionalNullable, UNSET +from typing import Any, Optional, Union, cast + + +class Connections(BaseSDK): + r"""Create new and manage existing data connections for a company.""" + + def list( + self, + *, + request: Union[ + operations.ListConnectionsRequest, + operations.ListConnectionsRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.Connections: + r"""List connections + + List the connections for a company. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.ListConnectionsRequest) + request = cast(operations.ListConnectionsRequest, request) + + req = self.build_request( + method="GET", + path="/companies/{companyId}/connections", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + operation_id="list-connections", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "400", + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return utils.unmarshal_json(http_res.text, shared.Connections) + if utils.match_response( + http_res, + ["400", "401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + async def list_async( + self, + *, + request: Union[ + operations.ListConnectionsRequest, + operations.ListConnectionsRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.Connections: + r"""List connections + + List the connections for a company. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.ListConnectionsRequest) + request = cast(operations.ListConnectionsRequest, request) + + req = self.build_request_async( + method="GET", + path="/companies/{companyId}/connections", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + operation_id="list-connections", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "400", + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return utils.unmarshal_json(http_res.text, shared.Connections) + if utils.match_response( + http_res, + ["400", "401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + def create( + self, + *, + request: Union[ + operations.CreateConnectionRequest, + operations.CreateConnectionRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.Connection: + r"""Create connection + + Creates a connection for the company by providing a valid `platformKey`. + + Use the [List Integrations](https://docs.codat.io/sync-for-payables-api#/operations/list-integrations) endpoint to access valid platform keys. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.CreateConnectionRequest) + request = cast(operations.CreateConnectionRequest, request) + + req = self.build_request( + method="POST", + path="/companies/{companyId}/connections", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.request_body, + False, + True, + "json", + Optional[operations.CreateConnectionRequestBody], + ), + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + operation_id="create-connection", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return utils.unmarshal_json(http_res.text, shared.Connection) + if utils.match_response( + http_res, + ["401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + async def create_async( + self, + *, + request: Union[ + operations.CreateConnectionRequest, + operations.CreateConnectionRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.Connection: + r"""Create connection + + Creates a connection for the company by providing a valid `platformKey`. + + Use the [List Integrations](https://docs.codat.io/sync-for-payables-api#/operations/list-integrations) endpoint to access valid platform keys. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.CreateConnectionRequest) + request = cast(operations.CreateConnectionRequest, request) + + req = self.build_request_async( + method="POST", + path="/companies/{companyId}/connections", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.request_body, + False, + True, + "json", + Optional[operations.CreateConnectionRequestBody], + ), + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + operation_id="create-connection", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return utils.unmarshal_json(http_res.text, shared.Connection) + if utils.match_response( + http_res, + ["401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + def get( + self, + *, + request: Union[ + operations.GetConnectionRequest, operations.GetConnectionRequestTypedDict + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.Connection: + r"""Get connection + + Returns a specific connection for a company when valid identifiers are provided. If the identifiers are for a deleted company and/or connection, a not found response is returned. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.GetConnectionRequest) + request = cast(operations.GetConnectionRequest, request) + + req = self.build_request( + method="GET", + path="/companies/{companyId}/connections/{connectionId}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + operation_id="get-connection", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return utils.unmarshal_json(http_res.text, shared.Connection) + if utils.match_response( + http_res, + ["401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + async def get_async( + self, + *, + request: Union[ + operations.GetConnectionRequest, operations.GetConnectionRequestTypedDict + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.Connection: + r"""Get connection + + Returns a specific connection for a company when valid identifiers are provided. If the identifiers are for a deleted company and/or connection, a not found response is returned. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.GetConnectionRequest) + request = cast(operations.GetConnectionRequest, request) + + req = self.build_request_async( + method="GET", + path="/companies/{companyId}/connections/{connectionId}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + operation_id="get-connection", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return utils.unmarshal_json(http_res.text, shared.Connection) + if utils.match_response( + http_res, + ["401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + def delete( + self, + *, + request: Union[ + operations.DeleteConnectionRequest, + operations.DeleteConnectionRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ): + r"""Delete connection + + Revoke and remove a connection from a company. + This operation is not reversible. The end user would need to reauthorize a new data connection if you wish to view new data for this company. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.DeleteConnectionRequest) + request = cast(operations.DeleteConnectionRequest, request) + + req = self.build_request( + method="DELETE", + path="/companies/{companyId}/connections/{connectionId}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + operation_id="delete-connection", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "*"): + return + if utils.match_response( + http_res, + ["401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + async def delete_async( + self, + *, + request: Union[ + operations.DeleteConnectionRequest, + operations.DeleteConnectionRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ): + r"""Delete connection + + Revoke and remove a connection from a company. + This operation is not reversible. The end user would need to reauthorize a new data connection if you wish to view new data for this company. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.DeleteConnectionRequest) + request = cast(operations.DeleteConnectionRequest, request) + + req = self.build_request_async( + method="DELETE", + path="/companies/{companyId}/connections/{connectionId}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + operation_id="delete-connection", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "*"): + return + if utils.match_response( + http_res, + ["401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + def unlink( + self, + *, + request: Union[ + operations.UnlinkConnectionRequest, + operations.UnlinkConnectionRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.Connection: + r"""Unlink connection + + This allows you to deauthorize a connection, without deleting it from Codat. This means you can still view any data that has previously been pulled into Codat, and also lets you re-authorize in future if your customer wishes to resume sharing their data. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.UnlinkConnectionRequest) + request = cast(operations.UnlinkConnectionRequest, request) + + req = self.build_request( + method="PATCH", + path="/companies/{companyId}/connections/{connectionId}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.request_body, + False, + True, + "json", + Optional[operations.UnlinkConnectionUpdateConnection], + ), + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + operation_id="unlink-connection", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return utils.unmarshal_json(http_res.text, shared.Connection) + if utils.match_response( + http_res, + ["401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + async def unlink_async( + self, + *, + request: Union[ + operations.UnlinkConnectionRequest, + operations.UnlinkConnectionRequestTypedDict, + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.Connection: + r"""Unlink connection + + This allows you to deauthorize a connection, without deleting it from Codat. This means you can still view any data that has previously been pulled into Codat, and also lets you re-authorize in future if your customer wishes to resume sharing their data. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.UnlinkConnectionRequest) + request = cast(operations.UnlinkConnectionRequest, request) + + req = self.build_request_async( + method="PATCH", + path="/companies/{companyId}/connections/{connectionId}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.request_body, + False, + True, + "json", + Optional[operations.UnlinkConnectionUpdateConnection], + ), + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + operation_id="unlink-connection", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return utils.unmarshal_json(http_res.text, shared.Connection) + if utils.match_response( + http_res, + ["401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) diff --git a/sync-for-payables/src/codat_sync_for_payables/httpclient.py b/sync-for-payables/src/codat_sync_for_payables/httpclient.py new file mode 100644 index 000000000..36b642a0e --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/httpclient.py @@ -0,0 +1,78 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +# pyright: reportReturnType = false +from typing_extensions import Protocol, runtime_checkable +import httpx +from typing import Any, Optional, Union + + +@runtime_checkable +class HttpClient(Protocol): + def send( + self, + request: httpx.Request, + *, + stream: bool = False, + auth: Union[ + httpx._types.AuthTypes, httpx._client.UseClientDefault, None + ] = httpx.USE_CLIENT_DEFAULT, + follow_redirects: Union[ + bool, httpx._client.UseClientDefault + ] = httpx.USE_CLIENT_DEFAULT, + ) -> httpx.Response: + pass + + def build_request( + self, + method: str, + url: httpx._types.URLTypes, + *, + content: Optional[httpx._types.RequestContent] = None, + data: Optional[httpx._types.RequestData] = None, + files: Optional[httpx._types.RequestFiles] = None, + json: Optional[Any] = None, + params: Optional[httpx._types.QueryParamTypes] = None, + headers: Optional[httpx._types.HeaderTypes] = None, + cookies: Optional[httpx._types.CookieTypes] = None, + timeout: Union[ + httpx._types.TimeoutTypes, httpx._client.UseClientDefault + ] = httpx.USE_CLIENT_DEFAULT, + extensions: Optional[httpx._types.RequestExtensions] = None, + ) -> httpx.Request: + pass + + +@runtime_checkable +class AsyncHttpClient(Protocol): + async def send( + self, + request: httpx.Request, + *, + stream: bool = False, + auth: Union[ + httpx._types.AuthTypes, httpx._client.UseClientDefault, None + ] = httpx.USE_CLIENT_DEFAULT, + follow_redirects: Union[ + bool, httpx._client.UseClientDefault + ] = httpx.USE_CLIENT_DEFAULT, + ) -> httpx.Response: + pass + + def build_request( + self, + method: str, + url: httpx._types.URLTypes, + *, + content: Optional[httpx._types.RequestContent] = None, + data: Optional[httpx._types.RequestData] = None, + files: Optional[httpx._types.RequestFiles] = None, + json: Optional[Any] = None, + params: Optional[httpx._types.QueryParamTypes] = None, + headers: Optional[httpx._types.HeaderTypes] = None, + cookies: Optional[httpx._types.CookieTypes] = None, + timeout: Union[ + httpx._types.TimeoutTypes, httpx._client.UseClientDefault + ] = httpx.USE_CLIENT_DEFAULT, + extensions: Optional[httpx._types.RequestExtensions] = None, + ) -> httpx.Request: + pass diff --git a/sync-for-payables/src/codat_sync_for_payables/models/errors/__init__.py b/sync-for-payables/src/codat_sync_for_payables/models/errors/__init__.py new file mode 100644 index 000000000..f056b05a6 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/errors/__init__.py @@ -0,0 +1,6 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .errormessage import ErrorMessage, ErrorMessageData +from .sdkerror import SDKError + +__all__ = ["ErrorMessage", "ErrorMessageData", "SDKError"] diff --git a/sync-for-payables/src/codat_sync_for_payables/models/errors/errormessage.py b/sync-for-payables/src/codat_sync_for_payables/models/errors/errormessage.py new file mode 100644 index 000000000..02083443a --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/errors/errormessage.py @@ -0,0 +1,52 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables import utils +from codat_sync_for_payables.models.shared import ( + errorvalidation as shared_errorvalidation, +) +from codat_sync_for_payables.types import BaseModel, OptionalNullable, UNSET +import pydantic +from typing import Optional +from typing_extensions import Annotated + + +class ErrorMessageData(BaseModel): + status_code: Annotated[Optional[int], pydantic.Field(alias="statusCode")] = None + r"""The HTTP status code returned by the error.""" + + service: Optional[str] = None + r"""Codat's service the returned the error.""" + + error: Optional[str] = None + r"""A brief description of the error.""" + + correlation_id: Annotated[Optional[str], pydantic.Field(alias="correlationId")] = ( + None + ) + r"""Unique identifier used to propagate to all downstream services and determine the source of the error.""" + + validation: OptionalNullable[shared_errorvalidation.ErrorValidation] = UNSET + r"""A human-readable object describing validation decisions Codat has made. If an operation has failed because of validation errors, they will be detailed here.""" + + can_be_retried: Annotated[Optional[str], pydantic.Field(alias="canBeRetried")] = ( + None + ) + r"""`True` if the error occurred transiently and can be retried.""" + + detailed_error_code: Annotated[ + Optional[int], pydantic.Field(alias="detailedErrorCode") + ] = None + r"""Machine readable error code used to automate processes based on the code returned.""" + + +class ErrorMessage(Exception): + r"""Your `query` parameter was not correctly formed""" + + data: ErrorMessageData + + def __init__(self, data: ErrorMessageData): + self.data = data + + def __str__(self) -> str: + return utils.marshal_json(self.data, ErrorMessageData) diff --git a/sync-for-payables/src/codat_sync_for_payables/models/errors/sdkerror.py b/sync-for-payables/src/codat_sync_for_payables/models/errors/sdkerror.py new file mode 100644 index 000000000..03216cbf5 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/errors/sdkerror.py @@ -0,0 +1,22 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from dataclasses import dataclass +from typing import Optional +import httpx + + +@dataclass +class SDKError(Exception): + """Represents an error returned by the API.""" + + message: str + status_code: int = -1 + body: str = "" + raw_response: Optional[httpx.Response] = None + + def __str__(self): + body = "" + if len(self.body) > 0: + body = f"\n{self.body}" + + return f"{self.message}: Status {self.status_code}{body}" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/operations/__init__.py b/sync-for-payables/src/codat_sync_for_payables/models/operations/__init__.py new file mode 100644 index 000000000..3f73d72a0 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/operations/__init__.py @@ -0,0 +1,106 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .create_bank_account import ( + CreateBankAccountRequest, + CreateBankAccountRequestTypedDict, +) +from .create_bill import CreateBillRequest, CreateBillRequestTypedDict +from .create_bill_payment import ( + CreateBillPaymentRequest, + CreateBillPaymentRequestTypedDict, +) +from .create_connection import ( + CreateConnectionRequest, + CreateConnectionRequestBody, + CreateConnectionRequestBodyTypedDict, + CreateConnectionRequestTypedDict, +) +from .create_supplier import CreateSupplierRequest, CreateSupplierRequestTypedDict +from .delete_company import DeleteCompanyRequest, DeleteCompanyRequestTypedDict +from .delete_connection import DeleteConnectionRequest, DeleteConnectionRequestTypedDict +from .download_bill_attachment import ( + DownloadBillAttachmentRequest, + DownloadBillAttachmentRequestTypedDict, +) +from .get_company import GetCompanyRequest, GetCompanyRequestTypedDict +from .get_company_information import ( + GetCompanyInformationRequest, + GetCompanyInformationRequestTypedDict, +) +from .get_connection import GetConnectionRequest, GetConnectionRequestTypedDict +from .get_mapping_options_bills import ( + GetMappingOptionsBillsRequest, + GetMappingOptionsBillsRequestTypedDict, +) +from .get_mapping_options_payments import ( + GetMappingOptionsPaymentsRequest, + GetMappingOptionsPaymentsRequestTypedDict, +) +from .list_bill_attachments import ( + ListBillAttachmentsRequest, + ListBillAttachmentsRequestTypedDict, +) +from .list_bills import ListBillsRequest, ListBillsRequestTypedDict +from .list_companies import ListCompaniesRequest, ListCompaniesRequestTypedDict +from .list_connections import ListConnectionsRequest, ListConnectionsRequestTypedDict +from .list_suppliers import ListSuppliersRequest, ListSuppliersRequestTypedDict +from .unlink_connection import ( + UnlinkConnectionRequest, + UnlinkConnectionRequestTypedDict, + UnlinkConnectionUpdateConnection, + UnlinkConnectionUpdateConnectionTypedDict, +) +from .update_company import UpdateCompanyRequest, UpdateCompanyRequestTypedDict +from .upload_bill_attachment import ( + UploadBillAttachmentRequest, + UploadBillAttachmentRequestTypedDict, +) + +__all__ = [ + "CreateBankAccountRequest", + "CreateBankAccountRequestTypedDict", + "CreateBillPaymentRequest", + "CreateBillPaymentRequestTypedDict", + "CreateBillRequest", + "CreateBillRequestTypedDict", + "CreateConnectionRequest", + "CreateConnectionRequestBody", + "CreateConnectionRequestBodyTypedDict", + "CreateConnectionRequestTypedDict", + "CreateSupplierRequest", + "CreateSupplierRequestTypedDict", + "DeleteCompanyRequest", + "DeleteCompanyRequestTypedDict", + "DeleteConnectionRequest", + "DeleteConnectionRequestTypedDict", + "DownloadBillAttachmentRequest", + "DownloadBillAttachmentRequestTypedDict", + "GetCompanyInformationRequest", + "GetCompanyInformationRequestTypedDict", + "GetCompanyRequest", + "GetCompanyRequestTypedDict", + "GetConnectionRequest", + "GetConnectionRequestTypedDict", + "GetMappingOptionsBillsRequest", + "GetMappingOptionsBillsRequestTypedDict", + "GetMappingOptionsPaymentsRequest", + "GetMappingOptionsPaymentsRequestTypedDict", + "ListBillAttachmentsRequest", + "ListBillAttachmentsRequestTypedDict", + "ListBillsRequest", + "ListBillsRequestTypedDict", + "ListCompaniesRequest", + "ListCompaniesRequestTypedDict", + "ListConnectionsRequest", + "ListConnectionsRequestTypedDict", + "ListSuppliersRequest", + "ListSuppliersRequestTypedDict", + "UnlinkConnectionRequest", + "UnlinkConnectionRequestTypedDict", + "UnlinkConnectionUpdateConnection", + "UnlinkConnectionUpdateConnectionTypedDict", + "UpdateCompanyRequest", + "UpdateCompanyRequestTypedDict", + "UploadBillAttachmentRequest", + "UploadBillAttachmentRequestTypedDict", +] diff --git a/sync-for-payables/src/codat_sync_for_payables/models/operations/create_bank_account.py b/sync-for-payables/src/codat_sync_for_payables/models/operations/create_bank_account.py new file mode 100644 index 000000000..de52628c1 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/operations/create_bank_account.py @@ -0,0 +1,56 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.models.shared import ( + bankaccountprototype as shared_bankaccountprototype, +) +from codat_sync_for_payables.types import BaseModel +from codat_sync_for_payables.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + RequestMetadata, +) +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class CreateBankAccountRequestTypedDict(TypedDict): + company_id: str + r"""Unique identifier for a company.""" + connection_id: str + r"""Unique identifier for a connection.""" + idempotency_key: NotRequired[str] + r"""A unique identifier to ensure idempotent behaviour for subsequent requests.""" + bank_account_prototype: NotRequired[ + shared_bankaccountprototype.BankAccountPrototypeTypedDict + ] + + +class CreateBankAccountRequest(BaseModel): + company_id: Annotated[ + str, + pydantic.Field(alias="companyId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a company.""" + + connection_id: Annotated[ + str, + pydantic.Field(alias="connectionId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a connection.""" + + idempotency_key: Annotated[ + Optional[str], + pydantic.Field(alias="Idempotency-Key"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""A unique identifier to ensure idempotent behaviour for subsequent requests.""" + + bank_account_prototype: Annotated[ + Optional[shared_bankaccountprototype.BankAccountPrototype], + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] = None diff --git a/sync-for-payables/src/codat_sync_for_payables/models/operations/create_bill.py b/sync-for-payables/src/codat_sync_for_payables/models/operations/create_bill.py new file mode 100644 index 000000000..caade28c3 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/operations/create_bill.py @@ -0,0 +1,52 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.models.shared import billprototype as shared_billprototype +from codat_sync_for_payables.types import BaseModel +from codat_sync_for_payables.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + RequestMetadata, +) +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class CreateBillRequestTypedDict(TypedDict): + company_id: str + r"""Unique identifier for a company.""" + connection_id: str + r"""Unique identifier for a connection.""" + idempotency_key: NotRequired[str] + r"""A unique identifier to ensure idempotent behaviour for subsequent requests.""" + bill_prototype: NotRequired[shared_billprototype.BillPrototypeTypedDict] + + +class CreateBillRequest(BaseModel): + company_id: Annotated[ + str, + pydantic.Field(alias="companyId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a company.""" + + connection_id: Annotated[ + str, + pydantic.Field(alias="connectionId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a connection.""" + + idempotency_key: Annotated[ + Optional[str], + pydantic.Field(alias="Idempotency-Key"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""A unique identifier to ensure idempotent behaviour for subsequent requests.""" + + bill_prototype: Annotated[ + Optional[shared_billprototype.BillPrototype], + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] = None diff --git a/sync-for-payables/src/codat_sync_for_payables/models/operations/create_bill_payment.py b/sync-for-payables/src/codat_sync_for_payables/models/operations/create_bill_payment.py new file mode 100644 index 000000000..92c5011a6 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/operations/create_bill_payment.py @@ -0,0 +1,65 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.models.shared import ( + billpaymentprototype as shared_billpaymentprototype, +) +from codat_sync_for_payables.types import BaseModel +from codat_sync_for_payables.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + RequestMetadata, +) +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class CreateBillPaymentRequestTypedDict(TypedDict): + company_id: str + r"""Unique identifier for a company.""" + connection_id: str + r"""Unique identifier for a connection.""" + bill_id: str + r"""Unique identifier for a bill.""" + idempotency_key: NotRequired[str] + r"""A unique identifier to ensure idempotent behaviour for subsequent requests.""" + bill_payment_prototype: NotRequired[ + shared_billpaymentprototype.BillPaymentPrototypeTypedDict + ] + + +class CreateBillPaymentRequest(BaseModel): + company_id: Annotated[ + str, + pydantic.Field(alias="companyId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a company.""" + + connection_id: Annotated[ + str, + pydantic.Field(alias="connectionId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a connection.""" + + bill_id: Annotated[ + str, + pydantic.Field(alias="billId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a bill.""" + + idempotency_key: Annotated[ + Optional[str], + pydantic.Field(alias="Idempotency-Key"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""A unique identifier to ensure idempotent behaviour for subsequent requests.""" + + bill_payment_prototype: Annotated[ + Optional[shared_billpaymentprototype.BillPaymentPrototype], + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] = None diff --git a/sync-for-payables/src/codat_sync_for_payables/models/operations/create_connection.py b/sync-for-payables/src/codat_sync_for_payables/models/operations/create_connection.py new file mode 100644 index 000000000..68a50cead --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/operations/create_connection.py @@ -0,0 +1,42 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import BaseModel +from codat_sync_for_payables.utils import ( + FieldMetadata, + PathParamMetadata, + RequestMetadata, +) +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class CreateConnectionRequestBodyTypedDict(TypedDict): + platform_key: NotRequired[str] + r"""A unique 4-letter key to represent a platform in each integration. View [accounting](https://docs.codat.io/integrations/accounting/overview#platform-keys), [banking](https://docs.codat.io/integrations/banking/overview#platform-keys), and [commerce](https://docs.codat.io/integrations/commerce/overview#platform-keys) platform keys.""" + + +class CreateConnectionRequestBody(BaseModel): + platform_key: Annotated[Optional[str], pydantic.Field(alias="platformKey")] = None + r"""A unique 4-letter key to represent a platform in each integration. View [accounting](https://docs.codat.io/integrations/accounting/overview#platform-keys), [banking](https://docs.codat.io/integrations/banking/overview#platform-keys), and [commerce](https://docs.codat.io/integrations/commerce/overview#platform-keys) platform keys.""" + + +class CreateConnectionRequestTypedDict(TypedDict): + company_id: str + r"""Unique identifier for a company.""" + request_body: NotRequired[CreateConnectionRequestBodyTypedDict] + + +class CreateConnectionRequest(BaseModel): + company_id: Annotated[ + str, + pydantic.Field(alias="companyId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a company.""" + + request_body: Annotated[ + Optional[CreateConnectionRequestBody], + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] = None diff --git a/sync-for-payables/src/codat_sync_for_payables/models/operations/create_supplier.py b/sync-for-payables/src/codat_sync_for_payables/models/operations/create_supplier.py new file mode 100644 index 000000000..c5c89adeb --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/operations/create_supplier.py @@ -0,0 +1,54 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.models.shared import ( + supplierprototype as shared_supplierprototype, +) +from codat_sync_for_payables.types import BaseModel +from codat_sync_for_payables.utils import ( + FieldMetadata, + HeaderMetadata, + PathParamMetadata, + RequestMetadata, +) +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class CreateSupplierRequestTypedDict(TypedDict): + company_id: str + r"""Unique identifier for a company.""" + connection_id: str + r"""Unique identifier for a connection.""" + idempotency_key: NotRequired[str] + r"""A unique identifier to ensure idempotent behaviour for subsequent requests.""" + supplier_prototype: NotRequired[shared_supplierprototype.SupplierPrototypeTypedDict] + + +class CreateSupplierRequest(BaseModel): + company_id: Annotated[ + str, + pydantic.Field(alias="companyId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a company.""" + + connection_id: Annotated[ + str, + pydantic.Field(alias="connectionId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a connection.""" + + idempotency_key: Annotated[ + Optional[str], + pydantic.Field(alias="Idempotency-Key"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""A unique identifier to ensure idempotent behaviour for subsequent requests.""" + + supplier_prototype: Annotated[ + Optional[shared_supplierprototype.SupplierPrototype], + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] = None diff --git a/sync-for-payables/src/codat_sync_for_payables/models/operations/delete_company.py b/sync-for-payables/src/codat_sync_for_payables/models/operations/delete_company.py new file mode 100644 index 000000000..efb24dca6 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/operations/delete_company.py @@ -0,0 +1,21 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import BaseModel +from codat_sync_for_payables.utils import FieldMetadata, PathParamMetadata +import pydantic +from typing_extensions import Annotated, TypedDict + + +class DeleteCompanyRequestTypedDict(TypedDict): + company_id: str + r"""Unique identifier for a company.""" + + +class DeleteCompanyRequest(BaseModel): + company_id: Annotated[ + str, + pydantic.Field(alias="companyId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a company.""" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/operations/delete_connection.py b/sync-for-payables/src/codat_sync_for_payables/models/operations/delete_connection.py new file mode 100644 index 000000000..cdaa556cd --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/operations/delete_connection.py @@ -0,0 +1,30 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import BaseModel +from codat_sync_for_payables.utils import FieldMetadata, PathParamMetadata +import pydantic +from typing_extensions import Annotated, TypedDict + + +class DeleteConnectionRequestTypedDict(TypedDict): + company_id: str + r"""Unique identifier for a company.""" + connection_id: str + r"""Unique identifier for a connection.""" + + +class DeleteConnectionRequest(BaseModel): + company_id: Annotated[ + str, + pydantic.Field(alias="companyId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a company.""" + + connection_id: Annotated[ + str, + pydantic.Field(alias="connectionId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a connection.""" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/operations/download_bill_attachment.py b/sync-for-payables/src/codat_sync_for_payables/models/operations/download_bill_attachment.py new file mode 100644 index 000000000..c22442f7c --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/operations/download_bill_attachment.py @@ -0,0 +1,48 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import BaseModel +from codat_sync_for_payables.utils import FieldMetadata, PathParamMetadata +import pydantic +from typing_extensions import Annotated, TypedDict + + +class DownloadBillAttachmentRequestTypedDict(TypedDict): + company_id: str + r"""Unique identifier for a company.""" + connection_id: str + r"""Unique identifier for a connection.""" + bill_id: str + r"""Unique identifier for a bill.""" + attachment_id: str + r"""Unique identifier for an attachment.""" + + +class DownloadBillAttachmentRequest(BaseModel): + company_id: Annotated[ + str, + pydantic.Field(alias="companyId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a company.""" + + connection_id: Annotated[ + str, + pydantic.Field(alias="connectionId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a connection.""" + + bill_id: Annotated[ + str, + pydantic.Field(alias="billId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a bill.""" + + attachment_id: Annotated[ + str, + pydantic.Field(alias="attachmentId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for an attachment.""" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/operations/get_company.py b/sync-for-payables/src/codat_sync_for_payables/models/operations/get_company.py new file mode 100644 index 000000000..67ba39ebb --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/operations/get_company.py @@ -0,0 +1,21 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import BaseModel +from codat_sync_for_payables.utils import FieldMetadata, PathParamMetadata +import pydantic +from typing_extensions import Annotated, TypedDict + + +class GetCompanyRequestTypedDict(TypedDict): + company_id: str + r"""Unique identifier for a company.""" + + +class GetCompanyRequest(BaseModel): + company_id: Annotated[ + str, + pydantic.Field(alias="companyId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a company.""" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/operations/get_company_information.py b/sync-for-payables/src/codat_sync_for_payables/models/operations/get_company_information.py new file mode 100644 index 000000000..6844e6789 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/operations/get_company_information.py @@ -0,0 +1,30 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import BaseModel +from codat_sync_for_payables.utils import FieldMetadata, PathParamMetadata +import pydantic +from typing_extensions import Annotated, TypedDict + + +class GetCompanyInformationRequestTypedDict(TypedDict): + company_id: str + r"""Unique identifier for a company.""" + connection_id: str + r"""Unique identifier for a connection.""" + + +class GetCompanyInformationRequest(BaseModel): + company_id: Annotated[ + str, + pydantic.Field(alias="companyId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a company.""" + + connection_id: Annotated[ + str, + pydantic.Field(alias="connectionId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a connection.""" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/operations/get_connection.py b/sync-for-payables/src/codat_sync_for_payables/models/operations/get_connection.py new file mode 100644 index 000000000..3dee0e6e1 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/operations/get_connection.py @@ -0,0 +1,30 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import BaseModel +from codat_sync_for_payables.utils import FieldMetadata, PathParamMetadata +import pydantic +from typing_extensions import Annotated, TypedDict + + +class GetConnectionRequestTypedDict(TypedDict): + company_id: str + r"""Unique identifier for a company.""" + connection_id: str + r"""Unique identifier for a connection.""" + + +class GetConnectionRequest(BaseModel): + company_id: Annotated[ + str, + pydantic.Field(alias="companyId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a company.""" + + connection_id: Annotated[ + str, + pydantic.Field(alias="connectionId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a connection.""" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/operations/get_mapping_options_bills.py b/sync-for-payables/src/codat_sync_for_payables/models/operations/get_mapping_options_bills.py new file mode 100644 index 000000000..010685a38 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/operations/get_mapping_options_bills.py @@ -0,0 +1,53 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import BaseModel +from codat_sync_for_payables.utils import ( + FieldMetadata, + PathParamMetadata, + QueryParamMetadata, +) +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class GetMappingOptionsBillsRequestTypedDict(TypedDict): + company_id: str + r"""Unique identifier for a company.""" + connection_id: str + r"""Unique identifier for a connection.""" + continuation_token: NotRequired[str] + r"""Retrieve the next page of results using the continuation token from the previous response.""" + status_query: NotRequired[str] + r"""Codat query string allows you to filter by `status` (`status=Active||status=Archived`). [Learn more](https://docs.codat.io/using-the-api/querying) about Codat's query string.""" + + +class GetMappingOptionsBillsRequest(BaseModel): + company_id: Annotated[ + str, + pydantic.Field(alias="companyId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a company.""" + + connection_id: Annotated[ + str, + pydantic.Field(alias="connectionId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a connection.""" + + continuation_token: Annotated[ + Optional[str], + pydantic.Field(alias="continuationToken"), + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Retrieve the next page of results using the continuation token from the previous response.""" + + status_query: Annotated[ + Optional[str], + pydantic.Field(alias="statusQuery"), + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Codat query string allows you to filter by `status` (`status=Active||status=Archived`). [Learn more](https://docs.codat.io/using-the-api/querying) about Codat's query string.""" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/operations/get_mapping_options_payments.py b/sync-for-payables/src/codat_sync_for_payables/models/operations/get_mapping_options_payments.py new file mode 100644 index 000000000..9a795ec9f --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/operations/get_mapping_options_payments.py @@ -0,0 +1,53 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import BaseModel +from codat_sync_for_payables.utils import ( + FieldMetadata, + PathParamMetadata, + QueryParamMetadata, +) +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class GetMappingOptionsPaymentsRequestTypedDict(TypedDict): + company_id: str + r"""Unique identifier for a company.""" + connection_id: str + r"""Unique identifier for a connection.""" + continuation_token: NotRequired[str] + r"""Retrieve the next page of results using the continuation token from the previous response.""" + status_query: NotRequired[str] + r"""Codat query string allows you to filter by `status` (`status=Active||status=Archived`). [Learn more](https://docs.codat.io/using-the-api/querying) about Codat's query string.""" + + +class GetMappingOptionsPaymentsRequest(BaseModel): + company_id: Annotated[ + str, + pydantic.Field(alias="companyId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a company.""" + + connection_id: Annotated[ + str, + pydantic.Field(alias="connectionId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a connection.""" + + continuation_token: Annotated[ + Optional[str], + pydantic.Field(alias="continuationToken"), + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Retrieve the next page of results using the continuation token from the previous response.""" + + status_query: Annotated[ + Optional[str], + pydantic.Field(alias="statusQuery"), + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Codat query string allows you to filter by `status` (`status=Active||status=Archived`). [Learn more](https://docs.codat.io/using-the-api/querying) about Codat's query string.""" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/operations/list_bill_attachments.py b/sync-for-payables/src/codat_sync_for_payables/models/operations/list_bill_attachments.py new file mode 100644 index 000000000..077e7104a --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/operations/list_bill_attachments.py @@ -0,0 +1,39 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import BaseModel +from codat_sync_for_payables.utils import FieldMetadata, PathParamMetadata +import pydantic +from typing_extensions import Annotated, TypedDict + + +class ListBillAttachmentsRequestTypedDict(TypedDict): + company_id: str + r"""Unique identifier for a company.""" + connection_id: str + r"""Unique identifier for a connection.""" + bill_id: str + r"""Unique identifier for a bill.""" + + +class ListBillAttachmentsRequest(BaseModel): + company_id: Annotated[ + str, + pydantic.Field(alias="companyId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a company.""" + + connection_id: Annotated[ + str, + pydantic.Field(alias="connectionId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a connection.""" + + bill_id: Annotated[ + str, + pydantic.Field(alias="billId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a bill.""" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/operations/list_bills.py b/sync-for-payables/src/codat_sync_for_payables/models/operations/list_bills.py new file mode 100644 index 000000000..f0ce17326 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/operations/list_bills.py @@ -0,0 +1,52 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import BaseModel +from codat_sync_for_payables.utils import ( + FieldMetadata, + PathParamMetadata, + QueryParamMetadata, +) +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ListBillsRequestTypedDict(TypedDict): + company_id: str + r"""Unique identifier for a company.""" + connection_id: str + r"""Unique identifier for a connection.""" + continuation_token: NotRequired[str] + r"""Retrieve the next page of results using the continuation token from the previous response.""" + query: NotRequired[str] + r"""Codat query string allows you to filter by `status` and `sourceModifiedDate`. Learn more about Codat's query string [here](https://docs.codat.io/using-the-api/querying). Platfrom specfic statuses: Xero supports Open | PartiallyPaid | Paid | Void | Draft. Qbo supports Open | PartiallyPaid | Paid. FreeAgent supports Open | PartiallyPaid | Paid.""" + + +class ListBillsRequest(BaseModel): + company_id: Annotated[ + str, + pydantic.Field(alias="companyId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a company.""" + + connection_id: Annotated[ + str, + pydantic.Field(alias="connectionId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a connection.""" + + continuation_token: Annotated[ + Optional[str], + pydantic.Field(alias="continuationToken"), + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Retrieve the next page of results using the continuation token from the previous response.""" + + query: Annotated[ + Optional[str], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Codat query string allows you to filter by `status` and `sourceModifiedDate`. Learn more about Codat's query string [here](https://docs.codat.io/using-the-api/querying). Platfrom specfic statuses: Xero supports Open | PartiallyPaid | Paid | Void | Draft. Qbo supports Open | PartiallyPaid | Paid. FreeAgent supports Open | PartiallyPaid | Paid.""" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/operations/list_companies.py b/sync-for-payables/src/codat_sync_for_payables/models/operations/list_companies.py new file mode 100644 index 000000000..e6a8df3bc --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/operations/list_companies.py @@ -0,0 +1,47 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import BaseModel +from codat_sync_for_payables.utils import FieldMetadata, QueryParamMetadata +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ListCompaniesRequestTypedDict(TypedDict): + page: NotRequired[int] + r"""Page number. [Read more](https://docs.codat.io/using-the-api/paging).""" + page_size: NotRequired[int] + r"""Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging).""" + query: NotRequired[str] + r"""Codat query string. [Read more](https://docs.codat.io/using-the-api/querying).""" + order_by: NotRequired[str] + r"""Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results).""" + + +class ListCompaniesRequest(BaseModel): + page: Annotated[ + Optional[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = 1 + r"""Page number. [Read more](https://docs.codat.io/using-the-api/paging).""" + + page_size: Annotated[ + Optional[int], + pydantic.Field(alias="pageSize"), + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = 100 + r"""Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging).""" + + query: Annotated[ + Optional[str], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Codat query string. [Read more](https://docs.codat.io/using-the-api/querying).""" + + order_by: Annotated[ + Optional[str], + pydantic.Field(alias="orderBy"), + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results).""" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/operations/list_connections.py b/sync-for-payables/src/codat_sync_for_payables/models/operations/list_connections.py new file mode 100644 index 000000000..e422e36fd --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/operations/list_connections.py @@ -0,0 +1,60 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import BaseModel +from codat_sync_for_payables.utils import ( + FieldMetadata, + PathParamMetadata, + QueryParamMetadata, +) +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ListConnectionsRequestTypedDict(TypedDict): + company_id: str + r"""Unique identifier for a company.""" + page: NotRequired[int] + r"""Page number. [Read more](https://docs.codat.io/using-the-api/paging).""" + page_size: NotRequired[int] + r"""Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging).""" + query: NotRequired[str] + r"""Codat query string. [Read more](https://docs.codat.io/using-the-api/querying).""" + order_by: NotRequired[str] + r"""Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results).""" + + +class ListConnectionsRequest(BaseModel): + company_id: Annotated[ + str, + pydantic.Field(alias="companyId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a company.""" + + page: Annotated[ + Optional[int], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = 1 + r"""Page number. [Read more](https://docs.codat.io/using-the-api/paging).""" + + page_size: Annotated[ + Optional[int], + pydantic.Field(alias="pageSize"), + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = 100 + r"""Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging).""" + + query: Annotated[ + Optional[str], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Codat query string. [Read more](https://docs.codat.io/using-the-api/querying).""" + + order_by: Annotated[ + Optional[str], + pydantic.Field(alias="orderBy"), + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results).""" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/operations/list_suppliers.py b/sync-for-payables/src/codat_sync_for_payables/models/operations/list_suppliers.py new file mode 100644 index 000000000..e37ad2e71 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/operations/list_suppliers.py @@ -0,0 +1,52 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import BaseModel +from codat_sync_for_payables.utils import ( + FieldMetadata, + PathParamMetadata, + QueryParamMetadata, +) +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ListSuppliersRequestTypedDict(TypedDict): + company_id: str + r"""Unique identifier for a company.""" + connection_id: str + r"""Unique identifier for a connection.""" + continuation_token: NotRequired[str] + r"""Retrieve the next page of results using the continuation token from the previous response.""" + query: NotRequired[str] + r"""Codat query string allows you to filter by `sourceModifiedDate` or if a supplier is `Active` or `Archived` in the accounting software. Learn more about Codat's query string [here](https://docs.codat.io/using-the-api/querying).""" + + +class ListSuppliersRequest(BaseModel): + company_id: Annotated[ + str, + pydantic.Field(alias="companyId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a company.""" + + connection_id: Annotated[ + str, + pydantic.Field(alias="connectionId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a connection.""" + + continuation_token: Annotated[ + Optional[str], + pydantic.Field(alias="continuationToken"), + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Retrieve the next page of results using the continuation token from the previous response.""" + + query: Annotated[ + Optional[str], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = None + r"""Codat query string allows you to filter by `sourceModifiedDate` or if a supplier is `Active` or `Archived` in the accounting software. Learn more about Codat's query string [here](https://docs.codat.io/using-the-api/querying).""" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/operations/unlink_connection.py b/sync-for-payables/src/codat_sync_for_payables/models/operations/unlink_connection.py new file mode 100644 index 000000000..08747aaae --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/operations/unlink_connection.py @@ -0,0 +1,54 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.models.shared import ( + dataconnectionstatus as shared_dataconnectionstatus, +) +from codat_sync_for_payables.types import BaseModel +from codat_sync_for_payables.utils import ( + FieldMetadata, + PathParamMetadata, + RequestMetadata, +) +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class UnlinkConnectionUpdateConnectionTypedDict(TypedDict): + status: NotRequired[shared_dataconnectionstatus.DataConnectionStatus] + r"""The current authorization status of the data connection.""" + + +class UnlinkConnectionUpdateConnection(BaseModel): + status: Optional[shared_dataconnectionstatus.DataConnectionStatus] = None + r"""The current authorization status of the data connection.""" + + +class UnlinkConnectionRequestTypedDict(TypedDict): + company_id: str + r"""Unique identifier for a company.""" + connection_id: str + r"""Unique identifier for a connection.""" + request_body: NotRequired[UnlinkConnectionUpdateConnectionTypedDict] + + +class UnlinkConnectionRequest(BaseModel): + company_id: Annotated[ + str, + pydantic.Field(alias="companyId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a company.""" + + connection_id: Annotated[ + str, + pydantic.Field(alias="connectionId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a connection.""" + + request_body: Annotated[ + Optional[UnlinkConnectionUpdateConnection], + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] = None diff --git a/sync-for-payables/src/codat_sync_for_payables/models/operations/update_company.py b/sync-for-payables/src/codat_sync_for_payables/models/operations/update_company.py new file mode 100644 index 000000000..a73b48dfc --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/operations/update_company.py @@ -0,0 +1,37 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.models.shared import ( + companyrequestbody as shared_companyrequestbody, +) +from codat_sync_for_payables.types import BaseModel +from codat_sync_for_payables.utils import ( + FieldMetadata, + PathParamMetadata, + RequestMetadata, +) +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class UpdateCompanyRequestTypedDict(TypedDict): + company_id: str + r"""Unique identifier for a company.""" + company_request_body: NotRequired[ + shared_companyrequestbody.CompanyRequestBodyTypedDict + ] + + +class UpdateCompanyRequest(BaseModel): + company_id: Annotated[ + str, + pydantic.Field(alias="companyId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a company.""" + + company_request_body: Annotated[ + Optional[shared_companyrequestbody.CompanyRequestBody], + FieldMetadata(request=RequestMetadata(media_type="application/json")), + ] = None diff --git a/sync-for-payables/src/codat_sync_for_payables/models/operations/upload_bill_attachment.py b/sync-for-payables/src/codat_sync_for_payables/models/operations/upload_bill_attachment.py new file mode 100644 index 000000000..5c22b7d01 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/operations/upload_bill_attachment.py @@ -0,0 +1,53 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.models.shared import ( + attachmentupload as shared_attachmentupload, +) +from codat_sync_for_payables.types import BaseModel +from codat_sync_for_payables.utils import ( + FieldMetadata, + PathParamMetadata, + RequestMetadata, +) +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class UploadBillAttachmentRequestTypedDict(TypedDict): + company_id: str + r"""Unique identifier for a company.""" + connection_id: str + r"""Unique identifier for a connection.""" + bill_id: str + r"""Unique identifier for a bill.""" + attachment_upload: NotRequired[shared_attachmentupload.AttachmentUploadTypedDict] + + +class UploadBillAttachmentRequest(BaseModel): + company_id: Annotated[ + str, + pydantic.Field(alias="companyId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a company.""" + + connection_id: Annotated[ + str, + pydantic.Field(alias="connectionId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a connection.""" + + bill_id: Annotated[ + str, + pydantic.Field(alias="billId"), + FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), + ] + r"""Unique identifier for a bill.""" + + attachment_upload: Annotated[ + Optional[shared_attachmentupload.AttachmentUpload], + FieldMetadata(request=RequestMetadata(media_type="multipart/form-data")), + ] = None diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/__init__.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/__init__.py new file mode 100644 index 000000000..63eecf279 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/__init__.py @@ -0,0 +1,186 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .accountmappingoption import AccountMappingOption, AccountMappingOptionTypedDict +from .accountstatus import AccountStatus +from .accounttype import AccountType +from .address import Address, AddressTypedDict +from .addresstype import AddressType +from .attachment import Attachment, AttachmentTypedDict +from .attachmentupload import AttachmentUpload, AttachmentUploadTypedDict +from .bankaccount import BankAccount, BankAccountType, BankAccountTypedDict +from .bankaccountmappingoption import ( + BankAccountMappingOption, + BankAccountMappingOptionTypedDict, +) +from .bankaccountprototype import BankAccountPrototype, BankAccountPrototypeTypedDict +from .bankaccountstatus import BankAccountStatus +from .bill import Bill, BillTypedDict +from .billaccountref import BillAccountRef, BillAccountRefTypedDict +from .billlineitem import BillLineItem, BillLineItemTypedDict +from .billmappingoptions import BillMappingOptions, BillMappingOptionsTypedDict +from .billpayment import BillPayment, BillPaymentTypedDict +from .billpaymentaccountref import BillPaymentAccountRef, BillPaymentAccountRefTypedDict +from .billpaymentprototype import BillPaymentPrototype, BillPaymentPrototypeTypedDict +from .billprototype import BillPrototype, BillPrototypeTypedDict +from .bills import Bills, BillsTypedDict +from .billstatus import BillStatus +from .billtaxrateref import BillTaxRateRef, BillTaxRateRefTypedDict +from .clientratelimitreachedwebhook import ( + ClientRateLimitReachedWebhook, + ClientRateLimitReachedWebhookTypedDict, +) +from .clientratelimitreachedwebhookdata import ( + ClientRateLimitReachedWebhookData, + ClientRateLimitReachedWebhookDataTypedDict, +) +from .clientratelimitresetwebhook import ( + ClientRateLimitResetWebhook, + ClientRateLimitResetWebhookTypedDict, +) +from .clientratelimitresetwebhookdata import ( + ClientRateLimitResetWebhookData, + ClientRateLimitResetWebhookDataTypedDict, +) +from .clientratelimitwebhook import ( + ClientRateLimitWebhook, + ClientRateLimitWebhookTypedDict, +) +from .clientratelimitwebhookpayload import ( + ClientRateLimitWebhookPayload, + ClientRateLimitWebhookPayloadTypedDict, +) +from .codatfile import CodatFile, CodatFileTypedDict +from .companies import Companies, CompaniesTypedDict +from .company import Company, CompanyTags, CompanyTagsTypedDict, CompanyTypedDict +from .companyinformation import CompanyInformation, CompanyInformationTypedDict +from .companyrequestbody import CompanyRequestBody, CompanyRequestBodyTypedDict +from .connection import Connection, ConnectionTypedDict, SourceType +from .connections import Connections, ConnectionsTypedDict +from .dataconnectionerror import ( + DataConnectionError, + DataConnectionErrorTypedDict, + ErrorStatus, +) +from .dataconnectionstatus import DataConnectionStatus +from .errorvalidation import ErrorValidation, ErrorValidationTypedDict +from .errorvalidationitem import ErrorValidationItem, ErrorValidationItemTypedDict +from .halref import HalRef, HalRefTypedDict +from .links import Links, LinksTypedDict +from .pagination import Pagination, PaginationTypedDict +from .paymentmappingoptions import PaymentMappingOptions, PaymentMappingOptionsTypedDict +from .security import Security, SecurityTypedDict +from .supplier import Supplier, SupplierTypedDict +from .supplierprototype import SupplierPrototype, SupplierPrototypeTypedDict +from .supplierref import SupplierRef, SupplierRefTypedDict +from .suppliers import Suppliers, SuppliersTypedDict +from .supplierstatus import SupplierStatus +from .tags import Tags, TagsTypedDict +from .taxratemappingoption import ( + TaxRateMappingOption, + TaxRateMappingOptionTypedDict, + TaxRateStatus, +) + +__all__ = [ + "AccountMappingOption", + "AccountMappingOptionTypedDict", + "AccountStatus", + "AccountType", + "Address", + "AddressType", + "AddressTypedDict", + "Attachment", + "AttachmentTypedDict", + "AttachmentUpload", + "AttachmentUploadTypedDict", + "BankAccount", + "BankAccountMappingOption", + "BankAccountMappingOptionTypedDict", + "BankAccountPrototype", + "BankAccountPrototypeTypedDict", + "BankAccountStatus", + "BankAccountType", + "BankAccountTypedDict", + "Bill", + "BillAccountRef", + "BillAccountRefTypedDict", + "BillLineItem", + "BillLineItemTypedDict", + "BillMappingOptions", + "BillMappingOptionsTypedDict", + "BillPayment", + "BillPaymentAccountRef", + "BillPaymentAccountRefTypedDict", + "BillPaymentPrototype", + "BillPaymentPrototypeTypedDict", + "BillPaymentTypedDict", + "BillPrototype", + "BillPrototypeTypedDict", + "BillStatus", + "BillTaxRateRef", + "BillTaxRateRefTypedDict", + "BillTypedDict", + "Bills", + "BillsTypedDict", + "ClientRateLimitReachedWebhook", + "ClientRateLimitReachedWebhookData", + "ClientRateLimitReachedWebhookDataTypedDict", + "ClientRateLimitReachedWebhookTypedDict", + "ClientRateLimitResetWebhook", + "ClientRateLimitResetWebhookData", + "ClientRateLimitResetWebhookDataTypedDict", + "ClientRateLimitResetWebhookTypedDict", + "ClientRateLimitWebhook", + "ClientRateLimitWebhookPayload", + "ClientRateLimitWebhookPayloadTypedDict", + "ClientRateLimitWebhookTypedDict", + "CodatFile", + "CodatFileTypedDict", + "Companies", + "CompaniesTypedDict", + "Company", + "CompanyInformation", + "CompanyInformationTypedDict", + "CompanyRequestBody", + "CompanyRequestBodyTypedDict", + "CompanyTags", + "CompanyTagsTypedDict", + "CompanyTypedDict", + "Connection", + "ConnectionTypedDict", + "Connections", + "ConnectionsTypedDict", + "DataConnectionError", + "DataConnectionErrorTypedDict", + "DataConnectionStatus", + "ErrorStatus", + "ErrorValidation", + "ErrorValidationItem", + "ErrorValidationItemTypedDict", + "ErrorValidationTypedDict", + "HalRef", + "HalRefTypedDict", + "Links", + "LinksTypedDict", + "Pagination", + "PaginationTypedDict", + "PaymentMappingOptions", + "PaymentMappingOptionsTypedDict", + "Security", + "SecurityTypedDict", + "SourceType", + "Supplier", + "SupplierPrototype", + "SupplierPrototypeTypedDict", + "SupplierRef", + "SupplierRefTypedDict", + "SupplierStatus", + "SupplierTypedDict", + "Suppliers", + "SuppliersTypedDict", + "Tags", + "TagsTypedDict", + "TaxRateMappingOption", + "TaxRateMappingOptionTypedDict", + "TaxRateStatus", +] diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/accountmappingoption.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/accountmappingoption.py new file mode 100644 index 000000000..a99171912 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/accountmappingoption.py @@ -0,0 +1,109 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .accountstatus import AccountStatus +from codat_sync_for_payables.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class AccountMappingOptionTypedDict(TypedDict): + id: NotRequired[str] + r"""Identifier for the account, unique for the company.""" + nominal_code: NotRequired[Nullable[str]] + r"""Reference given to each nominal account for a business. It ensures money is allocated to the correct account. This code isn't a unique identifier in the Codat system.""" + name: NotRequired[Nullable[str]] + r"""Name of the account.""" + type: NotRequired[Nullable[str]] + r"""Type of account.""" + currency: NotRequired[str] + r"""The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. + + ## Unknown currencies + + In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + + There are only a very small number of edge cases where this currency code is returned by the Codat system. + """ + status: NotRequired[AccountStatus] + r"""The current status of the account.""" + source_modified_date: NotRequired[str] + + +class AccountMappingOption(BaseModel): + id: Optional[str] = None + r"""Identifier for the account, unique for the company.""" + + nominal_code: Annotated[ + OptionalNullable[str], pydantic.Field(alias="nominalCode") + ] = UNSET + r"""Reference given to each nominal account for a business. It ensures money is allocated to the correct account. This code isn't a unique identifier in the Codat system.""" + + name: OptionalNullable[str] = UNSET + r"""Name of the account.""" + + type: OptionalNullable[str] = UNSET + r"""Type of account.""" + + currency: Optional[str] = None + r"""The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. + + ## Unknown currencies + + In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + + There are only a very small number of edge cases where this currency code is returned by the Codat system. + """ + + status: Optional[AccountStatus] = None + r"""The current status of the account.""" + + source_modified_date: Annotated[ + Optional[str], pydantic.Field(alias="sourceModifiedDate") + ] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [ + "id", + "nominalCode", + "name", + "type", + "currency", + "status", + "sourceModifiedDate", + ] + nullable_fields = ["nominalCode", "name", "type"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in self.model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/accountstatus.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/accountstatus.py new file mode 100644 index 000000000..5f3a1eff9 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/accountstatus.py @@ -0,0 +1,11 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from enum import Enum + + +class AccountStatus(str, Enum): + r"""The current status of the account.""" + + ACTIVE = "Active" + ARCHIVED = "Archived" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/accounttype.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/accounttype.py new file mode 100644 index 000000000..e1e0a0ef8 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/accounttype.py @@ -0,0 +1,15 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from enum import Enum + + +class AccountType(str, Enum): + r"""The type of transactions and balances on the account. + For Credit accounts, positive balances are liabilities, and positive transactions **reduce** liabilities. + For Debit accounts, positive balances are assets, and positive transactions **increase** assets. + """ + + UNKNOWN = "Unknown" + CREDIT = "Credit" + DEBIT = "Debit" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/address.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/address.py new file mode 100644 index 000000000..f9b642ac9 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/address.py @@ -0,0 +1,95 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .addresstype import AddressType +from codat_sync_for_payables.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class AddressTypedDict(TypedDict): + type: NotRequired[AddressType] + r"""The type of the address""" + line1: NotRequired[Nullable[str]] + r"""Line 1 of the customer address.""" + line2: NotRequired[Nullable[str]] + r"""Line 2 of the customer address.""" + city: NotRequired[Nullable[str]] + r"""City of the customer address.""" + region: NotRequired[Nullable[str]] + r"""Region of the customer address.""" + country: NotRequired[Nullable[str]] + r"""Country of the customer's address. For NetSuite, use the 2-digit [ISO 3166](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes) country code.""" + postal_code: NotRequired[Nullable[str]] + r"""Postal code or zip code.""" + + +class Address(BaseModel): + type: Optional[AddressType] = None + r"""The type of the address""" + + line1: OptionalNullable[str] = UNSET + r"""Line 1 of the customer address.""" + + line2: OptionalNullable[str] = UNSET + r"""Line 2 of the customer address.""" + + city: OptionalNullable[str] = UNSET + r"""City of the customer address.""" + + region: OptionalNullable[str] = UNSET + r"""Region of the customer address.""" + + country: OptionalNullable[str] = UNSET + r"""Country of the customer's address. For NetSuite, use the 2-digit [ISO 3166](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes) country code.""" + + postal_code: Annotated[ + OptionalNullable[str], pydantic.Field(alias="postalCode") + ] = UNSET + r"""Postal code or zip code.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [ + "type", + "line1", + "line2", + "city", + "region", + "country", + "postalCode", + ] + nullable_fields = ["line1", "line2", "city", "region", "country", "postalCode"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in self.model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/addresstype.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/addresstype.py new file mode 100644 index 000000000..05cc759d8 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/addresstype.py @@ -0,0 +1,12 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from enum import Enum + + +class AddressType(str, Enum): + r"""The type of the address""" + + UNKNOWN = "Unknown" + BILLING = "Billing" + DELIVERY = "Delivery" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/attachment.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/attachment.py new file mode 100644 index 000000000..e863fc54b --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/attachment.py @@ -0,0 +1,178 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class AttachmentTypedDict(TypedDict): + r"""The Codat API supports pulling and pushing of file attachments for invoices, bills, direct costs, and direct incomes. + + > **Retrieving attachments** + > + > If a company is authorized, you can query the Codat API to read, download, and upload attachments without requiring a fresh sync of data. + + Unlike other data types, Codat doesn't support [sync settings](https://docs.codat.io/knowledge-base/advanced-sync-settings) for attachments. + + Note that different integrations have different requirements for file size and extension of attachments. + + | Integration | File size | File extension | + |-------------------|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Xero | 4 MB | 7Z, BMP, CSV, DOC, DOCX, EML, GIF, JPEG, JPG, KEYNOTE, MSG, NUMBERS, ODF, ODS, ODT, PAGES, PDF, PNG, PPT, PPTX, RAR, RTF, TIF, TIFF, TXT, XLS, XLSX, ZIP | + | QuickBooks Online | 100 MB | AI, CSV, DOC, DOCX, EPS, GIF, JPEG, JPG, ODS, PAGES, PDF, PNG, RTF, TIF, TXT, XLS, XLSX, XML | + | NetSuite | 100 MB | BMP, CSV, XLS, XLSX, JSON, PDF, PJPG, PJPEG, PNG, TXT, SVG, TIF, TIFF, DOC, DOCX, ZIP | + | Dynamics 365 Business Central | 350 MB | Dynamics do not explicitly outline which file types are supported but they do state here that \"You can attach any type of file, such as text, image, or video files\". | + """ + + id: NotRequired[str] + r"""Identifier for the attachment, unique for the company in the accounting software.""" + name: NotRequired[Nullable[str]] + r"""Name of the attachment file.""" + content_type: NotRequired[Nullable[str]] + r"""File type of the attachment. This is represented by appending the file type to the [IETF standard file naming requirements](https://tools.ietf.org/html/rfc6838). For example, for a jpeg file the output is **image/jpeg**. + + Supported file types vary per platform. + """ + date_created: NotRequired[str] + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ + file_size: NotRequired[Nullable[int]] + r"""File size in bytes. For example, if this reads **46153**, then the file size is 46kb.""" + include_when_sent: NotRequired[bool] + r"""If `true`, then the attachment is included with the associated invoice, bill or direct costs when it is printed, emailed, or sent to a customer, if the underlying accounting software allows this.""" + source_modified_date: NotRequired[str] + + +class Attachment(BaseModel): + r"""The Codat API supports pulling and pushing of file attachments for invoices, bills, direct costs, and direct incomes. + + > **Retrieving attachments** + > + > If a company is authorized, you can query the Codat API to read, download, and upload attachments without requiring a fresh sync of data. + + Unlike other data types, Codat doesn't support [sync settings](https://docs.codat.io/knowledge-base/advanced-sync-settings) for attachments. + + Note that different integrations have different requirements for file size and extension of attachments. + + | Integration | File size | File extension | + |-------------------|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------| + | Xero | 4 MB | 7Z, BMP, CSV, DOC, DOCX, EML, GIF, JPEG, JPG, KEYNOTE, MSG, NUMBERS, ODF, ODS, ODT, PAGES, PDF, PNG, PPT, PPTX, RAR, RTF, TIF, TIFF, TXT, XLS, XLSX, ZIP | + | QuickBooks Online | 100 MB | AI, CSV, DOC, DOCX, EPS, GIF, JPEG, JPG, ODS, PAGES, PDF, PNG, RTF, TIF, TXT, XLS, XLSX, XML | + | NetSuite | 100 MB | BMP, CSV, XLS, XLSX, JSON, PDF, PJPG, PJPEG, PNG, TXT, SVG, TIF, TIFF, DOC, DOCX, ZIP | + | Dynamics 365 Business Central | 350 MB | Dynamics do not explicitly outline which file types are supported but they do state here that \"You can attach any type of file, such as text, image, or video files\". | + """ + + id: Optional[str] = None + r"""Identifier for the attachment, unique for the company in the accounting software.""" + + name: OptionalNullable[str] = UNSET + r"""Name of the attachment file.""" + + content_type: Annotated[ + OptionalNullable[str], pydantic.Field(alias="contentType") + ] = UNSET + r"""File type of the attachment. This is represented by appending the file type to the [IETF standard file naming requirements](https://tools.ietf.org/html/rfc6838). For example, for a jpeg file the output is **image/jpeg**. + + Supported file types vary per platform. + """ + + date_created: Annotated[Optional[str], pydantic.Field(alias="dateCreated")] = None + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ + + file_size: Annotated[OptionalNullable[int], pydantic.Field(alias="fileSize")] = ( + UNSET + ) + r"""File size in bytes. For example, if this reads **46153**, then the file size is 46kb.""" + + include_when_sent: Annotated[ + Optional[bool], pydantic.Field(alias="includeWhenSent") + ] = None + r"""If `true`, then the attachment is included with the associated invoice, bill or direct costs when it is printed, emailed, or sent to a customer, if the underlying accounting software allows this.""" + + source_modified_date: Annotated[ + Optional[str], pydantic.Field(alias="sourceModifiedDate") + ] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [ + "id", + "name", + "contentType", + "dateCreated", + "fileSize", + "includeWhenSent", + "sourceModifiedDate", + ] + nullable_fields = ["name", "contentType", "fileSize"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in self.model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/attachmentupload.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/attachmentupload.py new file mode 100644 index 000000000..94768bf1f --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/attachmentupload.py @@ -0,0 +1,22 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .codatfile import CodatFile, CodatFileTypedDict +from codat_sync_for_payables.types import BaseModel +from codat_sync_for_payables.utils import FieldMetadata, MultipartFormMetadata +import pydantic +from typing_extensions import Annotated, TypedDict + + +class AttachmentUploadTypedDict(TypedDict): + file: CodatFileTypedDict + r"""The file to be uploaded as an attachment.""" + + +class AttachmentUpload(BaseModel): + file: Annotated[ + CodatFile, + pydantic.Field(alias=""), + FieldMetadata(multipart=MultipartFormMetadata(file=True)), + ] + r"""The file to be uploaded as an attachment.""" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/bankaccount.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/bankaccount.py new file mode 100644 index 000000000..2b9bb0833 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/bankaccount.py @@ -0,0 +1,161 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .bankaccountstatus import BankAccountStatus +from codat_sync_for_payables.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from enum import Enum +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class BankAccountType(str, Enum): + r"""The type of transactions and balances on the account. + For Credit accounts, positive balances are liabilities, and positive transactions **reduce** liabilities. + For Debit accounts, positive balances are assets, and positive transactions **increase** assets. + """ + + UNKNOWN = "Unknown" + CREDIT = "Credit" + DEBIT = "Debit" + + +class BankAccountTypedDict(TypedDict): + id: NotRequired[str] + r"""Identifier for the bank account, unique for the company in the accounting software.""" + nominal_code: NotRequired[Nullable[str]] + r"""Code used to identify each nominal account for a business.""" + name: NotRequired[Nullable[str]] + r"""Name of the bank account in the accounting software.""" + account_type: NotRequired[BankAccountType] + r"""The type of transactions and balances on the account. + For Credit accounts, positive balances are liabilities, and positive transactions **reduce** liabilities. + For Debit accounts, positive balances are assets, and positive transactions **increase** assets. + """ + account_number: NotRequired[Nullable[str]] + r"""Account number for the bank account. + + Xero integrations + Only a UK account number shows for bank accounts with GBP currency and a combined total of sort code and account number that equals 14 digits, For non-GBP accounts, the full bank account number is populated. + """ + sort_code: NotRequired[Nullable[str]] + r"""Sort code for the bank account. This is relevant to UK bank accounts. + + Xero integrations + The sort code is only displayed when the currency = GBP and the sort code and account number sum to 14 digits. For non-GBP accounts, this field is not populated. + """ + currency: NotRequired[str] + r"""The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. + + ## Unknown currencies + + In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + + There are only a very small number of edge cases where this currency code is returned by the Codat system. + """ + status: NotRequired[BankAccountStatus] + r"""The current status of the bank account.""" + source_modified_date: NotRequired[str] + + +class BankAccount(BaseModel): + id: Optional[str] = None + r"""Identifier for the bank account, unique for the company in the accounting software.""" + + nominal_code: Annotated[ + OptionalNullable[str], pydantic.Field(alias="nominalCode") + ] = UNSET + r"""Code used to identify each nominal account for a business.""" + + name: OptionalNullable[str] = UNSET + r"""Name of the bank account in the accounting software.""" + + account_type: Annotated[ + Optional[BankAccountType], pydantic.Field(alias="accountType") + ] = None + r"""The type of transactions and balances on the account. + For Credit accounts, positive balances are liabilities, and positive transactions **reduce** liabilities. + For Debit accounts, positive balances are assets, and positive transactions **increase** assets. + """ + + account_number: Annotated[ + OptionalNullable[str], pydantic.Field(alias="accountNumber") + ] = UNSET + r"""Account number for the bank account. + + Xero integrations + Only a UK account number shows for bank accounts with GBP currency and a combined total of sort code and account number that equals 14 digits, For non-GBP accounts, the full bank account number is populated. + """ + + sort_code: Annotated[OptionalNullable[str], pydantic.Field(alias="sortCode")] = ( + UNSET + ) + r"""Sort code for the bank account. This is relevant to UK bank accounts. + + Xero integrations + The sort code is only displayed when the currency = GBP and the sort code and account number sum to 14 digits. For non-GBP accounts, this field is not populated. + """ + + currency: Optional[str] = None + r"""The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. + + ## Unknown currencies + + In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + + There are only a very small number of edge cases where this currency code is returned by the Codat system. + """ + + status: Optional[BankAccountStatus] = None + r"""The current status of the bank account.""" + + source_modified_date: Annotated[ + Optional[str], pydantic.Field(alias="sourceModifiedDate") + ] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [ + "id", + "nominalCode", + "name", + "accountType", + "accountNumber", + "sortCode", + "currency", + "status", + "sourceModifiedDate", + ] + nullable_fields = ["nominalCode", "name", "accountNumber", "sortCode"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in self.model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/bankaccountmappingoption.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/bankaccountmappingoption.py new file mode 100644 index 000000000..980deac36 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/bankaccountmappingoption.py @@ -0,0 +1,142 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .accounttype import AccountType +from .bankaccountstatus import BankAccountStatus +from codat_sync_for_payables.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class BankAccountMappingOptionTypedDict(TypedDict): + id: NotRequired[str] + r"""Identifier for the account, unique for the company in the accounting software.""" + name: NotRequired[Nullable[str]] + r"""Name of the bank account in the accounting software.""" + account_number: NotRequired[Nullable[str]] + r"""Account number for the bank account. + + Xero integrations + Only a UK account number shows for bank accounts with GBP currency and a combined total of sort code and account number that equals 14 digits, For non-GBP accounts, the full bank account number is populated. + """ + nominal_code: NotRequired[Nullable[str]] + r"""Code used to identify each nominal account for a business.""" + sort_code: NotRequired[Nullable[str]] + r"""Sort code for the bank account. + + Xero integrations + The sort code is only displayed when the currency = GBP and the sort code and account number sum to 14 digits. For non-GBP accounts, this field is not populated. + """ + currency: NotRequired[Nullable[str]] + r"""The bank account's base currency.""" + status: NotRequired[BankAccountStatus] + r"""The current status of the bank account.""" + account_type: NotRequired[AccountType] + r"""The type of transactions and balances on the account. + For Credit accounts, positive balances are liabilities, and positive transactions **reduce** liabilities. + For Debit accounts, positive balances are assets, and positive transactions **increase** assets. + """ + source_modified_date: NotRequired[str] + + +class BankAccountMappingOption(BaseModel): + id: Optional[str] = None + r"""Identifier for the account, unique for the company in the accounting software.""" + + name: OptionalNullable[str] = UNSET + r"""Name of the bank account in the accounting software.""" + + account_number: Annotated[ + OptionalNullable[str], pydantic.Field(alias="accountNumber") + ] = UNSET + r"""Account number for the bank account. + + Xero integrations + Only a UK account number shows for bank accounts with GBP currency and a combined total of sort code and account number that equals 14 digits, For non-GBP accounts, the full bank account number is populated. + """ + + nominal_code: Annotated[ + OptionalNullable[str], pydantic.Field(alias="nominalCode") + ] = UNSET + r"""Code used to identify each nominal account for a business.""" + + sort_code: Annotated[OptionalNullable[str], pydantic.Field(alias="sortCode")] = ( + UNSET + ) + r"""Sort code for the bank account. + + Xero integrations + The sort code is only displayed when the currency = GBP and the sort code and account number sum to 14 digits. For non-GBP accounts, this field is not populated. + """ + + currency: OptionalNullable[str] = UNSET + r"""The bank account's base currency.""" + + status: Optional[BankAccountStatus] = None + r"""The current status of the bank account.""" + + account_type: Annotated[ + Optional[AccountType], pydantic.Field(alias="accountType") + ] = None + r"""The type of transactions and balances on the account. + For Credit accounts, positive balances are liabilities, and positive transactions **reduce** liabilities. + For Debit accounts, positive balances are assets, and positive transactions **increase** assets. + """ + + source_modified_date: Annotated[ + Optional[str], pydantic.Field(alias="sourceModifiedDate") + ] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [ + "id", + "name", + "accountNumber", + "nominalCode", + "sortCode", + "currency", + "status", + "accountType", + "sourceModifiedDate", + ] + nullable_fields = [ + "name", + "accountNumber", + "nominalCode", + "sortCode", + "currency", + ] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in self.model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/bankaccountprototype.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/bankaccountprototype.py new file mode 100644 index 000000000..bd5ee7bbe --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/bankaccountprototype.py @@ -0,0 +1,119 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .accounttype import AccountType +from codat_sync_for_payables.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +import pydantic +from pydantic import model_serializer +from typing_extensions import Annotated, NotRequired, TypedDict + + +class BankAccountPrototypeTypedDict(TypedDict): + name: Nullable[str] + r"""Name of the bank account in the accounting software.""" + account_type: AccountType + r"""The type of transactions and balances on the account. + For Credit accounts, positive balances are liabilities, and positive transactions **reduce** liabilities. + For Debit accounts, positive balances are assets, and positive transactions **increase** assets. + """ + account_number: Nullable[str] + r"""Account number for the bank account. + + Xero integrations + Only a UK account number shows for bank accounts with GBP currency and a combined total of sort code and account number that equals 14 digits, For non-GBP accounts, the full bank account number is populated. + """ + currency: str + r"""The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. + + ## Unknown currencies + + In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + + There are only a very small number of edge cases where this currency code is returned by the Codat system. + """ + nominal_code: NotRequired[Nullable[str]] + r"""Code used to identify each nominal account for a business.""" + sort_code: NotRequired[Nullable[str]] + r"""Sort code for the bank account. This is relevant to UK bank accounts. + + Xero integrations + The sort code is only displayed when the currency = GBP and the sort code and account number sum to 14 digits. For non-GBP accounts, this field is not populated. + """ + + +class BankAccountPrototype(BaseModel): + name: Nullable[str] + r"""Name of the bank account in the accounting software.""" + + account_type: Annotated[AccountType, pydantic.Field(alias="accountType")] + r"""The type of transactions and balances on the account. + For Credit accounts, positive balances are liabilities, and positive transactions **reduce** liabilities. + For Debit accounts, positive balances are assets, and positive transactions **increase** assets. + """ + + account_number: Annotated[Nullable[str], pydantic.Field(alias="accountNumber")] + r"""Account number for the bank account. + + Xero integrations + Only a UK account number shows for bank accounts with GBP currency and a combined total of sort code and account number that equals 14 digits, For non-GBP accounts, the full bank account number is populated. + """ + + currency: str + r"""The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. + + ## Unknown currencies + + In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + + There are only a very small number of edge cases where this currency code is returned by the Codat system. + """ + + nominal_code: Annotated[ + OptionalNullable[str], pydantic.Field(alias="nominalCode") + ] = UNSET + r"""Code used to identify each nominal account for a business.""" + + sort_code: Annotated[OptionalNullable[str], pydantic.Field(alias="sortCode")] = ( + UNSET + ) + r"""Sort code for the bank account. This is relevant to UK bank accounts. + + Xero integrations + The sort code is only displayed when the currency = GBP and the sort code and account number sum to 14 digits. For non-GBP accounts, this field is not populated. + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["nominalCode", "sortCode"] + nullable_fields = ["name", "accountNumber", "nominalCode", "sortCode"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in self.model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/bankaccountstatus.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/bankaccountstatus.py new file mode 100644 index 000000000..7db267519 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/bankaccountstatus.py @@ -0,0 +1,11 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from enum import Enum + + +class BankAccountStatus(str, Enum): + r"""The current status of the bank account.""" + + ACTIVE = "Active" + ARCHIVED = "Archived" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/bill.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/bill.py new file mode 100644 index 000000000..2e6bd6c06 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/bill.py @@ -0,0 +1,225 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .billlineitem import BillLineItem, BillLineItemTypedDict +from .billstatus import BillStatus +from .supplierref import SupplierRef, SupplierRefTypedDict +from codat_sync_for_payables.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from codat_sync_for_payables.utils import serialize_decimal, validate_decimal +from decimal import Decimal +import pydantic +from pydantic import model_serializer +from pydantic.functional_serializers import PlainSerializer +from pydantic.functional_validators import BeforeValidator +from typing import List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class BillTypedDict(TypedDict): + r"""Bills are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services.""" + + supplier_ref: SupplierRefTypedDict + r"""Reference to the supplier the record relates to.""" + issue_date: str + due_date: str + currency: str + r"""The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. + + ## Unknown currencies + + In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + + There are only a very small number of edge cases where this currency code is returned by the Codat system. + """ + status: BillStatus + r"""Current state of the bill. If creating a bill the status must be `Open`.""" + id: NotRequired[str] + r"""Identifier for the bill, unique for the company in the accounting software.""" + reference: NotRequired[Nullable[str]] + r"""User-friendly reference for the bill.""" + currency_rate: NotRequired[Nullable[Decimal]] + r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. + + Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. + + It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. + + Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). + + For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. + + ## Examples with base currency of GBP + + | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | + | :--------------- | :------------- | :------------ | :------------------------- | + | **USD** | $20 | 0.781 | £15.62 | + | **EUR** | €20 | 0.885 | £17.70 | + | **RUB** | ₽20 | 0.011 | £0.22 | + + ## Examples with base currency of USD + + | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | + | :--------------- | :------------- | :------------ | :------------------------- | + | **GBP** | £20 | 1.277 | $25.54 | + | **EUR** | €20 | 1.134 | $22.68 | + | **RUB** | ₽20 | 0.015 | $0.30 | + + + ### Integration-specific details + + | Integration | Scenario | System behavior | + |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | + """ + line_items: NotRequired[Nullable[List[BillLineItemTypedDict]]] + r"""Array of Bill line items.""" + total_amount: NotRequired[Decimal] + r"""Amount of the bill, including tax.""" + amount_due: NotRequired[Nullable[Decimal]] + r"""Amount outstanding on the bill.""" + source_modified_date: NotRequired[str] + + +class Bill(BaseModel): + r"""Bills are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services.""" + + supplier_ref: Annotated[SupplierRef, pydantic.Field(alias="supplierRef")] + r"""Reference to the supplier the record relates to.""" + + issue_date: Annotated[str, pydantic.Field(alias="issueDate")] + + due_date: Annotated[str, pydantic.Field(alias="dueDate")] + + currency: str + r"""The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. + + ## Unknown currencies + + In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + + There are only a very small number of edge cases where this currency code is returned by the Codat system. + """ + + status: BillStatus + r"""Current state of the bill. If creating a bill the status must be `Open`.""" + + id: Optional[str] = None + r"""Identifier for the bill, unique for the company in the accounting software.""" + + reference: OptionalNullable[str] = UNSET + r"""User-friendly reference for the bill.""" + + currency_rate: Annotated[ + Annotated[ + OptionalNullable[Decimal], + BeforeValidator(validate_decimal), + PlainSerializer(serialize_decimal(False)), + ], + pydantic.Field(alias="currencyRate"), + ] = UNSET + r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. + + Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. + + It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. + + Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). + + For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. + + ## Examples with base currency of GBP + + | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | + | :--------------- | :------------- | :------------ | :------------------------- | + | **USD** | $20 | 0.781 | £15.62 | + | **EUR** | €20 | 0.885 | £17.70 | + | **RUB** | ₽20 | 0.011 | £0.22 | + + ## Examples with base currency of USD + + | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | + | :--------------- | :------------- | :------------ | :------------------------- | + | **GBP** | £20 | 1.277 | $25.54 | + | **EUR** | €20 | 1.134 | $22.68 | + | **RUB** | ₽20 | 0.015 | $0.30 | + + + ### Integration-specific details + + | Integration | Scenario | System behavior | + |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | + """ + + line_items: Annotated[ + OptionalNullable[List[BillLineItem]], pydantic.Field(alias="lineItems") + ] = UNSET + r"""Array of Bill line items.""" + + total_amount: Annotated[ + Annotated[ + Optional[Decimal], + BeforeValidator(validate_decimal), + PlainSerializer(serialize_decimal(False)), + ], + pydantic.Field(alias="totalAmount"), + ] = None + r"""Amount of the bill, including tax.""" + + amount_due: Annotated[ + Annotated[ + OptionalNullable[Decimal], + BeforeValidator(validate_decimal), + PlainSerializer(serialize_decimal(False)), + ], + pydantic.Field(alias="amountDue"), + ] = UNSET + r"""Amount outstanding on the bill.""" + + source_modified_date: Annotated[ + Optional[str], pydantic.Field(alias="sourceModifiedDate") + ] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [ + "id", + "reference", + "currencyRate", + "lineItems", + "totalAmount", + "amountDue", + "sourceModifiedDate", + ] + nullable_fields = ["reference", "currencyRate", "lineItems", "amountDue"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in self.model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/billaccountref.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/billaccountref.py new file mode 100644 index 000000000..211829d2e --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/billaccountref.py @@ -0,0 +1,20 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import BaseModel +from typing import Optional +from typing_extensions import NotRequired, TypedDict + + +class BillAccountRefTypedDict(TypedDict): + r"""Reference to the account to which the line item is linked.""" + + id: NotRequired[str] + r"""'id' from the Accounts data type.""" + + +class BillAccountRef(BaseModel): + r"""Reference to the account to which the line item is linked.""" + + id: Optional[str] = None + r"""'id' from the Accounts data type.""" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/billlineitem.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/billlineitem.py new file mode 100644 index 000000000..6c27c35a2 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/billlineitem.py @@ -0,0 +1,115 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .billaccountref import BillAccountRef, BillAccountRefTypedDict +from .billtaxrateref import BillTaxRateRef, BillTaxRateRefTypedDict +from codat_sync_for_payables.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from codat_sync_for_payables.utils import serialize_decimal, validate_decimal +from decimal import Decimal +import pydantic +from pydantic import model_serializer +from pydantic.functional_serializers import PlainSerializer +from pydantic.functional_validators import BeforeValidator +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class BillLineItemTypedDict(TypedDict): + unit_amount: Decimal + r"""Unit price of the goods or service.""" + quantity: Decimal + r"""Number of units of goods or services received.""" + account_ref: BillAccountRefTypedDict + r"""Reference to the account to which the line item is linked.""" + tax_rate_ref: BillTaxRateRefTypedDict + r"""Reference to the tax rate to which the line item is linked.""" + description: NotRequired[Nullable[str]] + r"""Friendly name of the goods or services received.""" + tax_amount: NotRequired[Decimal] + r"""Amount of tax applied to the line item.""" + total_amount: NotRequired[Nullable[Decimal]] + r"""Total amount of the line, including tax.""" + + +class BillLineItem(BaseModel): + unit_amount: Annotated[ + Annotated[ + Decimal, + BeforeValidator(validate_decimal), + PlainSerializer(serialize_decimal(False)), + ], + pydantic.Field(alias="unitAmount"), + ] + r"""Unit price of the goods or service.""" + + quantity: Annotated[ + Decimal, + BeforeValidator(validate_decimal), + PlainSerializer(serialize_decimal(False)), + ] + r"""Number of units of goods or services received.""" + + account_ref: Annotated[BillAccountRef, pydantic.Field(alias="accountRef")] + r"""Reference to the account to which the line item is linked.""" + + tax_rate_ref: Annotated[BillTaxRateRef, pydantic.Field(alias="taxRateRef")] + r"""Reference to the tax rate to which the line item is linked.""" + + description: OptionalNullable[str] = UNSET + r"""Friendly name of the goods or services received.""" + + tax_amount: Annotated[ + Annotated[ + Optional[Decimal], + BeforeValidator(validate_decimal), + PlainSerializer(serialize_decimal(False)), + ], + pydantic.Field(alias="taxAmount"), + ] = None + r"""Amount of tax applied to the line item.""" + + total_amount: Annotated[ + Annotated[ + OptionalNullable[Decimal], + BeforeValidator(validate_decimal), + PlainSerializer(serialize_decimal(False)), + ], + pydantic.Field(alias="totalAmount"), + ] = UNSET + r"""Total amount of the line, including tax.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["description", "taxAmount", "totalAmount"] + nullable_fields = ["description", "totalAmount"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in self.model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/billmappingoptions.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/billmappingoptions.py new file mode 100644 index 000000000..84b0c713c --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/billmappingoptions.py @@ -0,0 +1,30 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .accountmappingoption import AccountMappingOption, AccountMappingOptionTypedDict +from .pagination import Pagination, PaginationTypedDict +from .taxratemappingoption import TaxRateMappingOption, TaxRateMappingOptionTypedDict +from codat_sync_for_payables.types import BaseModel +import pydantic +from typing import List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class BillMappingOptionsTypedDict(TypedDict): + r"""The bill mapping options for a company's accounting software.""" + + accounts: NotRequired[List[AccountMappingOptionTypedDict]] + tax_rate: NotRequired[List[TaxRateMappingOptionTypedDict]] + pagination: NotRequired[PaginationTypedDict] + + +class BillMappingOptions(BaseModel): + r"""The bill mapping options for a company's accounting software.""" + + accounts: Optional[List[AccountMappingOption]] = None + + tax_rate: Annotated[ + Optional[List[TaxRateMappingOption]], pydantic.Field(alias="taxRate") + ] = None + + pagination: Optional[Pagination] = None diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/billpayment.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/billpayment.py new file mode 100644 index 000000000..03150a819 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/billpayment.py @@ -0,0 +1,166 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .billpaymentaccountref import BillPaymentAccountRef, BillPaymentAccountRefTypedDict +from codat_sync_for_payables.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from codat_sync_for_payables.utils import serialize_decimal, validate_decimal +from decimal import Decimal +import pydantic +from pydantic import model_serializer +from pydantic.functional_serializers import PlainSerializer +from pydantic.functional_validators import BeforeValidator +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class BillPaymentTypedDict(TypedDict): + id: NotRequired[str] + r"""Identifier for the bill payment, unique for the company in the accounting software.""" + amount: NotRequired[Decimal] + r"""Amount of the payment in the bill currency.""" + date_: NotRequired[str] + reference: NotRequired[Nullable[str]] + r"""Additional information associated with the payment.""" + account_ref: NotRequired[BillPaymentAccountRefTypedDict] + r"""Reference to the bank account / credit card which you are using to pay the bill.""" + currency_rate: NotRequired[Nullable[Decimal]] + r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. + + Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. + + It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. + + Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). + + For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. + + ## Examples with base currency of GBP + + | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | + | :--------------- | :------------- | :------------ | :------------------------- | + | **USD** | $20 | 0.781 | £15.62 | + | **EUR** | €20 | 0.885 | £17.70 | + | **RUB** | ₽20 | 0.011 | £0.22 | + + ## Examples with base currency of USD + + | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | + | :--------------- | :------------- | :------------ | :------------------------- | + | **GBP** | £20 | 1.277 | $25.54 | + | **EUR** | €20 | 1.134 | $22.68 | + | **RUB** | ₽20 | 0.015 | $0.30 | + + + ### Integration-specific details + + | Integration | Scenario | System behavior | + |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | + """ + + +class BillPayment(BaseModel): + id: Optional[str] = None + r"""Identifier for the bill payment, unique for the company in the accounting software.""" + + amount: Annotated[ + Optional[Decimal], + BeforeValidator(validate_decimal), + PlainSerializer(serialize_decimal(False)), + ] = None + r"""Amount of the payment in the bill currency.""" + + date_: Annotated[Optional[str], pydantic.Field(alias="date")] = None + + reference: OptionalNullable[str] = UNSET + r"""Additional information associated with the payment.""" + + account_ref: Annotated[ + Optional[BillPaymentAccountRef], pydantic.Field(alias="accountRef") + ] = None + r"""Reference to the bank account / credit card which you are using to pay the bill.""" + + currency_rate: Annotated[ + Annotated[ + OptionalNullable[Decimal], + BeforeValidator(validate_decimal), + PlainSerializer(serialize_decimal(False)), + ], + pydantic.Field(alias="currencyRate"), + ] = UNSET + r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. + + Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. + + It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. + + Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). + + For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. + + ## Examples with base currency of GBP + + | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | + | :--------------- | :------------- | :------------ | :------------------------- | + | **USD** | $20 | 0.781 | £15.62 | + | **EUR** | €20 | 0.885 | £17.70 | + | **RUB** | ₽20 | 0.011 | £0.22 | + + ## Examples with base currency of USD + + | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | + | :--------------- | :------------- | :------------ | :------------------------- | + | **GBP** | £20 | 1.277 | $25.54 | + | **EUR** | €20 | 1.134 | $22.68 | + | **RUB** | ₽20 | 0.015 | $0.30 | + + + ### Integration-specific details + + | Integration | Scenario | System behavior | + |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [ + "id", + "amount", + "date", + "reference", + "accountRef", + "currencyRate", + ] + nullable_fields = ["reference", "currencyRate"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in self.model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/billpaymentaccountref.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/billpaymentaccountref.py new file mode 100644 index 000000000..1f0115564 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/billpaymentaccountref.py @@ -0,0 +1,19 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import BaseModel +from typing_extensions import TypedDict + + +class BillPaymentAccountRefTypedDict(TypedDict): + r"""Reference to the bank account / credit card which you are using to pay the bill.""" + + id: str + r"""Unique ID of the bank account / credit card""" + + +class BillPaymentAccountRef(BaseModel): + r"""Reference to the bank account / credit card which you are using to pay the bill.""" + + id: str + r"""Unique ID of the bank account / credit card""" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/billpaymentprototype.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/billpaymentprototype.py new file mode 100644 index 000000000..8f8f30151 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/billpaymentprototype.py @@ -0,0 +1,151 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .billpaymentaccountref import BillPaymentAccountRef, BillPaymentAccountRefTypedDict +from codat_sync_for_payables.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from codat_sync_for_payables.utils import serialize_decimal, validate_decimal +from decimal import Decimal +import pydantic +from pydantic import model_serializer +from pydantic.functional_serializers import PlainSerializer +from pydantic.functional_validators import BeforeValidator +from typing_extensions import Annotated, NotRequired, TypedDict + + +class BillPaymentPrototypeTypedDict(TypedDict): + amount: Decimal + r"""Amount of the payment in the bill currency.""" + date_: str + account_ref: BillPaymentAccountRefTypedDict + r"""Reference to the bank account / credit card which you are using to pay the bill.""" + reference: NotRequired[Nullable[str]] + r"""Additional information associated with the payment.""" + currency_rate: NotRequired[Nullable[Decimal]] + r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. + + Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. + + It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. + + Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). + + For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. + + ## Examples with base currency of GBP + + | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | + | :--------------- | :------------- | :------------ | :------------------------- | + | **USD** | $20 | 0.781 | £15.62 | + | **EUR** | €20 | 0.885 | £17.70 | + | **RUB** | ₽20 | 0.011 | £0.22 | + + ## Examples with base currency of USD + + | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | + | :--------------- | :------------- | :------------ | :------------------------- | + | **GBP** | £20 | 1.277 | $25.54 | + | **EUR** | €20 | 1.134 | $22.68 | + | **RUB** | ₽20 | 0.015 | $0.30 | + + + ### Integration-specific details + + | Integration | Scenario | System behavior | + |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | + """ + + +class BillPaymentPrototype(BaseModel): + amount: Annotated[ + Decimal, + BeforeValidator(validate_decimal), + PlainSerializer(serialize_decimal(False)), + ] + r"""Amount of the payment in the bill currency.""" + + date_: Annotated[str, pydantic.Field(alias="date")] + + account_ref: Annotated[BillPaymentAccountRef, pydantic.Field(alias="accountRef")] + r"""Reference to the bank account / credit card which you are using to pay the bill.""" + + reference: OptionalNullable[str] = UNSET + r"""Additional information associated with the payment.""" + + currency_rate: Annotated[ + Annotated[ + OptionalNullable[Decimal], + BeforeValidator(validate_decimal), + PlainSerializer(serialize_decimal(False)), + ], + pydantic.Field(alias="currencyRate"), + ] = UNSET + r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. + + Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. + + It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. + + Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). + + For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. + + ## Examples with base currency of GBP + + | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | + | :--------------- | :------------- | :------------ | :------------------------- | + | **USD** | $20 | 0.781 | £15.62 | + | **EUR** | €20 | 0.885 | £17.70 | + | **RUB** | ₽20 | 0.011 | £0.22 | + + ## Examples with base currency of USD + + | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | + | :--------------- | :------------- | :------------ | :------------------------- | + | **GBP** | £20 | 1.277 | $25.54 | + | **EUR** | €20 | 1.134 | $22.68 | + | **RUB** | ₽20 | 0.015 | $0.30 | + + + ### Integration-specific details + + | Integration | Scenario | System behavior | + |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["reference", "currencyRate"] + nullable_fields = ["reference", "currencyRate"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in self.model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/billprototype.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/billprototype.py new file mode 100644 index 000000000..9ca17bfde --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/billprototype.py @@ -0,0 +1,179 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .billlineitem import BillLineItem, BillLineItemTypedDict +from .billstatus import BillStatus +from .supplierref import SupplierRef, SupplierRefTypedDict +from codat_sync_for_payables.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from codat_sync_for_payables.utils import serialize_decimal, validate_decimal +from decimal import Decimal +import pydantic +from pydantic import model_serializer +from pydantic.functional_serializers import PlainSerializer +from pydantic.functional_validators import BeforeValidator +from typing import List +from typing_extensions import Annotated, NotRequired, TypedDict + + +class BillPrototypeTypedDict(TypedDict): + supplier_ref: SupplierRefTypedDict + r"""Reference to the supplier the record relates to.""" + issue_date: str + due_date: str + currency: str + r"""The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. + + ## Unknown currencies + + In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + + There are only a very small number of edge cases where this currency code is returned by the Codat system. + """ + status: BillStatus + r"""Current state of the bill. If creating a bill the status must be `Open`.""" + reference: NotRequired[Nullable[str]] + r"""User-friendly reference for the bill.""" + currency_rate: NotRequired[Nullable[Decimal]] + r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. + + Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. + + It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. + + Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). + + For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. + + ## Examples with base currency of GBP + + | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | + | :--------------- | :------------- | :------------ | :------------------------- | + | **USD** | $20 | 0.781 | £15.62 | + | **EUR** | €20 | 0.885 | £17.70 | + | **RUB** | ₽20 | 0.011 | £0.22 | + + ## Examples with base currency of USD + + | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | + | :--------------- | :------------- | :------------ | :------------------------- | + | **GBP** | £20 | 1.277 | $25.54 | + | **EUR** | €20 | 1.134 | $22.68 | + | **RUB** | ₽20 | 0.015 | $0.30 | + + + ### Integration-specific details + + | Integration | Scenario | System behavior | + |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | + """ + line_items: NotRequired[Nullable[List[BillLineItemTypedDict]]] + r"""Array of Bill line items.""" + + +class BillPrototype(BaseModel): + supplier_ref: Annotated[SupplierRef, pydantic.Field(alias="supplierRef")] + r"""Reference to the supplier the record relates to.""" + + issue_date: Annotated[str, pydantic.Field(alias="issueDate")] + + due_date: Annotated[str, pydantic.Field(alias="dueDate")] + + currency: str + r"""The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. + + ## Unknown currencies + + In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + + There are only a very small number of edge cases where this currency code is returned by the Codat system. + """ + + status: BillStatus + r"""Current state of the bill. If creating a bill the status must be `Open`.""" + + reference: OptionalNullable[str] = UNSET + r"""User-friendly reference for the bill.""" + + currency_rate: Annotated[ + Annotated[ + OptionalNullable[Decimal], + BeforeValidator(validate_decimal), + PlainSerializer(serialize_decimal(False)), + ], + pydantic.Field(alias="currencyRate"), + ] = UNSET + r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. + + Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. + + It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. + + Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). + + For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. + + ## Examples with base currency of GBP + + | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | + | :--------------- | :------------- | :------------ | :------------------------- | + | **USD** | $20 | 0.781 | £15.62 | + | **EUR** | €20 | 0.885 | £17.70 | + | **RUB** | ₽20 | 0.011 | £0.22 | + + ## Examples with base currency of USD + + | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | + | :--------------- | :------------- | :------------ | :------------------------- | + | **GBP** | £20 | 1.277 | $25.54 | + | **EUR** | €20 | 1.134 | $22.68 | + | **RUB** | ₽20 | 0.015 | $0.30 | + + + ### Integration-specific details + + | Integration | Scenario | System behavior | + |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | + """ + + line_items: Annotated[ + OptionalNullable[List[BillLineItem]], pydantic.Field(alias="lineItems") + ] = UNSET + r"""Array of Bill line items.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["reference", "currencyRate", "lineItems"] + nullable_fields = ["reference", "currencyRate", "lineItems"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in self.model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/bills.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/bills.py new file mode 100644 index 000000000..893a3d1f5 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/bills.py @@ -0,0 +1,19 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .bill import Bill, BillTypedDict +from .pagination import Pagination, PaginationTypedDict +from codat_sync_for_payables.types import BaseModel +from typing import List, Optional +from typing_extensions import NotRequired, TypedDict + + +class BillsTypedDict(TypedDict): + results: NotRequired[List[BillTypedDict]] + pagination: NotRequired[PaginationTypedDict] + + +class Bills(BaseModel): + results: Optional[List[Bill]] = None + + pagination: Optional[Pagination] = None diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/billstatus.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/billstatus.py new file mode 100644 index 000000000..fcd1b5e91 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/billstatus.py @@ -0,0 +1,15 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from enum import Enum + + +class BillStatus(str, Enum): + r"""Current state of the bill. If creating a bill the status must be `Open`.""" + + UNKNOWN = "Unknown" + OPEN = "Open" + PARTIALLY_PAID = "PartiallyPaid" + PAID = "Paid" + VOID = "Void" + DRAFT = "Draft" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/billtaxrateref.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/billtaxrateref.py new file mode 100644 index 000000000..656a5aa2d --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/billtaxrateref.py @@ -0,0 +1,20 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import BaseModel +from typing import Optional +from typing_extensions import NotRequired, TypedDict + + +class BillTaxRateRefTypedDict(TypedDict): + r"""Reference to the tax rate to which the line item is linked.""" + + id: NotRequired[str] + r"""Unique identifier for the tax rate in the accounting software.""" + + +class BillTaxRateRef(BaseModel): + r"""Reference to the tax rate to which the line item is linked.""" + + id: Optional[str] = None + r"""Unique identifier for the tax rate in the accounting software.""" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/clientratelimitreachedwebhook.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/clientratelimitreachedwebhook.py new file mode 100644 index 000000000..ccf9415e1 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/clientratelimitreachedwebhook.py @@ -0,0 +1,61 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .clientratelimitreachedwebhookdata import ( + ClientRateLimitReachedWebhookData, + ClientRateLimitReachedWebhookDataTypedDict, +) +from codat_sync_for_payables.types import BaseModel +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ClientRateLimitReachedWebhookTypedDict(TypedDict): + r"""Webhook request body for a client that has reached their rate limit.""" + + client_id: NotRequired[str] + r"""Unique identifier for your client in Codat.""" + client_name: NotRequired[str] + r"""Name of your client in Codat.""" + rule_id: NotRequired[str] + r"""Unique identifier for the rule.""" + rule_type: NotRequired[str] + r"""The type of rule.""" + alert_id: NotRequired[str] + r"""Unique identifier of the webhook event.""" + message: NotRequired[str] + r"""A human-readable message about the webhook.""" + data: NotRequired[ClientRateLimitReachedWebhookDataTypedDict] + + +class ClientRateLimitReachedWebhook(BaseModel): + r"""Webhook request body for a client that has reached their rate limit.""" + + client_id: Annotated[Optional[str], pydantic.Field(alias="ClientId")] = None + r"""Unique identifier for your client in Codat.""" + + client_name: Annotated[Optional[str], pydantic.Field(alias="ClientName")] = None + r"""Name of your client in Codat.""" + + rule_id: Annotated[ + Optional[str], + pydantic.Field( + deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible.", + alias="RuleId", + ), + ] = None + r"""Unique identifier for the rule.""" + + rule_type: Annotated[Optional[str], pydantic.Field(alias="RuleType")] = None + r"""The type of rule.""" + + alert_id: Annotated[Optional[str], pydantic.Field(alias="AlertId")] = None + r"""Unique identifier of the webhook event.""" + + message: Annotated[Optional[str], pydantic.Field(alias="Message")] = None + r"""A human-readable message about the webhook.""" + + data: Annotated[ + Optional[ClientRateLimitReachedWebhookData], pydantic.Field(alias="Data") + ] = None diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/clientratelimitreachedwebhookdata.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/clientratelimitreachedwebhookdata.py new file mode 100644 index 000000000..3ba443c88 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/clientratelimitreachedwebhookdata.py @@ -0,0 +1,60 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import BaseModel +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ClientRateLimitReachedWebhookDataTypedDict(TypedDict): + daily_quota: NotRequired[int] + r"""The number of available requests per day.""" + expires_utc: NotRequired[str] + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ + + +class ClientRateLimitReachedWebhookData(BaseModel): + daily_quota: Annotated[Optional[int], pydantic.Field(alias="DailyQuota")] = None + r"""The number of available requests per day.""" + + expires_utc: Annotated[Optional[str], pydantic.Field(alias="ExpiresUtc")] = None + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/clientratelimitresetwebhook.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/clientratelimitresetwebhook.py new file mode 100644 index 000000000..8c8ba48d1 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/clientratelimitresetwebhook.py @@ -0,0 +1,61 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .clientratelimitresetwebhookdata import ( + ClientRateLimitResetWebhookData, + ClientRateLimitResetWebhookDataTypedDict, +) +from codat_sync_for_payables.types import BaseModel +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ClientRateLimitResetWebhookTypedDict(TypedDict): + r"""Webhook request body for a client that has had their rate limit reset.""" + + client_id: NotRequired[str] + r"""Unique identifier for your client in Codat.""" + client_name: NotRequired[str] + r"""Name of your client in Codat.""" + rule_id: NotRequired[str] + r"""Unique identifier for the rule.""" + rule_type: NotRequired[str] + r"""The type of rule.""" + alert_id: NotRequired[str] + r"""Unique identifier of the webhook event.""" + message: NotRequired[str] + r"""A human-readable message about the webhook.""" + data: NotRequired[ClientRateLimitResetWebhookDataTypedDict] + + +class ClientRateLimitResetWebhook(BaseModel): + r"""Webhook request body for a client that has had their rate limit reset.""" + + client_id: Annotated[Optional[str], pydantic.Field(alias="ClientId")] = None + r"""Unique identifier for your client in Codat.""" + + client_name: Annotated[Optional[str], pydantic.Field(alias="ClientName")] = None + r"""Name of your client in Codat.""" + + rule_id: Annotated[ + Optional[str], + pydantic.Field( + deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible.", + alias="RuleId", + ), + ] = None + r"""Unique identifier for the rule.""" + + rule_type: Annotated[Optional[str], pydantic.Field(alias="RuleType")] = None + r"""The type of rule.""" + + alert_id: Annotated[Optional[str], pydantic.Field(alias="AlertId")] = None + r"""Unique identifier of the webhook event.""" + + message: Annotated[Optional[str], pydantic.Field(alias="Message")] = None + r"""A human-readable message about the webhook.""" + + data: Annotated[ + Optional[ClientRateLimitResetWebhookData], pydantic.Field(alias="Data") + ] = None diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/clientratelimitresetwebhookdata.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/clientratelimitresetwebhookdata.py new file mode 100644 index 000000000..7c4b71602 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/clientratelimitresetwebhookdata.py @@ -0,0 +1,109 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ClientRateLimitResetWebhookDataTypedDict(TypedDict): + quota_remaining: NotRequired[Nullable[int]] + r"""Total number of requests remaining for your client.""" + reset_reason: NotRequired[str] + r"""The reason for your rate limit quota being reset.""" + daily_quota: NotRequired[int] + r"""The number of available requests per day.""" + expires_utc: NotRequired[str] + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ + + +class ClientRateLimitResetWebhookData(BaseModel): + quota_remaining: Annotated[ + OptionalNullable[int], pydantic.Field(alias="QuotaRemaining") + ] = UNSET + r"""Total number of requests remaining for your client.""" + + reset_reason: Annotated[Optional[str], pydantic.Field(alias="ResetReason")] = None + r"""The reason for your rate limit quota being reset.""" + + daily_quota: Annotated[Optional[int], pydantic.Field(alias="DailyQuota")] = None + r"""The number of available requests per day.""" + + expires_utc: Annotated[Optional[str], pydantic.Field(alias="ExpiresUtc")] = None + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["QuotaRemaining", "ResetReason", "DailyQuota", "ExpiresUtc"] + nullable_fields = ["QuotaRemaining"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in self.model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/clientratelimitwebhook.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/clientratelimitwebhook.py new file mode 100644 index 000000000..ac039a790 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/clientratelimitwebhook.py @@ -0,0 +1,74 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .clientratelimitwebhookpayload import ( + ClientRateLimitWebhookPayload, + ClientRateLimitWebhookPayloadTypedDict, +) +from codat_sync_for_payables.types import BaseModel +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ClientRateLimitWebhookTypedDict(TypedDict): + id: NotRequired[str] + r"""Unique identifier of the event.""" + event_type: NotRequired[str] + r"""The type of event.""" + generated_date: NotRequired[str] + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ + payload: NotRequired[ClientRateLimitWebhookPayloadTypedDict] + + +class ClientRateLimitWebhook(BaseModel): + id: Optional[str] = None + r"""Unique identifier of the event.""" + + event_type: Annotated[Optional[str], pydantic.Field(alias="eventType")] = None + r"""The type of event.""" + + generated_date: Annotated[Optional[str], pydantic.Field(alias="generatedDate")] = ( + None + ) + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ + + payload: Optional[ClientRateLimitWebhookPayload] = None diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/clientratelimitwebhookpayload.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/clientratelimitwebhookpayload.py new file mode 100644 index 000000000..fd1ee4f0d --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/clientratelimitwebhookpayload.py @@ -0,0 +1,67 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import BaseModel +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ClientRateLimitWebhookPayloadTypedDict(TypedDict): + daily_quota: NotRequired[int] + r"""The number of available requests per day.""" + quota_remaining: NotRequired[int] + r"""Total number of requests remaining for your client.""" + expiry_date: NotRequired[str] + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ + + +class ClientRateLimitWebhookPayload(BaseModel): + daily_quota: Annotated[Optional[int], pydantic.Field(alias="dailyQuota")] = None + r"""The number of available requests per day.""" + + quota_remaining: Annotated[ + Optional[int], pydantic.Field(alias="quotaRemaining") + ] = None + r"""Total number of requests remaining for your client.""" + + expiry_date: Annotated[Optional[str], pydantic.Field(alias="expiryDate")] = None + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/codatfile.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/codatfile.py new file mode 100644 index 000000000..0c51d083a --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/codatfile.py @@ -0,0 +1,33 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import BaseModel +from codat_sync_for_payables.utils import FieldMetadata, MultipartFormMetadata +import io +import pydantic +from typing import IO, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +class CodatFileTypedDict(TypedDict): + file_name: str + content: Union[bytes, IO[bytes], io.BufferedReader] + content_type: NotRequired[str] + + +class CodatFile(BaseModel): + file_name: Annotated[ + str, pydantic.Field(alias="fileName"), FieldMetadata(multipart=True) + ] + + content: Annotated[ + Union[bytes, IO[bytes], io.BufferedReader], + pydantic.Field(alias=""), + FieldMetadata(multipart=MultipartFormMetadata(content=True)), + ] + + content_type: Annotated[ + Optional[str], + pydantic.Field(alias="Content-Type"), + FieldMetadata(multipart=True), + ] = None diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/companies.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/companies.py new file mode 100644 index 000000000..2fe832d5f --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/companies.py @@ -0,0 +1,35 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .company import Company, CompanyTypedDict +from .links import Links, LinksTypedDict +from codat_sync_for_payables.types import BaseModel +import pydantic +from typing import List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class CompaniesTypedDict(TypedDict): + page_number: int + r"""Current page number.""" + page_size: int + r"""Number of items to return in results array.""" + total_results: int + r"""Total number of items.""" + links: LinksTypedDict + results: NotRequired[List[CompanyTypedDict]] + + +class Companies(BaseModel): + page_number: Annotated[int, pydantic.Field(alias="pageNumber")] + r"""Current page number.""" + + page_size: Annotated[int, pydantic.Field(alias="pageSize")] + r"""Number of items to return in results array.""" + + total_results: Annotated[int, pydantic.Field(alias="totalResults")] + r"""Total number of items.""" + + links: Annotated[Links, pydantic.Field(alias="_links")] + + results: Optional[List[Company]] = None diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/company.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/company.py new file mode 100644 index 000000000..791fb2601 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/company.py @@ -0,0 +1,208 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .connection import Connection, ConnectionTypedDict +from codat_sync_for_payables.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +import pydantic +from pydantic import model_serializer +from typing import List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class CompanyTagsTypedDict(TypedDict): + r"""A collection of user-defined key-value pairs that store custom metadata against the company.""" + + +class CompanyTags(BaseModel): + r"""A collection of user-defined key-value pairs that store custom metadata against the company.""" + + +class CompanyTypedDict(TypedDict): + r"""In Codat, a company represents a business sharing access to their data. Each company can have multiple [connections](https://docs.codat.io/sync-for-payables-api#/schemas/Connection) to different data sources such as one connection to [Xero](https://docs.codat.io/integrations/accounting/xero/accounting-xero) for accounting data, two connections to [Plaid](https://docs.codat.io/integrations/banking/plaid/banking-plaid) for two bank accounts and a connection to [Zettle](https://docs.codat.io/integrations/commerce/zettle/commerce-zettle) for POS data. + + Typically each company is one of your customers. + + When you create a company, you can specify a `name` and we will automatically generate a unique `id` for the company. You can also add a `description` to store any additional information about the company. + """ + + id: str + r"""Unique identifier for your SMB in Codat.""" + name: str + r"""The name of the company""" + redirect: str + r"""The `redirect` [Link URL](https://docs.codat.io/auth-flow/authorize-hosted-link) enabling the customer to start their auth flow journey for the company.""" + description: NotRequired[str] + r"""Additional information about the company. This can be used to store foreign IDs, references, etc.""" + last_sync: NotRequired[str] + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ + created: NotRequired[str] + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ + created_by_user_name: NotRequired[Nullable[str]] + r"""Name of user that created the company in Codat.""" + products: NotRequired[List[str]] + r"""An array of products that are currently enabled for the company.""" + tags: NotRequired[CompanyTagsTypedDict] + r"""A collection of user-defined key-value pairs that store custom metadata against the company.""" + data_connections: NotRequired[List[ConnectionTypedDict]] + + +class Company(BaseModel): + r"""In Codat, a company represents a business sharing access to their data. Each company can have multiple [connections](https://docs.codat.io/sync-for-payables-api#/schemas/Connection) to different data sources such as one connection to [Xero](https://docs.codat.io/integrations/accounting/xero/accounting-xero) for accounting data, two connections to [Plaid](https://docs.codat.io/integrations/banking/plaid/banking-plaid) for two bank accounts and a connection to [Zettle](https://docs.codat.io/integrations/commerce/zettle/commerce-zettle) for POS data. + + Typically each company is one of your customers. + + When you create a company, you can specify a `name` and we will automatically generate a unique `id` for the company. You can also add a `description` to store any additional information about the company. + """ + + id: str + r"""Unique identifier for your SMB in Codat.""" + + name: str + r"""The name of the company""" + + redirect: str + r"""The `redirect` [Link URL](https://docs.codat.io/auth-flow/authorize-hosted-link) enabling the customer to start their auth flow journey for the company.""" + + description: Optional[str] = None + r"""Additional information about the company. This can be used to store foreign IDs, references, etc.""" + + last_sync: Annotated[Optional[str], pydantic.Field(alias="lastSync")] = None + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ + + created: Optional[str] = None + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ + + created_by_user_name: Annotated[ + OptionalNullable[str], pydantic.Field(alias="createdByUserName") + ] = UNSET + r"""Name of user that created the company in Codat.""" + + products: Optional[List[str]] = None + r"""An array of products that are currently enabled for the company.""" + + tags: Optional[CompanyTags] = None + r"""A collection of user-defined key-value pairs that store custom metadata against the company.""" + + data_connections: Annotated[ + Optional[List[Connection]], pydantic.Field(alias="dataConnections") + ] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [ + "description", + "lastSync", + "created", + "createdByUserName", + "products", + "tags", + "dataConnections", + ] + nullable_fields = ["createdByUserName"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in self.model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/companyinformation.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/companyinformation.py new file mode 100644 index 000000000..48ab5dc73 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/companyinformation.py @@ -0,0 +1,66 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +import pydantic +from pydantic import model_serializer +from typing_extensions import Annotated, NotRequired, TypedDict + + +class CompanyInformationTypedDict(TypedDict): + r"""Gets the latest basic info for a company.""" + + company_name: NotRequired[Nullable[str]] + r"""Name of the linked company.""" + base_currency: NotRequired[Nullable[str]] + r"""Currency set in the accounting software of the linked company. Used by the currency rate.""" + + +class CompanyInformation(BaseModel): + r"""Gets the latest basic info for a company.""" + + company_name: Annotated[ + OptionalNullable[str], pydantic.Field(alias="companyName") + ] = UNSET + r"""Name of the linked company.""" + + base_currency: Annotated[ + OptionalNullable[str], pydantic.Field(alias="baseCurrency") + ] = UNSET + r"""Currency set in the accounting software of the linked company. Used by the currency rate.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["companyName", "baseCurrency"] + nullable_fields = ["companyName", "baseCurrency"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in self.model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/companyrequestbody.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/companyrequestbody.py new file mode 100644 index 000000000..ad4d893ee --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/companyrequestbody.py @@ -0,0 +1,27 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .tags import Tags, TagsTypedDict +from codat_sync_for_payables.types import BaseModel +from typing import Optional +from typing_extensions import NotRequired, TypedDict + + +class CompanyRequestBodyTypedDict(TypedDict): + name: str + r"""Name of company being connected.""" + description: NotRequired[str] + r"""Additional information about the company. This can be used to store foreign IDs, references, etc.""" + tags: NotRequired[TagsTypedDict] + r"""A collection of user-defined key-value pairs that store custom metadata against the company.""" + + +class CompanyRequestBody(BaseModel): + name: str + r"""Name of company being connected.""" + + description: Optional[str] = None + r"""Additional information about the company. This can be used to store foreign IDs, references, etc.""" + + tags: Optional[Tags] = None + r"""A collection of user-defined key-value pairs that store custom metadata against the company.""" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/connection.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/connection.py new file mode 100644 index 000000000..3eca3d708 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/connection.py @@ -0,0 +1,225 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .dataconnectionerror import DataConnectionError, DataConnectionErrorTypedDict +from .dataconnectionstatus import DataConnectionStatus +from codat_sync_for_payables.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from enum import Enum +import pydantic +from pydantic import model_serializer +from typing import Dict, List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class SourceType(str, Enum): + r"""The type of platform of the connection.""" + + ACCOUNTING = "Accounting" + BANKING = "Banking" + BANK_FEED = "BankFeed" + COMMERCE = "Commerce" + EXPENSE = "Expense" + OTHER = "Other" + UNKNOWN = "Unknown" + + +class ConnectionTypedDict(TypedDict): + r"""A connection represents a [company's](https://docs.codat.io/sync-for-payables-api#/schemas/Company) connection to a data source and allows you to synchronize data (pull and/or push) with that source. + + A company can have multiple data connections depending on the type of data source it is connecting to. For example, a single company can link to: + + - [Accounting data](https://docs.codat.io/accounting-api/overview) - 1 active connection. + - [Banking data](https://docs.codat.io/banking-api/overview) - Multiple active connections. + - [Commerce data](https://docs.codat.io/commerce-api/overview) - Multiple active connections. + Any combination of accounting, banking, and commerce data connections is allowed. + + Before you can use a data connection to pull or push data, the company must grant you access to their business data by [linking the connection](https://docs.codat.io/auth-flow/overview). + """ + + id: str + r"""Unique identifier for a company's data connection.""" + integration_id: str + r"""A Codat ID representing the integration.""" + integration_key: str + r"""A unique four-character ID that identifies the platform of the company's data connection. This ensures continuity if the platform changes its name in the future.""" + source_id: str + r"""A source-specific ID used to distinguish between different sources originating from the same data connection. In general, a data connection is a single data source. However, for TrueLayer, `sourceId` is associated with a specific bank and has a many-to-one relationship with the `integrationId`.""" + source_type: SourceType + r"""The type of platform of the connection.""" + platform_name: str + r"""Name of integration connected to company.""" + link_url: str + r"""The link URL your customers can use to authorize access to their business application.""" + status: DataConnectionStatus + r"""The current authorization status of the data connection.""" + created: str + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ + last_sync: NotRequired[str] + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ + data_connection_errors: NotRequired[Nullable[List[DataConnectionErrorTypedDict]]] + connection_info: NotRequired[Nullable[Dict[str, str]]] + + +class Connection(BaseModel): + r"""A connection represents a [company's](https://docs.codat.io/sync-for-payables-api#/schemas/Company) connection to a data source and allows you to synchronize data (pull and/or push) with that source. + + A company can have multiple data connections depending on the type of data source it is connecting to. For example, a single company can link to: + + - [Accounting data](https://docs.codat.io/accounting-api/overview) - 1 active connection. + - [Banking data](https://docs.codat.io/banking-api/overview) - Multiple active connections. + - [Commerce data](https://docs.codat.io/commerce-api/overview) - Multiple active connections. + Any combination of accounting, banking, and commerce data connections is allowed. + + Before you can use a data connection to pull or push data, the company must grant you access to their business data by [linking the connection](https://docs.codat.io/auth-flow/overview). + """ + + id: str + r"""Unique identifier for a company's data connection.""" + + integration_id: Annotated[str, pydantic.Field(alias="integrationId")] + r"""A Codat ID representing the integration.""" + + integration_key: Annotated[str, pydantic.Field(alias="integrationKey")] + r"""A unique four-character ID that identifies the platform of the company's data connection. This ensures continuity if the platform changes its name in the future.""" + + source_id: Annotated[str, pydantic.Field(alias="sourceId")] + r"""A source-specific ID used to distinguish between different sources originating from the same data connection. In general, a data connection is a single data source. However, for TrueLayer, `sourceId` is associated with a specific bank and has a many-to-one relationship with the `integrationId`.""" + + source_type: Annotated[SourceType, pydantic.Field(alias="sourceType")] + r"""The type of platform of the connection.""" + + platform_name: Annotated[str, pydantic.Field(alias="platformName")] + r"""Name of integration connected to company.""" + + link_url: Annotated[str, pydantic.Field(alias="linkUrl")] + r"""The link URL your customers can use to authorize access to their business application.""" + + status: DataConnectionStatus + r"""The current authorization status of the data connection.""" + + created: str + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ + + last_sync: Annotated[Optional[str], pydantic.Field(alias="lastSync")] = None + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ + + data_connection_errors: Annotated[ + OptionalNullable[List[DataConnectionError]], + pydantic.Field(alias="dataConnectionErrors"), + ] = UNSET + + connection_info: Annotated[ + OptionalNullable[Dict[str, str]], pydantic.Field(alias="connectionInfo") + ] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["lastSync", "dataConnectionErrors", "connectionInfo"] + nullable_fields = ["dataConnectionErrors", "connectionInfo"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in self.model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/connections.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/connections.py new file mode 100644 index 000000000..e373a22ca --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/connections.py @@ -0,0 +1,35 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .connection import Connection, ConnectionTypedDict +from .links import Links, LinksTypedDict +from codat_sync_for_payables.types import BaseModel +import pydantic +from typing import List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ConnectionsTypedDict(TypedDict): + page_number: int + r"""Current page number.""" + page_size: int + r"""Number of items to return in results array.""" + total_results: int + r"""Total number of items.""" + links: LinksTypedDict + results: NotRequired[List[ConnectionTypedDict]] + + +class Connections(BaseModel): + page_number: Annotated[int, pydantic.Field(alias="pageNumber")] + r"""Current page number.""" + + page_size: Annotated[int, pydantic.Field(alias="pageSize")] + r"""Number of items to return in results array.""" + + total_results: Annotated[int, pydantic.Field(alias="totalResults")] + r"""Total number of items.""" + + links: Annotated[Links, pydantic.Field(alias="_links")] + + results: Optional[List[Connection]] = None diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/dataconnectionerror.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/dataconnectionerror.py new file mode 100644 index 000000000..f33eb1f63 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/dataconnectionerror.py @@ -0,0 +1,174 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from enum import Enum +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ErrorStatus(str, Enum): + r"""The current status of a transient error. Null statuses indicate that the error is not transient.""" + + ACTIVE = "Active" + RESOLVED = "Resolved" + + +class DataConnectionErrorTypedDict(TypedDict): + status_code: NotRequired[str] + r"""The HTTP status code returned by the source platform when the error occurred.""" + status_text: NotRequired[str] + r"""A non-numeric status code/text returned by the source platform when the error occurred.""" + error_message: NotRequired[str] + r"""A message about a error returned by Codat.""" + errored_on_utc: NotRequired[str] + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ + status: NotRequired[Nullable[ErrorStatus]] + r"""The current status of a transient error. Null statuses indicate that the error is not transient.""" + resolved_on_utc: NotRequired[str] + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ + + +class DataConnectionError(BaseModel): + status_code: Annotated[Optional[str], pydantic.Field(alias="statusCode")] = None + r"""The HTTP status code returned by the source platform when the error occurred.""" + + status_text: Annotated[Optional[str], pydantic.Field(alias="statusText")] = None + r"""A non-numeric status code/text returned by the source platform when the error occurred.""" + + error_message: Annotated[Optional[str], pydantic.Field(alias="errorMessage")] = None + r"""A message about a error returned by Codat.""" + + errored_on_utc: Annotated[Optional[str], pydantic.Field(alias="erroredOnUtc")] = ( + None + ) + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ + + status: OptionalNullable[ErrorStatus] = UNSET + r"""The current status of a transient error. Null statuses indicate that the error is not transient.""" + + resolved_on_utc: Annotated[Optional[str], pydantic.Field(alias="resolvedOnUtc")] = ( + None + ) + r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + + ``` + 2020-10-08T22:40:50Z + 2021-01-01T00:00:00 + ``` + + + + When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + + - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + - Unqualified local time: `2021-11-15T01:00:00` + - UTC time offsets: `2021-11-15T01:00:00-05:00` + + > Time zones + > + > Not all dates from Codat will contain information about time zones. + > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [ + "statusCode", + "statusText", + "errorMessage", + "erroredOnUtc", + "status", + "resolvedOnUtc", + ] + nullable_fields = ["status"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in self.model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/dataconnectionstatus.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/dataconnectionstatus.py new file mode 100644 index 000000000..a97f7be30 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/dataconnectionstatus.py @@ -0,0 +1,13 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from enum import Enum + + +class DataConnectionStatus(str, Enum): + r"""The current authorization status of the data connection.""" + + PENDING_AUTH = "PendingAuth" + LINKED = "Linked" + UNLINKED = "Unlinked" + DEAUTHORIZED = "Deauthorized" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/errorvalidation.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/errorvalidation.py new file mode 100644 index 000000000..6ba86e02a --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/errorvalidation.py @@ -0,0 +1,59 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .errorvalidationitem import ErrorValidationItem, ErrorValidationItemTypedDict +from codat_sync_for_payables.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from pydantic import model_serializer +from typing import List +from typing_extensions import NotRequired, TypedDict + + +class ErrorValidationTypedDict(TypedDict): + r"""A human-readable object describing validation decisions Codat has made. If an operation has failed because of validation errors, they will be detailed here.""" + + errors: NotRequired[Nullable[List[ErrorValidationItemTypedDict]]] + warnings: NotRequired[Nullable[List[ErrorValidationItemTypedDict]]] + + +class ErrorValidation(BaseModel): + r"""A human-readable object describing validation decisions Codat has made. If an operation has failed because of validation errors, they will be detailed here.""" + + errors: OptionalNullable[List[ErrorValidationItem]] = UNSET + + warnings: OptionalNullable[List[ErrorValidationItem]] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["errors", "warnings"] + nullable_fields = ["errors", "warnings"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in self.model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/errorvalidationitem.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/errorvalidationitem.py new file mode 100644 index 000000000..82eeddaf4 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/errorvalidationitem.py @@ -0,0 +1,65 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +import pydantic +from pydantic import model_serializer +from typing_extensions import Annotated, NotRequired, TypedDict + + +class ErrorValidationItemTypedDict(TypedDict): + item_id: NotRequired[Nullable[str]] + r"""Unique identifier for a validation item.""" + message: NotRequired[Nullable[str]] + r"""A message outlining validation item's issue.""" + validator_name: NotRequired[Nullable[str]] + r"""Name of validator.""" + + +class ErrorValidationItem(BaseModel): + item_id: Annotated[OptionalNullable[str], pydantic.Field(alias="itemId")] = UNSET + r"""Unique identifier for a validation item.""" + + message: OptionalNullable[str] = UNSET + r"""A message outlining validation item's issue.""" + + validator_name: Annotated[ + OptionalNullable[str], pydantic.Field(alias="validatorName") + ] = UNSET + r"""Name of validator.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["itemId", "message", "validatorName"] + nullable_fields = ["itemId", "message", "validatorName"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in self.model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/halref.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/halref.py new file mode 100644 index 000000000..23ca53d21 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/halref.py @@ -0,0 +1,16 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import BaseModel +from typing import Optional +from typing_extensions import NotRequired, TypedDict + + +class HalRefTypedDict(TypedDict): + href: NotRequired[str] + r"""Uri hypertext reference.""" + + +class HalRef(BaseModel): + href: Optional[str] = None + r"""Uri hypertext reference.""" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/links.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/links.py new file mode 100644 index 000000000..2c814f351 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/links.py @@ -0,0 +1,25 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .halref import HalRef, HalRefTypedDict +from codat_sync_for_payables.types import BaseModel +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class LinksTypedDict(TypedDict): + self_: HalRefTypedDict + current: HalRefTypedDict + next: NotRequired[HalRefTypedDict] + previous: NotRequired[HalRefTypedDict] + + +class Links(BaseModel): + self_: Annotated[HalRef, pydantic.Field(alias="self")] + + current: HalRef + + next: Optional[HalRef] = None + + previous: Optional[HalRef] = None diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/pagination.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/pagination.py new file mode 100644 index 000000000..28e920235 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/pagination.py @@ -0,0 +1,19 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import BaseModel +import pydantic +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class PaginationTypedDict(TypedDict): + continuation_token: NotRequired[str] + r"""A continuation token indicating there are more results to be fetched. Supply this value in the `continuationToken` query parameter in the next request to fetch the next set of results. Once no more results are available, the continuation token will not be present in the response.""" + + +class Pagination(BaseModel): + continuation_token: Annotated[ + Optional[str], pydantic.Field(alias="continuationToken") + ] = None + r"""A continuation token indicating there are more results to be fetched. Supply this value in the `continuationToken` query parameter in the next request to fetch the next set of results. Once no more results are available, the continuation token will not be present in the response.""" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/paymentmappingoptions.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/paymentmappingoptions.py new file mode 100644 index 000000000..f9743e452 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/paymentmappingoptions.py @@ -0,0 +1,29 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .bankaccountmappingoption import ( + BankAccountMappingOption, + BankAccountMappingOptionTypedDict, +) +from .pagination import Pagination, PaginationTypedDict +from codat_sync_for_payables.types import BaseModel +import pydantic +from typing import List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class PaymentMappingOptionsTypedDict(TypedDict): + r"""Gets the bill payments mapping options for a company's accounting software""" + + bank_accounts: NotRequired[List[BankAccountMappingOptionTypedDict]] + pagination: NotRequired[PaginationTypedDict] + + +class PaymentMappingOptions(BaseModel): + r"""Gets the bill payments mapping options for a company's accounting software""" + + bank_accounts: Annotated[ + Optional[List[BankAccountMappingOption]], pydantic.Field(alias="bankAccounts") + ] = None + + pagination: Optional[Pagination] = None diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/security.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/security.py new file mode 100644 index 000000000..33927c43a --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/security.py @@ -0,0 +1,24 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import BaseModel +from codat_sync_for_payables.utils import FieldMetadata, SecurityMetadata +from typing_extensions import Annotated, TypedDict + + +class SecurityTypedDict(TypedDict): + auth_header: str + + +class Security(BaseModel): + auth_header: Annotated[ + str, + FieldMetadata( + security=SecurityMetadata( + scheme=True, + scheme_type="apiKey", + sub_type="header", + field_name="Authorization", + ) + ), + ] diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/supplier.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/supplier.py new file mode 100644 index 000000000..634e3b4cf --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/supplier.py @@ -0,0 +1,145 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .address import Address, AddressTypedDict +from .supplierstatus import SupplierStatus +from codat_sync_for_payables.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from codat_sync_for_payables.utils import serialize_decimal, validate_decimal +from decimal import Decimal +import pydantic +from pydantic import model_serializer +from pydantic.functional_serializers import PlainSerializer +from pydantic.functional_validators import BeforeValidator +from typing import List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class SupplierTypedDict(TypedDict): + r"""Suppliers are people or organizations that provide something, such as a product or service. Use the [List suppliers](https://docs.codat.io/sync-for-payables-v2-api#/operations/list-suppliers) endpoint to retrieve a list of all suppliers for a company. + + Suppliers' data links to accounts payable [bills](https://docs.codat.io/sync-for-payables-v2-api#/schemas/Bill). + + """ + + id: NotRequired[str] + r"""Identifier for the supplier, unique to the company in the accounting software.""" + supplier_name: NotRequired[str] + r"""Name of the supplier as recorded in the accounting system, typically the company name.""" + contact_name: NotRequired[Nullable[str]] + r"""Name of the main contact for the supplier.""" + email_address: NotRequired[Nullable[str]] + r"""Email address that the supplier may be contacted on.""" + phone: NotRequired[Nullable[str]] + r"""Phone number that the supplier may be contacted on.""" + addresses: NotRequired[Nullable[List[AddressTypedDict]]] + r"""An array of Addresses.""" + status: NotRequired[SupplierStatus] + r"""Status of the supplier.""" + balance: NotRequired[Nullable[Decimal]] + r"""Amount outstanding against the supplier.""" + default_currency: NotRequired[Nullable[str]] + r"""Default currency the supplier's transactional data is recorded in.""" + source_modified_date: NotRequired[str] + + +class Supplier(BaseModel): + r"""Suppliers are people or organizations that provide something, such as a product or service. Use the [List suppliers](https://docs.codat.io/sync-for-payables-v2-api#/operations/list-suppliers) endpoint to retrieve a list of all suppliers for a company. + + Suppliers' data links to accounts payable [bills](https://docs.codat.io/sync-for-payables-v2-api#/schemas/Bill). + + """ + + id: Optional[str] = None + r"""Identifier for the supplier, unique to the company in the accounting software.""" + + supplier_name: Annotated[Optional[str], pydantic.Field(alias="supplierName")] = None + r"""Name of the supplier as recorded in the accounting system, typically the company name.""" + + contact_name: Annotated[ + OptionalNullable[str], pydantic.Field(alias="contactName") + ] = UNSET + r"""Name of the main contact for the supplier.""" + + email_address: Annotated[ + OptionalNullable[str], pydantic.Field(alias="emailAddress") + ] = UNSET + r"""Email address that the supplier may be contacted on.""" + + phone: OptionalNullable[str] = UNSET + r"""Phone number that the supplier may be contacted on.""" + + addresses: OptionalNullable[List[Address]] = UNSET + r"""An array of Addresses.""" + + status: Optional[SupplierStatus] = None + r"""Status of the supplier.""" + + balance: Annotated[ + OptionalNullable[Decimal], + BeforeValidator(validate_decimal), + PlainSerializer(serialize_decimal(False)), + ] = UNSET + r"""Amount outstanding against the supplier.""" + + default_currency: Annotated[ + OptionalNullable[str], pydantic.Field(alias="defaultCurrency") + ] = UNSET + r"""Default currency the supplier's transactional data is recorded in.""" + + source_modified_date: Annotated[ + Optional[str], pydantic.Field(alias="sourceModifiedDate") + ] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [ + "id", + "supplierName", + "contactName", + "emailAddress", + "phone", + "addresses", + "status", + "balance", + "defaultCurrency", + "sourceModifiedDate", + ] + nullable_fields = [ + "contactName", + "emailAddress", + "phone", + "addresses", + "balance", + "defaultCurrency", + ] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in self.model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/supplierprototype.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/supplierprototype.py new file mode 100644 index 000000000..2623f6ba6 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/supplierprototype.py @@ -0,0 +1,119 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .address import Address, AddressTypedDict +from .supplierstatus import SupplierStatus +from codat_sync_for_payables.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from codat_sync_for_payables.utils import serialize_decimal, validate_decimal +from decimal import Decimal +import pydantic +from pydantic import model_serializer +from pydantic.functional_serializers import PlainSerializer +from pydantic.functional_validators import BeforeValidator +from typing import List +from typing_extensions import Annotated, NotRequired, TypedDict + + +class SupplierPrototypeTypedDict(TypedDict): + supplier_name: str + r"""Name of the supplier as recorded in the accounting system, typically the company name.""" + status: SupplierStatus + r"""Status of the supplier.""" + contact_name: NotRequired[Nullable[str]] + r"""Name of the main contact for the supplier.""" + email_address: NotRequired[Nullable[str]] + r"""Email address that the supplier may be contacted on.""" + phone: NotRequired[Nullable[str]] + r"""Phone number that the supplier may be contacted on.""" + addresses: NotRequired[Nullable[List[AddressTypedDict]]] + r"""An array of Addresses.""" + balance: NotRequired[Nullable[Decimal]] + r"""Amount outstanding against the supplier.""" + default_currency: NotRequired[Nullable[str]] + r"""Default currency the supplier's transactional data is recorded in.""" + + +class SupplierPrototype(BaseModel): + supplier_name: Annotated[str, pydantic.Field(alias="supplierName")] + r"""Name of the supplier as recorded in the accounting system, typically the company name.""" + + status: SupplierStatus + r"""Status of the supplier.""" + + contact_name: Annotated[ + OptionalNullable[str], pydantic.Field(alias="contactName") + ] = UNSET + r"""Name of the main contact for the supplier.""" + + email_address: Annotated[ + OptionalNullable[str], pydantic.Field(alias="emailAddress") + ] = UNSET + r"""Email address that the supplier may be contacted on.""" + + phone: OptionalNullable[str] = UNSET + r"""Phone number that the supplier may be contacted on.""" + + addresses: OptionalNullable[List[Address]] = UNSET + r"""An array of Addresses.""" + + balance: Annotated[ + OptionalNullable[Decimal], + BeforeValidator(validate_decimal), + PlainSerializer(serialize_decimal(False)), + ] = UNSET + r"""Amount outstanding against the supplier.""" + + default_currency: Annotated[ + OptionalNullable[str], pydantic.Field(alias="defaultCurrency") + ] = UNSET + r"""Default currency the supplier's transactional data is recorded in.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [ + "contactName", + "emailAddress", + "phone", + "addresses", + "balance", + "defaultCurrency", + ] + nullable_fields = [ + "contactName", + "emailAddress", + "phone", + "addresses", + "balance", + "defaultCurrency", + ] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in self.model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/supplierref.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/supplierref.py new file mode 100644 index 000000000..427049d1d --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/supplierref.py @@ -0,0 +1,64 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +import pydantic +from pydantic import model_serializer +from typing_extensions import Annotated, NotRequired, TypedDict + + +class SupplierRefTypedDict(TypedDict): + r"""Reference to the supplier the record relates to.""" + + id: str + r"""The supplier's unique ID""" + supplier_name: NotRequired[Nullable[str]] + r"""The supplier's name""" + + +class SupplierRef(BaseModel): + r"""Reference to the supplier the record relates to.""" + + id: str + r"""The supplier's unique ID""" + + supplier_name: Annotated[ + OptionalNullable[str], pydantic.Field(alias="supplierName") + ] = UNSET + r"""The supplier's name""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["supplierName"] + nullable_fields = ["supplierName"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in self.model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/suppliers.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/suppliers.py new file mode 100644 index 000000000..563954e01 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/suppliers.py @@ -0,0 +1,19 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .pagination import Pagination, PaginationTypedDict +from .supplier import Supplier, SupplierTypedDict +from codat_sync_for_payables.types import BaseModel +from typing import List, Optional +from typing_extensions import NotRequired, TypedDict + + +class SuppliersTypedDict(TypedDict): + results: NotRequired[List[SupplierTypedDict]] + pagination: NotRequired[PaginationTypedDict] + + +class Suppliers(BaseModel): + results: Optional[List[Supplier]] = None + + pagination: Optional[Pagination] = None diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/supplierstatus.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/supplierstatus.py new file mode 100644 index 000000000..0f7785837 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/supplierstatus.py @@ -0,0 +1,12 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from enum import Enum + + +class SupplierStatus(str, Enum): + r"""Status of the supplier.""" + + UNKNOWN = "Unknown" + ACTIVE = "Active" + ARCHIVED = "Archived" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/tags.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/tags.py new file mode 100644 index 000000000..388126903 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/tags.py @@ -0,0 +1,13 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import BaseModel +from typing_extensions import TypedDict + + +class TagsTypedDict(TypedDict): + r"""A collection of user-defined key-value pairs that store custom metadata against the company.""" + + +class Tags(BaseModel): + r"""A collection of user-defined key-value pairs that store custom metadata against the company.""" diff --git a/sync-for-payables/src/codat_sync_for_payables/models/shared/taxratemappingoption.py b/sync-for-payables/src/codat_sync_for_payables/models/shared/taxratemappingoption.py new file mode 100644 index 000000000..2c73ba36a --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/models/shared/taxratemappingoption.py @@ -0,0 +1,121 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from codat_sync_for_payables.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +from codat_sync_for_payables.utils import serialize_decimal, validate_decimal +from decimal import Decimal +from enum import Enum +import pydantic +from pydantic import model_serializer +from pydantic.functional_serializers import PlainSerializer +from pydantic.functional_validators import BeforeValidator +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class TaxRateStatus(str, Enum): + r"""Status of the tax rate in the accounting software. + - `Active` - An active tax rate in use by a company. + - `Archived` - A tax rate that has been archived or is inactive in the accounting software. + """ + + ACTIVE = "Active" + ARCHIVED = "Archived" + + +class TaxRateMappingOptionTypedDict(TypedDict): + id: NotRequired[str] + r"""Identifier for the tax rate, unique for the company in the accounting software.""" + name: NotRequired[Nullable[str]] + r"""Codat-augmented name of the tax rate in the accounting software.""" + code: NotRequired[Nullable[str]] + r"""Code for the tax rate from the accounting software.""" + effective_tax_rate: NotRequired[Nullable[Decimal]] + r"""See Effective tax rates description.""" + total_tax_rate: NotRequired[Nullable[Decimal]] + r"""Total (not compounded) sum of the components of a tax rate.""" + status: NotRequired[TaxRateStatus] + r"""Status of the tax rate in the accounting software. + - `Active` - An active tax rate in use by a company. + - `Archived` - A tax rate that has been archived or is inactive in the accounting software. + """ + + +class TaxRateMappingOption(BaseModel): + id: Optional[str] = None + r"""Identifier for the tax rate, unique for the company in the accounting software.""" + + name: OptionalNullable[str] = UNSET + r"""Codat-augmented name of the tax rate in the accounting software.""" + + code: OptionalNullable[str] = UNSET + r"""Code for the tax rate from the accounting software.""" + + effective_tax_rate: Annotated[ + Annotated[ + OptionalNullable[Decimal], + BeforeValidator(validate_decimal), + PlainSerializer(serialize_decimal(False)), + ], + pydantic.Field(alias="effectiveTaxRate"), + ] = UNSET + r"""See Effective tax rates description.""" + + total_tax_rate: Annotated[ + Annotated[ + OptionalNullable[Decimal], + BeforeValidator(validate_decimal), + PlainSerializer(serialize_decimal(False)), + ], + pydantic.Field(alias="totalTaxRate"), + ] = UNSET + r"""Total (not compounded) sum of the components of a tax rate.""" + + status: Optional[TaxRateStatus] = None + r"""Status of the tax rate in the accounting software. + - `Active` - An active tax rate in use by a company. + - `Archived` - A tax rate that has been archived or is inactive in the accounting software. + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [ + "id", + "name", + "code", + "effectiveTaxRate", + "totalTaxRate", + "status", + ] + nullable_fields = ["name", "code", "effectiveTaxRate", "totalTaxRate"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in self.model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/sync-for-payables/src/codat_sync_for_payables/py.typed b/sync-for-payables/src/codat_sync_for_payables/py.typed new file mode 100644 index 000000000..3e38f1a92 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. The package enables type hints. diff --git a/sync-for-payables/src/codat_sync_for_payables/sdk.py b/sync-for-payables/src/codat_sync_for_payables/sdk.py new file mode 100644 index 000000000..75df913df --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/sdk.py @@ -0,0 +1,140 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .basesdk import BaseSDK +from .httpclient import AsyncHttpClient, HttpClient +from .sdkconfiguration import SDKConfiguration +from .utils.logger import Logger, get_default_logger +from .utils.retries import RetryConfig +from codat_sync_for_payables import utils +from codat_sync_for_payables._hooks import SDKHooks +from codat_sync_for_payables.bank_accounts import BankAccounts +from codat_sync_for_payables.bill_payments import BillPayments +from codat_sync_for_payables.bills import Bills +from codat_sync_for_payables.companies import Companies +from codat_sync_for_payables.company_information import CompanyInformation +from codat_sync_for_payables.connections import Connections +from codat_sync_for_payables.models import shared +from codat_sync_for_payables.suppliers import Suppliers +from codat_sync_for_payables.types import OptionalNullable, UNSET +import httpx +from typing import Callable, Dict, Optional, Union + + +class CodatSyncPayables(BaseSDK): + r"""Bill pay kit: The API reference for the Bill Pay kit. + + The bill pay kit is an API and a set of supporting tools designed to integrate a bill pay flow into your app as quickly as possible. It's ideal for facilitating essential bill payment processes within your SMB's accounting software. + + [Explore product](https://docs.codat.io/payables/bill-pay-kit) | [See OpenAPI spec](https://github.com/codatio/oas) + + --- + + ## Endpoints + + | Endpoints | Description | + | :- |:- | + | Companies | Create and manage your SMB users' companies. | + | Connections | Create new and manage existing data connections for a company. | + | Company information | View company profile from the source platform. | + | Bills | Get, create, and update Bills. | + | Bill payments | Get, create, and update Bill payments. | + | Suppliers | Get, create, and update Suppliers. | + | Bank accounts | Create a bank account for a given company's connection. | + + """ + + companies: Companies + r"""Create and manage your SMB users' companies.""" + connections: Connections + r"""Create new and manage existing data connections for a company.""" + company_information: CompanyInformation + r"""View company profile from the source platform.""" + bills: Bills + r"""Get, create, and update Bills.""" + bill_payments: BillPayments + r"""Get, create, and update Bill payments.""" + suppliers: Suppliers + r"""Get, create, and update Suppliers.""" + bank_accounts: BankAccounts + r"""Create a bank account for a given company's connection.""" + + def __init__( + self, + security: Union[shared.Security, Callable[[], shared.Security]], + server_idx: Optional[int] = None, + server_url: Optional[str] = None, + url_params: Optional[Dict[str, str]] = None, + client: Optional[HttpClient] = None, + async_client: Optional[AsyncHttpClient] = None, + retry_config: OptionalNullable[RetryConfig] = UNSET, + timeout_ms: Optional[int] = None, + debug_logger: Optional[Logger] = None, + ) -> None: + r"""Instantiates the SDK configuring it with the provided parameters. + + :param security: The security details required for authentication + :param server_idx: The index of the server to use for all methods + :param server_url: The server URL to use for all methods + :param url_params: Parameters to optionally template the server URL with + :param client: The HTTP client to use for all synchronous methods + :param async_client: The Async HTTP client to use for all asynchronous methods + :param retry_config: The retry configuration to use for all supported methods + :param timeout_ms: Optional request timeout applied to each operation in milliseconds + """ + if client is None: + client = httpx.Client() + + assert issubclass( + type(client), HttpClient + ), "The provided client must implement the HttpClient protocol." + + if async_client is None: + async_client = httpx.AsyncClient() + + if debug_logger is None: + debug_logger = get_default_logger() + + assert issubclass( + type(async_client), AsyncHttpClient + ), "The provided async_client must implement the AsyncHttpClient protocol." + + if server_url is not None: + if url_params is not None: + server_url = utils.template_url(server_url, url_params) + + BaseSDK.__init__( + self, + SDKConfiguration( + client=client, + async_client=async_client, + security=security, + server_url=server_url, + server_idx=server_idx, + retry_config=retry_config, + timeout_ms=timeout_ms, + debug_logger=debug_logger, + ), + ) + + hooks = SDKHooks() + + current_server_url, *_ = self.sdk_configuration.get_server_details() + server_url, self.sdk_configuration.client = hooks.sdk_init( + current_server_url, self.sdk_configuration.client + ) + if current_server_url != server_url: + self.sdk_configuration.server_url = server_url + + # pylint: disable=protected-access + self.sdk_configuration.__dict__["_hooks"] = hooks + + self._init_sdks() + + def _init_sdks(self): + self.companies = Companies(self.sdk_configuration) + self.connections = Connections(self.sdk_configuration) + self.company_information = CompanyInformation(self.sdk_configuration) + self.bills = Bills(self.sdk_configuration) + self.bill_payments = BillPayments(self.sdk_configuration) + self.suppliers = Suppliers(self.sdk_configuration) + self.bank_accounts = BankAccounts(self.sdk_configuration) diff --git a/sync-for-payables/src/codat_sync_for_payables/sdkconfiguration.py b/sync-for-payables/src/codat_sync_for_payables/sdkconfiguration.py new file mode 100644 index 000000000..abbc775f4 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/sdkconfiguration.py @@ -0,0 +1,50 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from ._hooks import SDKHooks +from .httpclient import AsyncHttpClient, HttpClient +from .utils import Logger, RetryConfig, remove_suffix +from codat_sync_for_payables.models import shared +from codat_sync_for_payables.types import OptionalNullable, UNSET +from dataclasses import dataclass +from pydantic import Field +from typing import Callable, Dict, Optional, Tuple, Union + + +SERVERS = [ + "https://api.codat.io", + # Production +] +"""Contains the list of servers available to the SDK""" + + +@dataclass +class SDKConfiguration: + client: HttpClient + async_client: AsyncHttpClient + debug_logger: Logger + security: Optional[Union[shared.Security, Callable[[], shared.Security]]] = None + server_url: Optional[str] = "" + server_idx: Optional[int] = 0 + language: str = "python" + openapi_doc_version: str = "3.0.0" + sdk_version: str = "4.0.0" + gen_version: str = "2.438.15" + user_agent: str = ( + "speakeasy-sdk/python 4.0.0 2.438.15 3.0.0 codat-sync-for-payables" + ) + retry_config: OptionalNullable[RetryConfig] = Field(default_factory=lambda: UNSET) + timeout_ms: Optional[int] = None + + def __post_init__(self): + self._hooks = SDKHooks() + + def get_server_details(self) -> Tuple[str, Dict[str, str]]: + if self.server_url is not None and self.server_url: + return remove_suffix(self.server_url, "/"), {} + if self.server_idx is None: + self.server_idx = 0 + + return SERVERS[self.server_idx], {} + + def get_hooks(self) -> SDKHooks: + return self._hooks diff --git a/sync-for-payables/src/codat_sync_for_payables/suppliers.py b/sync-for-payables/src/codat_sync_for_payables/suppliers.py new file mode 100644 index 000000000..f0acd70bc --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/suppliers.py @@ -0,0 +1,466 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .basesdk import BaseSDK +from codat_sync_for_payables import utils +from codat_sync_for_payables._hooks import HookContext +from codat_sync_for_payables.models import errors, operations, shared +from codat_sync_for_payables.types import BaseModel, OptionalNullable, UNSET +from typing import Any, Optional, Union, cast + + +class Suppliers(BaseSDK): + r"""Get, create, and update Suppliers.""" + + def list( + self, + *, + request: Union[ + operations.ListSuppliersRequest, operations.ListSuppliersRequestTypedDict + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.Suppliers: + r"""List suppliers + + The *List suppliers* endpoint returns a list of [suppliers](https://docs.codat.io/sync-for-payables-api#/schemas/Supplier) for a given company's connection. + + [Suppliers](https://docs.codat.io/sync-for-payables-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service. + + By default, this endpoint returns a list of active and archived suppliers. You can use [querying](https://docs.codat.io/using-the-api/querying) to change that. + + For example, to retrieve only active suppliers (i.e. `status=Active`) or suppliers created within the specified number of days (e.g. `sourceModifiedDate>2023-12-15T00:00:00.000Z`), query the endpoint as follows: `/payables/suppliers?query=sourceModifiedDate>2023-12-15T00:00:00.000Z&&status=Active`.For example, to retrieve active suppliers modified after a particular date use `query=sourceModifiedDate>2023-12-15T00:00:00.000Z&&status=Active`. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.ListSuppliersRequest) + request = cast(operations.ListSuppliersRequest, request) + + req = self.build_request( + method="GET", + path="/companies/{companyId}/connections/{connectionId}/payables/suppliers", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + operation_id="list-suppliers", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "400", + "401", + "402", + "403", + "404", + "409", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return utils.unmarshal_json(http_res.text, shared.Suppliers) + if utils.match_response( + http_res, + ["400", "401", "402", "403", "404", "409", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + async def list_async( + self, + *, + request: Union[ + operations.ListSuppliersRequest, operations.ListSuppliersRequestTypedDict + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.Suppliers: + r"""List suppliers + + The *List suppliers* endpoint returns a list of [suppliers](https://docs.codat.io/sync-for-payables-api#/schemas/Supplier) for a given company's connection. + + [Suppliers](https://docs.codat.io/sync-for-payables-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service. + + By default, this endpoint returns a list of active and archived suppliers. You can use [querying](https://docs.codat.io/using-the-api/querying) to change that. + + For example, to retrieve only active suppliers (i.e. `status=Active`) or suppliers created within the specified number of days (e.g. `sourceModifiedDate>2023-12-15T00:00:00.000Z`), query the endpoint as follows: `/payables/suppliers?query=sourceModifiedDate>2023-12-15T00:00:00.000Z&&status=Active`.For example, to retrieve active suppliers modified after a particular date use `query=sourceModifiedDate>2023-12-15T00:00:00.000Z&&status=Active`. + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.ListSuppliersRequest) + request = cast(operations.ListSuppliersRequest, request) + + req = self.build_request_async( + method="GET", + path="/companies/{companyId}/connections/{connectionId}/payables/suppliers", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + operation_id="list-suppliers", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "400", + "401", + "402", + "403", + "404", + "409", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return utils.unmarshal_json(http_res.text, shared.Suppliers) + if utils.match_response( + http_res, + ["400", "401", "402", "403", "404", "409", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + def create( + self, + *, + request: Union[ + operations.CreateSupplierRequest, operations.CreateSupplierRequestTypedDict + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.Supplier: + r"""Create supplier + + The *Create supplier* endpoint creates a new [supplier](https://docs.codat.io/sync-for-payables-api#/schemas/Supplier) for a given company's connection. + + [Suppliers](https://docs.codat.io/sync-for-payables-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service. + + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.CreateSupplierRequest) + request = cast(operations.CreateSupplierRequest, request) + + req = self.build_request( + method="POST", + path="/companies/{companyId}/connections/{connectionId}/payables/suppliers", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.supplier_prototype, + False, + True, + "json", + Optional[shared.SupplierPrototype], + ), + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = self.do_request( + hook_ctx=HookContext( + operation_id="create-supplier", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "400", + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "201", "application/json"): + return utils.unmarshal_json(http_res.text, shared.Supplier) + if utils.match_response( + http_res, + ["400", "401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = utils.stream_to_text(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) + + async def create_async( + self, + *, + request: Union[ + operations.CreateSupplierRequest, operations.CreateSupplierRequestTypedDict + ], + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + ) -> shared.Supplier: + r"""Create supplier + + The *Create supplier* endpoint creates a new [supplier](https://docs.codat.io/sync-for-payables-api#/schemas/Supplier) for a given company's connection. + + [Suppliers](https://docs.codat.io/sync-for-payables-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service. + + + :param request: The request object to send. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + + if not isinstance(request, BaseModel): + request = utils.unmarshal(request, operations.CreateSupplierRequest) + request = cast(operations.CreateSupplierRequest, request) + + req = self.build_request_async( + method="POST", + path="/companies/{companyId}/connections/{connectionId}/payables/suppliers", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request.supplier_prototype, + False, + True, + "json", + Optional[shared.SupplierPrototype], + ), + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + else: + retries = utils.RetryConfig( + "backoff", utils.BackoffStrategy(500, 60000, 1.5, 3600000), True + ) + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["408", "429", "5XX"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + operation_id="create-supplier", + oauth2_scopes=[], + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=[ + "400", + "401", + "402", + "403", + "404", + "429", + "4XX", + "500", + "503", + "5XX", + ], + retry_config=retry_config, + ) + + data: Any = None + if utils.match_response(http_res, "201", "application/json"): + return utils.unmarshal_json(http_res.text, shared.Supplier) + if utils.match_response( + http_res, + ["400", "401", "402", "403", "404", "429", "500", "503"], + "application/json", + ): + data = utils.unmarshal_json(http_res.text, errors.ErrorMessageData) + raise errors.ErrorMessage(data=data) + if utils.match_response(http_res, ["4XX", "5XX"], "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + "API error occurred", http_res.status_code, http_res_text, http_res + ) + + content_type = http_res.headers.get("Content-Type") + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.SDKError( + f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", + http_res.status_code, + http_res_text, + http_res, + ) diff --git a/sync-for-payables/src/codat_sync_for_payables/types/__init__.py b/sync-for-payables/src/codat_sync_for_payables/types/__init__.py new file mode 100644 index 000000000..fc76fe0c5 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/types/__init__.py @@ -0,0 +1,21 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .basemodel import ( + BaseModel, + Nullable, + OptionalNullable, + UnrecognizedInt, + UnrecognizedStr, + UNSET, + UNSET_SENTINEL, +) + +__all__ = [ + "BaseModel", + "Nullable", + "OptionalNullable", + "UnrecognizedInt", + "UnrecognizedStr", + "UNSET", + "UNSET_SENTINEL", +] diff --git a/sync-for-payables/src/codat_sync_for_payables/types/basemodel.py b/sync-for-payables/src/codat_sync_for_payables/types/basemodel.py new file mode 100644 index 000000000..a6187efa6 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/types/basemodel.py @@ -0,0 +1,39 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from pydantic import ConfigDict, model_serializer +from pydantic import BaseModel as PydanticBaseModel +from typing import TYPE_CHECKING, Literal, Optional, TypeVar, Union, NewType +from typing_extensions import TypeAliasType, TypeAlias + + +class BaseModel(PydanticBaseModel): + model_config = ConfigDict( + populate_by_name=True, arbitrary_types_allowed=True, protected_namespaces=() + ) + + +class Unset(BaseModel): + @model_serializer(mode="plain") + def serialize_model(self): + return UNSET_SENTINEL + + def __bool__(self) -> Literal[False]: + return False + + +UNSET = Unset() +UNSET_SENTINEL = "~?~unset~?~sentinel~?~" + + +T = TypeVar("T") +if TYPE_CHECKING: + Nullable: TypeAlias = Union[T, None] + OptionalNullable: TypeAlias = Union[Optional[Nullable[T]], Unset] +else: + Nullable = TypeAliasType("Nullable", Union[T, None], type_params=(T,)) + OptionalNullable = TypeAliasType( + "OptionalNullable", Union[Optional[Nullable[T]], Unset], type_params=(T,) + ) + +UnrecognizedInt = NewType("UnrecognizedInt", int) +UnrecognizedStr = NewType("UnrecognizedStr", str) diff --git a/sync-for-payables/src/codat_sync_for_payables/utils/__init__.py b/sync-for-payables/src/codat_sync_for_payables/utils/__init__.py new file mode 100644 index 000000000..26d51ae8f --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/utils/__init__.py @@ -0,0 +1,97 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .annotations import get_discriminator +from .enums import OpenEnumMeta +from .headers import get_headers, get_response_headers +from .metadata import ( + FieldMetadata, + find_metadata, + FormMetadata, + HeaderMetadata, + MultipartFormMetadata, + PathParamMetadata, + QueryParamMetadata, + RequestMetadata, + SecurityMetadata, +) +from .queryparams import get_query_params +from .retries import BackoffStrategy, Retries, retry, retry_async, RetryConfig +from .requestbodies import serialize_request_body, SerializedRequestBody +from .security import get_security +from .serializers import ( + get_pydantic_model, + marshal_json, + unmarshal, + unmarshal_json, + serialize_decimal, + serialize_float, + serialize_int, + stream_to_text, + stream_to_text_async, + stream_to_bytes, + stream_to_bytes_async, + validate_const, + validate_decimal, + validate_float, + validate_int, + validate_open_enum, +) +from .url import generate_url, template_url, remove_suffix +from .values import ( + get_global_from_env, + match_content_type, + match_status_codes, + match_response, +) +from .logger import Logger, get_body_content, get_default_logger + +__all__ = [ + "BackoffStrategy", + "FieldMetadata", + "find_metadata", + "FormMetadata", + "generate_url", + "get_body_content", + "get_default_logger", + "get_discriminator", + "get_global_from_env", + "get_headers", + "get_pydantic_model", + "get_query_params", + "get_response_headers", + "get_security", + "HeaderMetadata", + "Logger", + "marshal_json", + "match_content_type", + "match_status_codes", + "match_response", + "MultipartFormMetadata", + "OpenEnumMeta", + "PathParamMetadata", + "QueryParamMetadata", + "remove_suffix", + "Retries", + "retry", + "retry_async", + "RetryConfig", + "RequestMetadata", + "SecurityMetadata", + "serialize_decimal", + "serialize_float", + "serialize_int", + "serialize_request_body", + "SerializedRequestBody", + "stream_to_text", + "stream_to_text_async", + "stream_to_bytes", + "stream_to_bytes_async", + "template_url", + "unmarshal", + "unmarshal_json", + "validate_decimal", + "validate_const", + "validate_float", + "validate_int", + "validate_open_enum", +] diff --git a/sync-for-payables/src/codat_sync_for_payables/utils/annotations.py b/sync-for-payables/src/codat_sync_for_payables/utils/annotations.py new file mode 100644 index 000000000..5b3bbb027 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/utils/annotations.py @@ -0,0 +1,30 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from enum import Enum +from typing import Any + +def get_discriminator(model: Any, fieldname: str, key: str) -> str: + if isinstance(model, dict): + try: + return f'{model.get(key)}' + except AttributeError as e: + raise ValueError(f'Could not find discriminator key {key} in {model}') from e + + if hasattr(model, fieldname): + attr = getattr(model, fieldname) + + if isinstance(attr, Enum): + return f'{attr.value}' + + return f'{attr}' + + fieldname = fieldname.upper() + if hasattr(model, fieldname): + attr = getattr(model, fieldname) + + if isinstance(attr, Enum): + return f'{attr.value}' + + return f'{attr}' + + raise ValueError(f'Could not find discriminator field {fieldname} in {model}') diff --git a/sync-for-payables/src/codat_sync_for_payables/utils/enums.py b/sync-for-payables/src/codat_sync_for_payables/utils/enums.py new file mode 100644 index 000000000..c650b10cb --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/utils/enums.py @@ -0,0 +1,34 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +import enum + + +class OpenEnumMeta(enum.EnumMeta): + def __call__( + cls, value, names=None, *, module=None, qualname=None, type=None, start=1 + ): + # The `type` kwarg also happens to be a built-in that pylint flags as + # redeclared. Safe to ignore this lint rule with this scope. + # pylint: disable=redefined-builtin + + if names is not None: + return super().__call__( + value, + names=names, + module=module, + qualname=qualname, + type=type, + start=start, + ) + + try: + return super().__call__( + value, + names=names, # pyright: ignore[reportArgumentType] + module=module, + qualname=qualname, + type=type, + start=start, + ) + except ValueError: + return value diff --git a/sync-for-payables/src/codat_sync_for_payables/utils/eventstreaming.py b/sync-for-payables/src/codat_sync_for_payables/utils/eventstreaming.py new file mode 100644 index 000000000..553b386b3 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/utils/eventstreaming.py @@ -0,0 +1,178 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +import re +import json +from typing import Callable, TypeVar, Optional, Generator, AsyncGenerator, Tuple +import httpx + +T = TypeVar("T") + + +class ServerEvent: + id: Optional[str] = None + event: Optional[str] = None + data: Optional[str] = None + retry: Optional[int] = None + + +MESSAGE_BOUNDARIES = [ + b"\r\n\r\n", + b"\n\n", + b"\r\r", +] + + +async def stream_events_async( + response: httpx.Response, + decoder: Callable[[str], T], + sentinel: Optional[str] = None, +) -> AsyncGenerator[T, None]: + buffer = bytearray() + position = 0 + discard = False + async for chunk in response.aiter_bytes(): + # We've encountered the sentinel value and should no longer process + # incoming data. Instead we throw new data away until the server closes + # the connection. + if discard: + continue + + buffer += chunk + for i in range(position, len(buffer)): + char = buffer[i : i + 1] + seq: Optional[bytes] = None + if char in [b"\r", b"\n"]: + for boundary in MESSAGE_BOUNDARIES: + seq = _peek_sequence(i, buffer, boundary) + if seq is not None: + break + if seq is None: + continue + + block = buffer[position:i] + position = i + len(seq) + event, discard = _parse_event(block, decoder, sentinel) + if event is not None: + yield event + + if position > 0: + buffer = buffer[position:] + position = 0 + + event, discard = _parse_event(buffer, decoder, sentinel) + if event is not None: + yield event + + +def stream_events( + response: httpx.Response, + decoder: Callable[[str], T], + sentinel: Optional[str] = None, +) -> Generator[T, None, None]: + buffer = bytearray() + position = 0 + discard = False + for chunk in response.iter_bytes(): + # We've encountered the sentinel value and should no longer process + # incoming data. Instead we throw new data away until the server closes + # the connection. + if discard: + continue + + buffer += chunk + for i in range(position, len(buffer)): + char = buffer[i : i + 1] + seq: Optional[bytes] = None + if char in [b"\r", b"\n"]: + for boundary in MESSAGE_BOUNDARIES: + seq = _peek_sequence(i, buffer, boundary) + if seq is not None: + break + if seq is None: + continue + + block = buffer[position:i] + position = i + len(seq) + event, discard = _parse_event(block, decoder, sentinel) + if event is not None: + yield event + + if position > 0: + buffer = buffer[position:] + position = 0 + + event, discard = _parse_event(buffer, decoder, sentinel) + if event is not None: + yield event + + +def _parse_event( + raw: bytearray, decoder: Callable[[str], T], sentinel: Optional[str] = None +) -> Tuple[Optional[T], bool]: + block = raw.decode() + lines = re.split(r"\r?\n|\r", block) + publish = False + event = ServerEvent() + data = "" + for line in lines: + if not line: + continue + + delim = line.find(":") + if delim <= 0: + continue + + field = line[0:delim] + value = line[delim + 1 :] if delim < len(line) - 1 else "" + if len(value) and value[0] == " ": + value = value[1:] + + if field == "event": + event.event = value + publish = True + elif field == "data": + data += value + "\n" + publish = True + elif field == "id": + event.id = value + publish = True + elif field == "retry": + event.retry = int(value) if value.isdigit() else None + publish = True + + if sentinel and data == f"{sentinel}\n": + return None, True + + if data: + data = data[:-1] + event.data = data + + data_is_primitive = ( + data.isnumeric() or data == "true" or data == "false" or data == "null" + ) + data_is_json = ( + data.startswith("{") or data.startswith("[") or data.startswith('"') + ) + + if data_is_primitive or data_is_json: + try: + event.data = json.loads(data) + except Exception: + pass + + out = None + if publish: + out = decoder(json.dumps(event.__dict__)) + + return out, False + + +def _peek_sequence(position: int, buffer: bytearray, sequence: bytes): + if len(sequence) > (len(buffer) - position): + return None + + for i, seq in enumerate(sequence): + if buffer[position + i] != seq: + return None + + return sequence diff --git a/sync-for-payables/src/codat_sync_for_payables/utils/forms.py b/sync-for-payables/src/codat_sync_for_payables/utils/forms.py new file mode 100644 index 000000000..9f5a731e9 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/utils/forms.py @@ -0,0 +1,208 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from typing import ( + Any, + Dict, + get_type_hints, + List, + Tuple, +) +from pydantic import BaseModel +from pydantic.fields import FieldInfo + +from .serializers import marshal_json + +from .metadata import ( + FormMetadata, + MultipartFormMetadata, + find_field_metadata, +) +from .values import _is_set, _val_to_string + + +def _populate_form( + field_name: str, + explode: bool, + obj: Any, + delimiter: str, + form: Dict[str, List[str]], +): + if not _is_set(obj): + return form + + if isinstance(obj, BaseModel): + items = [] + + obj_fields: Dict[str, FieldInfo] = obj.__class__.model_fields + for name in obj_fields: + obj_field = obj_fields[name] + obj_field_name = obj_field.alias if obj_field.alias is not None else name + if obj_field_name == "": + continue + + val = getattr(obj, name) + if not _is_set(val): + continue + + if explode: + form[obj_field_name] = [_val_to_string(val)] + else: + items.append(f"{obj_field_name}{delimiter}{_val_to_string(val)}") + + if len(items) > 0: + form[field_name] = [delimiter.join(items)] + elif isinstance(obj, Dict): + items = [] + for key, value in obj.items(): + if not _is_set(value): + continue + + if explode: + form[key] = [_val_to_string(value)] + else: + items.append(f"{key}{delimiter}{_val_to_string(value)}") + + if len(items) > 0: + form[field_name] = [delimiter.join(items)] + elif isinstance(obj, List): + items = [] + + for value in obj: + if not _is_set(value): + continue + + if explode: + if not field_name in form: + form[field_name] = [] + form[field_name].append(_val_to_string(value)) + else: + items.append(_val_to_string(value)) + + if len(items) > 0: + form[field_name] = [delimiter.join([str(item) for item in items])] + else: + form[field_name] = [_val_to_string(obj)] + + return form + + +def serialize_multipart_form( + media_type: str, request: Any +) -> Tuple[str, Dict[str, Any], Dict[str, Any]]: + form: Dict[str, Any] = {} + files: Dict[str, Any] = {} + + if not isinstance(request, BaseModel): + raise TypeError("invalid request body type") + + request_fields: Dict[str, FieldInfo] = request.__class__.model_fields + request_field_types = get_type_hints(request.__class__) + + for name in request_fields: + field = request_fields[name] + + val = getattr(request, name) + if not _is_set(val): + continue + + field_metadata = find_field_metadata(field, MultipartFormMetadata) + if not field_metadata: + continue + + f_name = field.alias if field.alias is not None else name + + if field_metadata.file: + file_fields: Dict[str, FieldInfo] = val.__class__.model_fields + + file_name = "" + field_name = "" + content = None + content_type = None + + for file_field_name in file_fields: + file_field = file_fields[file_field_name] + + file_metadata = find_field_metadata(file_field, MultipartFormMetadata) + if file_metadata is None: + continue + + if file_metadata.content: + content = getattr(val, file_field_name, None) + elif file_field_name == "content_type": + content_type = getattr(val, file_field_name, None) + else: + field_name = ( + file_field.alias + if file_field.alias is not None + else file_field_name + ) + file_name = getattr(val, file_field_name) + + if field_name == "" or file_name == "" or content is None: + raise ValueError("invalid multipart/form-data file") + + if content_type is not None: + files[field_name] = (file_name, content, content_type) + else: + files[field_name] = (file_name, content) + elif field_metadata.json: + files[f_name] = ( + None, + marshal_json(val, request_field_types[name]), + "application/json", + ) + else: + if isinstance(val, List): + values = [] + + for value in val: + if not _is_set(value): + continue + values.append(_val_to_string(value)) + + form[f_name + "[]"] = values + else: + form[f_name] = _val_to_string(val) + return media_type, form, files + + +def serialize_form_data(data: Any) -> Dict[str, Any]: + form: Dict[str, List[str]] = {} + + if isinstance(data, BaseModel): + data_fields: Dict[str, FieldInfo] = data.__class__.model_fields + data_field_types = get_type_hints(data.__class__) + for name in data_fields: + field = data_fields[name] + + val = getattr(data, name) + if not _is_set(val): + continue + + metadata = find_field_metadata(field, FormMetadata) + if metadata is None: + continue + + f_name = field.alias if field.alias is not None else name + + if metadata.json: + form[f_name] = [marshal_json(val, data_field_types[name])] + else: + if metadata.style == "form": + _populate_form( + f_name, + metadata.explode, + val, + ",", + form, + ) + else: + raise ValueError(f"Invalid form style for field {name}") + elif isinstance(data, Dict): + for key, value in data.items(): + if _is_set(value): + form[key] = [_val_to_string(value)] + else: + raise TypeError(f"Invalid request body type {type(data)} for form data") + + return form diff --git a/sync-for-payables/src/codat_sync_for_payables/utils/headers.py b/sync-for-payables/src/codat_sync_for_payables/utils/headers.py new file mode 100644 index 000000000..37864cbbb --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/utils/headers.py @@ -0,0 +1,136 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from typing import ( + Any, + Dict, + List, + Optional, +) +from httpx import Headers +from pydantic import BaseModel +from pydantic.fields import FieldInfo + +from .metadata import ( + HeaderMetadata, + find_field_metadata, +) + +from .values import _is_set, _populate_from_globals, _val_to_string + + +def get_headers(headers_params: Any, gbls: Optional[Any] = None) -> Dict[str, str]: + headers: Dict[str, str] = {} + + globals_already_populated = [] + if _is_set(headers_params): + globals_already_populated = _populate_headers(headers_params, gbls, headers, []) + if _is_set(gbls): + _populate_headers(gbls, None, headers, globals_already_populated) + + return headers + + +def _populate_headers( + headers_params: Any, + gbls: Any, + header_values: Dict[str, str], + skip_fields: List[str], +) -> List[str]: + globals_already_populated: List[str] = [] + + if not isinstance(headers_params, BaseModel): + return globals_already_populated + + param_fields: Dict[str, FieldInfo] = headers_params.__class__.model_fields + for name in param_fields: + if name in skip_fields: + continue + + field = param_fields[name] + f_name = field.alias if field.alias is not None else name + + metadata = find_field_metadata(field, HeaderMetadata) + if metadata is None: + continue + + value, global_found = _populate_from_globals( + name, getattr(headers_params, name), HeaderMetadata, gbls + ) + if global_found: + globals_already_populated.append(name) + value = _serialize_header(metadata.explode, value) + + if value != "": + header_values[f_name] = value + + return globals_already_populated + + +def _serialize_header(explode: bool, obj: Any) -> str: + if not _is_set(obj): + return "" + + if isinstance(obj, BaseModel): + items = [] + obj_fields: Dict[str, FieldInfo] = obj.__class__.model_fields + for name in obj_fields: + obj_field = obj_fields[name] + obj_param_metadata = find_field_metadata(obj_field, HeaderMetadata) + + if not obj_param_metadata: + continue + + f_name = obj_field.alias if obj_field.alias is not None else name + + val = getattr(obj, name) + if not _is_set(val): + continue + + if explode: + items.append(f"{f_name}={_val_to_string(val)}") + else: + items.append(f_name) + items.append(_val_to_string(val)) + + if len(items) > 0: + return ",".join(items) + elif isinstance(obj, Dict): + items = [] + + for key, value in obj.items(): + if not _is_set(value): + continue + + if explode: + items.append(f"{key}={_val_to_string(value)}") + else: + items.append(key) + items.append(_val_to_string(value)) + + if len(items) > 0: + return ",".join([str(item) for item in items]) + elif isinstance(obj, List): + items = [] + + for value in obj: + if not _is_set(value): + continue + + items.append(_val_to_string(value)) + + if len(items) > 0: + return ",".join(items) + elif _is_set(obj): + return f"{_val_to_string(obj)}" + + return "" + + +def get_response_headers(headers: Headers) -> Dict[str, List[str]]: + res: Dict[str, List[str]] = {} + for k, v in headers.items(): + if not k in res: + res[k] = [] + + res[k].append(v) + return res diff --git a/sync-for-payables/src/codat_sync_for_payables/utils/logger.py b/sync-for-payables/src/codat_sync_for_payables/utils/logger.py new file mode 100644 index 000000000..b661aff65 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/utils/logger.py @@ -0,0 +1,22 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +import httpx +from typing import Any, Protocol + + +class Logger(Protocol): + def debug(self, msg: str, *args: Any, **kwargs: Any) -> None: + pass + + +class NoOpLogger: + def debug(self, msg: str, *args: Any, **kwargs: Any) -> None: + pass + + +def get_body_content(req: httpx.Request) -> str: + return "" if not hasattr(req, "_content") else str(req.content) + + +def get_default_logger() -> Logger: + return NoOpLogger() diff --git a/sync-for-payables/src/codat_sync_for_payables/utils/metadata.py b/sync-for-payables/src/codat_sync_for_payables/utils/metadata.py new file mode 100644 index 000000000..173b3e5ce --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/utils/metadata.py @@ -0,0 +1,118 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from typing import Optional, Type, TypeVar, Union +from dataclasses import dataclass +from pydantic.fields import FieldInfo + + +T = TypeVar("T") + + +@dataclass +class SecurityMetadata: + option: bool = False + scheme: bool = False + scheme_type: Optional[str] = None + sub_type: Optional[str] = None + field_name: Optional[str] = None + + def get_field_name(self, default: str) -> str: + return self.field_name or default + + +@dataclass +class ParamMetadata: + serialization: Optional[str] = None + style: str = "simple" + explode: bool = False + + +@dataclass +class PathParamMetadata(ParamMetadata): + pass + + +@dataclass +class QueryParamMetadata(ParamMetadata): + style: str = "form" + explode: bool = True + + +@dataclass +class HeaderMetadata(ParamMetadata): + pass + + +@dataclass +class RequestMetadata: + media_type: str = "application/octet-stream" + + +@dataclass +class MultipartFormMetadata: + file: bool = False + content: bool = False + json: bool = False + + +@dataclass +class FormMetadata: + json: bool = False + style: str = "form" + explode: bool = True + + +class FieldMetadata: + security: Optional[SecurityMetadata] = None + path: Optional[PathParamMetadata] = None + query: Optional[QueryParamMetadata] = None + header: Optional[HeaderMetadata] = None + request: Optional[RequestMetadata] = None + form: Optional[FormMetadata] = None + multipart: Optional[MultipartFormMetadata] = None + + def __init__( + self, + security: Optional[SecurityMetadata] = None, + path: Optional[Union[PathParamMetadata, bool]] = None, + query: Optional[Union[QueryParamMetadata, bool]] = None, + header: Optional[Union[HeaderMetadata, bool]] = None, + request: Optional[Union[RequestMetadata, bool]] = None, + form: Optional[Union[FormMetadata, bool]] = None, + multipart: Optional[Union[MultipartFormMetadata, bool]] = None, + ): + self.security = security + self.path = PathParamMetadata() if isinstance(path, bool) else path + self.query = QueryParamMetadata() if isinstance(query, bool) else query + self.header = HeaderMetadata() if isinstance(header, bool) else header + self.request = RequestMetadata() if isinstance(request, bool) else request + self.form = FormMetadata() if isinstance(form, bool) else form + self.multipart = ( + MultipartFormMetadata() if isinstance(multipart, bool) else multipart + ) + + +def find_field_metadata(field_info: FieldInfo, metadata_type: Type[T]) -> Optional[T]: + metadata = find_metadata(field_info, FieldMetadata) + if not metadata: + return None + + fields = metadata.__dict__ + + for field in fields: + if isinstance(fields[field], metadata_type): + return fields[field] + + return None + + +def find_metadata(field_info: FieldInfo, metadata_type: Type[T]) -> Optional[T]: + metadata = field_info.metadata + if not metadata: + return None + + for md in metadata: + if isinstance(md, metadata_type): + return md + + return None diff --git a/sync-for-payables/src/codat_sync_for_payables/utils/queryparams.py b/sync-for-payables/src/codat_sync_for_payables/utils/queryparams.py new file mode 100644 index 000000000..37a6e7f9a --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/utils/queryparams.py @@ -0,0 +1,205 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from typing import ( + Any, + Dict, + get_type_hints, + List, + Optional, +) + +from pydantic import BaseModel +from pydantic.fields import FieldInfo + +from .metadata import ( + QueryParamMetadata, + find_field_metadata, +) +from .values import ( + _get_serialized_params, + _is_set, + _populate_from_globals, + _val_to_string, +) +from .forms import _populate_form + + +def get_query_params( + query_params: Any, + gbls: Optional[Any] = None, +) -> Dict[str, List[str]]: + params: Dict[str, List[str]] = {} + + globals_already_populated = _populate_query_params(query_params, gbls, params, []) + if _is_set(gbls): + _populate_query_params(gbls, None, params, globals_already_populated) + + return params + + +def _populate_query_params( + query_params: Any, + gbls: Any, + query_param_values: Dict[str, List[str]], + skip_fields: List[str], +) -> List[str]: + globals_already_populated: List[str] = [] + + if not isinstance(query_params, BaseModel): + return globals_already_populated + + param_fields: Dict[str, FieldInfo] = query_params.__class__.model_fields + param_field_types = get_type_hints(query_params.__class__) + for name in param_fields: + if name in skip_fields: + continue + + field = param_fields[name] + + metadata = find_field_metadata(field, QueryParamMetadata) + if not metadata: + continue + + value = getattr(query_params, name) if _is_set(query_params) else None + + value, global_found = _populate_from_globals( + name, value, QueryParamMetadata, gbls + ) + if global_found: + globals_already_populated.append(name) + + f_name = field.alias if field.alias is not None else name + serialization = metadata.serialization + if serialization is not None: + serialized_parms = _get_serialized_params( + metadata, f_name, value, param_field_types[name] + ) + for key, value in serialized_parms.items(): + if key in query_param_values: + query_param_values[key].extend(value) + else: + query_param_values[key] = [value] + else: + style = metadata.style + if style == "deepObject": + _populate_deep_object_query_params(f_name, value, query_param_values) + elif style == "form": + _populate_delimited_query_params( + metadata, f_name, value, ",", query_param_values + ) + elif style == "pipeDelimited": + _populate_delimited_query_params( + metadata, f_name, value, "|", query_param_values + ) + else: + raise NotImplementedError( + f"query param style {style} not yet supported" + ) + + return globals_already_populated + + +def _populate_deep_object_query_params( + field_name: str, + obj: Any, + params: Dict[str, List[str]], +): + if not _is_set(obj): + return + + if isinstance(obj, BaseModel): + _populate_deep_object_query_params_basemodel(field_name, obj, params) + elif isinstance(obj, Dict): + _populate_deep_object_query_params_dict(field_name, obj, params) + + +def _populate_deep_object_query_params_basemodel( + prior_params_key: str, + obj: Any, + params: Dict[str, List[str]], +): + if not _is_set(obj) or not isinstance(obj, BaseModel): + return + + obj_fields: Dict[str, FieldInfo] = obj.__class__.model_fields + for name in obj_fields: + obj_field = obj_fields[name] + + f_name = obj_field.alias if obj_field.alias is not None else name + + params_key = f"{prior_params_key}[{f_name}]" + + obj_param_metadata = find_field_metadata(obj_field, QueryParamMetadata) + if not _is_set(obj_param_metadata): + continue + + obj_val = getattr(obj, name) + if not _is_set(obj_val): + continue + + if isinstance(obj_val, BaseModel): + _populate_deep_object_query_params_basemodel(params_key, obj_val, params) + elif isinstance(obj_val, Dict): + _populate_deep_object_query_params_dict(params_key, obj_val, params) + elif isinstance(obj_val, List): + _populate_deep_object_query_params_list(params_key, obj_val, params) + else: + params[params_key] = [_val_to_string(obj_val)] + + +def _populate_deep_object_query_params_dict( + prior_params_key: str, + value: Dict, + params: Dict[str, List[str]], +): + if not _is_set(value): + return + + for key, val in value.items(): + if not _is_set(val): + continue + + params_key = f"{prior_params_key}[{key}]" + + if isinstance(val, BaseModel): + _populate_deep_object_query_params_basemodel(params_key, val, params) + elif isinstance(val, Dict): + _populate_deep_object_query_params_dict(params_key, val, params) + elif isinstance(val, List): + _populate_deep_object_query_params_list(params_key, val, params) + else: + params[params_key] = [_val_to_string(val)] + + +def _populate_deep_object_query_params_list( + params_key: str, + value: List, + params: Dict[str, List[str]], +): + if not _is_set(value): + return + + for val in value: + if not _is_set(val): + continue + + if params.get(params_key) is None: + params[params_key] = [] + + params[params_key].append(_val_to_string(val)) + + +def _populate_delimited_query_params( + metadata: QueryParamMetadata, + field_name: str, + obj: Any, + delimiter: str, + query_param_values: Dict[str, List[str]], +): + _populate_form( + field_name, + metadata.explode, + obj, + delimiter, + query_param_values, + ) diff --git a/sync-for-payables/src/codat_sync_for_payables/utils/requestbodies.py b/sync-for-payables/src/codat_sync_for_payables/utils/requestbodies.py new file mode 100644 index 000000000..4f586ae79 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/utils/requestbodies.py @@ -0,0 +1,66 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +import io +from dataclasses import dataclass +import re +from typing import ( + Any, + Optional, +) + +from .forms import serialize_form_data, serialize_multipart_form + +from .serializers import marshal_json + +SERIALIZATION_METHOD_TO_CONTENT_TYPE = { + "json": "application/json", + "form": "application/x-www-form-urlencoded", + "multipart": "multipart/form-data", + "raw": "application/octet-stream", + "string": "text/plain", +} + + +@dataclass +class SerializedRequestBody: + media_type: str + content: Optional[Any] = None + data: Optional[Any] = None + files: Optional[Any] = None + + +def serialize_request_body( + request_body: Any, + nullable: bool, + optional: bool, + serialization_method: str, + request_body_type, +) -> Optional[SerializedRequestBody]: + if request_body is None: + if not nullable and optional: + return None + + media_type = SERIALIZATION_METHOD_TO_CONTENT_TYPE[serialization_method] + + serialized_request_body = SerializedRequestBody(media_type) + + if re.match(r"(application|text)\/.*?\+*json.*", media_type) is not None: + serialized_request_body.content = marshal_json(request_body, request_body_type) + elif re.match(r"multipart\/.*", media_type) is not None: + ( + serialized_request_body.media_type, + serialized_request_body.data, + serialized_request_body.files, + ) = serialize_multipart_form(media_type, request_body) + elif re.match(r"application\/x-www-form-urlencoded.*", media_type) is not None: + serialized_request_body.data = serialize_form_data(request_body) + elif isinstance(request_body, (bytes, bytearray, io.BytesIO, io.BufferedReader)): + serialized_request_body.content = request_body + elif isinstance(request_body, str): + serialized_request_body.content = request_body + else: + raise TypeError( + f"invalid request body type {type(request_body)} for mediaType {media_type}" + ) + + return serialized_request_body diff --git a/sync-for-payables/src/codat_sync_for_payables/utils/retries.py b/sync-for-payables/src/codat_sync_for_payables/utils/retries.py new file mode 100644 index 000000000..4d6086716 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/utils/retries.py @@ -0,0 +1,217 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +import asyncio +import random +import time +from typing import List + +import httpx + + +class BackoffStrategy: + initial_interval: int + max_interval: int + exponent: float + max_elapsed_time: int + + def __init__( + self, + initial_interval: int, + max_interval: int, + exponent: float, + max_elapsed_time: int, + ): + self.initial_interval = initial_interval + self.max_interval = max_interval + self.exponent = exponent + self.max_elapsed_time = max_elapsed_time + + +class RetryConfig: + strategy: str + backoff: BackoffStrategy + retry_connection_errors: bool + + def __init__( + self, strategy: str, backoff: BackoffStrategy, retry_connection_errors: bool + ): + self.strategy = strategy + self.backoff = backoff + self.retry_connection_errors = retry_connection_errors + + +class Retries: + config: RetryConfig + status_codes: List[str] + + def __init__(self, config: RetryConfig, status_codes: List[str]): + self.config = config + self.status_codes = status_codes + + +class TemporaryError(Exception): + response: httpx.Response + + def __init__(self, response: httpx.Response): + self.response = response + + +class PermanentError(Exception): + inner: Exception + + def __init__(self, inner: Exception): + self.inner = inner + + +def retry(func, retries: Retries): + if retries.config.strategy == "backoff": + + def do_request() -> httpx.Response: + res: httpx.Response + try: + res = func() + + for code in retries.status_codes: + if "X" in code.upper(): + code_range = int(code[0]) + + status_major = res.status_code / 100 + + if code_range <= status_major < code_range + 1: + raise TemporaryError(res) + else: + parsed_code = int(code) + + if res.status_code == parsed_code: + raise TemporaryError(res) + except httpx.ConnectError as exception: + if retries.config.retry_connection_errors: + raise + + raise PermanentError(exception) from exception + except httpx.TimeoutException as exception: + if retries.config.retry_connection_errors: + raise + + raise PermanentError(exception) from exception + except TemporaryError: + raise + except Exception as exception: + raise PermanentError(exception) from exception + + return res + + return retry_with_backoff( + do_request, + retries.config.backoff.initial_interval, + retries.config.backoff.max_interval, + retries.config.backoff.exponent, + retries.config.backoff.max_elapsed_time, + ) + + return func() + + +async def retry_async(func, retries: Retries): + if retries.config.strategy == "backoff": + + async def do_request() -> httpx.Response: + res: httpx.Response + try: + res = await func() + + for code in retries.status_codes: + if "X" in code.upper(): + code_range = int(code[0]) + + status_major = res.status_code / 100 + + if code_range <= status_major < code_range + 1: + raise TemporaryError(res) + else: + parsed_code = int(code) + + if res.status_code == parsed_code: + raise TemporaryError(res) + except httpx.ConnectError as exception: + if retries.config.retry_connection_errors: + raise + + raise PermanentError(exception) from exception + except httpx.TimeoutException as exception: + if retries.config.retry_connection_errors: + raise + + raise PermanentError(exception) from exception + except TemporaryError: + raise + except Exception as exception: + raise PermanentError(exception) from exception + + return res + + return await retry_with_backoff_async( + do_request, + retries.config.backoff.initial_interval, + retries.config.backoff.max_interval, + retries.config.backoff.exponent, + retries.config.backoff.max_elapsed_time, + ) + + return await func() + + +def retry_with_backoff( + func, + initial_interval=500, + max_interval=60000, + exponent=1.5, + max_elapsed_time=3600000, +): + start = round(time.time() * 1000) + retries = 0 + + while True: + try: + return func() + except PermanentError as exception: + raise exception.inner + except Exception as exception: # pylint: disable=broad-exception-caught + now = round(time.time() * 1000) + if now - start > max_elapsed_time: + if isinstance(exception, TemporaryError): + return exception.response + + raise + sleep = (initial_interval / 1000) * exponent**retries + random.uniform(0, 1) + sleep = min(sleep, max_interval / 1000) + time.sleep(sleep) + retries += 1 + + +async def retry_with_backoff_async( + func, + initial_interval=500, + max_interval=60000, + exponent=1.5, + max_elapsed_time=3600000, +): + start = round(time.time() * 1000) + retries = 0 + + while True: + try: + return await func() + except PermanentError as exception: + raise exception.inner + except Exception as exception: # pylint: disable=broad-exception-caught + now = round(time.time() * 1000) + if now - start > max_elapsed_time: + if isinstance(exception, TemporaryError): + return exception.response + + raise + sleep = (initial_interval / 1000) * exponent**retries + random.uniform(0, 1) + sleep = min(sleep, max_interval / 1000) + await asyncio.sleep(sleep) + retries += 1 diff --git a/sync-for-payables/src/codat_sync_for_payables/utils/security.py b/sync-for-payables/src/codat_sync_for_payables/utils/security.py new file mode 100644 index 000000000..295a3f400 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/utils/security.py @@ -0,0 +1,174 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +import base64 +from typing import ( + Any, + Dict, + List, + Tuple, +) +from pydantic import BaseModel +from pydantic.fields import FieldInfo + +from .metadata import ( + SecurityMetadata, + find_field_metadata, +) + + +def get_security(security: Any) -> Tuple[Dict[str, str], Dict[str, List[str]]]: + headers: Dict[str, str] = {} + query_params: Dict[str, List[str]] = {} + + if security is None: + return headers, query_params + + if not isinstance(security, BaseModel): + raise TypeError("security must be a pydantic model") + + sec_fields: Dict[str, FieldInfo] = security.__class__.model_fields + for name in sec_fields: + sec_field = sec_fields[name] + + value = getattr(security, name) + if value is None: + continue + + metadata = find_field_metadata(sec_field, SecurityMetadata) + if metadata is None: + continue + if metadata.option: + _parse_security_option(headers, query_params, value) + return headers, query_params + if metadata.scheme: + # Special case for basic auth or custom auth which could be a flattened model + if metadata.sub_type in ["basic", "custom"] and not isinstance( + value, BaseModel + ): + _parse_security_scheme(headers, query_params, metadata, name, security) + else: + _parse_security_scheme(headers, query_params, metadata, name, value) + + return headers, query_params + + +def _parse_security_option( + headers: Dict[str, str], query_params: Dict[str, List[str]], option: Any +): + if not isinstance(option, BaseModel): + raise TypeError("security option must be a pydantic model") + + opt_fields: Dict[str, FieldInfo] = option.__class__.model_fields + for name in opt_fields: + opt_field = opt_fields[name] + + metadata = find_field_metadata(opt_field, SecurityMetadata) + if metadata is None or not metadata.scheme: + continue + _parse_security_scheme( + headers, query_params, metadata, name, getattr(option, name) + ) + + +def _parse_security_scheme( + headers: Dict[str, str], + query_params: Dict[str, List[str]], + scheme_metadata: SecurityMetadata, + field_name: str, + scheme: Any, +): + scheme_type = scheme_metadata.scheme_type + sub_type = scheme_metadata.sub_type + + if isinstance(scheme, BaseModel): + if scheme_type == "http": + if sub_type == "basic": + _parse_basic_auth_scheme(headers, scheme) + return + if sub_type == "custom": + return + + scheme_fields: Dict[str, FieldInfo] = scheme.__class__.model_fields + for name in scheme_fields: + scheme_field = scheme_fields[name] + + metadata = find_field_metadata(scheme_field, SecurityMetadata) + if metadata is None or metadata.field_name is None: + continue + + value = getattr(scheme, name) + + _parse_security_scheme_value( + headers, query_params, scheme_metadata, metadata, name, value + ) + else: + _parse_security_scheme_value( + headers, query_params, scheme_metadata, scheme_metadata, field_name, scheme + ) + + +def _parse_security_scheme_value( + headers: Dict[str, str], + query_params: Dict[str, List[str]], + scheme_metadata: SecurityMetadata, + security_metadata: SecurityMetadata, + field_name: str, + value: Any, +): + scheme_type = scheme_metadata.scheme_type + sub_type = scheme_metadata.sub_type + + header_name = security_metadata.get_field_name(field_name) + + if scheme_type == "apiKey": + if sub_type == "header": + headers[header_name] = value + elif sub_type == "query": + query_params[header_name] = [value] + else: + raise ValueError("sub type {sub_type} not supported") + elif scheme_type == "openIdConnect": + headers[header_name] = _apply_bearer(value) + elif scheme_type == "oauth2": + if sub_type != "client_credentials": + headers[header_name] = _apply_bearer(value) + elif scheme_type == "http": + if sub_type == "bearer": + headers[header_name] = _apply_bearer(value) + elif sub_type == "custom": + return + else: + raise ValueError("sub type {sub_type} not supported") + else: + raise ValueError("scheme type {scheme_type} not supported") + + +def _apply_bearer(token: str) -> str: + return token.lower().startswith("bearer ") and token or f"Bearer {token}" + + +def _parse_basic_auth_scheme(headers: Dict[str, str], scheme: Any): + username = "" + password = "" + + if not isinstance(scheme, BaseModel): + raise TypeError("basic auth scheme must be a pydantic model") + + scheme_fields: Dict[str, FieldInfo] = scheme.__class__.model_fields + for name in scheme_fields: + scheme_field = scheme_fields[name] + + metadata = find_field_metadata(scheme_field, SecurityMetadata) + if metadata is None or metadata.field_name is None: + continue + + field_name = metadata.field_name + value = getattr(scheme, name) + + if field_name == "username": + username = value + if field_name == "password": + password = value + + data = f"{username}:{password}".encode() + headers["Authorization"] = f"Basic {base64.b64encode(data).decode()}" diff --git a/sync-for-payables/src/codat_sync_for_payables/utils/serializers.py b/sync-for-payables/src/codat_sync_for_payables/utils/serializers.py new file mode 100644 index 000000000..c5eb36597 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/utils/serializers.py @@ -0,0 +1,215 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from decimal import Decimal +import json +from typing import Any, Dict, List, Union, get_args +import httpx +from typing_extensions import get_origin +from pydantic import ConfigDict, create_model +from pydantic_core import from_json +from typing_inspect import is_optional_type + +from ..types.basemodel import BaseModel, Nullable, OptionalNullable, Unset + + +def serialize_decimal(as_str: bool): + def serialize(d): + if is_optional_type(type(d)) and d is None: + return None + if isinstance(d, Unset): + return d + + if not isinstance(d, Decimal): + raise ValueError("Expected Decimal object") + + return str(d) if as_str else float(d) + + return serialize + + +def validate_decimal(d): + if d is None: + return None + + if isinstance(d, (Decimal, Unset)): + return d + + if not isinstance(d, (str, int, float)): + raise ValueError("Expected string, int or float") + + return Decimal(str(d)) + + +def serialize_float(as_str: bool): + def serialize(f): + if is_optional_type(type(f)) and f is None: + return None + if isinstance(f, Unset): + return f + + if not isinstance(f, float): + raise ValueError("Expected float") + + return str(f) if as_str else f + + return serialize + + +def validate_float(f): + if f is None: + return None + + if isinstance(f, (float, Unset)): + return f + + if not isinstance(f, str): + raise ValueError("Expected string") + + return float(f) + + +def serialize_int(as_str: bool): + def serialize(i): + if is_optional_type(type(i)) and i is None: + return None + if isinstance(i, Unset): + return i + + if not isinstance(i, int): + raise ValueError("Expected int") + + return str(i) if as_str else i + + return serialize + + +def validate_int(b): + if b is None: + return None + + if isinstance(b, (int, Unset)): + return b + + if not isinstance(b, str): + raise ValueError("Expected string") + + return int(b) + + +def validate_open_enum(is_int: bool): + def validate(e): + if e is None: + return None + + if isinstance(e, Unset): + return e + + if is_int: + if not isinstance(e, int): + raise ValueError("Expected int") + else: + if not isinstance(e, str): + raise ValueError("Expected string") + + return e + + return validate + + +def validate_const(v): + def validate(c): + if is_optional_type(type(c)) and c is None: + return None + + if v != c: + raise ValueError(f"Expected {v}") + + return c + + return validate + + +def unmarshal_json(raw, typ: Any) -> Any: + return unmarshal(from_json(raw), typ) + + +def unmarshal(val, typ: Any) -> Any: + unmarshaller = create_model( + "Unmarshaller", + body=(typ, ...), + __config__=ConfigDict(populate_by_name=True, arbitrary_types_allowed=True), + ) + + m = unmarshaller(body=val) + + # pyright: ignore[reportAttributeAccessIssue] + return m.body # type: ignore + + +def marshal_json(val, typ): + if is_nullable(typ) and val is None: + return "null" + + marshaller = create_model( + "Marshaller", + body=(typ, ...), + __config__=ConfigDict(populate_by_name=True, arbitrary_types_allowed=True), + ) + + m = marshaller(body=val) + + d = m.model_dump(by_alias=True, mode="json", exclude_none=True) + + if len(d) == 0: + return "" + + return json.dumps(d[next(iter(d))], separators=(",", ":"), sort_keys=True) + + +def is_nullable(field): + origin = get_origin(field) + if origin is Nullable or origin is OptionalNullable: + return True + + if not origin is Union or type(None) not in get_args(field): + return False + + for arg in get_args(field): + if get_origin(arg) is Nullable or get_origin(arg) is OptionalNullable: + return True + + return False + + +def stream_to_text(stream: httpx.Response) -> str: + return "".join(stream.iter_text()) + + +async def stream_to_text_async(stream: httpx.Response) -> str: + return "".join([chunk async for chunk in stream.aiter_text()]) + + +def stream_to_bytes(stream: httpx.Response) -> bytes: + return stream.content + + +async def stream_to_bytes_async(stream: httpx.Response) -> bytes: + return await stream.aread() + + +def get_pydantic_model(data: Any, typ: Any) -> Any: + if not _contains_pydantic_model(data): + return unmarshal(data, typ) + + return data + + +def _contains_pydantic_model(data: Any) -> bool: + if isinstance(data, BaseModel): + return True + if isinstance(data, List): + return any(_contains_pydantic_model(item) for item in data) + if isinstance(data, Dict): + return any(_contains_pydantic_model(value) for value in data.values()) + + return False diff --git a/sync-for-payables/src/codat_sync_for_payables/utils/url.py b/sync-for-payables/src/codat_sync_for_payables/utils/url.py new file mode 100644 index 000000000..c78ccbae4 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/utils/url.py @@ -0,0 +1,155 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from decimal import Decimal +from typing import ( + Any, + Dict, + get_type_hints, + List, + Optional, + Union, + get_args, + get_origin, +) +from pydantic import BaseModel +from pydantic.fields import FieldInfo + +from .metadata import ( + PathParamMetadata, + find_field_metadata, +) +from .values import ( + _get_serialized_params, + _is_set, + _populate_from_globals, + _val_to_string, +) + + +def generate_url( + server_url: str, + path: str, + path_params: Any, + gbls: Optional[Any] = None, +) -> str: + path_param_values: Dict[str, str] = {} + + globals_already_populated = _populate_path_params( + path_params, gbls, path_param_values, [] + ) + if _is_set(gbls): + _populate_path_params(gbls, None, path_param_values, globals_already_populated) + + for key, value in path_param_values.items(): + path = path.replace("{" + key + "}", value, 1) + + return remove_suffix(server_url, "/") + path + + +def _populate_path_params( + path_params: Any, + gbls: Any, + path_param_values: Dict[str, str], + skip_fields: List[str], +) -> List[str]: + globals_already_populated: List[str] = [] + + if not isinstance(path_params, BaseModel): + return globals_already_populated + + path_param_fields: Dict[str, FieldInfo] = path_params.__class__.model_fields + path_param_field_types = get_type_hints(path_params.__class__) + for name in path_param_fields: + if name in skip_fields: + continue + + field = path_param_fields[name] + + param_metadata = find_field_metadata(field, PathParamMetadata) + if param_metadata is None: + continue + + param = getattr(path_params, name) if _is_set(path_params) else None + param, global_found = _populate_from_globals( + name, param, PathParamMetadata, gbls + ) + if global_found: + globals_already_populated.append(name) + + if not _is_set(param): + continue + + f_name = field.alias if field.alias is not None else name + serialization = param_metadata.serialization + if serialization is not None: + serialized_params = _get_serialized_params( + param_metadata, f_name, param, path_param_field_types[name] + ) + for key, value in serialized_params.items(): + path_param_values[key] = value + else: + pp_vals: List[str] = [] + if param_metadata.style == "simple": + if isinstance(param, List): + for pp_val in param: + if not _is_set(pp_val): + continue + pp_vals.append(_val_to_string(pp_val)) + path_param_values[f_name] = ",".join(pp_vals) + elif isinstance(param, Dict): + for pp_key in param: + if not _is_set(param[pp_key]): + continue + if param_metadata.explode: + pp_vals.append(f"{pp_key}={_val_to_string(param[pp_key])}") + else: + pp_vals.append(f"{pp_key},{_val_to_string(param[pp_key])}") + path_param_values[f_name] = ",".join(pp_vals) + elif not isinstance(param, (str, int, float, complex, bool, Decimal)): + param_fields: Dict[str, FieldInfo] = param.__class__.model_fields + for name in param_fields: + param_field = param_fields[name] + + param_value_metadata = find_field_metadata( + param_field, PathParamMetadata + ) + if param_value_metadata is None: + continue + + param_name = ( + param_field.alias if param_field.alias is not None else name + ) + + param_field_val = getattr(param, name) + if not _is_set(param_field_val): + continue + if param_metadata.explode: + pp_vals.append( + f"{param_name}={_val_to_string(param_field_val)}" + ) + else: + pp_vals.append( + f"{param_name},{_val_to_string(param_field_val)}" + ) + path_param_values[f_name] = ",".join(pp_vals) + elif _is_set(param): + path_param_values[f_name] = _val_to_string(param) + + return globals_already_populated + + +def is_optional(field): + return get_origin(field) is Union and type(None) in get_args(field) + + +def template_url(url_with_params: str, params: Dict[str, str]) -> str: + for key, value in params.items(): + url_with_params = url_with_params.replace("{" + key + "}", value) + + return url_with_params + + +def remove_suffix(input_string, suffix): + if suffix and input_string.endswith(suffix): + return input_string[: -len(suffix)] + return input_string diff --git a/sync-for-payables/src/codat_sync_for_payables/utils/values.py b/sync-for-payables/src/codat_sync_for_payables/utils/values.py new file mode 100644 index 000000000..2b4b68321 --- /dev/null +++ b/sync-for-payables/src/codat_sync_for_payables/utils/values.py @@ -0,0 +1,134 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from datetime import datetime +from enum import Enum +from email.message import Message +import os +from typing import Any, Callable, Dict, List, Optional, Tuple, TypeVar, Union + +from httpx import Response +from pydantic import BaseModel +from pydantic.fields import FieldInfo + +from ..types.basemodel import Unset + +from .serializers import marshal_json + +from .metadata import ParamMetadata, find_field_metadata + + +def match_content_type(content_type: str, pattern: str) -> bool: + if pattern in (content_type, "*", "*/*"): + return True + + msg = Message() + msg["content-type"] = content_type + media_type = msg.get_content_type() + + if media_type == pattern: + return True + + parts = media_type.split("/") + if len(parts) == 2: + if pattern in (f"{parts[0]}/*", f"*/{parts[1]}"): + return True + + return False + + +def match_status_codes(status_codes: List[str], status_code: int) -> bool: + if "default" in status_codes: + return True + + for code in status_codes: + if code == str(status_code): + return True + + if code.endswith("XX") and code.startswith(str(status_code)[:1]): + return True + return False + + +T = TypeVar("T") + + +def get_global_from_env( + value: Optional[T], env_key: str, type_cast: Callable[[str], T] +) -> Optional[T]: + if value is not None: + return value + env_value = os.getenv(env_key) + if env_value is not None: + try: + return type_cast(env_value) + except ValueError: + pass + return None + + +def match_response( + response: Response, code: Union[str, List[str]], content_type: str +) -> bool: + codes = code if isinstance(code, list) else [code] + return match_status_codes(codes, response.status_code) and match_content_type( + response.headers.get("content-type", "application/octet-stream"), content_type + ) + + +def _populate_from_globals( + param_name: str, value: Any, param_metadata_type: type, gbls: Any +) -> Tuple[Any, bool]: + if gbls is None: + return value, False + + if not isinstance(gbls, BaseModel): + raise TypeError("globals must be a pydantic model") + + global_fields: Dict[str, FieldInfo] = gbls.__class__.model_fields + found = False + for name in global_fields: + field = global_fields[name] + if name is not param_name: + continue + + found = True + + if value is not None: + return value, True + + global_value = getattr(gbls, name) + + param_metadata = find_field_metadata(field, param_metadata_type) + if param_metadata is None: + return value, True + + return global_value, True + + return value, found + + +def _val_to_string(val) -> str: + if isinstance(val, bool): + return str(val).lower() + if isinstance(val, datetime): + return str(val.isoformat().replace("+00:00", "Z")) + if isinstance(val, Enum): + return str(val.value) + + return str(val) + + +def _get_serialized_params( + metadata: ParamMetadata, field_name: str, obj: Any, typ: type +) -> Dict[str, str]: + params: Dict[str, str] = {} + + serialization = metadata.serialization + if serialization == "json": + params[field_name] = marshal_json(obj, typ) + + return params + + +def _is_set(value: Any) -> bool: + return value is not None and not isinstance(value, Unset)