From ba0a921201de2eb23d7ad72bc73e99ad732494b2 Mon Sep 17 00:00:00 2001 From: codat-sdk-codegen Date: Fri, 7 Aug 2026 11:55:51 +0000 Subject: [PATCH] bank-feeds: regenerate with the in-house pipeline @ b5f2513, version 12.0.1 -> 12.0.2 --- bank-feeds/RELEASES.md | 12 +- bank-feeds/USAGE.md | 98 +- bank-feeds/docs/models/errors/errormessage.md | 30 +- .../createbankaccountmappingrequest.md | 18 +- .../operations/createbankaccountrequest.md | 20 +- .../createbanktransactionsrequest.md | 24 +- .../operations/createbatchsourceaccount1.md | 23 - .../createbatchsourceaccountrequest.md | 18 +- .../createbatchsourceaccountrequestbody.md | 34 +- .../createbatchsourceaccountresponse.md | 34 +- .../createbatchsourceaccountresponsebody.md | 46 +- ...sourceaccountsourceaccountsresponsebody.md | 13 - .../models/operations/createcompanyrequest.md | 8 + .../operations/createconnectionrequest.md | 16 +- .../operations/createconnectionrequestbody.md | 16 +- .../operations/createsourceaccountrequest.md | 18 +- .../createsourceaccountrequestbody.md | 34 +- .../createsourceaccountresponsebody.md | 38 +- .../deletebankfeedcredentialsrequest.md | 16 +- .../models/operations/deletecompanyrequest.md | 14 +- .../operations/deleteconnectionrequest.md | 16 +- .../operations/deletesourceaccountrequest.md | 18 +- .../operations/generatecredentialsrequest.md | 20 +- .../models/operations/generateotprequest.md | 16 +- .../getbankaccountmappingrequest.md | 16 +- .../getcompanyaccesstokenrequest.md | 14 +- .../getcompanyinformationrequest.md | 16 +- .../models/operations/getcompanyrequest.md | 14 +- .../models/operations/getconnectionrequest.md | 16 +- .../getcreatebankaccountsmodelrequest.md | 16 +- .../getcreatebanktransactionsmodelrequest.md | 18 +- .../operations/getcreateoperationrequest.md | 16 +- .../getlatestmanagedbankfeedsyncrequest.md | 18 +- .../getmanagedbankfeedsyncrequest.md | 20 +- .../operations/listbankaccountsrequest.md | 24 +- .../models/operations/listcompaniesrequest.md | 22 +- .../operations/listconnectionsrequest.md | 22 +- .../operations/listcreateoperationsrequest.md | 22 +- .../operations/listsourceaccountsrequest.md | 16 +- .../listsourceaccountsresponsebody.md | 38 +- bank-feeds/docs/models/operations/one.md | 17 - .../operations/replacecompanyrequest.md | 18 +- .../docs/models/operations/responsebody.md | 34 +- .../runmanagedbankfeedadhocsyncrequest.md | 18 +- .../docs/models/operations/sourceaccount.md | 18 + .../sourceaccountbatchcreateresponse.md | 9 + .../sourceaccountbatcherrorresponse.md | 9 + .../sourceaccountprototype.md} | 54 +- .../docs/models/operations/sourceaccountv2.md | 20 + .../sourceaccountv2batchcreateresponse.md | 9 + .../operations/sourceaccountv2prototype.md | 17 + .../operations/unlinkconnectionrequest.md | 20 +- .../unlinkconnectionupdateconnection.md | 15 +- .../models/operations/updatecompanyrequest.md | 18 +- .../operations/updatesourceaccountrequest.md | 22 +- bank-feeds/docs/models/shared/accesstoken.md | 10 + bank-feeds/docs/models/shared/accountinfo.md | 20 +- .../models/shared/accountingbankaccount.md | 65 +- bank-feeds/docs/models/shared/accounttype.md | 40 +- .../shared/bankaccountcreateresponse.md | 42 +- ...ankaccountcreateresponsebankaccounttype.md | 38 +- .../models/shared/bankaccountcredentials.md | 20 +- .../models/shared/bankaccountprototype.md | 36 +- bank-feeds/docs/models/shared/bankaccounts.md | 24 +- .../shared/bankaccountsbankaccounttype.md | 38 +- .../models/shared/bankaccountsmetadata.md | 8 - .../shared/bankaccountssupplementaldata.md | 12 - .../docs/models/shared/bankaccountstatus.md | 38 +- .../docs/models/shared/bankaccounttype.md | 42 +- .../models/shared/bankfeedaccountmapping.md | 19 +- .../shared/bankfeedaccountmappingresponse.md | 21 +- .../docs/models/shared/bankfeedmapping.md | 37 +- ...banktransactions.md => banktransaction.md} | 32 +- .../docs/models/shared/banktransactiontype.md | 68 +- .../models/shared/clientratelimitwebhook.md | 20 +- .../shared/clientratelimitwebhookpayload.md | 18 +- bank-feeds/docs/models/shared/companies.md | 22 +- bank-feeds/docs/models/shared/company.md | 48 +- .../docs/models/shared/companyaccesstoken.md | 22 +- .../docs/models/shared/companydetails.md | 18 + .../docs/models/shared/companyinformation.md | 26 +- .../docs/models/shared/companyreference.md | 22 +- .../models/shared/companyreferencelinks.md | 18 +- .../docs/models/shared/companyrequestbody.md | 18 +- .../models/shared/companyupdaterequest.md | 18 +- bank-feeds/docs/models/shared/connection.md | 59 +- bank-feeds/docs/models/shared/connections.md | 22 +- .../models/shared/createbanktransactions.md | 18 +- .../shared/createbanktransactionsresponse.md | 40 +- ...reatebatchsourceaccount201responseinner.md | 11 + ...reatebatchsourceaccount207responseinner.md | 12 + .../createbatchsourceaccountrequestbody.md | 11 + .../models/shared/createconnectionrequest.md | 8 + .../shared/createsourceaccount200response.md | 11 + .../shared/createsourceaccountrequest.md | 11 + .../docs/models/shared/dataconnectionerror.md | 24 +- .../models/shared/dataconnectionstatus.md | 40 +- .../docs/models/shared/datasetstatus.md | 38 + bank-feeds/docs/models/shared/datatype.md | 135 +- bank-feeds/docs/models/shared/errormessage.md | 14 + bank-feeds/docs/models/shared/errorstatus.md | 36 +- .../docs/models/shared/errorvalidation.md | 18 +- .../docs/models/shared/errorvalidationitem.md | 18 +- .../docs/models/shared/generateotpresponse.md | 21 +- bank-feeds/docs/models/shared/halref.md | 14 +- bank-feeds/docs/models/shared/items.md | 24 + .../models/shared/itemsbankaccounttype.md | 18 + bank-feeds/docs/models/shared/links.md | 20 +- bank-feeds/docs/models/shared/metadata.md | 14 +- bank-feeds/docs/models/shared/model1.md | 11 + .../docs/models/shared/pulloperation.md | 22 + .../docs/models/shared/pulloperations.md | 12 + .../docs/models/shared/pushchangetype.md | 42 +- .../docs/models/shared/pushfieldvalidation.md | 19 +- .../docs/models/shared/pushoperation.md | 38 +- .../docs/models/shared/pushoperationchange.md | 20 +- .../docs/models/shared/pushoperationref.md | 19 +- .../docs/models/shared/pushoperations.md | 22 +- .../docs/models/shared/pushoperationstatus.md | 40 +- bank-feeds/docs/models/shared/pushoption.md | 26 +- .../docs/models/shared/pushoptionchoice.md | 22 +- .../docs/models/shared/pushoptionproperty.md | 26 +- .../docs/models/shared/pushoptiontype.md | 46 +- .../docs/models/shared/pushvalidationinfo.md | 17 +- bank-feeds/docs/models/shared/routinginfo.md | 22 +- bank-feeds/docs/models/shared/security.md | 16 +- .../docs/models/shared/sourceaccount.md | 37 +- .../sourceaccountbatchcreateresponse.md | 20 +- .../shared/sourceaccountbatchcreateresult.md | 24 +- .../shared/sourceaccountbatcherrorresponse.md | 22 +- ... sourceaccountbatcherrorresponseresult.md} | 16 +- .../models/shared/sourceaccountprototype.md | 30 +- .../docs/models/shared/sourceaccountv2.md | 41 +- .../shared/sourceaccountv2accounttype.md | 42 +- .../sourceaccountv2batchcreateresponse.md | 20 +- .../sourceaccountv2batchcreateresult.md | 24 +- .../models/shared/sourceaccountv2prototype.md | 34 +- .../models/shared/sourceaccountv2status.md | 40 +- .../models/shared/sourceaccountwebhook.md | 20 +- .../shared/sourceaccountwebhookpayload.md | 22 +- ...ourceaccountwebhookpayloadsourceaccount.md | 34 +- bank-feeds/docs/models/shared/sourcetype.md | 46 +- .../models/shared/startscheduledsyncresult.md | 18 +- bank-feeds/docs/models/shared/status.md | 40 +- .../docs/models/shared/supplementaldata.md | 24 +- .../docs/models/shared/syncstatusresult.md | 44 +- .../docs/models/shared/targetaccountoption.md | 22 +- bank-feeds/docs/models/shared/type.md | 56 +- .../docs/models/shared/updateconnection.md | 9 + bank-feeds/docs/models/shared/validation.md | 20 +- .../docs/models/shared/validationitem.md | 19 +- bank-feeds/docs/models/utils/retryconfig.md | 46 +- bank-feeds/docs/sdks/accountmapping/README.md | 338 +-- bank-feeds/docs/sdks/bankaccounts/README.md | 1268 +++++------ bank-feeds/docs/sdks/companies/README.md | 1234 ++++++----- .../docs/sdks/companyinformation/README.md | 130 +- bank-feeds/docs/sdks/connections/README.md | 546 +++-- .../docs/sdks/managedbankfeeds/README.md | 327 ++- bank-feeds/docs/sdks/sourceaccounts/README.md | 980 ++++----- bank-feeds/docs/sdks/transactions/README.md | 909 ++++---- bank-feeds/pyproject.toml | 55 +- bank-feeds/src/codat_bankfeeds/__init__.py | 139 +- .../src/codat_bankfeeds/_hooks/__init__.py | 31 +- .../src/codat_bankfeeds/_hooks/sdkhooks.py | 111 +- .../src/codat_bankfeeds/_hooks/types.py | 68 +- .../src/codat_bankfeeds/_httpx_transport.py | 130 ++ bank-feeds/src/codat_bankfeeds/_version.py | 13 +- .../src/codat_bankfeeds/account_mapping.py | 540 +---- .../src/codat_bankfeeds/api/__init__.py | 12 + .../codat_bankfeeds/api/account_mapping.py | 500 +++++ .../src/codat_bankfeeds/api/bank_accounts.py | 758 +++++++ .../src/codat_bankfeeds/api/companies.py | 1598 ++++++++++++++ .../api/company_information.py | 264 +++ .../src/codat_bankfeeds/api/connections.py | 1183 ++++++++++ .../codat_bankfeeds/api/managed_bank_feeds.py | 721 +++++++ .../codat_bankfeeds/api/source_accounts.py | 1905 +++++++++++++++++ .../src/codat_bankfeeds/api/transactions.py | 987 +++++++++ bank-feeds/src/codat_bankfeeds/api_client.py | 803 +++++++ .../src/codat_bankfeeds/api_response.py | 21 + .../src/codat_bankfeeds/bank_accounts.py | 726 +------ bank-feeds/src/codat_bankfeeds/basesdk.py | 396 ---- bank-feeds/src/codat_bankfeeds/companies.py | 1626 +------------- .../codat_bankfeeds/company_information.py | 252 +-- .../src/codat_bankfeeds/configuration.py | 596 ++++++ bank-feeds/src/codat_bankfeeds/connections.py | 1128 +--------- bank-feeds/src/codat_bankfeeds/exceptions.py | 200 ++ .../src/codat_bankfeeds/managed_bank_feeds.py | 698 +----- .../src/codat_bankfeeds/models/__init__.py | 109 +- .../models/_compat/__init__.py | 3 + .../models/_compat/sourceaccountv2.py | 12 + .../codat_bankfeeds/models/access_token.py | 105 + .../models/accounting_bank_account.py | 175 ++ ...ank_account_create_response_all_of_data.py | 5 + ...count_create_response_bank_account_type.py | 10 + .../models/bank_account_type.py | 10 + .../models/bank_accounts_bank_account_type.py | 10 + .../models/bank_transaction.py | 136 ++ .../models/bank_transaction_type.py | 25 + .../codat_bankfeeds/models/company_details.py | 141 ++ .../models/company_reference_links.py | 99 + ..._batch_source_account201_response_inner.py | 152 ++ ..._batch_source_account207_response_inner.py | 167 ++ ...reate_batch_source_account_request_body.py | 160 ++ .../models/create_connection_request.py | 110 + .../create_source_account200_response.py | 152 ++ .../models/create_source_account_request.py | 152 ++ .../codat_bankfeeds/models/dataset_status.py | 28 + .../codat_bankfeeds/models/error_message.py | 121 ++ .../codat_bankfeeds/models/error_status.py | 9 + .../codat_bankfeeds/models/errors/__init__.py | 35 +- .../models/errors/codatbankfeedserror.py | 74 +- .../models/errors/errormessage.py | 74 +- .../models/errors/no_response_error.py | 11 +- .../models/errors/responsevalidationerror.py | 45 +- .../codat_bankfeeds/models/errors/sdkerror.py | 55 +- .../src/codat_bankfeeds/models/items.py | 169 ++ .../models/items_bank_account_type.py | 10 + .../list_source_accounts200_response.py | 43 + .../src/codat_bankfeeds/models/metadata.py | 104 + .../src/codat_bankfeeds/models/model1.py | 113 + .../models/operations/__init__.py | 414 +--- .../models/operations/create_bank_account.py | 75 +- .../operations/create_bank_account_mapping.py | 61 +- .../operations/create_bank_transactions.py | 95 +- .../operations/create_batch_source_account.py | 133 +- ...reate_batch_source_account_request_body.py | 7 + ..._source_account_request_body_typed_dict.py | 7 + .../create_batch_source_account_response.py | 7 + ...eate_batch_source_account_response_body.py | 8 + ...source_account_response_body_typed_dict.py | 8 + ...atch_source_account_response_typed_dict.py | 7 + .../models/operations/create_connection.py | 81 +- .../operations/create_source_account.py | 97 +- .../create_source_account_request_body.py | 7 + ..._source_account_request_body_typed_dict.py | 7 + .../create_source_account_response_body.py | 7 + ...source_account_response_body_typed_dict.py | 7 + .../delete_bank_feed_credentials.py | 32 +- .../models/operations/delete_company.py | 23 +- .../models/operations/delete_connection.py | 32 +- .../operations/delete_source_account.py | 41 +- .../models/operations/generate_credentials.py | 40 +- .../models/operations/generate_otp.py | 32 +- .../operations/get_bank_account_mapping.py | 32 +- .../models/operations/get_company.py | 23 +- .../operations/get_company_access_token.py | 23 +- .../operations/get_company_information.py | 32 +- .../models/operations/get_connection.py | 32 +- .../get_create_bank_transactions_model.py | 41 +- .../get_create_bankaccounts_model.py | 32 +- .../models/operations/get_create_operation.py | 32 +- .../get_latest_managed_bank_feed_sync.py | 41 +- .../operations/get_managed_bank_feed_sync.py | 50 +- .../models/operations/list_bank_accounts.py | 84 +- .../models/operations/list_companies.py | 74 +- .../models/operations/list_connections.py | 75 +- .../operations/list_create_operations.py | 75 +- .../models/operations/list_source_accounts.py | 57 +- .../list_source_accounts_response_body.py | 7 + ...ource_accounts_response_body_typed_dict.py | 7 + .../models/operations/replace_company.py | 52 +- .../models/operations/response_body.py | 7 + .../operations/response_body_typed_dict.py | 7 + .../run_managed_bank_feed_ad_hoc_sync.py | 41 +- .../models/operations/unlink_connection.py | 87 +- .../models/operations/update_company.py | 52 +- .../operations/update_source_account.py | 66 +- .../codat_bankfeeds/models/pull_operation.py | 140 ++ .../codat_bankfeeds/models/pull_operations.py | 124 ++ .../codat_bankfeeds/models/shared/__init__.py | 843 ++++---- .../models/shared/accountinfo.py | 183 +- .../models/shared/accounttype.py | 16 +- .../shared/bankaccountcreateresponse.py | 705 ++---- .../models/shared/bankaccountcredentials.py | 116 +- .../models/shared/bankaccountprototype.py | 331 ++- .../models/shared/bankaccounts.py | 496 +---- .../models/shared/bankaccountstatus.py | 39 +- .../models/shared/bankfeedaccountmapping.py | 189 +- .../shared/bankfeedaccountmappingresponse.py | 179 +- .../models/shared/bankfeedmapping.py | 311 ++- .../models/shared/banktransactions.py | 177 -- .../models/shared/clientratelimitwebhook.py | 155 +- .../shared/clientratelimitwebhookpayload.py | 143 +- .../models/shared/companies.py | 148 +- .../codat_bankfeeds/models/shared/company.py | 344 ++- .../models/shared/companyaccesstoken.py | 117 +- .../models/shared/companyinformation.py | 179 +- .../models/shared/companyreference.py | 149 +- .../models/shared/companyrequestbody.py | 130 +- .../models/shared/companyupdaterequest.py | 133 +- .../models/shared/connection.py | 368 ++-- .../models/shared/connections.py | 148 +- .../models/shared/createbanktransactions.py | 120 +- .../shared/createbanktransactionsresponse.py | 356 ++- .../models/shared/dataconnectionerror.py | 253 +-- .../models/shared/dataconnectionstatus.py | 39 +- .../codat_bankfeeds/models/shared/datatype.py | 134 +- .../models/shared/errorvalidation.py | 154 +- .../models/shared/errorvalidationitem.py | 156 +- .../models/shared/generateotpresponse.py | 136 +- .../codat_bankfeeds/models/shared/halref.py | 108 +- .../codat_bankfeeds/models/shared/links.py | 137 +- .../models/shared/pushchangetype.py | 40 +- .../models/shared/pushfieldvalidation.py | 163 +- .../models/shared/pushoperation.py | 343 ++- .../models/shared/pushoperationchange.py | 164 +- .../models/shared/pushoperationref.py | 135 +- .../models/shared/pushoperations.py | 148 +- .../models/shared/pushoperationstatus.py | 38 +- .../models/shared/pushoption.py | 202 +- .../models/shared/pushoptionchoice.py | 140 +- .../models/shared/pushoptionproperty.py | 200 +- .../models/shared/pushoptiontype.py | 48 +- .../models/shared/pushvalidationinfo.py | 168 +- .../models/shared/routinginfo.py | 180 +- .../codat_bankfeeds/models/shared/security.py | 24 +- ..._account_webhook_payload_source_account.py | 7 + ...bhook_payload_source_account_typed_dict.py | 7 + .../models/shared/sourceaccount.py | 350 ++- .../sourceaccountbatchcreateresponse.py | 129 +- .../shared/sourceaccountbatchcreateresult.py | 160 +- .../shared/sourceaccountbatcherrorresponse.py | 140 +- .../models/shared/sourceaccountprototype.py | 245 +-- .../models/shared/sourceaccountv2.py | 220 +- .../sourceaccountv2batchcreateresponse.py | 129 +- .../sourceaccountv2batchcreateresult.py | 160 +- .../models/shared/sourceaccountv2prototype.py | 263 +-- .../models/shared/sourceaccountwebhook.py | 155 +- .../shared/sourceaccountwebhookpayload.py | 157 +- .../models/shared/startscheduledsyncresult.py | 105 +- .../models/shared/syncstatusresult.py | 239 ++- .../models/shared/targetaccountoption.py | 187 +- .../models/shared/validation.py | 154 +- .../models/shared/validationitem.py | 170 +- ...rce_account_batch_error_response_result.py | 102 + .../models/source_account_v2.py | 181 ++ .../models/source_account_v2_status.py | 12 + .../src/codat_bankfeeds/models/source_type.py | 14 + .../src/codat_bankfeeds/models/status.py | 12 + .../models/supplemental_data.py | 104 + bank-feeds/src/codat_bankfeeds/models/type.py | 20 + .../models/update_connection.py | 114 + bank-feeds/src/codat_bankfeeds/py.typed | 1 - bank-feeds/src/codat_bankfeeds/rest.py | 258 +++ bank-feeds/src/codat_bankfeeds/sdk.py | 323 ++- .../src/codat_bankfeeds/sdkconfiguration.py | 49 - .../src/codat_bankfeeds/source_accounts.py | 1899 +--------------- .../src/codat_bankfeeds/transactions.py | 946 +------- .../src/codat_bankfeeds/types/__init__.py | 73 +- .../src/codat_bankfeeds/types/basemodel.py | 77 - .../src/codat_bankfeeds/utils/__init__.py | 176 +- .../src/codat_bankfeeds/utils/annotations.py | 79 - .../src/codat_bankfeeds/utils/datetimes.py | 23 - .../codat_bankfeeds/utils/dynamic_imports.py | 54 - bank-feeds/src/codat_bankfeeds/utils/enums.py | 134 -- .../codat_bankfeeds/utils/eventstreaming.py | 309 --- bank-feeds/src/codat_bankfeeds/utils/forms.py | 234 -- .../src/codat_bankfeeds/utils/headers.py | 136 -- .../src/codat_bankfeeds/utils/logger.py | 22 - .../src/codat_bankfeeds/utils/metadata.py | 119 - .../src/codat_bankfeeds/utils/queryparams.py | 217 -- .../codat_bankfeeds/utils/requestbodies.py | 66 - .../src/codat_bankfeeds/utils/retries.py | 343 ++- .../src/codat_bankfeeds/utils/security.py | 198 -- .../src/codat_bankfeeds/utils/serializers.py | 205 +- .../utils/unmarshal_json_response.py | 38 - bank-feeds/src/codat_bankfeeds/utils/url.py | 155 -- .../src/codat_bankfeeds/utils/values.py | 137 -- 368 files changed, 25376 insertions(+), 23847 deletions(-) delete mode 100644 bank-feeds/docs/models/operations/createbatchsourceaccount1.md delete mode 100644 bank-feeds/docs/models/operations/createbatchsourceaccountsourceaccountsresponsebody.md create mode 100644 bank-feeds/docs/models/operations/createcompanyrequest.md delete mode 100644 bank-feeds/docs/models/operations/one.md create mode 100644 bank-feeds/docs/models/operations/sourceaccount.md create mode 100644 bank-feeds/docs/models/operations/sourceaccountbatchcreateresponse.md create mode 100644 bank-feeds/docs/models/operations/sourceaccountbatcherrorresponse.md rename bank-feeds/docs/models/{shared/bankaccountsaccountingbankaccount.md => operations/sourceaccountprototype.md} (75%) create mode 100644 bank-feeds/docs/models/operations/sourceaccountv2.md create mode 100644 bank-feeds/docs/models/operations/sourceaccountv2batchcreateresponse.md create mode 100644 bank-feeds/docs/models/operations/sourceaccountv2prototype.md create mode 100644 bank-feeds/docs/models/shared/accesstoken.md delete mode 100644 bank-feeds/docs/models/shared/bankaccountsmetadata.md delete mode 100644 bank-feeds/docs/models/shared/bankaccountssupplementaldata.md rename bank-feeds/docs/models/shared/{banktransactions.md => banktransaction.md} (98%) create mode 100644 bank-feeds/docs/models/shared/companydetails.md create mode 100644 bank-feeds/docs/models/shared/createbatchsourceaccount201responseinner.md create mode 100644 bank-feeds/docs/models/shared/createbatchsourceaccount207responseinner.md create mode 100644 bank-feeds/docs/models/shared/createbatchsourceaccountrequestbody.md create mode 100644 bank-feeds/docs/models/shared/createconnectionrequest.md create mode 100644 bank-feeds/docs/models/shared/createsourceaccount200response.md create mode 100644 bank-feeds/docs/models/shared/createsourceaccountrequest.md create mode 100644 bank-feeds/docs/models/shared/datasetstatus.md create mode 100644 bank-feeds/docs/models/shared/errormessage.md create mode 100644 bank-feeds/docs/models/shared/items.md create mode 100644 bank-feeds/docs/models/shared/itemsbankaccounttype.md create mode 100644 bank-feeds/docs/models/shared/model1.md create mode 100644 bank-feeds/docs/models/shared/pulloperation.md create mode 100644 bank-feeds/docs/models/shared/pulloperations.md rename bank-feeds/docs/models/shared/{result.md => sourceaccountbatcherrorresponseresult.md} (96%) create mode 100644 bank-feeds/docs/models/shared/updateconnection.md create mode 100644 bank-feeds/src/codat_bankfeeds/_httpx_transport.py create mode 100644 bank-feeds/src/codat_bankfeeds/api/__init__.py create mode 100644 bank-feeds/src/codat_bankfeeds/api/account_mapping.py create mode 100644 bank-feeds/src/codat_bankfeeds/api/bank_accounts.py create mode 100644 bank-feeds/src/codat_bankfeeds/api/companies.py create mode 100644 bank-feeds/src/codat_bankfeeds/api/company_information.py create mode 100644 bank-feeds/src/codat_bankfeeds/api/connections.py create mode 100644 bank-feeds/src/codat_bankfeeds/api/managed_bank_feeds.py create mode 100644 bank-feeds/src/codat_bankfeeds/api/source_accounts.py create mode 100644 bank-feeds/src/codat_bankfeeds/api/transactions.py create mode 100644 bank-feeds/src/codat_bankfeeds/api_client.py create mode 100644 bank-feeds/src/codat_bankfeeds/api_response.py delete mode 100644 bank-feeds/src/codat_bankfeeds/basesdk.py create mode 100644 bank-feeds/src/codat_bankfeeds/configuration.py create mode 100644 bank-feeds/src/codat_bankfeeds/exceptions.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/_compat/__init__.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/_compat/sourceaccountv2.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/access_token.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/accounting_bank_account.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/bank_account_create_response_all_of_data.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/bank_account_create_response_bank_account_type.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/bank_account_type.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/bank_accounts_bank_account_type.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/bank_transaction.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/bank_transaction_type.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/company_details.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/company_reference_links.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/create_batch_source_account201_response_inner.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/create_batch_source_account207_response_inner.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/create_batch_source_account_request_body.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/create_connection_request.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/create_source_account200_response.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/create_source_account_request.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/dataset_status.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/error_message.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/error_status.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/items.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/items_bank_account_type.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/list_source_accounts200_response.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/metadata.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/model1.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/operations/create_batch_source_account_request_body.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/operations/create_batch_source_account_request_body_typed_dict.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/operations/create_batch_source_account_response.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/operations/create_batch_source_account_response_body.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/operations/create_batch_source_account_response_body_typed_dict.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/operations/create_batch_source_account_response_typed_dict.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/operations/create_source_account_request_body.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/operations/create_source_account_request_body_typed_dict.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/operations/create_source_account_response_body.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/operations/create_source_account_response_body_typed_dict.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/operations/list_source_accounts_response_body.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/operations/list_source_accounts_response_body_typed_dict.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/operations/response_body.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/operations/response_body_typed_dict.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/pull_operation.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/pull_operations.py delete mode 100644 bank-feeds/src/codat_bankfeeds/models/shared/banktransactions.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/shared/source_account_webhook_payload_source_account.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/shared/source_account_webhook_payload_source_account_typed_dict.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/source_account_batch_error_response_result.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/source_account_v2.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/source_account_v2_status.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/source_type.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/status.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/supplemental_data.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/type.py create mode 100644 bank-feeds/src/codat_bankfeeds/models/update_connection.py create mode 100644 bank-feeds/src/codat_bankfeeds/rest.py delete mode 100644 bank-feeds/src/codat_bankfeeds/sdkconfiguration.py delete mode 100644 bank-feeds/src/codat_bankfeeds/types/basemodel.py delete mode 100644 bank-feeds/src/codat_bankfeeds/utils/annotations.py delete mode 100644 bank-feeds/src/codat_bankfeeds/utils/datetimes.py delete mode 100644 bank-feeds/src/codat_bankfeeds/utils/dynamic_imports.py delete mode 100644 bank-feeds/src/codat_bankfeeds/utils/enums.py delete mode 100644 bank-feeds/src/codat_bankfeeds/utils/eventstreaming.py delete mode 100644 bank-feeds/src/codat_bankfeeds/utils/forms.py delete mode 100644 bank-feeds/src/codat_bankfeeds/utils/headers.py delete mode 100644 bank-feeds/src/codat_bankfeeds/utils/logger.py delete mode 100644 bank-feeds/src/codat_bankfeeds/utils/metadata.py delete mode 100644 bank-feeds/src/codat_bankfeeds/utils/queryparams.py delete mode 100644 bank-feeds/src/codat_bankfeeds/utils/requestbodies.py delete mode 100644 bank-feeds/src/codat_bankfeeds/utils/security.py delete mode 100644 bank-feeds/src/codat_bankfeeds/utils/unmarshal_json_response.py delete mode 100644 bank-feeds/src/codat_bankfeeds/utils/url.py delete mode 100644 bank-feeds/src/codat_bankfeeds/utils/values.py diff --git a/bank-feeds/RELEASES.md b/bank-feeds/RELEASES.md index 5e8724610..72df43083 100644 --- a/bank-feeds/RELEASES.md +++ b/bank-feeds/RELEASES.md @@ -918,4 +918,14 @@ Based on: ### Generated - [python v12.0.1] bank-feeds ### Releases -- [PyPI v12.0.1] https://pypi.org/project/codat-bankfeeds/12.0.1 - bank-feeds \ No newline at end of file +- [PyPI v12.0.1] https://pypi.org/project/codat-bankfeeds/12.0.1 - bank-feeds + +## 2026-08-07 11:55:50 +### Changes +Based on: +- OpenAPI Doc 3.0.0 https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Bank-Feeds.yaml +- codat sdk-codegen b5f25135143b1ccfb99c941df11a7a1596dbe31e https://github.com/codat-spikes/sdk-codegen +### Generated +- [python v12.0.2] bank-feeds +### Releases +- [PyPI v12.0.2] https://pypi.org/project/codat-bankfeeds/12.0.2 - bank-feeds diff --git a/bank-feeds/USAGE.md b/bank-feeds/USAGE.md index 84aec15dc..33d935d5f 100644 --- a/bank-feeds/USAGE.md +++ b/bank-feeds/USAGE.md @@ -1,49 +1,51 @@ - -```python -# Synchronous Example -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.companies.create(request={ - "name": "Technicalium", - }) - - # Handle response - print(res) -``` - -
- -The same SDK client can also be used to make asynchronous requests by importing asyncio. - -```python -# Asynchronous Example -import asyncio -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - -async def main(): - - async with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), - ) as codat_bank_feeds: - - res = await codat_bank_feeds.companies.create_async(request={ - "name": "Technicalium", - }) - - # Handle response - print(res) - -asyncio.run(main()) -``` + +```python +# Synchronous Example +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.companies.create(request={ + "description": "Requested early access to the new financing scheme.", + "name": "Bank of Dave", + }) + + # Handle response + print(res) +``` + +
+ +The same SDK client can also be used to make asynchronous requests by importing asyncio. + +```python +# Asynchronous Example +import asyncio +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + +async def main(): + + async with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), + ) as codat_bank_feeds: + + res = await codat_bank_feeds.companies.create_async(request={ + "description": "Requested early access to the new financing scheme.", + "name": "Bank of Dave", + }) + + # Handle response + print(res) + +asyncio.run(main()) +``` \ No newline at end of file diff --git a/bank-feeds/docs/models/errors/errormessage.md b/bank-feeds/docs/models/errors/errormessage.md index c24cd9acc..425e22bbf 100644 --- a/bank-feeds/docs/models/errors/errormessage.md +++ b/bank-feeds/docs/models/errors/errormessage.md @@ -1,16 +1,14 @@ -# ErrorMessage - -Your `query` parameter was not correctly formed - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `can_be_retried` | *Optional[str]* | :heavy_minus_sign: | `True` if the error occurred transiently and can be retried. | -| `correlation_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier used to propagate to all downstream services and determine the source of the error. | -| `detailed_error_code` | *Optional[int]* | :heavy_minus_sign: | Machine readable error code used to automate processes based on the code returned. | -| `error` | *Optional[str]* | :heavy_minus_sign: | A brief description of the error. | -| `service` | *Optional[str]* | :heavy_minus_sign: | Codat's service the returned the error. | -| `status_code` | *Optional[int]* | :heavy_minus_sign: | The HTTP status code returned by 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. | \ No newline at end of file +# ErrorMessage + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `can_be_retried` | *Optional[str]* | :heavy_minus_sign: | `True` if the error occurred transiently and can be retried. | +| `correlation_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier used to propagate to all downstream services and determine the source of the error. | +| `detailed_error_code` | *Optional[int]* | :heavy_minus_sign: | Machine readable error code used to automate processes based on the code returned. | +| `error` | *Optional[str]* | :heavy_minus_sign: | A brief description of the error. | +| `service` | *Optional[str]* | :heavy_minus_sign: | Codat's service the returned the error. | +| `status_code` | *Optional[int]* | :heavy_minus_sign: | The HTTP status code returned by the error. | +| `validation` | [Optional[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. | \ No newline at end of file diff --git a/bank-feeds/docs/models/operations/createbankaccountmappingrequest.md b/bank-feeds/docs/models/operations/createbankaccountmappingrequest.md index 38b305691..6e2490b75 100644 --- a/bank-feeds/docs/models/operations/createbankaccountmappingrequest.md +++ b/bank-feeds/docs/models/operations/createbankaccountmappingrequest.md @@ -1,10 +1,10 @@ -# CreateBankAccountMappingRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `bank_feed_account_mapping` | [Optional[shared.BankFeedAccountMapping]](../../models/shared/bankfeedaccountmapping.md) | :heavy_minus_sign: | N/A | {
"sourceAccountId": "acc-002",
"targetAccountId": "account-081"
} | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# CreateBankAccountMappingRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `bank_feed_account_mapping` | [Optional[shared.BankFeedAccountMapping]](../../models/shared/bankfeedaccountmapping.md) | :heavy_minus_sign: | N/A | | +| `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/bank-feeds/docs/models/operations/createbankaccountrequest.md b/bank-feeds/docs/models/operations/createbankaccountrequest.md index c7324959e..41ba02c46 100644 --- a/bank-feeds/docs/models/operations/createbankaccountrequest.md +++ b/bank-feeds/docs/models/operations/createbankaccountrequest.md @@ -1,11 +1,11 @@ -# CreateBankAccountRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `bank_account_prototype` | [Optional[shared.BankAccountPrototype]](../../models/shared/bankaccountprototype.md) | :heavy_minus_sign: | N/A | | -| `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 | +# CreateBankAccountRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `bank_account_prototype` | [Optional[shared.BankAccountPrototype]](../../models/shared/bankaccountprototype.md) | :heavy_minus_sign: | N/A | | +| `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 | | `timeout_in_minutes` | *Optional[int]* | :heavy_minus_sign: | Time limit for the push operation to complete before it is timed out. | | \ No newline at end of file diff --git a/bank-feeds/docs/models/operations/createbanktransactionsrequest.md b/bank-feeds/docs/models/operations/createbanktransactionsrequest.md index 9336e67bd..f8e26e26c 100644 --- a/bank-feeds/docs/models/operations/createbanktransactionsrequest.md +++ b/bank-feeds/docs/models/operations/createbanktransactionsrequest.md @@ -1,13 +1,13 @@ -# CreateBankTransactionsRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `create_bank_transactions` | [Optional[shared.CreateBankTransactions]](../../models/shared/createbanktransactions.md) | :heavy_minus_sign: | N/A | | -| `account_id` | *str* | :heavy_check_mark: | Unique identifier for an account. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | -| `allow_sync_on_push_complete` | *Optional[bool]* | :heavy_minus_sign: | Allow a sync upon push completion. | | -| `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 | +# CreateBankTransactionsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_id` | *str* | :heavy_check_mark: | Unique identifier for an account. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | +| `allow_sync_on_push_complete` | *Optional[bool]* | :heavy_minus_sign: | Allow a sync upon push completion. | | +| `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 | +| `create_bank_transactions` | [Optional[shared.CreateBankTransactions]](../../models/shared/createbanktransactions.md) | :heavy_minus_sign: | N/A | | | `timeout_in_minutes` | *Optional[int]* | :heavy_minus_sign: | Time limit for the push operation to complete before it is timed out. | | \ No newline at end of file diff --git a/bank-feeds/docs/models/operations/createbatchsourceaccount1.md b/bank-feeds/docs/models/operations/createbatchsourceaccount1.md deleted file mode 100644 index e4089ed93..000000000 --- a/bank-feeds/docs/models/operations/createbatchsourceaccount1.md +++ /dev/null @@ -1,23 +0,0 @@ -# CreateBatchSourceAccount1 - - -## Supported Types - -### `shared.SourceAccountV2BatchCreateResponse` - -```python -value: shared.SourceAccountV2BatchCreateResponse = /* values here */ -``` - -### `shared.SourceAccountBatchCreateResponse` - -```python -value: shared.SourceAccountBatchCreateResponse = /* values here */ -``` - -### `shared.SourceAccountBatchErrorResponse` - -```python -value: shared.SourceAccountBatchErrorResponse = /* values here */ -``` - diff --git a/bank-feeds/docs/models/operations/createbatchsourceaccountrequest.md b/bank-feeds/docs/models/operations/createbatchsourceaccountrequest.md index 89c125888..9c4317ee9 100644 --- a/bank-feeds/docs/models/operations/createbatchsourceaccountrequest.md +++ b/bank-feeds/docs/models/operations/createbatchsourceaccountrequest.md @@ -1,10 +1,10 @@ -# CreateBatchSourceAccountRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -| `request_body` | [Optional[operations.CreateBatchSourceAccountRequestBody]](../../models/operations/createbatchsourceaccountrequestbody.md) | :heavy_minus_sign: | N/A | | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# CreateBatchSourceAccountRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| `request_body` | [Optional[operations.CreateBatchSourceAccountRequestBody]](../../models/operations/createbatchsourceaccountrequestbody.md) | :heavy_minus_sign: | N/A | | +| `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/bank-feeds/docs/models/operations/createbatchsourceaccountrequestbody.md b/bank-feeds/docs/models/operations/createbatchsourceaccountrequestbody.md index b262fe4a7..34d8b6ac2 100644 --- a/bank-feeds/docs/models/operations/createbatchsourceaccountrequestbody.md +++ b/bank-feeds/docs/models/operations/createbatchsourceaccountrequestbody.md @@ -1,17 +1,17 @@ -# CreateBatchSourceAccountRequestBody - - -## Supported Types - -### `List[shared.SourceAccountV2Prototype]` - -```python -value: List[shared.SourceAccountV2Prototype] = /* values here */ -``` - -### `List[shared.SourceAccountPrototype]` - -```python -value: List[shared.SourceAccountPrototype] = /* values here */ -``` - +# CreateBatchSourceAccountRequestBody + + +## Supported Types + +### `List[shared.SourceAccountV2Prototype]` + +```python +value: List[shared.SourceAccountV2Prototype] = /* values here */ +``` + +### `List[shared.SourceAccountPrototype]` + +```python +value: List[shared.SourceAccountPrototype] = /* values here */ +``` + diff --git a/bank-feeds/docs/models/operations/createbatchsourceaccountresponse.md b/bank-feeds/docs/models/operations/createbatchsourceaccountresponse.md index a63e6176a..06bf9bb2b 100644 --- a/bank-feeds/docs/models/operations/createbatchsourceaccountresponse.md +++ b/bank-feeds/docs/models/operations/createbatchsourceaccountresponse.md @@ -1,17 +1,17 @@ -# CreateBatchSourceAccountResponse - - -## Supported Types - -### `List[operations.ResponseBody]` - -```python -value: List[operations.ResponseBody] = /* values here */ -``` - -### `List[operations.CreateBatchSourceAccountResponseBody]` - -```python -value: List[operations.CreateBatchSourceAccountResponseBody] = /* values here */ -``` - +# CreateBatchSourceAccountResponse + + +## Supported Types + +### `List[operations.ResponseBody]` + +```python +value: List[operations.ResponseBody] = /* values here */ +``` + +### `List[operations.CreateBatchSourceAccountResponseBody]` + +```python +value: List[operations.CreateBatchSourceAccountResponseBody] = /* values here */ +``` + diff --git a/bank-feeds/docs/models/operations/createbatchsourceaccountresponsebody.md b/bank-feeds/docs/models/operations/createbatchsourceaccountresponsebody.md index b7660d7fc..06e9cd4d0 100644 --- a/bank-feeds/docs/models/operations/createbatchsourceaccountresponsebody.md +++ b/bank-feeds/docs/models/operations/createbatchsourceaccountresponsebody.md @@ -1,23 +1,23 @@ -# CreateBatchSourceAccountResponseBody - - -## Supported Types - -### `shared.SourceAccountV2BatchCreateResponse` - -```python -value: shared.SourceAccountV2BatchCreateResponse = /* values here */ -``` - -### `shared.SourceAccountBatchCreateResponse` - -```python -value: shared.SourceAccountBatchCreateResponse = /* values here */ -``` - -### `shared.SourceAccountBatchErrorResponse` - -```python -value: shared.SourceAccountBatchErrorResponse = /* values here */ -``` - +# CreateBatchSourceAccountResponseBody + + +## Supported Types + +### `shared.SourceAccountV2BatchCreateResponse` + +```python +value: shared.SourceAccountV2BatchCreateResponse = /* values here */ +``` + +### `shared.SourceAccountBatchCreateResponse` + +```python +value: shared.SourceAccountBatchCreateResponse = /* values here */ +``` + +### `shared.SourceAccountBatchErrorResponse` + +```python +value: shared.SourceAccountBatchErrorResponse = /* values here */ +``` + diff --git a/bank-feeds/docs/models/operations/createbatchsourceaccountsourceaccountsresponsebody.md b/bank-feeds/docs/models/operations/createbatchsourceaccountsourceaccountsresponsebody.md deleted file mode 100644 index f6f205ca0..000000000 --- a/bank-feeds/docs/models/operations/createbatchsourceaccountsourceaccountsresponsebody.md +++ /dev/null @@ -1,13 +0,0 @@ -# CreateBatchSourceAccountSourceAccountsResponseBody - -Multi-Status - - -## Supported Types - -### `List[operations.CreateBatchSourceAccount1]` - -```python -value: List[operations.CreateBatchSourceAccount1] = /* values here */ -``` - diff --git a/bank-feeds/docs/models/operations/createcompanyrequest.md b/bank-feeds/docs/models/operations/createcompanyrequest.md new file mode 100644 index 000000000..ebd7ca0a0 --- /dev/null +++ b/bank-feeds/docs/models/operations/createcompanyrequest.md @@ -0,0 +1,8 @@ +# CreateCompanyRequest + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `company_request_body` | [Optional[shared.CompanyRequestBody]](../../models/shared/companyrequestbody.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/bank-feeds/docs/models/operations/createconnectionrequest.md b/bank-feeds/docs/models/operations/createconnectionrequest.md index 0998495bf..32316fd7b 100644 --- a/bank-feeds/docs/models/operations/createconnectionrequest.md +++ b/bank-feeds/docs/models/operations/createconnectionrequest.md @@ -1,9 +1,9 @@ -# CreateConnectionRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| `request_body` | [Optional[operations.CreateConnectionRequestBody]](../../models/operations/createconnectionrequestbody.md) | :heavy_minus_sign: | N/A | | +# CreateConnectionRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | +| `request_body` | [Optional[operations.CreateConnectionRequestBody]](../../models/operations/createconnectionrequestbody.md) | :heavy_minus_sign: | N/A | | | `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/bank-feeds/docs/models/operations/createconnectionrequestbody.md b/bank-feeds/docs/models/operations/createconnectionrequestbody.md index 891314d08..5a6200d18 100644 --- a/bank-feeds/docs/models/operations/createconnectionrequestbody.md +++ b/bank-feeds/docs/models/operations/createconnectionrequestbody.md @@ -1,8 +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 +# CreateConnectionRequestBody + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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. | \ No newline at end of file diff --git a/bank-feeds/docs/models/operations/createsourceaccountrequest.md b/bank-feeds/docs/models/operations/createsourceaccountrequest.md index dfc128841..7a6459cd5 100644 --- a/bank-feeds/docs/models/operations/createsourceaccountrequest.md +++ b/bank-feeds/docs/models/operations/createsourceaccountrequest.md @@ -1,10 +1,10 @@ -# CreateSourceAccountRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | -| `request_body` | [Optional[operations.CreateSourceAccountRequestBody]](../../models/operations/createsourceaccountrequestbody.md) | :heavy_minus_sign: | N/A | | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# CreateSourceAccountRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | +| `request_body` | [Optional[operations.CreateSourceAccountRequestBody]](../../models/operations/createsourceaccountrequestbody.md) | :heavy_minus_sign: | N/A | | +| `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/bank-feeds/docs/models/operations/createsourceaccountrequestbody.md b/bank-feeds/docs/models/operations/createsourceaccountrequestbody.md index 12a62d529..8cd37465b 100644 --- a/bank-feeds/docs/models/operations/createsourceaccountrequestbody.md +++ b/bank-feeds/docs/models/operations/createsourceaccountrequestbody.md @@ -1,17 +1,17 @@ -# CreateSourceAccountRequestBody - - -## Supported Types - -### `shared.SourceAccountV2Prototype` - -```python -value: shared.SourceAccountV2Prototype = /* values here */ -``` - -### `shared.SourceAccountPrototype` - -```python -value: shared.SourceAccountPrototype = /* values here */ -``` - +# CreateSourceAccountRequestBody + + +## Supported Types + +### `shared.SourceAccountV2Prototype` + +```python +value: shared.SourceAccountV2Prototype = /* values here */ +``` + +### `shared.SourceAccountPrototype` + +```python +value: shared.SourceAccountPrototype = /* values here */ +``` + diff --git a/bank-feeds/docs/models/operations/createsourceaccountresponsebody.md b/bank-feeds/docs/models/operations/createsourceaccountresponsebody.md index 28e4dd0dd..90aa56db4 100644 --- a/bank-feeds/docs/models/operations/createsourceaccountresponsebody.md +++ b/bank-feeds/docs/models/operations/createsourceaccountresponsebody.md @@ -1,19 +1,19 @@ -# CreateSourceAccountResponseBody - -Success - - -## Supported Types - -### `shared.SourceAccountV2` - -```python -value: shared.SourceAccountV2 = /* values here */ -``` - -### `shared.SourceAccount` - -```python -value: shared.SourceAccount = /* values here */ -``` - +# CreateSourceAccountResponseBody + +Success + + +## Supported Types + +### `shared.SourceAccountV2` + +```python +value: shared.SourceAccountV2 = /* values here */ +``` + +### `shared.SourceAccount` + +```python +value: shared.SourceAccount = /* values here */ +``` + diff --git a/bank-feeds/docs/models/operations/deletebankfeedcredentialsrequest.md b/bank-feeds/docs/models/operations/deletebankfeedcredentialsrequest.md index 504ac9a26..708229d60 100644 --- a/bank-feeds/docs/models/operations/deletebankfeedcredentialsrequest.md +++ b/bank-feeds/docs/models/operations/deletebankfeedcredentialsrequest.md @@ -1,9 +1,9 @@ -# DeleteBankFeedCredentialsRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# DeleteBankFeedCredentialsRequest + + +## 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/bank-feeds/docs/models/operations/deletecompanyrequest.md b/bank-feeds/docs/models/operations/deletecompanyrequest.md index 338ee40e5..6f16204ca 100644 --- a/bank-feeds/docs/models/operations/deletecompanyrequest.md +++ b/bank-feeds/docs/models/operations/deletecompanyrequest.md @@ -1,8 +1,8 @@ -# DeleteCompanyRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +# 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/bank-feeds/docs/models/operations/deleteconnectionrequest.md b/bank-feeds/docs/models/operations/deleteconnectionrequest.md index 9650dc387..f4b0d4cb4 100644 --- a/bank-feeds/docs/models/operations/deleteconnectionrequest.md +++ b/bank-feeds/docs/models/operations/deleteconnectionrequest.md @@ -1,9 +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 | +# 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/bank-feeds/docs/models/operations/deletesourceaccountrequest.md b/bank-feeds/docs/models/operations/deletesourceaccountrequest.md index 2c44c0519..f7a548140 100644 --- a/bank-feeds/docs/models/operations/deletesourceaccountrequest.md +++ b/bank-feeds/docs/models/operations/deletesourceaccountrequest.md @@ -1,10 +1,10 @@ -# DeleteSourceAccountRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_id` | *str* | :heavy_check_mark: | Unique identifier for an account. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# DeleteSourceAccountRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_id` | *str* | :heavy_check_mark: | Unique identifier for an account. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | +| `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/bank-feeds/docs/models/operations/generatecredentialsrequest.md b/bank-feeds/docs/models/operations/generatecredentialsrequest.md index 822a2e604..790801074 100644 --- a/bank-feeds/docs/models/operations/generatecredentialsrequest.md +++ b/bank-feeds/docs/models/operations/generatecredentialsrequest.md @@ -1,10 +1,10 @@ -# GenerateCredentialsRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -| `request_body` | *Union[bytes, IO[bytes], io.BufferedReader]* | :heavy_check_mark: | N/A | | -| `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 +# GenerateCredentialsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | -------------------------------------- | -------------------------------------- | +| `request_body` | *Union[bytes, str, Tuple[str, bytes]]* | :heavy_check_mark: | N/A | | +| `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/bank-feeds/docs/models/operations/generateotprequest.md b/bank-feeds/docs/models/operations/generateotprequest.md index 319844bc0..396885c9e 100644 --- a/bank-feeds/docs/models/operations/generateotprequest.md +++ b/bank-feeds/docs/models/operations/generateotprequest.md @@ -1,9 +1,9 @@ -# GenerateOtpRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# GenerateOtpRequest + + +## 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/bank-feeds/docs/models/operations/getbankaccountmappingrequest.md b/bank-feeds/docs/models/operations/getbankaccountmappingrequest.md index 236504a59..929c4fca4 100644 --- a/bank-feeds/docs/models/operations/getbankaccountmappingrequest.md +++ b/bank-feeds/docs/models/operations/getbankaccountmappingrequest.md @@ -1,9 +1,9 @@ -# GetBankAccountMappingRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# GetBankAccountMappingRequest + + +## 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/bank-feeds/docs/models/operations/getcompanyaccesstokenrequest.md b/bank-feeds/docs/models/operations/getcompanyaccesstokenrequest.md index 255289cd1..7d5ca4902 100644 --- a/bank-feeds/docs/models/operations/getcompanyaccesstokenrequest.md +++ b/bank-feeds/docs/models/operations/getcompanyaccesstokenrequest.md @@ -1,8 +1,8 @@ -# GetCompanyAccessTokenRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +# GetCompanyAccessTokenRequest + + +## 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/bank-feeds/docs/models/operations/getcompanyinformationrequest.md b/bank-feeds/docs/models/operations/getcompanyinformationrequest.md index 657eb5cde..850e223d8 100644 --- a/bank-feeds/docs/models/operations/getcompanyinformationrequest.md +++ b/bank-feeds/docs/models/operations/getcompanyinformationrequest.md @@ -1,9 +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 | +# 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/bank-feeds/docs/models/operations/getcompanyrequest.md b/bank-feeds/docs/models/operations/getcompanyrequest.md index 240b811b6..295378c0b 100644 --- a/bank-feeds/docs/models/operations/getcompanyrequest.md +++ b/bank-feeds/docs/models/operations/getcompanyrequest.md @@ -1,8 +1,8 @@ -# GetCompanyRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +# 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/bank-feeds/docs/models/operations/getconnectionrequest.md b/bank-feeds/docs/models/operations/getconnectionrequest.md index 6e9f3d18b..61c906783 100644 --- a/bank-feeds/docs/models/operations/getconnectionrequest.md +++ b/bank-feeds/docs/models/operations/getconnectionrequest.md @@ -1,9 +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 | +# 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/bank-feeds/docs/models/operations/getcreatebankaccountsmodelrequest.md b/bank-feeds/docs/models/operations/getcreatebankaccountsmodelrequest.md index a45e1bb79..ad90536da 100644 --- a/bank-feeds/docs/models/operations/getcreatebankaccountsmodelrequest.md +++ b/bank-feeds/docs/models/operations/getcreatebankaccountsmodelrequest.md @@ -1,9 +1,9 @@ -# GetCreateBankAccountsModelRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# GetCreateBankAccountsModelRequest + + +## 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/bank-feeds/docs/models/operations/getcreatebanktransactionsmodelrequest.md b/bank-feeds/docs/models/operations/getcreatebanktransactionsmodelrequest.md index d6c379573..5e482bcd8 100644 --- a/bank-feeds/docs/models/operations/getcreatebanktransactionsmodelrequest.md +++ b/bank-feeds/docs/models/operations/getcreatebanktransactionsmodelrequest.md @@ -1,10 +1,10 @@ -# GetCreateBankTransactionsModelRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_id` | *str* | :heavy_check_mark: | Unique identifier for an account. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# GetCreateBankTransactionsModelRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_id` | *str* | :heavy_check_mark: | Unique identifier for an account. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | +| `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/bank-feeds/docs/models/operations/getcreateoperationrequest.md b/bank-feeds/docs/models/operations/getcreateoperationrequest.md index 82b4db6ad..294511482 100644 --- a/bank-feeds/docs/models/operations/getcreateoperationrequest.md +++ b/bank-feeds/docs/models/operations/getcreateoperationrequest.md @@ -1,9 +1,9 @@ -# GetCreateOperationRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# GetCreateOperationRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | | `push_operation_key` | *str* | :heavy_check_mark: | Push operation key. | | \ No newline at end of file diff --git a/bank-feeds/docs/models/operations/getlatestmanagedbankfeedsyncrequest.md b/bank-feeds/docs/models/operations/getlatestmanagedbankfeedsyncrequest.md index e225bf24b..5e9937e4a 100644 --- a/bank-feeds/docs/models/operations/getlatestmanagedbankfeedsyncrequest.md +++ b/bank-feeds/docs/models/operations/getlatestmanagedbankfeedsyncrequest.md @@ -1,10 +1,10 @@ -# GetLatestManagedBankFeedSyncRequest - - -## 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 | +# GetLatestManagedBankFeedSyncRequest + + +## 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 | | `source_account_id` | *str* | :heavy_check_mark: | The ID of the source bank account. | | \ No newline at end of file diff --git a/bank-feeds/docs/models/operations/getmanagedbankfeedsyncrequest.md b/bank-feeds/docs/models/operations/getmanagedbankfeedsyncrequest.md index dac98dbe5..fed2e28b9 100644 --- a/bank-feeds/docs/models/operations/getmanagedbankfeedsyncrequest.md +++ b/bank-feeds/docs/models/operations/getmanagedbankfeedsyncrequest.md @@ -1,11 +1,11 @@ -# GetManagedBankFeedSyncRequest - - -## 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 | -| `source_account_id` | *str* | :heavy_check_mark: | The ID of the source bank account. | | +# GetManagedBankFeedSyncRequest + + +## 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 | +| `source_account_id` | *str* | :heavy_check_mark: | The ID of the source bank account. | | | `sync_id` | *str* | :heavy_check_mark: | The ID of the sync. | | \ No newline at end of file diff --git a/bank-feeds/docs/models/operations/listbankaccountsrequest.md b/bank-feeds/docs/models/operations/listbankaccountsrequest.md index 73e7ff8bc..70531b292 100644 --- a/bank-feeds/docs/models/operations/listbankaccountsrequest.md +++ b/bank-feeds/docs/models/operations/listbankaccountsrequest.md @@ -1,13 +1,13 @@ -# ListBankAccountsRequest - - -## 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 | -| `order_by` | *Optional[str]* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | -| `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 | +# ListBankAccountsRequest + + +## 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 | +| `order_by` | *Optional[str]* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | +| `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 | \ No newline at end of file diff --git a/bank-feeds/docs/models/operations/listcompaniesrequest.md b/bank-feeds/docs/models/operations/listcompaniesrequest.md index 25cc480a0..e43853f9f 100644 --- a/bank-feeds/docs/models/operations/listcompaniesrequest.md +++ b/bank-feeds/docs/models/operations/listcompaniesrequest.md @@ -1,12 +1,12 @@ -# ListCompaniesRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `order_by` | *Optional[str]* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | -| `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 | +# ListCompaniesRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `order_by` | *Optional[str]* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | +| `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 | | `tags` | *Optional[str]* | :heavy_minus_sign: | Filter companies by tags using the "equals" (=), "not equals" (!=), and "contains" (~) operators with [Codat’s query language](https://docs.codat.io/using-the-api/querying). | region=uk && team=invoice-finance | \ No newline at end of file diff --git a/bank-feeds/docs/models/operations/listconnectionsrequest.md b/bank-feeds/docs/models/operations/listconnectionsrequest.md index 949d3e3b6..0a3173fc6 100644 --- a/bank-feeds/docs/models/operations/listconnectionsrequest.md +++ b/bank-feeds/docs/models/operations/listconnectionsrequest.md @@ -1,12 +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 | -| `order_by` | *Optional[str]* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | -| `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 | +# ListConnectionsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `order_by` | *Optional[str]* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | +| `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 | \ No newline at end of file diff --git a/bank-feeds/docs/models/operations/listcreateoperationsrequest.md b/bank-feeds/docs/models/operations/listcreateoperationsrequest.md index e92d7ed96..26382171e 100644 --- a/bank-feeds/docs/models/operations/listcreateoperationsrequest.md +++ b/bank-feeds/docs/models/operations/listcreateoperationsrequest.md @@ -1,12 +1,12 @@ -# ListCreateOperationsRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `order_by` | *Optional[str]* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | -| `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 | +# ListCreateOperationsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `order_by` | *Optional[str]* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | +| `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 | \ No newline at end of file diff --git a/bank-feeds/docs/models/operations/listsourceaccountsrequest.md b/bank-feeds/docs/models/operations/listsourceaccountsrequest.md index 3ea2a0879..884f929ab 100644 --- a/bank-feeds/docs/models/operations/listsourceaccountsrequest.md +++ b/bank-feeds/docs/models/operations/listsourceaccountsrequest.md @@ -1,9 +1,9 @@ -# ListSourceAccountsRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# ListSourceAccountsRequest + + +## 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/bank-feeds/docs/models/operations/listsourceaccountsresponsebody.md b/bank-feeds/docs/models/operations/listsourceaccountsresponsebody.md index e18be7bfb..a8e9617bf 100644 --- a/bank-feeds/docs/models/operations/listsourceaccountsresponsebody.md +++ b/bank-feeds/docs/models/operations/listsourceaccountsresponsebody.md @@ -1,19 +1,19 @@ -# ListSourceAccountsResponseBody - -Success - - -## Supported Types - -### `List[shared.SourceAccountV2]` - -```python -value: List[shared.SourceAccountV2] = /* values here */ -``` - -### `List[shared.SourceAccount]` - -```python -value: List[shared.SourceAccount] = /* values here */ -``` - +# ListSourceAccountsResponseBody + +Success + + +## Supported Types + +### `List[shared.SourceAccountV2]` + +```python +value: List[shared.SourceAccountV2] = /* values here */ +``` + +### `List[shared.SourceAccount]` + +```python +value: List[shared.SourceAccount] = /* values here */ +``` + diff --git a/bank-feeds/docs/models/operations/one.md b/bank-feeds/docs/models/operations/one.md deleted file mode 100644 index 1ae630b86..000000000 --- a/bank-feeds/docs/models/operations/one.md +++ /dev/null @@ -1,17 +0,0 @@ -# One - - -## Supported Types - -### `shared.SourceAccountV2BatchCreateResponse` - -```python -value: shared.SourceAccountV2BatchCreateResponse = /* values here */ -``` - -### `shared.SourceAccountBatchCreateResponse` - -```python -value: shared.SourceAccountBatchCreateResponse = /* values here */ -``` - diff --git a/bank-feeds/docs/models/operations/replacecompanyrequest.md b/bank-feeds/docs/models/operations/replacecompanyrequest.md index cde3d20e3..2b90faf30 100644 --- a/bank-feeds/docs/models/operations/replacecompanyrequest.md +++ b/bank-feeds/docs/models/operations/replacecompanyrequest.md @@ -1,9 +1,9 @@ -# ReplaceCompanyRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -| `company_request_body` | [Optional[shared.CompanyRequestBody]](../../models/shared/companyrequestbody.md) | :heavy_minus_sign: | N/A | | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | \ No newline at end of file +# ReplaceCompanyRequest + + +## 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/bank-feeds/docs/models/operations/responsebody.md b/bank-feeds/docs/models/operations/responsebody.md index d1bad853b..3bcb1dd29 100644 --- a/bank-feeds/docs/models/operations/responsebody.md +++ b/bank-feeds/docs/models/operations/responsebody.md @@ -1,17 +1,17 @@ -# ResponseBody - - -## Supported Types - -### `shared.SourceAccountV2BatchCreateResponse` - -```python -value: shared.SourceAccountV2BatchCreateResponse = /* values here */ -``` - -### `shared.SourceAccountBatchCreateResponse` - -```python -value: shared.SourceAccountBatchCreateResponse = /* values here */ -``` - +# ResponseBody + + +## Supported Types + +### `shared.SourceAccountV2BatchCreateResponse` + +```python +value: shared.SourceAccountV2BatchCreateResponse = /* values here */ +``` + +### `shared.SourceAccountBatchCreateResponse` + +```python +value: shared.SourceAccountBatchCreateResponse = /* values here */ +``` + diff --git a/bank-feeds/docs/models/operations/runmanagedbankfeedadhocsyncrequest.md b/bank-feeds/docs/models/operations/runmanagedbankfeedadhocsyncrequest.md index 45d47e102..ca3b48f67 100644 --- a/bank-feeds/docs/models/operations/runmanagedbankfeedadhocsyncrequest.md +++ b/bank-feeds/docs/models/operations/runmanagedbankfeedadhocsyncrequest.md @@ -1,10 +1,10 @@ -# RunManagedBankFeedAdHocSyncRequest - - -## 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 | +# RunManagedBankFeedAdHocSyncRequest + + +## 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 | | `source_account_id` | *str* | :heavy_check_mark: | The ID of the source bank account. | | \ No newline at end of file diff --git a/bank-feeds/docs/models/operations/sourceaccount.md b/bank-feeds/docs/models/operations/sourceaccount.md new file mode 100644 index 000000000..a883aa30e --- /dev/null +++ b/bank-feeds/docs/models/operations/sourceaccount.md @@ -0,0 +1,18 @@ +# SourceAccount + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_name` | *OptionalNullable[str]* | :heavy_minus_sign: | The bank account name. | +| `account_number` | *OptionalNullable[str]* | :heavy_minus_sign: | The account number. | +| `account_type` | *OptionalNullable[str]* | :heavy_minus_sign: | The type of bank account e.g. Credit. | +| `additional_properties` | Dict[str, *Any*] | :heavy_check_mark: | N/A | +| `balance` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | The latest balance for the bank account. | +| `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. | +| `feed_start_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. | +| `id` | *str* | :heavy_check_mark: | Unique ID for the bank account. | +| `modified_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. | +| `sort_code` | *OptionalNullable[str]* | :heavy_minus_sign: | The sort code. | +| `status` | [OptionalNullable[shared.Status]](../../models/shared/status.md) | :heavy_minus_sign: | Status of the source account. | \ No newline at end of file diff --git a/bank-feeds/docs/models/operations/sourceaccountbatchcreateresponse.md b/bank-feeds/docs/models/operations/sourceaccountbatchcreateresponse.md new file mode 100644 index 000000000..8db6fd9b7 --- /dev/null +++ b/bank-feeds/docs/models/operations/sourceaccountbatchcreateresponse.md @@ -0,0 +1,9 @@ +# SourceAccountBatchCreateResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `result` | [Optional[shared.SourceAccountBatchCreateResult]](../../models/shared/sourceaccountbatchcreateresult.md) | :heavy_minus_sign: | N/A | +| `source_account_id` | *Optional[str]* | :heavy_minus_sign: | Unique ID for the source account. | \ No newline at end of file diff --git a/bank-feeds/docs/models/operations/sourceaccountbatcherrorresponse.md b/bank-feeds/docs/models/operations/sourceaccountbatcherrorresponse.md new file mode 100644 index 000000000..d9291ae82 --- /dev/null +++ b/bank-feeds/docs/models/operations/sourceaccountbatcherrorresponse.md @@ -0,0 +1,9 @@ +# SourceAccountBatchErrorResponse + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | +| `result` | [Optional[shared.SourceAccountBatchErrorResponseResult]](../../models/shared/sourceaccountbatcherrorresponseresult.md) | :heavy_minus_sign: | N/A | +| `source_account_id` | *Optional[str]* | :heavy_minus_sign: | Unique ID for the source account. | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/bankaccountsaccountingbankaccount.md b/bank-feeds/docs/models/operations/sourceaccountprototype.md similarity index 75% rename from bank-feeds/docs/models/shared/bankaccountsaccountingbankaccount.md rename to bank-feeds/docs/models/operations/sourceaccountprototype.md index 39097ef01..e4552c370 100644 --- a/bank-feeds/docs/models/shared/bankaccountsaccountingbankaccount.md +++ b/bank-feeds/docs/models/operations/sourceaccountprototype.md @@ -1,39 +1,15 @@ -# BankAccountsAccountingBankAccount - -> **Accessing Bank Accounts through Banking API** -> -> This datatype was originally used for accessing bank account data both in accounting integrations and open banking aggregators. -> -> To view bank account data through the Banking API, please refer to the new [Banking: Account](https://docs.codat.io/bank-feeds-api#/schemas/Account) data type. - -## Overview - -A list of bank accounts associated with a company and a specific data connection. - -Bank accounts data includes: -* The name and ID of the account in the accounting software. -* The currency and balance of the account. -* The sort code and account number. - - -## Fields - -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the bank account in the accounting software. | | -| `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.

FreeAgent integrations
For Credit accounts, only the last four digits are required. For other types, the field is optional. | | -| `account_type` | [Optional[shared.BankAccountsBankAccountType]](../../models/shared/bankaccountsbankaccounttype.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. | | -| `available_balance` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Total available balance of the bank account as reported by the underlying data source. This may take into account overdrafts or pending transactions for example. | | -| `balance` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Balance of the bank account. | | -| `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. | **Example 1:** GBP
**Example 2:** USD
**Example 3:** EUR | -| `i_ban` | *OptionalNullable[str]* | :heavy_minus_sign: | International bank account number of the account. Often used when making or receiving international payments. | | -| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the account, unique for the company in the accounting software. | | -| `institution` | *OptionalNullable[str]* | :heavy_minus_sign: | The institution of the bank account. | | -| `metadata` | [Optional[shared.BankAccountsMetadata]](../../models/shared/bankaccountsmetadata.md) | :heavy_minus_sign: | N/A | | -| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `nominal_code` | *OptionalNullable[str]* | :heavy_minus_sign: | Code used to identify each nominal account for a business. | | -| `overdraft_limit` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Pre-arranged overdraft limit of the account.

The value is always positive. For example, an overdraftLimit of `1000` means that the balance of the account can go down to `-1000`. | | -| `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. | | -| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `status` | [Optional[shared.BankAccountStatus]](../../models/shared/bankaccountstatus.md) | :heavy_minus_sign: | Status of the bank account. | Active | -| `supplemental_data` | [Optional[shared.BankAccountsSupplementalData]](../../models/shared/bankaccountssupplementaldata.md) | :heavy_minus_sign: | Supplemental data is additional data you can include in our standard data types.

It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. | | \ No newline at end of file +# SourceAccountPrototype + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_name` | *OptionalNullable[str]* | :heavy_minus_sign: | The bank account name. | +| `account_number` | *OptionalNullable[str]* | :heavy_minus_sign: | The account number. | +| `account_type` | *OptionalNullable[str]* | :heavy_minus_sign: | The type of bank account e.g. Credit. | +| `balance` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | The latest balance for the bank account. | +| `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. | +| `id` | *str* | :heavy_check_mark: | Unique ID for the bank account. | +| `modified_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. | +| `sort_code` | *OptionalNullable[str]* | :heavy_minus_sign: | The sort code. | \ No newline at end of file diff --git a/bank-feeds/docs/models/operations/sourceaccountv2.md b/bank-feeds/docs/models/operations/sourceaccountv2.md new file mode 100644 index 000000000..760791283 --- /dev/null +++ b/bank-feeds/docs/models/operations/sourceaccountv2.md @@ -0,0 +1,20 @@ +# SourceAccountV2 + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_info` | [OptionalNullable[shared.AccountInfo]](../../models/shared/accountinfo.md) | :heavy_minus_sign: | N/A | +| `account_name` | *str* | :heavy_check_mark: | The bank account name. | +| `account_number` | *str* | :heavy_check_mark: | The account number. | +| `account_type` | [shared.SourceAccountV2AccountType](../../models/shared/sourceaccountv2accounttype.md) | :heavy_check_mark: | The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard. | +| `additional_properties` | Dict[str, *Any*] | :heavy_check_mark: | N/A | +| `balance` | *Decimal* | :heavy_check_mark: | The latest balance for the bank account. | +| `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. | +| `feed_start_date` | *OptionalNullable[str]* | :heavy_minus_sign: | In Codat's data model, dates are represented using the ISO 8601 standard. Date fields are formatted as strings; for example: ``` 2020-10-08 ``` | +| `id` | *str* | :heavy_check_mark: | Unique ID for the bank account. | +| `modified_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. | +| `routing_info` | [Optional[shared.RoutingInfo]](../../models/shared/routinginfo.md) | :heavy_minus_sign: | N/A | +| `sort_code` | *OptionalNullable[str]* | :heavy_minus_sign: | The sort code. | +| `status` | [OptionalNullable[shared.SourceAccountV2Status]](../../models/shared/sourceaccountv2status.md) | :heavy_minus_sign: | Status of the source account. | \ No newline at end of file diff --git a/bank-feeds/docs/models/operations/sourceaccountv2batchcreateresponse.md b/bank-feeds/docs/models/operations/sourceaccountv2batchcreateresponse.md new file mode 100644 index 000000000..6896485cc --- /dev/null +++ b/bank-feeds/docs/models/operations/sourceaccountv2batchcreateresponse.md @@ -0,0 +1,9 @@ +# SourceAccountV2BatchCreateResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `result` | [Optional[shared.SourceAccountV2BatchCreateResult]](../../models/shared/sourceaccountv2batchcreateresult.md) | :heavy_minus_sign: | N/A | +| `source_account_id` | *Optional[str]* | :heavy_minus_sign: | Unique ID for the source account. | \ No newline at end of file diff --git a/bank-feeds/docs/models/operations/sourceaccountv2prototype.md b/bank-feeds/docs/models/operations/sourceaccountv2prototype.md new file mode 100644 index 000000000..a4c905c8e --- /dev/null +++ b/bank-feeds/docs/models/operations/sourceaccountv2prototype.md @@ -0,0 +1,17 @@ +# SourceAccountV2Prototype + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_info` | [OptionalNullable[shared.AccountInfo]](../../models/shared/accountinfo.md) | :heavy_minus_sign: | N/A | +| `account_name` | *str* | :heavy_check_mark: | The bank account name. | +| `account_number` | *str* | :heavy_check_mark: | The account number. | +| `account_type` | [shared.AccountType](../../models/shared/accounttype.md) | :heavy_check_mark: | The type of bank account e.g. Credit. | +| `balance` | *Decimal* | :heavy_check_mark: | The latest balance for the bank account. | +| `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. | +| `id` | *str* | :heavy_check_mark: | Unique ID for the bank account. | +| `modified_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. | +| `routing_info` | [Optional[shared.RoutingInfo]](../../models/shared/routinginfo.md) | :heavy_minus_sign: | N/A | +| `sort_code` | *OptionalNullable[str]* | :heavy_minus_sign: | The sort code. | \ No newline at end of file diff --git a/bank-feeds/docs/models/operations/unlinkconnectionrequest.md b/bank-feeds/docs/models/operations/unlinkconnectionrequest.md index 37c72c7bc..66136f30f 100644 --- a/bank-feeds/docs/models/operations/unlinkconnectionrequest.md +++ b/bank-feeds/docs/models/operations/unlinkconnectionrequest.md @@ -1,10 +1,10 @@ -# UnlinkConnectionRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -| `request_body` | [Optional[operations.UnlinkConnectionUpdateConnection]](../../models/operations/unlinkconnectionupdateconnection.md) | :heavy_minus_sign: | N/A | | -| `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 +# UnlinkConnectionRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `request_body` | [Optional[shared.UpdateConnection]](../../models/shared/updateconnection.md) | :heavy_minus_sign: | N/A | | +| `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/bank-feeds/docs/models/operations/unlinkconnectionupdateconnection.md b/bank-feeds/docs/models/operations/unlinkconnectionupdateconnection.md index 5a5f2911b..476521561 100644 --- a/bank-feeds/docs/models/operations/unlinkconnectionupdateconnection.md +++ b/bank-feeds/docs/models/operations/unlinkconnectionupdateconnection.md @@ -1,8 +1,9 @@ -# UnlinkConnectionUpdateConnection - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +# UnlinkConnectionUpdateConnection + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `additional_properties` | Dict[str, *Any*] | :heavy_check_mark: | N/A | | `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/bank-feeds/docs/models/operations/updatecompanyrequest.md b/bank-feeds/docs/models/operations/updatecompanyrequest.md index 47802c383..9718e2ff6 100644 --- a/bank-feeds/docs/models/operations/updatecompanyrequest.md +++ b/bank-feeds/docs/models/operations/updatecompanyrequest.md @@ -1,9 +1,9 @@ -# UpdateCompanyRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `company_update_request` | [Optional[shared.CompanyUpdateRequest]](../../models/shared/companyupdaterequest.md) | :heavy_minus_sign: | N/A | | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | \ No newline at end of file +# UpdateCompanyRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `company_update_request` | [Optional[shared.CompanyUpdateRequest]](../../models/shared/companyupdaterequest.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/bank-feeds/docs/models/operations/updatesourceaccountrequest.md b/bank-feeds/docs/models/operations/updatesourceaccountrequest.md index 82daea723..de3cea43b 100644 --- a/bank-feeds/docs/models/operations/updatesourceaccountrequest.md +++ b/bank-feeds/docs/models/operations/updatesourceaccountrequest.md @@ -1,11 +1,11 @@ -# UpdateSourceAccountRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `source_account` | [Optional[shared.SourceAccount]](../../models/shared/sourceaccount.md) | :heavy_minus_sign: | N/A | **Example 1:** {
"id": "acc-002",
"accountName": "account-081",
"sortCode": "123456",
"accountType": "Credit",
"accountNumber": "12345670",
"currency": "GBP",
"balance": 99.99,
"modifiedDate": "2023-01-09T14:14:14.1057478Z",
"status": "pending"
}
**Example 2:** {
"id": "acc-003",
"accountName": "account-095",
"sortCode": "123456",
"accountType": "Credit",
"accountNumber": "12345671",
"currency": "USD",
"balance": 0,
"modifiedDate": "2023-01-09T14:14:14.1057478Z",
"status": "pending"
} | -| `account_id` | *str* | :heavy_check_mark: | Unique identifier for an account. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | -| `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 +# UpdateSourceAccountRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_id` | *str* | :heavy_check_mark: | Unique identifier for an account. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | +| `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 | +| `source_account` | [Optional[shared.SourceAccount]](../../models/shared/sourceaccount.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/accesstoken.md b/bank-feeds/docs/models/shared/accesstoken.md new file mode 100644 index 000000000..c159a6812 --- /dev/null +++ b/bank-feeds/docs/models/shared/accesstoken.md @@ -0,0 +1,10 @@ +# AccessToken + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | +| `access_token` | *str* | :heavy_check_mark: | The access token for the company. | | +| `expires_in` | *int* | :heavy_check_mark: | The number of seconds until the access token expires. | 86400 | +| `token_type` | *str* | :heavy_check_mark: | The type of token. | Bearer | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/accountinfo.md b/bank-feeds/docs/models/shared/accountinfo.md index 9883d2487..c58ab5b5d 100644 --- a/bank-feeds/docs/models/shared/accountinfo.md +++ b/bank-feeds/docs/models/shared/accountinfo.md @@ -1,11 +1,11 @@ -# AccountInfo - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_open_date` | *OptionalNullable[str]* | :heavy_minus_sign: | In Codat's data model, dates are represented using the ISO 8601 standard. Date fields are formatted as strings; for example:
```
2020-10-08
``` | 2022-10-23 | -| `available_balance` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Balance of funds available for use. This includes pending activity. | | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the account. | | +# AccountInfo + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_open_date` | *OptionalNullable[str]* | :heavy_minus_sign: | In Codat's data model, dates are represented using the ISO 8601 standard. Date fields are formatted as strings; for example:
```
2020-10-08
``` | 2022-10-23 | +| `available_balance` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Balance of funds available for use. This includes pending activity. | | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the account. | | | `nickname` | *OptionalNullable[str]* | :heavy_minus_sign: | Name given to the account by the user. Used in UIs to assist in account selection. | | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/accountingbankaccount.md b/bank-feeds/docs/models/shared/accountingbankaccount.md index d5ff9f41a..d19e3576e 100644 --- a/bank-feeds/docs/models/shared/accountingbankaccount.md +++ b/bank-feeds/docs/models/shared/accountingbankaccount.md @@ -1,41 +1,24 @@ -# ~~AccountingBankAccount~~ - -> **Accessing Bank Accounts through Banking API** -> -> This datatype was originally used for accessing bank account data both in accounting integrations and open banking aggregators. -> -> To view bank account data through the Banking API, please refer to the new [Banking: Account](https://docs.codat.io/bank-feeds-api#/schemas/Account) data type. - -## Overview - -A list of bank accounts associated with a company and a specific data connection. - -Bank accounts data includes: -* The name and ID of the account in the accounting software. -* The currency and balance of the account. -* The sort code and account number. - -> :warning: **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible. - - -## Fields - -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the bank account in the accounting software. | | -| `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.

FreeAgent integrations
For Credit accounts, only the last four digits are required. For other types, the field is optional. | | -| `account_type` | [Optional[shared.BankAccountCreateResponseBankAccountType]](../../models/shared/bankaccountcreateresponsebankaccounttype.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. | | -| `available_balance` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Total available balance of the bank account as reported by the underlying data source. This may take into account overdrafts or pending transactions for example. | | -| `balance` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Balance of the bank account. | | -| `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. | **Example 1:** GBP
**Example 2:** USD
**Example 3:** EUR | -| `i_ban` | *OptionalNullable[str]* | :heavy_minus_sign: | International bank account number of the account. Often used when making or receiving international payments. | | -| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the account, unique for the company in the accounting software. | | -| `institution` | *OptionalNullable[str]* | :heavy_minus_sign: | The institution of the bank account. | | -| `metadata` | [Optional[shared.Metadata]](../../models/shared/metadata.md) | :heavy_minus_sign: | N/A | | -| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `nominal_code` | *OptionalNullable[str]* | :heavy_minus_sign: | Code used to identify each nominal account for a business. | | -| `overdraft_limit` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Pre-arranged overdraft limit of the account.

The value is always positive. For example, an overdraftLimit of `1000` means that the balance of the account can go down to `-1000`. | | -| `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. | | -| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `status` | [Optional[shared.BankAccountStatus]](../../models/shared/bankaccountstatus.md) | :heavy_minus_sign: | Status of the bank account. | Active | -| `supplemental_data` | [Optional[shared.SupplementalData]](../../models/shared/supplementaldata.md) | :heavy_minus_sign: | Supplemental data is additional data you can include in our standard data types.

It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. | | \ No newline at end of file +# AccountingBankAccount + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `account_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the bank account in the accounting software. | +| `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. FreeAgent integrations For Credit accounts, only the last four digits are required. For other types, the field is optional. | +| `account_type` | [Optional[shared.BankAccountCreateResponseBankAccountType]](../../models/shared/bankaccountcreateresponsebankaccounttype.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. | +| `available_balance` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Total available balance of the bank account as reported by the underlying data source. This may take into account overdrafts or pending transactions for example. | +| `balance` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Balance of the bank account. | +| `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. | +| `i_ban` | *OptionalNullable[str]* | :heavy_minus_sign: | International bank account number of the account. Often used when making or receiving international payments. | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the account, unique for the company in the accounting software. | +| `institution` | *OptionalNullable[str]* | :heavy_minus_sign: | The institution of the bank account. | +| `metadata` | [Optional[shared.Metadata]](../../models/shared/metadata.md) | :heavy_minus_sign: | N/A | +| `modified_date` | *Optional[str]* | :heavy_minus_sign: | The date when the record was last fetched from the accounting software, commerce software, or open banking provider and updated in Codat’s data cache. Use it to identify and retrieve records that have changed since your last fetch. For example, filtering `modifiedDate` to today will provide new records updated in Codat today. This date is populated for all data types except for attachments, balance sheets, company information, and profit & loss reports ([read more](https://docs.codat.io/using-the-api/modified-dates#modified-date)). In Codat's data model, dates and times are represented using the ISO 8601 standard. | +| `nominal_code` | *OptionalNullable[str]* | :heavy_minus_sign: | Code used to identify each nominal account for a business. | +| `overdraft_limit` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Pre-arranged overdraft limit of the account. The value is always positive. For example, an overdraftLimit of `1000` means that the balance of the account can go down to `-1000`. | +| `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. | +| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | The date when a record was last modified in the accounting software, usually by the business or a business process. For example, when payments are made against an invoice. It is not populated ([read more](https://docs.codat.io/using-the-api/modified-dates#source-modified-date)) when: - Pulling attachments - The accounting software does not provide modification dates for a data type - A record has been deleted from the source platform and Codat doesn't have a record of when the deletion occurred - A record has been voided. For certain platforms that soft delete records, `isDeleted` metadata is used to identify void records In Codat's data model, dates and times are represented using the ISO 8601 standard. | +| `status` | [Optional[shared.BankAccountStatus]](../../models/shared/bankaccountstatus.md) | :heavy_minus_sign: | N/A | +| `supplemental_data` | [Optional[shared.SupplementalData]](../../models/shared/supplementaldata.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/accounttype.md b/bank-feeds/docs/models/shared/accounttype.md index 56197a9dc..b10fd282f 100644 --- a/bank-feeds/docs/models/shared/accounttype.md +++ b/bank-feeds/docs/models/shared/accounttype.md @@ -1,22 +1,20 @@ -# AccountType - -The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard. - -## Example Usage - -```python -from codat_bankfeeds.models.shared import AccountType - -value = AccountType.CHECKING -``` - - -## Values - -| Name | Value | -| -------------- | -------------- | -| `CHECKING` | checking | -| `SAVINGS` | savings | -| `LOAN` | loan | -| `CREDIT_CARD` | creditCard | +# AccountType + +## Example Usage + +```python +from codat_bankfeeds.models.shared import AccountType + +value = AccountType.CHECKING +``` + + +## Values + +| Name | Value | +| -------------- | -------------- | +| `CHECKING` | checking | +| `SAVINGS` | savings | +| `LOAN` | loan | +| `CREDIT_CARD` | creditCard | | `PREPAID_CARD` | prepaidCard | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/bankaccountcreateresponse.md b/bank-feeds/docs/models/shared/bankaccountcreateresponse.md index 7106d8f27..b4789da90 100644 --- a/bank-feeds/docs/models/shared/bankaccountcreateresponse.md +++ b/bank-feeds/docs/models/shared/bankaccountcreateresponse.md @@ -1,21 +1,21 @@ -# BankAccountCreateResponse - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `changes` | List[[shared.PushOperationChange](../../models/shared/pushoperationchange.md)] | :heavy_minus_sign: | Contains a single entry that communicates which record has changed and the manner in which it changed. | | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `completed_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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `data` | [OptionalNullable[shared.AccountingBankAccount]](../../models/shared/accountingbankaccount.md) | :heavy_minus_sign: | N/A | | -| `data_connection_key` | *str* | :heavy_check_mark: | Unique identifier for a company's data connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | -| `data_type` | [Optional[shared.DataType]](../../models/shared/datatype.md) | :heavy_minus_sign: | Available data types | invoices | -| `error_message` | *OptionalNullable[str]* | :heavy_minus_sign: | A message about the error. | | -| `push_operation_key` | *str* | :heavy_check_mark: | A unique identifier generated by Codat to represent this single push operation. This identifier can be used to track the status of the push, and should be persisted. | | -| `requested_on_utc` | *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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `status` | [shared.PushOperationStatus](../../models/shared/pushoperationstatus.md) | :heavy_check_mark: | The current status of the push operation. | | -| `status_code` | *int* | :heavy_check_mark: | Push status code. | | -| `timeout_in_minutes` | *OptionalNullable[int]* | :heavy_minus_sign: | Number of minutes the push operation must complete within before it times out. | | -| ~~`timeout_in_seconds`~~ | *OptionalNullable[int]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Number of seconds the push operation must complete within before it times out. | | -| `validation` | [Optional[shared.Validation]](../../models/shared/validation.md) | :heavy_minus_sign: | A human-readable object describing validation decisions Codat has made when pushing data into the platform. If a push has failed because of validation errors, they will be detailed here. | | \ No newline at end of file +# BankAccountCreateResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `changes` | List[[shared.PushOperationChange](../../models/shared/pushoperationchange.md)] | :heavy_minus_sign: | Contains a single entry that communicates which record has changed and the manner in which it changed. | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for your SMB in Codat. | +| `completed_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. | +| `data` | [OptionalNullable[shared.BankAccountCreateResponseAllOfData]](../../models/shared/bankaccountcreateresponseallofdata.md) | :heavy_minus_sign: | N/A | +| `data_connection_key` | *str* | :heavy_check_mark: | Unique identifier for a company's data connection. | +| `data_type` | [Optional[shared.DataType]](../../models/shared/datatype.md) | :heavy_minus_sign: | The type of data being pushed, eg invoices, customers. | +| `error_message` | *OptionalNullable[str]* | :heavy_minus_sign: | A message about the error. | +| `push_operation_key` | *str* | :heavy_check_mark: | A unique identifier generated by Codat to represent this single push operation. This identifier can be used to track the status of the push, and should be persisted. | +| `requested_on_utc` | *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. | +| `status` | [shared.PushOperationStatus](../../models/shared/pushoperationstatus.md) | :heavy_check_mark: | N/A | +| `status_code` | *int* | :heavy_check_mark: | Push status code. | +| `timeout_in_minutes` | *OptionalNullable[int]* | :heavy_minus_sign: | Number of minutes the push operation must complete within before it times out. | +| `timeout_in_seconds` | *OptionalNullable[int]* | :heavy_minus_sign: | Number of seconds the push operation must complete within before it times out. | +| `validation` | [Optional[shared.Validation]](../../models/shared/validation.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/bankaccountcreateresponsebankaccounttype.md b/bank-feeds/docs/models/shared/bankaccountcreateresponsebankaccounttype.md index 4a4ee2412..2e6e55231 100644 --- a/bank-feeds/docs/models/shared/bankaccountcreateresponsebankaccounttype.md +++ b/bank-feeds/docs/models/shared/bankaccountcreateresponsebankaccounttype.md @@ -1,22 +1,18 @@ -# BankAccountCreateResponseBankAccountType - -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. - -## Example Usage - -```python -from codat_bankfeeds.models.shared import BankAccountCreateResponseBankAccountType - -value = BankAccountCreateResponseBankAccountType.UNKNOWN -``` - - -## Values - -| Name | Value | -| --------- | --------- | -| `UNKNOWN` | Unknown | -| `CREDIT` | Credit | +# BankAccountCreateResponseBankAccountType + +## Example Usage + +```python +from codat_bankfeeds.models.shared import BankAccountCreateResponseBankAccountType + +value = BankAccountCreateResponseBankAccountType.UNKNOWN +``` + + +## Values + +| Name | Value | +| --------- | --------- | +| `UNKNOWN` | Unknown | +| `CREDIT` | Credit | | `DEBIT` | Debit | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/bankaccountcredentials.md b/bank-feeds/docs/models/shared/bankaccountcredentials.md index 3052bc441..f890b7d83 100644 --- a/bank-feeds/docs/models/shared/bankaccountcredentials.md +++ b/bank-feeds/docs/models/shared/bankaccountcredentials.md @@ -1,11 +1,11 @@ -# BankAccountCredentials - -Result of generate credentials - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | -| `password` | *Optional[str]* | :heavy_minus_sign: | Password to enable the bank feeds platform to securely retrieve transactions. | cO0ajh0uGyTN0Pwh | +# BankAccountCredentials + +Result of generate credentials + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| `password` | *Optional[str]* | :heavy_minus_sign: | Password to enable the bank feeds platform to securely retrieve transactions. | cO0ajh0uGyTN0Pwh | | `username` | *Optional[str]* | :heavy_minus_sign: | Username used by the bank feeds platform to retrieve transactions | S0MW-TR0P-7DS0 | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/bankaccountprototype.md b/bank-feeds/docs/models/shared/bankaccountprototype.md index 3efe4911f..df1f3b59d 100644 --- a/bank-feeds/docs/models/shared/bankaccountprototype.md +++ b/bank-feeds/docs/models/shared/bankaccountprototype.md @@ -1,19 +1,19 @@ -# BankAccountPrototype - - -## Fields - -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the bank account in the accounting software. | | -| `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.

FreeAgent integrations
For Credit accounts, only the last four digits are required. For other types, the field is optional. | | -| `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. | | -| `available_balance` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Total available balance of the bank account as reported by the underlying data source. This may take into account overdrafts or pending transactions for example. | | -| `balance` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Balance of the bank account. | | -| `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. | **Example 1:** GBP
**Example 2:** USD
**Example 3:** EUR | -| `i_ban` | *OptionalNullable[str]* | :heavy_minus_sign: | International bank account number of the account. Often used when making or receiving international payments. | | -| `institution` | *OptionalNullable[str]* | :heavy_minus_sign: | The institution of the bank account. | | -| `nominal_code` | *OptionalNullable[str]* | :heavy_minus_sign: | Code used to identify each nominal account for a business. | | -| `overdraft_limit` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Pre-arranged overdraft limit of the account.

The value is always positive. For example, an overdraftLimit of `1000` means that the balance of the account can go down to `-1000`. | | -| `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. | | +# BankAccountPrototype + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the bank account in the accounting software. | | +| `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.

FreeAgent integrations
For Credit accounts, only the last four digits are required. For other types, the field is optional. | | +| `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. | | +| `available_balance` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Total available balance of the bank account as reported by the underlying data source. This may take into account overdrafts or pending transactions for example. | | +| `balance` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Balance of the bank account. | | +| `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. | **Example 1:** GBP
**Example 2:** USD
**Example 3:** EUR | +| `i_ban` | *OptionalNullable[str]* | :heavy_minus_sign: | International bank account number of the account. Often used when making or receiving international payments. | | +| `institution` | *OptionalNullable[str]* | :heavy_minus_sign: | The institution of the bank account. | | +| `nominal_code` | *OptionalNullable[str]* | :heavy_minus_sign: | Code used to identify each nominal account for a business. | | +| `overdraft_limit` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Pre-arranged overdraft limit of the account.

The value is always positive. For example, an overdraftLimit of `1000` means that the balance of the account can go down to `-1000`. | | +| `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. | | | `status` | [Optional[shared.BankAccountStatus]](../../models/shared/bankaccountstatus.md) | :heavy_minus_sign: | Status of the bank account. | Active | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/bankaccounts.md b/bank-feeds/docs/models/shared/bankaccounts.md index 5fa89d709..d3fffac3f 100644 --- a/bank-feeds/docs/models/shared/bankaccounts.md +++ b/bank-feeds/docs/models/shared/bankaccounts.md @@ -1,12 +1,12 @@ -# BankAccounts - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -| `links` | [shared.Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} | -| `page_number` | *int* | :heavy_check_mark: | Current page number. | | -| `page_size` | *int* | :heavy_check_mark: | Number of items to return in results array. | | -| `results` | List[[Nullable[shared.BankAccountsAccountingBankAccount]](../../models/shared/bankaccountsaccountingbankaccount.md)] | :heavy_minus_sign: | N/A | | -| `total_results` | *int* | :heavy_check_mark: | Total number of items. | | \ No newline at end of file +# BankAccounts + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `links` | [shared.Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} | +| `page_number` | *int* | :heavy_check_mark: | Current page number. | | +| `page_size` | *int* | :heavy_check_mark: | Number of items to return in results array. | | +| `results` | List[[Nullable[shared.AccountingBankAccount]](../../models/shared/accountingbankaccount.md)] | :heavy_minus_sign: | N/A | | +| `total_results` | *int* | :heavy_check_mark: | Total number of items. | | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/bankaccountsbankaccounttype.md b/bank-feeds/docs/models/shared/bankaccountsbankaccounttype.md index 3a3185cdf..75244b6a1 100644 --- a/bank-feeds/docs/models/shared/bankaccountsbankaccounttype.md +++ b/bank-feeds/docs/models/shared/bankaccountsbankaccounttype.md @@ -1,22 +1,18 @@ -# BankAccountsBankAccountType - -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. - -## Example Usage - -```python -from codat_bankfeeds.models.shared import BankAccountsBankAccountType - -value = BankAccountsBankAccountType.UNKNOWN -``` - - -## Values - -| Name | Value | -| --------- | --------- | -| `UNKNOWN` | Unknown | -| `CREDIT` | Credit | +# BankAccountsBankAccountType + +## Example Usage + +```python +from codat_bankfeeds.models.shared import BankAccountsBankAccountType + +value = BankAccountsBankAccountType.UNKNOWN +``` + + +## Values + +| Name | Value | +| --------- | --------- | +| `UNKNOWN` | Unknown | +| `CREDIT` | Credit | | `DEBIT` | Debit | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/bankaccountsmetadata.md b/bank-feeds/docs/models/shared/bankaccountsmetadata.md deleted file mode 100644 index d6c8c9785..000000000 --- a/bank-feeds/docs/models/shared/bankaccountsmetadata.md +++ /dev/null @@ -1,8 +0,0 @@ -# BankAccountsMetadata - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | -| `is_deleted` | *OptionalNullable[bool]* | :heavy_minus_sign: | Indicates whether the record has been deleted in the third-party system this record originated from. | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/bankaccountssupplementaldata.md b/bank-feeds/docs/models/shared/bankaccountssupplementaldata.md deleted file mode 100644 index b26b85416..000000000 --- a/bank-feeds/docs/models/shared/bankaccountssupplementaldata.md +++ /dev/null @@ -1,12 +0,0 @@ -# BankAccountsSupplementalData - -Supplemental data is additional data you can include in our standard data types. - -It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. - - -## Fields - -| Field | Type | Required | Description | -| --------------------------- | --------------------------- | --------------------------- | --------------------------- | -| `content` | Dict[str, Dict[str, *Any*]] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/bankaccountstatus.md b/bank-feeds/docs/models/shared/bankaccountstatus.md index da22b0f42..d942423a2 100644 --- a/bank-feeds/docs/models/shared/bankaccountstatus.md +++ b/bank-feeds/docs/models/shared/bankaccountstatus.md @@ -1,21 +1,19 @@ -# BankAccountStatus - -Status of the bank account. - -## Example Usage - -```python -from codat_bankfeeds.models.shared import BankAccountStatus - -value = BankAccountStatus.UNKNOWN -``` - - -## Values - -| Name | Value | -| ---------- | ---------- | -| `UNKNOWN` | Unknown | -| `ACTIVE` | Active | -| `ARCHIVED` | Archived | +# BankAccountStatus + +## Example Usage + +```python +from codat_bankfeeds.models.shared import BankAccountStatus + +value = BankAccountStatus.UNKNOWN +``` + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `UNKNOWN` | Unknown | +| `ACTIVE` | Active | +| `ARCHIVED` | Archived | | `PENDING` | Pending | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/bankaccounttype.md b/bank-feeds/docs/models/shared/bankaccounttype.md index 3380fac3f..3c7887e38 100644 --- a/bank-feeds/docs/models/shared/bankaccounttype.md +++ b/bank-feeds/docs/models/shared/bankaccounttype.md @@ -1,22 +1,22 @@ -# 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. - -## Example Usage - -```python -from codat_bankfeeds.models.shared import BankAccountType - -value = BankAccountType.UNKNOWN -``` - - -## Values - -| Name | Value | -| --------- | --------- | -| `UNKNOWN` | Unknown | -| `CREDIT` | Credit | +# 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. + +## Example Usage + +```python +from codat_bankfeeds.models.shared import BankAccountType + +value = BankAccountType.UNKNOWN +``` + + +## Values + +| Name | Value | +| --------- | --------- | +| `UNKNOWN` | Unknown | +| `CREDIT` | Credit | | `DEBIT` | Debit | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/bankfeedaccountmapping.md b/bank-feeds/docs/models/shared/bankfeedaccountmapping.md index 09562644e..d7b65cee0 100644 --- a/bank-feeds/docs/models/shared/bankfeedaccountmapping.md +++ b/bank-feeds/docs/models/shared/bankfeedaccountmapping.md @@ -1,10 +1,11 @@ -# BankFeedAccountMapping - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `feed_start_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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `source_account_id` | *str* | :heavy_check_mark: | Unique ID for the source account | | +# BankFeedAccountMapping + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `additional_properties` | Dict[str, *Any*] | :heavy_check_mark: | N/A | | +| `feed_start_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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `source_account_id` | *str* | :heavy_check_mark: | Unique ID for the source account | | | `target_account_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Unique ID for the target account | | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/bankfeedaccountmappingresponse.md b/bank-feeds/docs/models/shared/bankfeedaccountmappingresponse.md index c5f69332d..643c85d9c 100644 --- a/bank-feeds/docs/models/shared/bankfeedaccountmappingresponse.md +++ b/bank-feeds/docs/models/shared/bankfeedaccountmappingresponse.md @@ -1,11 +1,12 @@ -# BankFeedAccountMappingResponse - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------- | -------------------------------------- | -------------------------------------- | -------------------------------------- | -| `error` | *OptionalNullable[str]* | :heavy_minus_sign: | Error returned during the post request | -| `source_account_id` | *Optional[str]* | :heavy_minus_sign: | Unique ID for the source account. | -| `status` | *OptionalNullable[str]* | :heavy_minus_sign: | Status of the POST request. | +# BankFeedAccountMappingResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | -------------------------------------- | +| `additional_properties` | Dict[str, *Any*] | :heavy_check_mark: | N/A | +| `error` | *OptionalNullable[str]* | :heavy_minus_sign: | Error returned during the post request | +| `source_account_id` | *Optional[str]* | :heavy_minus_sign: | Unique ID for the source account. | +| `status` | *OptionalNullable[str]* | :heavy_minus_sign: | Status of the POST request. | | `target_account_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Unique ID for the target account. | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/bankfeedmapping.md b/bank-feeds/docs/models/shared/bankfeedmapping.md index 0334478b5..187472389 100644 --- a/bank-feeds/docs/models/shared/bankfeedmapping.md +++ b/bank-feeds/docs/models/shared/bankfeedmapping.md @@ -1,19 +1,20 @@ -# BankFeedMapping - -A bank feed connection between a source account and a target account, including potential target accounts. - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `feed_start_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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `source_account_id` | *Optional[str]* | :heavy_minus_sign: | Unique ID for the source account. | | -| `source_account_name` | *Optional[str]* | :heavy_minus_sign: | Name for the source account. | | -| `source_account_number` | *Optional[str]* | :heavy_minus_sign: | Account number for the source account. | | -| `source_balance` | *Optional[Decimal]* | :heavy_minus_sign: | Balance for the source account. | | -| `source_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. | **Example 1:** GBP
**Example 2:** USD
**Example 3:** EUR | -| `status` | *Optional[str]* | :heavy_minus_sign: | The status. | | -| `target_account_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Unique ID for the target account in the accounting software. | | -| `target_account_name` | *Optional[str]* | :heavy_minus_sign: | Name for the target account in the accounting software. | | +# BankFeedMapping + +A bank feed connection between a source account and a target account, including potential target accounts. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `additional_properties` | Dict[str, *Any*] | :heavy_check_mark: | N/A | | +| `feed_start_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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `source_account_id` | *Optional[str]* | :heavy_minus_sign: | Unique ID for the source account. | | +| `source_account_name` | *Optional[str]* | :heavy_minus_sign: | Name for the source account. | | +| `source_account_number` | *Optional[str]* | :heavy_minus_sign: | Account number for the source account. | | +| `source_balance` | *Optional[Decimal]* | :heavy_minus_sign: | Balance for the source account. | | +| `source_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. | **Example 1:** GBP
**Example 2:** USD
**Example 3:** EUR | +| `status` | *Optional[str]* | :heavy_minus_sign: | The status. | | +| `target_account_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Unique ID for the target account in the accounting software. | | +| `target_account_name` | *Optional[str]* | :heavy_minus_sign: | Name for the target account in the accounting software. | | | `target_account_options` | List[[shared.TargetAccountOption](../../models/shared/targetaccountoption.md)] | :heavy_minus_sign: | An array of potential target accounts. | | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/banktransactions.md b/bank-feeds/docs/models/shared/banktransaction.md similarity index 98% rename from bank-feeds/docs/models/shared/banktransactions.md rename to bank-feeds/docs/models/shared/banktransaction.md index 8295d90e8..0a04f11a6 100644 --- a/bank-feeds/docs/models/shared/banktransactions.md +++ b/bank-feeds/docs/models/shared/banktransaction.md @@ -1,16 +1,16 @@ -# BankTransactions - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | The amount transacted in the bank transaction. | 999.99 | -| `balance` | *Optional[Decimal]* | :heavy_minus_sign: | The remaining balance in the account with ID `accountId`. This field is optional for QuickBooks Online but is required for Xero, Sage, NetSuite, Exact, and FreeAgent. | -999.99 | -| `counterparty` | *OptionalNullable[str]* | :heavy_minus_sign: | The giving or receiving party such as a person or organization. | ACME INC | -| `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:

```
2023-08-22T10:21:00
2023-08-22
```

When pushing bank transaction data to Codat, the date is treated as a local date. This means:

- The date/time is used exactly as provided, without any timezone conversion.
- If a timezone offset is included (e.g., `2023-08-22T10:21:00-05:00`), the offset will be ignored and only the local date/time portion will be used.
- We recommend providing dates without a timezone suffix for clarity (e.g., `2023-08-22T10:21:00` rather than `2023-08-22T10:21:00Z`). | **Example 1:** 2023-08-22T10:21:00
**Example 2:** 2023-08-22 | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the bank transaction. | Debit for Payment Id sdp-1-57379a43-c4b8-49f5-bd7c-699189ee7a60 | -| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the bank account transaction, unique for the company in the accounting software. | 716422529 | -| `reconciled` | *OptionalNullable[bool]* | :heavy_minus_sign: | `True` if the bank transaction has been [reconciled](https://www.xero.com/uk/guides/what-is-bank-reconciliation/) in the accounting software. | false | -| `reference` | *OptionalNullable[str]* | :heavy_minus_sign: | An optional reference to the bank transaction. | reference for transaction | -| `transaction_type` | [OptionalNullable[shared.BankTransactionType]](../../models/shared/banktransactiontype.md) | :heavy_minus_sign: | Type of transaction for the bank statement line. | | \ No newline at end of file +# BankTransaction + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | The amount transacted in the bank transaction. | 999.99 | +| `balance` | *Optional[Decimal]* | :heavy_minus_sign: | The remaining balance in the account with ID `accountId`. This field is optional for QuickBooks Online but is required for Xero, Sage, NetSuite, Exact, and FreeAgent. | -999.99 | +| `counterparty` | *Optional[str]* | :heavy_minus_sign: | The giving or receiving party such as a person or organization. | ACME INC | +| `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:

```
2023-08-22T10:21:00
2023-08-22
```

When pushing bank transaction data to Codat, the date is treated as a local date. This means:

- The date/time is used exactly as provided, without any timezone conversion.
- If a timezone offset is included (e.g., `2023-08-22T10:21:00-05:00`), the offset will be ignored and only the local date/time portion will be used.
- We recommend providing dates without a timezone suffix for clarity (e.g., `2023-08-22T10:21:00` rather than `2023-08-22T10:21:00Z`). | **Example 1:** 2023-08-22T10:21:00
**Example 2:** 2023-08-22 | +| `description` | *Optional[str]* | :heavy_minus_sign: | Description of the bank transaction. | Debit for Payment Id sdp-1-57379a43-c4b8-49f5-bd7c-699189ee7a60 | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the bank account transaction, unique for the company in the accounting software. | 716422529 | +| `reconciled` | *Optional[bool]* | :heavy_minus_sign: | `True` if the bank transaction has been [reconciled](https://www.xero.com/uk/guides/what-is-bank-reconciliation/) in the accounting software. | false | +| `reference` | *Optional[str]* | :heavy_minus_sign: | An optional reference to the bank transaction. | reference for transaction | +| `transaction_type` | [Optional[shared.BankTransactionType]](../../models/shared/banktransactiontype.md) | :heavy_minus_sign: | Type of transaction for the bank statement line. | | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/banktransactiontype.md b/bank-feeds/docs/models/shared/banktransactiontype.md index 910f23efc..222bf46d6 100644 --- a/bank-feeds/docs/models/shared/banktransactiontype.md +++ b/bank-feeds/docs/models/shared/banktransactiontype.md @@ -1,35 +1,35 @@ -# BankTransactionType - -Type of transaction for the bank statement line. - -## Example Usage - -```python -from codat_bankfeeds.models.shared import BankTransactionType - -value = BankTransactionType.UNKNOWN -``` - - -## Values - -| Name | Value | -| -------------- | -------------- | -| `UNKNOWN` | Unknown | -| `CREDIT` | Credit | -| `DEBIT` | Debit | -| `INT` | Int | -| `DIV` | Div | -| `FEE` | Fee | -| `SER_CHG` | SerChg | -| `DEP` | Dep | -| `ATM` | Atm | -| `POS` | Pos | -| `XFER` | Xfer | -| `CHECK` | Check | -| `PAYMENT` | Payment | -| `CASH` | Cash | -| `DIRECT_DEP` | DirectDep | -| `DIRECT_DEBIT` | DirectDebit | -| `REPEAT_PMT` | RepeatPmt | +# BankTransactionType + +Type of transaction for the bank statement line. + +## Example Usage + +```python +from codat_bankfeeds.models.shared import BankTransactionType + +value = BankTransactionType.UNKNOWN +``` + + +## Values + +| Name | Value | +| -------------- | -------------- | +| `UNKNOWN` | Unknown | +| `CREDIT` | Credit | +| `DEBIT` | Debit | +| `INT` | Int | +| `DIV` | Div | +| `FEE` | Fee | +| `SER_CHG` | SerChg | +| `DEP` | Dep | +| `ATM` | Atm | +| `POS` | Pos | +| `XFER` | Xfer | +| `CHECK` | Check | +| `PAYMENT` | Payment | +| `CASH` | Cash | +| `DIRECT_DEP` | DirectDep | +| `DIRECT_DEBIT` | DirectDebit | +| `REPEAT_PMT` | RepeatPmt | | `OTHER` | Other | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/clientratelimitwebhook.md b/bank-feeds/docs/models/shared/clientratelimitwebhook.md index 36e2030f0..8ecf1141e 100644 --- a/bank-feeds/docs/models/shared/clientratelimitwebhook.md +++ b/bank-feeds/docs/models/shared/clientratelimitwebhook.md @@ -1,11 +1,11 @@ -# ClientRateLimitWebhook - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `event_type` | *Optional[str]* | :heavy_minus_sign: | The type of event. | **Example 1:** client.rateLimit.reset
**Example 2:** client.rateLimit.reached | -| `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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the event. | 743ec94a-8aa4-44bb-8bd4-e1855ee0e74b | +# ClientRateLimitWebhook + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `event_type` | *Optional[str]* | :heavy_minus_sign: | The type of event. | **Example 1:** client.rateLimit.reset
**Example 2:** client.rateLimit.reached | +| `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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the event. | 743ec94a-8aa4-44bb-8bd4-e1855ee0e74b | | `payload` | [Optional[shared.ClientRateLimitWebhookPayload]](../../models/shared/clientratelimitwebhookpayload.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/clientratelimitwebhookpayload.md b/bank-feeds/docs/models/shared/clientratelimitwebhookpayload.md index 41b82096c..ae6051b29 100644 --- a/bank-feeds/docs/models/shared/clientratelimitwebhookpayload.md +++ b/bank-feeds/docs/models/shared/clientratelimitwebhookpayload.md @@ -1,10 +1,10 @@ -# ClientRateLimitWebhookPayload - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `daily_quota` | *Optional[int]* | :heavy_minus_sign: | The number of available requests per day. | | -| `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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +# ClientRateLimitWebhookPayload + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `daily_quota` | *Optional[int]* | :heavy_minus_sign: | The number of available requests per day. | | +| `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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | | `quota_remaining` | *Optional[int]* | :heavy_minus_sign: | Total number of requests remaining for your client. | | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/companies.md b/bank-feeds/docs/models/shared/companies.md index 670c41db2..a4a43b1c2 100644 --- a/bank-feeds/docs/models/shared/companies.md +++ b/bank-feeds/docs/models/shared/companies.md @@ -1,12 +1,12 @@ -# Companies - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | -| `links` | [shared.Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} | -| `page_number` | *int* | :heavy_check_mark: | Current page number. | | -| `page_size` | *int* | :heavy_check_mark: | Number of items to return in results array. | | -| `results` | List[[shared.Company](../../models/shared/company.md)] | :heavy_minus_sign: | N/A | | +# Companies + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `links` | [shared.Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} | +| `page_number` | *int* | :heavy_check_mark: | Current page number. | | +| `page_size` | *int* | :heavy_check_mark: | Number of items to return in results array. | | +| `results` | List[[shared.Company](../../models/shared/company.md)] | :heavy_minus_sign: | N/A | | | `total_results` | *int* | :heavy_check_mark: | Total number of items. | | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/company.md b/bank-feeds/docs/models/shared/company.md index a73391baf..698d9850f 100644 --- a/bank-feeds/docs/models/shared/company.md +++ b/bank-feeds/docs/models/shared/company.md @@ -1,25 +1,25 @@ -# Company - -In Codat, a company represents a business sharing access to their data. Each company can have multiple [connections](https://docs.codat.io/bank-feeds-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 | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `created_by_user_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of user that created the company in Codat. | | -| `data_connections` | List[[shared.Connection](../../models/shared/connection.md)] | :heavy_minus_sign: | N/A | | -| `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. | -| `id` | *str* | :heavy_check_mark: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `name` | *str* | :heavy_check_mark: | The name of the company | Codat Ltd. | -| `products` | List[*str*] | :heavy_minus_sign: | An array of products that are currently enabled for the company. | | -| `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 | -| `reference_parent_company` | [Optional[shared.CompanyReference]](../../models/shared/companyreference.md) | :heavy_minus_sign: | N/A | | -| `reference_subsidiary_companies` | List[[shared.CompanyReference](../../models/shared/companyreference.md)] | :heavy_minus_sign: | A list of subsidiary companies owned or controlled by this entity. Empty if the company has no children. | | +# Company + +In Codat, a company represents a business sharing access to their data. Each company can have multiple [connections](https://docs.codat.io/bank-feeds-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 | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `created_by_user_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of user that created the company in Codat. | | +| `data_connections` | List[[shared.Connection](../../models/shared/connection.md)] | :heavy_minus_sign: | N/A | | +| `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. | +| `id` | *str* | :heavy_check_mark: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `name` | *str* | :heavy_check_mark: | The name of the company | Codat Ltd. | +| `products` | List[*str*] | :heavy_minus_sign: | An array of products that are currently enabled for the company. | | +| `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 | +| `reference_parent_company` | [Optional[shared.CompanyReference]](../../models/shared/companyreference.md) | :heavy_minus_sign: | The parent entity or controlling organization of this company. Null if the company has no parent. | | +| `reference_subsidiary_companies` | List[[shared.CompanyReference](../../models/shared/companyreference.md)] | :heavy_minus_sign: | A list of subsidiary companies owned or controlled by this entity. Empty if the company has no children. | | | `tags` | Dict[str, *str*] | :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/bank-feeds/docs/models/shared/companyaccesstoken.md b/bank-feeds/docs/models/shared/companyaccesstoken.md index a6304c6d3..fee04db9e 100644 --- a/bank-feeds/docs/models/shared/companyaccesstoken.md +++ b/bank-feeds/docs/models/shared/companyaccesstoken.md @@ -1,12 +1,12 @@ -# CompanyAccessToken - -Details of the access token provisioned for a company. - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `access_token` | *str* | :heavy_check_mark: | The access token for the company. | | -| `expires_in` | *int* | :heavy_check_mark: | The number of seconds until the access token expires. | 86400 | +# CompanyAccessToken + +Details of the access token provisioned for a company. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | +| `access_token` | *str* | :heavy_check_mark: | The access token for the company. | | +| `expires_in` | *int* | :heavy_check_mark: | The number of seconds until the access token expires. | 86400 | | `token_type` | *str* | :heavy_check_mark: | The type of token. | Bearer | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/companydetails.md b/bank-feeds/docs/models/shared/companydetails.md new file mode 100644 index 000000000..ec8efb694 --- /dev/null +++ b/bank-feeds/docs/models/shared/companydetails.md @@ -0,0 +1,18 @@ +# CompanyDetails + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `created_by_user_name` | *Optional[str]* | :heavy_minus_sign: | Name of user that created the company in Codat. | | +| `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. | +| `id` | *str* | :heavy_check_mark: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `name` | *str* | :heavy_check_mark: | The name of the company | Codat Ltd. | +| `products` | List[*str*] | :heavy_minus_sign: | An array of products that are currently enabled for the company. | | +| `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 | +| `reference_parent_company` | [Optional[shared.CompanyReference]](../../models/shared/companyreference.md) | :heavy_minus_sign: | The parent entity or controlling organization of this company. Null if the company has no parent. | | +| `reference_subsidiary_companies` | List[[shared.CompanyReference](../../models/shared/companyreference.md)] | :heavy_minus_sign: | A list of subsidiary companies owned or controlled by this entity. Empty if the company has no children. | | +| `tags` | Dict[str, *str*] | :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/bank-feeds/docs/models/shared/companyinformation.md b/bank-feeds/docs/models/shared/companyinformation.md index e981bd251..b47bff3fc 100644 --- a/bank-feeds/docs/models/shared/companyinformation.md +++ b/bank-feeds/docs/models/shared/companyinformation.md @@ -1,14 +1,14 @@ -# CompanyInformation - -Information about the company from the underlying accounting software. - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `base_currency` | *Optional[str]* | :heavy_minus_sign: | Currency set in the accounting software of the linked company. | -| `company_name` | *Optional[str]* | :heavy_minus_sign: | Name of the linked company. | -| `currencies` | List[*str*] | :heavy_minus_sign: | Array of enabled currencies for the linked company. | -| `multicurrency_enabled` | *Optional[bool]* | :heavy_minus_sign: | Boolean showing if the organisation has multicurrency enabled. | +# CompanyInformation + +Information about the company from the underlying accounting software. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | +| `base_currency` | *Optional[str]* | :heavy_minus_sign: | Currency set in the accounting software of the linked company. | +| `company_name` | *Optional[str]* | :heavy_minus_sign: | Name of the linked company. | +| `currencies` | List[*str*] | :heavy_minus_sign: | Array of enabled currencies for the linked company. | +| `multicurrency_enabled` | *Optional[bool]* | :heavy_minus_sign: | Boolean showing if the organisation has multicurrency enabled. | | `plan_type` | *OptionalNullable[str]* | :heavy_minus_sign: | Accounting software subscription type such as Trial, Demo, Standard. | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/companyreference.md b/bank-feeds/docs/models/shared/companyreference.md index b651f69d5..97b15c6bc 100644 --- a/bank-feeds/docs/models/shared/companyreference.md +++ b/bank-feeds/docs/models/shared/companyreference.md @@ -1,12 +1,12 @@ -# CompanyReference - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | -| `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. | -| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `links` | [Optional[shared.CompanyReferenceLinks]](../../models/shared/companyreferencelinks.md) | :heavy_minus_sign: | A collection of links for the company. | | -| `name` | *Optional[str]* | :heavy_minus_sign: | The name of the company | Codat Ltd. | +# CompanyReference + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `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. | +| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `links` | [Optional[shared.CompanyReferenceLinks]](../../models/shared/companyreferencelinks.md) | :heavy_minus_sign: | A collection of links for the company. | | +| `name` | *Optional[str]* | :heavy_minus_sign: | The name of the company | Codat Ltd. | | `tags` | Dict[str, *str*] | :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/bank-feeds/docs/models/shared/companyreferencelinks.md b/bank-feeds/docs/models/shared/companyreferencelinks.md index ee01fd320..a4c491724 100644 --- a/bank-feeds/docs/models/shared/companyreferencelinks.md +++ b/bank-feeds/docs/models/shared/companyreferencelinks.md @@ -1,10 +1,10 @@ -# CompanyReferenceLinks - -A collection of links for the company. - - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------- | --------------------------------------- | --------------------------------------- | --------------------------------------- | +# CompanyReferenceLinks + +A collection of links for the company. + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------- | --------------------------------------- | --------------------------------------- | --------------------------------------- | | `portal` | *Optional[str]* | :heavy_minus_sign: | Link to the company page in the portal. | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/companyrequestbody.md b/bank-feeds/docs/models/shared/companyrequestbody.md index 3ae35b3c7..107790e6e 100644 --- a/bank-feeds/docs/models/shared/companyrequestbody.md +++ b/bank-feeds/docs/models/shared/companyrequestbody.md @@ -1,10 +1,10 @@ -# CompanyRequestBody - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | -| `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. | -| `name` | *str* | :heavy_check_mark: | Name of company being connected. | Bank of Dave | +# CompanyRequestBody + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `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. | +| `name` | *str* | :heavy_check_mark: | Name of company being connected. | Bank of Dave | | `tags` | Dict[str, *str*] | :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/bank-feeds/docs/models/shared/companyupdaterequest.md b/bank-feeds/docs/models/shared/companyupdaterequest.md index c79edb11b..1ae031209 100644 --- a/bank-feeds/docs/models/shared/companyupdaterequest.md +++ b/bank-feeds/docs/models/shared/companyupdaterequest.md @@ -1,10 +1,10 @@ -# CompanyUpdateRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | -| `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. | -| `name` | *Optional[str]* | :heavy_minus_sign: | Name of company being connected. | Bank of Dave | +# CompanyUpdateRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `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. | +| `name` | *Optional[str]* | :heavy_minus_sign: | Name of company being connected. | Bank of Dave | | `tags` | Dict[str, *str*] | :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/bank-feeds/docs/models/shared/connection.md b/bank-feeds/docs/models/shared/connection.md index 8cca7306a..d40a055ef 100644 --- a/bank-feeds/docs/models/shared/connection.md +++ b/bank-feeds/docs/models/shared/connection.md @@ -1,30 +1,31 @@ -# Connection - -A connection represents a [company's](https://docs.codat.io/bank-feeds-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 | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `connection_info` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | | -| `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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `data_connection_errors` | List[[shared.DataConnectionError](../../models/shared/dataconnectionerror.md)] | :heavy_minus_sign: | N/A | | -| `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` | *Optional[str]* | :heavy_minus_sign: | 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. | | -| `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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `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 | -| `platform_name` | *str* | :heavy_check_mark: | Name of integration connected to company. | | -| `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 | +# Connection + +A connection represents a [company's](https://docs.codat.io/bank-feeds-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 | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `additional_properties` | Dict[str, *Any*] | :heavy_check_mark: | N/A | | +| `connection_info` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | | +| `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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `data_connection_errors` | List[[shared.DataConnectionError](../../models/shared/dataconnectionerror.md)] | :heavy_minus_sign: | N/A | | +| `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` | *Optional[str]* | :heavy_minus_sign: | 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. | | +| `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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `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 | +| `platform_name` | *str* | :heavy_check_mark: | Name of integration connected to company. | | +| `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 | | `status` | [shared.DataConnectionStatus](../../models/shared/dataconnectionstatus.md) | :heavy_check_mark: | The current authorization status of the data connection. | | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/connections.md b/bank-feeds/docs/models/shared/connections.md index 69b3bdc2c..29a1b8ed3 100644 --- a/bank-feeds/docs/models/shared/connections.md +++ b/bank-feeds/docs/models/shared/connections.md @@ -1,12 +1,12 @@ -# Connections - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | -| `links` | [shared.Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} | -| `page_number` | *int* | :heavy_check_mark: | Current page number. | | -| `page_size` | *int* | :heavy_check_mark: | Number of items to return in results array. | | -| `results` | List[[shared.Connection](../../models/shared/connection.md)] | :heavy_minus_sign: | N/A | | +# Connections + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `links` | [shared.Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} | +| `page_number` | *int* | :heavy_check_mark: | Current page number. | | +| `page_size` | *int* | :heavy_check_mark: | Number of items to return in results array. | | +| `results` | List[[shared.Connection](../../models/shared/connection.md)] | :heavy_minus_sign: | N/A | | | `total_results` | *int* | :heavy_check_mark: | Total number of items. | | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/createbanktransactions.md b/bank-feeds/docs/models/shared/createbanktransactions.md index 7d7543da5..e338c7438 100644 --- a/bank-feeds/docs/models/shared/createbanktransactions.md +++ b/bank-feeds/docs/models/shared/createbanktransactions.md @@ -1,9 +1,9 @@ -# CreateBankTransactions - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_id` | *str* | :heavy_check_mark: | Unique identifier for a bank account. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ
**Example 5:** Checking 0202 | -| `transactions` | List[[shared.BankTransactions](../../models/shared/banktransactions.md)] | :heavy_check_mark: | N/A | | \ No newline at end of file +# CreateBankTransactions + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_id` | *str* | :heavy_check_mark: | Unique identifier for a bank account. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ
**Example 5:** Checking 0202 | +| `transactions` | List[[shared.BankTransaction](../../models/shared/banktransaction.md)] | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/createbanktransactionsresponse.md b/bank-feeds/docs/models/shared/createbanktransactionsresponse.md index 3825f1494..c6613d056 100644 --- a/bank-feeds/docs/models/shared/createbanktransactionsresponse.md +++ b/bank-feeds/docs/models/shared/createbanktransactionsresponse.md @@ -1,21 +1,21 @@ -# CreateBankTransactionsResponse - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `changes` | List[[shared.PushOperationChange](../../models/shared/pushoperationchange.md)] | :heavy_minus_sign: | Contains a single entry that communicates which record has changed and the manner in which it changed. | | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `completed_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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `data` | [Optional[shared.CreateBankTransactions]](../../models/shared/createbanktransactions.md) | :heavy_minus_sign: | N/A | | -| `data_connection_key` | *str* | :heavy_check_mark: | Unique identifier for a company's data connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | -| `data_type` | [Optional[shared.DataType]](../../models/shared/datatype.md) | :heavy_minus_sign: | Available data types | invoices | -| `error_message` | *OptionalNullable[str]* | :heavy_minus_sign: | A message about the error. | | -| `push_operation_key` | *str* | :heavy_check_mark: | A unique identifier generated by Codat to represent this single push operation. This identifier can be used to track the status of the push, and should be persisted. | | -| `requested_on_utc` | *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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `status` | [shared.PushOperationStatus](../../models/shared/pushoperationstatus.md) | :heavy_check_mark: | The current status of the push operation. | | -| `status_code` | *int* | :heavy_check_mark: | Push status code. | | -| `timeout_in_minutes` | *OptionalNullable[int]* | :heavy_minus_sign: | Number of minutes the push operation must complete within before it times out. | | -| ~~`timeout_in_seconds`~~ | *OptionalNullable[int]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Number of seconds the push operation must complete within before it times out. | | +# CreateBankTransactionsResponse + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `changes` | List[[shared.PushOperationChange](../../models/shared/pushoperationchange.md)] | :heavy_minus_sign: | Contains a single entry that communicates which record has changed and the manner in which it changed. | | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `completed_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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `data` | [Optional[shared.CreateBankTransactions]](../../models/shared/createbanktransactions.md) | :heavy_minus_sign: | N/A | | +| `data_connection_key` | *str* | :heavy_check_mark: | Unique identifier for a company's data connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `data_type` | [Optional[shared.DataType]](../../models/shared/datatype.md) | :heavy_minus_sign: | Available data types | invoices | +| `error_message` | *OptionalNullable[str]* | :heavy_minus_sign: | A message about the error. | | +| `push_operation_key` | *str* | :heavy_check_mark: | A unique identifier generated by Codat to represent this single push operation. This identifier can be used to track the status of the push, and should be persisted. | | +| `requested_on_utc` | *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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `status` | [shared.PushOperationStatus](../../models/shared/pushoperationstatus.md) | :heavy_check_mark: | The current status of the push operation. | | +| `status_code` | *int* | :heavy_check_mark: | Push status code. | | +| `timeout_in_minutes` | *OptionalNullable[int]* | :heavy_minus_sign: | Number of minutes the push operation must complete within before it times out. | | +| ~~`timeout_in_seconds`~~ | *OptionalNullable[int]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Number of seconds the push operation must complete within before it times out. | | | `validation` | [Optional[shared.Validation]](../../models/shared/validation.md) | :heavy_minus_sign: | A human-readable object describing validation decisions Codat has made when pushing data into the platform. If a push has failed because of validation errors, they will be detailed here. | | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/createbatchsourceaccount201responseinner.md b/bank-feeds/docs/models/shared/createbatchsourceaccount201responseinner.md new file mode 100644 index 000000000..e128020b6 --- /dev/null +++ b/bank-feeds/docs/models/shared/createbatchsourceaccount201responseinner.md @@ -0,0 +1,11 @@ +# CreateBatchSourceAccount201ResponseInner + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | +| `actual_instance` | *Optional[Union[SourceAccountBatchCreateResponse, SourceAccountV2BatchCreateResponse]]* | :heavy_minus_sign: | N/A | +| `one_of_schemas` | *Set[str]* | :heavy_check_mark: | N/A | +| `oneof_schema_1_validator` | [Optional[shared.SourceAccountV2BatchCreateResponse]](../../models/shared/sourceaccountv2batchcreateresponse.md) | :heavy_minus_sign: | N/A | +| `oneof_schema_2_validator` | [Optional[shared.SourceAccountBatchCreateResponse]](../../models/shared/sourceaccountbatchcreateresponse.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/createbatchsourceaccount207responseinner.md b/bank-feeds/docs/models/shared/createbatchsourceaccount207responseinner.md new file mode 100644 index 000000000..7206aba3d --- /dev/null +++ b/bank-feeds/docs/models/shared/createbatchsourceaccount207responseinner.md @@ -0,0 +1,12 @@ +# CreateBatchSourceAccount207ResponseInner + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | +| `actual_instance` | *Optional[Union[SourceAccountBatchCreateResponse, SourceAccountBatchErrorResponse, SourceAccountV2BatchCreateResponse]]* | :heavy_minus_sign: | N/A | +| `one_of_schemas` | *Set[str]* | :heavy_check_mark: | N/A | +| `oneof_schema_1_validator` | [Optional[shared.SourceAccountV2BatchCreateResponse]](../../models/shared/sourceaccountv2batchcreateresponse.md) | :heavy_minus_sign: | N/A | +| `oneof_schema_2_validator` | [Optional[shared.SourceAccountBatchCreateResponse]](../../models/shared/sourceaccountbatchcreateresponse.md) | :heavy_minus_sign: | N/A | +| `oneof_schema_3_validator` | [Optional[shared.SourceAccountBatchErrorResponse]](../../models/shared/sourceaccountbatcherrorresponse.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/createbatchsourceaccountrequestbody.md b/bank-feeds/docs/models/shared/createbatchsourceaccountrequestbody.md new file mode 100644 index 000000000..3b5305afc --- /dev/null +++ b/bank-feeds/docs/models/shared/createbatchsourceaccountrequestbody.md @@ -0,0 +1,11 @@ +# CreateBatchSourceAccountRequestBody + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `actual_instance` | *Optional[Union[List[SourceAccountPrototype], List[SourceAccountV2Prototype]]]* | :heavy_minus_sign: | N/A | +| `one_of_schemas` | *Set[str]* | :heavy_check_mark: | N/A | +| `oneof_schema_1_validator` | List[[shared.SourceAccountV2Prototype](../../models/shared/sourceaccountv2prototype.md)] | :heavy_minus_sign: | N/A | +| `oneof_schema_2_validator` | List[[shared.SourceAccountPrototype](../../models/shared/sourceaccountprototype.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/createconnectionrequest.md b/bank-feeds/docs/models/shared/createconnectionrequest.md new file mode 100644 index 000000000..dcf930d2f --- /dev/null +++ b/bank-feeds/docs/models/shared/createconnectionrequest.md @@ -0,0 +1,8 @@ +# CreateConnectionRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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. | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/createsourceaccount200response.md b/bank-feeds/docs/models/shared/createsourceaccount200response.md new file mode 100644 index 000000000..2f646e66c --- /dev/null +++ b/bank-feeds/docs/models/shared/createsourceaccount200response.md @@ -0,0 +1,11 @@ +# CreateSourceAccount200Response + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `actual_instance` | *Optional[Union[SourceAccount, SourceAccountV2]]* | :heavy_minus_sign: | N/A | +| `one_of_schemas` | *Set[str]* | :heavy_check_mark: | N/A | +| `oneof_schema_1_validator` | [Optional[shared.SourceAccountV2]](../../models/shared/sourceaccountv2.md) | :heavy_minus_sign: | N/A | +| `oneof_schema_2_validator` | [Optional[shared.SourceAccount]](../../models/shared/sourceaccount.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/createsourceaccountrequest.md b/bank-feeds/docs/models/shared/createsourceaccountrequest.md new file mode 100644 index 000000000..96ce20b9c --- /dev/null +++ b/bank-feeds/docs/models/shared/createsourceaccountrequest.md @@ -0,0 +1,11 @@ +# CreateSourceAccountRequest + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `actual_instance` | *Optional[Union[SourceAccountPrototype, SourceAccountV2Prototype]]* | :heavy_minus_sign: | N/A | +| `one_of_schemas` | *Set[str]* | :heavy_check_mark: | N/A | +| `oneof_schema_1_validator` | [Optional[shared.SourceAccountV2Prototype]](../../models/shared/sourceaccountv2prototype.md) | :heavy_minus_sign: | N/A | +| `oneof_schema_2_validator` | [Optional[shared.SourceAccountPrototype]](../../models/shared/sourceaccountprototype.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/dataconnectionerror.md b/bank-feeds/docs/models/shared/dataconnectionerror.md index 33b523477..96b4828fa 100644 --- a/bank-feeds/docs/models/shared/dataconnectionerror.md +++ b/bank-feeds/docs/models/shared/dataconnectionerror.md @@ -1,13 +1,13 @@ -# DataConnectionError - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `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. | | -| `status_code` | *Optional[str]* | :heavy_minus_sign: | The HTTP status code returned by the source platform when the error occurred. | | +# DataConnectionError + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `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. | | +| `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. | | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/dataconnectionstatus.md b/bank-feeds/docs/models/shared/dataconnectionstatus.md index 5607abb70..3822b4a7d 100644 --- a/bank-feeds/docs/models/shared/dataconnectionstatus.md +++ b/bank-feeds/docs/models/shared/dataconnectionstatus.md @@ -1,21 +1,21 @@ -# DataConnectionStatus - -The current authorization status of the data connection. - -## Example Usage - -```python -from codat_bankfeeds.models.shared import DataConnectionStatus - -value = DataConnectionStatus.PENDING_AUTH -``` - - -## Values - -| Name | Value | -| -------------- | -------------- | -| `PENDING_AUTH` | PendingAuth | -| `LINKED` | Linked | -| `UNLINKED` | Unlinked | +# DataConnectionStatus + +The current authorization status of the data connection. + +## Example Usage + +```python +from codat_bankfeeds.models.shared import DataConnectionStatus + +value = DataConnectionStatus.PENDING_AUTH +``` + + +## Values + +| Name | Value | +| -------------- | -------------- | +| `PENDING_AUTH` | PendingAuth | +| `LINKED` | Linked | +| `UNLINKED` | Unlinked | | `DEAUTHORIZED` | Deauthorized | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/datasetstatus.md b/bank-feeds/docs/models/shared/datasetstatus.md new file mode 100644 index 000000000..79bd2b176 --- /dev/null +++ b/bank-feeds/docs/models/shared/datasetstatus.md @@ -0,0 +1,38 @@ +# DatasetStatus + +The current status of the dataset. + +## Example Usage + +```python +from codat_bankfeeds.models.shared import DatasetStatus + +value = DatasetStatus.INITIAL +``` + + +## Values + +| Name | Value | +| ---------------------- | ---------------------- | +| `INITIAL` | Initial | +| `QUEUED` | Queued | +| `FETCHING` | Fetching | +| `MAP_QUEUED` | MapQueued | +| `MAPPING` | Mapping | +| `COMPLETE` | Complete | +| `FETCH_ERROR` | FetchError | +| `MAP_ERROR` | MapError | +| `INTERNAL_ERROR` | InternalError | +| `PROCESSING_QUEUED` | ProcessingQueued | +| `PROCESSING` | Processing | +| `PROCESSING_ERROR` | ProcessingError | +| `VALIDATION_QUEUED` | ValidationQueued | +| `VALIDATING` | Validating | +| `VALIDATION_ERROR` | ValidationError | +| `AUTH_ERROR` | AuthError | +| `CANCELLED` | Cancelled | +| `NOT_SUPPORTED` | NotSupported | +| `RATE_LIMIT_ERROR` | RateLimitError | +| `PERMISSIONS_ERROR` | PermissionsError | +| `PREREQUISITE_NOT_MET` | PrerequisiteNotMet | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/datatype.md b/bank-feeds/docs/models/shared/datatype.md index 13d7b63e1..576eed07a 100644 --- a/bank-feeds/docs/models/shared/datatype.md +++ b/bank-feeds/docs/models/shared/datatype.md @@ -1,60 +1,75 @@ -# DataType - -Available data types - -## Example Usage - -```python -from codat_bankfeeds.models.shared import DataType - -value = DataType.ACCOUNT_TRANSACTIONS -``` - - -## Values - -| Name | Value | -| -------------------------------- | -------------------------------- | -| `ACCOUNT_TRANSACTIONS` | accountTransactions | -| `BALANCE_SHEET` | balanceSheet | -| `BANK_ACCOUNTS` | bankAccounts | -| `BANK_TRANSACTIONS` | bankTransactions | -| `BILL_CREDIT_NOTES` | billCreditNotes | -| `BILL_PAYMENTS` | billPayments | -| `BILLS` | bills | -| `CASH_FLOW_STATEMENT` | cashFlowStatement | -| `CHART_OF_ACCOUNTS` | chartOfAccounts | -| `COMPANY` | company | -| `CREDIT_NOTES` | creditNotes | -| `CUSTOMERS` | customers | -| `DIRECT_COSTS` | directCosts | -| `DIRECT_INCOMES` | directIncomes | -| `INVOICES` | invoices | -| `ITEM_RECEIPTS` | itemReceipts | -| `ITEMS` | items | -| `JOURNAL_ENTRIES` | journalEntries | -| `JOURNALS` | journals | -| `PAYMENT_METHODS` | paymentMethods | -| `PAYMENTS` | payments | -| `PROFIT_AND_LOSS` | profitAndLoss | -| `PURCHASE_ORDERS` | purchaseOrders | -| `SALES_ORDERS` | salesOrders | -| `SUPPLIERS` | suppliers | -| `TAX_RATES` | taxRates | -| `TRACKING_CATEGORIES` | trackingCategories | -| `TRANSFERS` | transfers | -| `BANKING_ACCOUNT_BALANCES` | banking-accountBalances | -| `BANKING_ACCOUNTS` | banking-accounts | -| `BANKING_TRANSACTION_CATEGORIES` | banking-transactionCategories | -| `BANKING_TRANSACTIONS` | banking-transactions | -| `COMMERCE_COMPANY_INFO` | commerce-companyInfo | -| `COMMERCE_CUSTOMERS` | commerce-customers | -| `COMMERCE_DISPUTES` | commerce-disputes | -| `COMMERCE_LOCATIONS` | commerce-locations | -| `COMMERCE_ORDERS` | commerce-orders | -| `COMMERCE_PAYMENT_METHODS` | commerce-paymentMethods | -| `COMMERCE_PAYMENTS` | commerce-payments | -| `COMMERCE_PRODUCT_CATEGORIES` | commerce-productCategories | -| `COMMERCE_PRODUCTS` | commerce-products | -| `COMMERCE_TAX_COMPONENTS` | commerce-taxComponents | -| `COMMERCE_TRANSACTIONS` | commerce-transactions | \ No newline at end of file +# DataType + +Available data types + +## Example Usage + +```python +from codat_bankfeeds.models.shared import DataType + +value = DataType.ACCOUNT_TRANSACTIONS +``` + + +## Values + +| Name | Value | +| -------------------------------------- | -------------------------------------- | +| `ACCOUNT_TRANSACTIONS` | accountTransactions | +| `BALANCE_SHEET` | balanceSheet | +| `BANK_ACCOUNTS` | bankAccounts | +| `BANK_TRANSACTIONS` | bankTransactions | +| `BILL_CREDIT_NOTES` | billCreditNotes | +| `BILL_PAYMENTS` | billPayments | +| `BILLS` | bills | +| `CASH_FLOW_STATEMENT` | cashFlowStatement | +| `CHART_OF_ACCOUNTS` | chartOfAccounts | +| `COMPANY` | company | +| `CREDIT_NOTES` | creditNotes | +| `CUSTOMERS` | customers | +| `DIRECT_COSTS` | directCosts | +| `DIRECT_INCOMES` | directIncomes | +| `INVOICES` | invoices | +| `ITEM_RECEIPTS` | itemReceipts | +| `ITEMS` | items | +| `JOURNAL_ENTRIES` | journalEntries | +| `JOURNALS` | journals | +| `PAYMENT_METHODS` | paymentMethods | +| `PAYMENTS` | payments | +| `PROFIT_AND_LOSS` | profitAndLoss | +| `PURCHASE_ORDERS` | purchaseOrders | +| `SALES_ORDERS` | salesOrders | +| `SUPPLIERS` | suppliers | +| `TAX_RATES` | taxRates | +| `TRACKING_CATEGORIES` | trackingCategories | +| `TRANSFERS` | transfers | +| `BANKING_MINUS_ACCOUNT_BALANCES` | banking-accountBalances | +| `BANKING_ACCOUNT_BALANCES` | banking-accountBalances | +| `BANKING_MINUS_ACCOUNTS` | banking-accounts | +| `BANKING_ACCOUNTS` | banking-accounts | +| `BANKING_MINUS_TRANSACTION_CATEGORIES` | banking-transactionCategories | +| `BANKING_TRANSACTION_CATEGORIES` | banking-transactionCategories | +| `BANKING_MINUS_TRANSACTIONS` | banking-transactions | +| `BANKING_TRANSACTIONS` | banking-transactions | +| `COMMERCE_MINUS_COMPANY_INFO` | commerce-companyInfo | +| `COMMERCE_COMPANY_INFO` | commerce-companyInfo | +| `COMMERCE_MINUS_CUSTOMERS` | commerce-customers | +| `COMMERCE_CUSTOMERS` | commerce-customers | +| `COMMERCE_MINUS_DISPUTES` | commerce-disputes | +| `COMMERCE_DISPUTES` | commerce-disputes | +| `COMMERCE_MINUS_LOCATIONS` | commerce-locations | +| `COMMERCE_LOCATIONS` | commerce-locations | +| `COMMERCE_MINUS_ORDERS` | commerce-orders | +| `COMMERCE_ORDERS` | commerce-orders | +| `COMMERCE_MINUS_PAYMENT_METHODS` | commerce-paymentMethods | +| `COMMERCE_PAYMENT_METHODS` | commerce-paymentMethods | +| `COMMERCE_MINUS_PAYMENTS` | commerce-payments | +| `COMMERCE_PAYMENTS` | commerce-payments | +| `COMMERCE_MINUS_PRODUCT_CATEGORIES` | commerce-productCategories | +| `COMMERCE_PRODUCT_CATEGORIES` | commerce-productCategories | +| `COMMERCE_MINUS_PRODUCTS` | commerce-products | +| `COMMERCE_PRODUCTS` | commerce-products | +| `COMMERCE_MINUS_TAX_COMPONENTS` | commerce-taxComponents | +| `COMMERCE_TAX_COMPONENTS` | commerce-taxComponents | +| `COMMERCE_MINUS_TRANSACTIONS` | commerce-transactions | +| `COMMERCE_TRANSACTIONS` | commerce-transactions | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/errormessage.md b/bank-feeds/docs/models/shared/errormessage.md new file mode 100644 index 000000000..425e22bbf --- /dev/null +++ b/bank-feeds/docs/models/shared/errormessage.md @@ -0,0 +1,14 @@ +# ErrorMessage + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `can_be_retried` | *Optional[str]* | :heavy_minus_sign: | `True` if the error occurred transiently and can be retried. | +| `correlation_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier used to propagate to all downstream services and determine the source of the error. | +| `detailed_error_code` | *Optional[int]* | :heavy_minus_sign: | Machine readable error code used to automate processes based on the code returned. | +| `error` | *Optional[str]* | :heavy_minus_sign: | A brief description of the error. | +| `service` | *Optional[str]* | :heavy_minus_sign: | Codat's service the returned the error. | +| `status_code` | *Optional[int]* | :heavy_minus_sign: | The HTTP status code returned by the error. | +| `validation` | [Optional[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. | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/errorstatus.md b/bank-feeds/docs/models/shared/errorstatus.md index 0b8a3683b..a69996369 100644 --- a/bank-feeds/docs/models/shared/errorstatus.md +++ b/bank-feeds/docs/models/shared/errorstatus.md @@ -1,19 +1,19 @@ -# ErrorStatus - -The current status of a transient error. Null statuses indicate that the error is not transient. - -## Example Usage - -```python -from codat_bankfeeds.models.shared import ErrorStatus - -value = ErrorStatus.ACTIVE -``` - - -## Values - -| Name | Value | -| ---------- | ---------- | -| `ACTIVE` | Active | +# ErrorStatus + +The current status of a transient error. Null statuses indicate that the error is not transient. + +## Example Usage + +```python +from codat_bankfeeds.models.shared import ErrorStatus + +value = ErrorStatus.ACTIVE +``` + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `ACTIVE` | Active | | `RESOLVED` | Resolved | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/errorvalidation.md b/bank-feeds/docs/models/shared/errorvalidation.md index 122badd9d..618d40ff2 100644 --- a/bank-feeds/docs/models/shared/errorvalidation.md +++ b/bank-feeds/docs/models/shared/errorvalidation.md @@ -1,11 +1,9 @@ -# 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 | +# ErrorValidation + + +## 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/bank-feeds/docs/models/shared/errorvalidationitem.md b/bank-feeds/docs/models/shared/errorvalidationitem.md index fca2ef14a..a2ea37332 100644 --- a/bank-feeds/docs/models/shared/errorvalidationitem.md +++ b/bank-feeds/docs/models/shared/errorvalidationitem.md @@ -1,10 +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. | +# 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/bank-feeds/docs/models/shared/generateotpresponse.md b/bank-feeds/docs/models/shared/generateotpresponse.md index a73c2397f..04c1e4135 100644 --- a/bank-feeds/docs/models/shared/generateotpresponse.md +++ b/bank-feeds/docs/models/shared/generateotpresponse.md @@ -1,11 +1,12 @@ -# GenerateOtpResponse - -Response containing a one-time password and its expiry time. - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `expiry` | *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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +# GenerateOtpResponse + +Response containing a one-time password and its expiry time. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `additional_properties` | Dict[str, *Any*] | :heavy_check_mark: | N/A | | +| `expiry` | *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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | | `otp` | *str* | :heavy_check_mark: | The one-time password. | | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/halref.md b/bank-feeds/docs/models/shared/halref.md index 94c6476ff..75aa86923 100644 --- a/bank-feeds/docs/models/shared/halref.md +++ b/bank-feeds/docs/models/shared/halref.md @@ -1,8 +1,8 @@ -# HalRef - - -## Fields - -| Field | Type | Required | Description | -| ------------------------ | ------------------------ | ------------------------ | ------------------------ | +# HalRef + + +## Fields + +| Field | Type | Required | Description | +| ------------------------ | ------------------------ | ------------------------ | ------------------------ | | `href` | *Optional[str]* | :heavy_minus_sign: | Uri hypertext reference. | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/items.md b/bank-feeds/docs/models/shared/items.md new file mode 100644 index 000000000..d5213be33 --- /dev/null +++ b/bank-feeds/docs/models/shared/items.md @@ -0,0 +1,24 @@ +# Items + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `account_name` | *Optional[str]* | :heavy_minus_sign: | Name of the bank account in the accounting software. | +| `account_number` | *Optional[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. FreeAgent integrations For Credit accounts, only the last four digits are required. For other types, the field is optional. | +| `account_type` | *Optional[str]* | :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. | +| `available_balance` | *Optional[Decimal]* | :heavy_minus_sign: | Total available balance of the bank account as reported by the underlying data source. This may take into account overdrafts or pending transactions for example. | +| `balance` | *Optional[Decimal]* | :heavy_minus_sign: | Balance of the bank account. | +| `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. | +| `i_ban` | *Optional[str]* | :heavy_minus_sign: | International bank account number of the account. Often used when making or receiving international payments. | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the account, unique for the company in the accounting software. | +| `institution` | *Optional[str]* | :heavy_minus_sign: | The institution of the bank account. | +| `metadata` | [Optional[shared.Metadata]](../../models/shared/metadata.md) | :heavy_minus_sign: | N/A | +| `modified_date` | *Optional[str]* | :heavy_minus_sign: | The date when the record was last fetched from the accounting software, commerce software, or open banking provider and updated in Codat’s data cache. Use it to identify and retrieve records that have changed since your last fetch. For example, filtering `modifiedDate` to today will provide new records updated in Codat today. This date is populated for all data types except for attachments, balance sheets, company information, and profit & loss reports ([read more](https://docs.codat.io/using-the-api/modified-dates#modified-date)). In Codat's data model, dates and times are represented using the ISO 8601 standard. | +| `nominal_code` | *Optional[str]* | :heavy_minus_sign: | Code used to identify each nominal account for a business. | +| `overdraft_limit` | *Optional[Decimal]* | :heavy_minus_sign: | Pre-arranged overdraft limit of the account. The value is always positive. For example, an overdraftLimit of `1000` means that the balance of the account can go down to `-1000`. | +| `sort_code` | *Optional[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. | +| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | The date when a record was last modified in the accounting software, usually by the business or a business process. For example, when payments are made against an invoice. It is not populated ([read more](https://docs.codat.io/using-the-api/modified-dates#source-modified-date)) when: - Pulling attachments - The accounting software does not provide modification dates for a data type - A record has been deleted from the source platform and Codat doesn't have a record of when the deletion occurred - A record has been voided. For certain platforms that soft delete records, `isDeleted` metadata is used to identify void records In Codat's data model, dates and times are represented using the ISO 8601 standard. | +| `status` | [Optional[shared.BankAccountStatus]](../../models/shared/bankaccountstatus.md) | :heavy_minus_sign: | N/A | +| `supplemental_data` | [Optional[shared.SupplementalData]](../../models/shared/supplementaldata.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/itemsbankaccounttype.md b/bank-feeds/docs/models/shared/itemsbankaccounttype.md new file mode 100644 index 000000000..ba53727ef --- /dev/null +++ b/bank-feeds/docs/models/shared/itemsbankaccounttype.md @@ -0,0 +1,18 @@ +# ItemsBankAccountType + +## Example Usage + +```python +from codat_bankfeeds.models.shared import ItemsBankAccountType + +value = ItemsBankAccountType.UNKNOWN +``` + + +## Values + +| Name | Value | +| --------- | --------- | +| `UNKNOWN` | Unknown | +| `CREDIT` | Credit | +| `DEBIT` | Debit | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/links.md b/bank-feeds/docs/models/shared/links.md index 5f80d2652..b91889951 100644 --- a/bank-feeds/docs/models/shared/links.md +++ b/bank-feeds/docs/models/shared/links.md @@ -1,11 +1,11 @@ -# Links - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `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 | +# Links + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `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 | | `self_` | [shared.HalRef](../../models/shared/halref.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/metadata.md b/bank-feeds/docs/models/shared/metadata.md index 8fb4a6e5c..0b4a50ce8 100644 --- a/bank-feeds/docs/models/shared/metadata.md +++ b/bank-feeds/docs/models/shared/metadata.md @@ -1,8 +1,8 @@ -# Metadata - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +# Metadata + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | | `is_deleted` | *OptionalNullable[bool]* | :heavy_minus_sign: | Indicates whether the record has been deleted in the third-party system this record originated from. | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/model1.md b/bank-feeds/docs/models/shared/model1.md new file mode 100644 index 000000000..86a9a4096 --- /dev/null +++ b/bank-feeds/docs/models/shared/model1.md @@ -0,0 +1,11 @@ +# Model1 + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `links` | [shared.Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} | +| `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. | | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/pulloperation.md b/bank-feeds/docs/models/shared/pulloperation.md new file mode 100644 index 000000000..0de376d2e --- /dev/null +++ b/bank-feeds/docs/models/shared/pulloperation.md @@ -0,0 +1,22 @@ +# PullOperation + +Information about a queued, in progress or completed pull operation. +*Formally called `dataset`* + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier of the company associated to this pull operation. | 22ece347-e5f6-4896-95e0-35a4c7f17023 | +| `completed` | *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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `connection_id` | *str* | :heavy_check_mark: | Unique identifier of the connection associated to this pull operation. | 50830828-7d39-4367-b0eb-5ddb2de5faa5 | +| `data_type` | *str* | :heavy_check_mark: | The data type you are requesting in a pull operation. | | +| `error_message` | *Optional[str]* | :heavy_minus_sign: | A message about a transient or persistent error returned by Codat or the source platform. | | +| `id` | *str* | :heavy_check_mark: | Unique identifier of the pull operation. | 943accd0-4247-42d8-865b-363c8629e1da | +| `is_completed` | *bool* | :heavy_check_mark: | `True` if the pull operation is completed successfully. The `isCompleted` property is not queryable. To filter failed pull operations, query by `status!=Complete&&status!=NotSupported` instead. | | +| `is_errored` | *bool* | :heavy_check_mark: | `True` if the pull operation entered an error state. | | +| `progress` | *int* | :heavy_check_mark: | An integer signifying the progress of the pull operation. | | +| `requested` | *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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `status` | [shared.DatasetStatus](../../models/shared/datasetstatus.md) | :heavy_check_mark: | The current status of the dataset. | | +| `status_description` | *Optional[str]* | :heavy_minus_sign: | Additional information about the dataset status. | Paused until 2022-10-23T00:00:00.000Z | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/pulloperations.md b/bank-feeds/docs/models/shared/pulloperations.md new file mode 100644 index 000000000..1c994a999 --- /dev/null +++ b/bank-feeds/docs/models/shared/pulloperations.md @@ -0,0 +1,12 @@ +# PullOperations + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `links` | [shared.Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} | +| `page_number` | *int* | :heavy_check_mark: | Current page number. | | +| `page_size` | *int* | :heavy_check_mark: | Number of items to return in results array. | | +| `results` | List[[shared.PullOperation](../../models/shared/pulloperation.md)] | :heavy_minus_sign: | N/A | | +| `total_results` | *int* | :heavy_check_mark: | Total number of items. | | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/pushchangetype.md b/bank-feeds/docs/models/shared/pushchangetype.md index 244024258..4ae4121b9 100644 --- a/bank-feeds/docs/models/shared/pushchangetype.md +++ b/bank-feeds/docs/models/shared/pushchangetype.md @@ -1,22 +1,22 @@ -# PushChangeType - -Type of change being applied to record in third party platform. - -## Example Usage - -```python -from codat_bankfeeds.models.shared import PushChangeType - -value = PushChangeType.UNKNOWN -``` - - -## Values - -| Name | Value | -| --------------------- | --------------------- | -| `UNKNOWN` | Unknown | -| `CREATED` | Created | -| `MODIFIED` | Modified | -| `DELETED` | Deleted | +# PushChangeType + +Type of change being applied to record in third party platform. + +## Example Usage + +```python +from codat_bankfeeds.models.shared import PushChangeType + +value = PushChangeType.UNKNOWN +``` + + +## Values + +| Name | Value | +| --------------------- | --------------------- | +| `UNKNOWN` | Unknown | +| `CREATED` | Created | +| `MODIFIED` | Modified | +| `DELETED` | Deleted | | `ATTACHMENT_UPLOADED` | AttachmentUploaded | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/pushfieldvalidation.md b/bank-feeds/docs/models/shared/pushfieldvalidation.md index d3558cfad..b10ead92d 100644 --- a/bank-feeds/docs/models/shared/pushfieldvalidation.md +++ b/bank-feeds/docs/models/shared/pushfieldvalidation.md @@ -1,10 +1,11 @@ -# PushFieldValidation - - -## Fields - -| Field | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `details` | *str* | :heavy_check_mark: | Details on the validation issue. | -| `field` | *Optional[str]* | :heavy_minus_sign: | Field name that resulted in the validation issue. | +# PushFieldValidation + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | +| `additional_properties` | Dict[str, *Any*] | :heavy_check_mark: | N/A | +| `details` | *str* | :heavy_check_mark: | Details on the validation issue. | +| `field` | *Optional[str]* | :heavy_minus_sign: | Field name that resulted in the validation issue. | | `ref` | *OptionalNullable[str]* | :heavy_minus_sign: | Unique reference identifier for the validation issue. | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/pushoperation.md b/bank-feeds/docs/models/shared/pushoperation.md index d01e17840..415430ac6 100644 --- a/bank-feeds/docs/models/shared/pushoperation.md +++ b/bank-feeds/docs/models/shared/pushoperation.md @@ -1,20 +1,20 @@ -# PushOperation - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `changes` | List[[shared.PushOperationChange](../../models/shared/pushoperationchange.md)] | :heavy_minus_sign: | Contains a single entry that communicates which record has changed and the manner in which it changed. | | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `completed_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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `data_connection_key` | *str* | :heavy_check_mark: | Unique identifier for a company's data connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | -| `data_type` | [Optional[shared.DataType]](../../models/shared/datatype.md) | :heavy_minus_sign: | Available data types | invoices | -| `error_message` | *OptionalNullable[str]* | :heavy_minus_sign: | A message about the error. | | -| `push_operation_key` | *str* | :heavy_check_mark: | A unique identifier generated by Codat to represent this single push operation. This identifier can be used to track the status of the push, and should be persisted. | | -| `requested_on_utc` | *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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `status` | [shared.PushOperationStatus](../../models/shared/pushoperationstatus.md) | :heavy_check_mark: | The current status of the push operation. | | -| `status_code` | *int* | :heavy_check_mark: | Push status code. | | -| `timeout_in_minutes` | *OptionalNullable[int]* | :heavy_minus_sign: | Number of minutes the push operation must complete within before it times out. | | -| ~~`timeout_in_seconds`~~ | *OptionalNullable[int]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Number of seconds the push operation must complete within before it times out. | | +# PushOperation + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `changes` | List[[shared.PushOperationChange](../../models/shared/pushoperationchange.md)] | :heavy_minus_sign: | Contains a single entry that communicates which record has changed and the manner in which it changed. | | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `completed_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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `data_connection_key` | *str* | :heavy_check_mark: | Unique identifier for a company's data connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `data_type` | [Optional[shared.DataType]](../../models/shared/datatype.md) | :heavy_minus_sign: | Available data types | invoices | +| `error_message` | *OptionalNullable[str]* | :heavy_minus_sign: | A message about the error. | | +| `push_operation_key` | *str* | :heavy_check_mark: | A unique identifier generated by Codat to represent this single push operation. This identifier can be used to track the status of the push, and should be persisted. | | +| `requested_on_utc` | *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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `status` | [shared.PushOperationStatus](../../models/shared/pushoperationstatus.md) | :heavy_check_mark: | The current status of the push operation. | | +| `status_code` | *int* | :heavy_check_mark: | Push status code. | | +| `timeout_in_minutes` | *OptionalNullable[int]* | :heavy_minus_sign: | Number of minutes the push operation must complete within before it times out. | | +| ~~`timeout_in_seconds`~~ | *OptionalNullable[int]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Number of seconds the push operation must complete within before it times out. | | | `validation` | [Optional[shared.Validation]](../../models/shared/validation.md) | :heavy_minus_sign: | A human-readable object describing validation decisions Codat has made when pushing data into the platform. If a push has failed because of validation errors, they will be detailed here. | | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/pushoperationchange.md b/bank-feeds/docs/models/shared/pushoperationchange.md index d5516b5c7..ef8fa0986 100644 --- a/bank-feeds/docs/models/shared/pushoperationchange.md +++ b/bank-feeds/docs/models/shared/pushoperationchange.md @@ -1,10 +1,10 @@ -# PushOperationChange - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `attachment_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Unique identifier for the attachment created otherwise null. | -| `record_ref` | [Optional[shared.PushOperationRef]](../../models/shared/pushoperationref.md) | :heavy_minus_sign: | N/A | -| `type` | [Optional[shared.PushChangeType]](../../models/shared/pushchangetype.md) | :heavy_minus_sign: | Type of change being applied to record in third party platform. | \ No newline at end of file +# PushOperationChange + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `attachment_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Unique identifier for the attachment created otherwise null. | +| `record_ref` | [Optional[shared.PushOperationRef]](../../models/shared/pushoperationref.md) | :heavy_minus_sign: | N/A | +| `type` | [Optional[shared.PushChangeType]](../../models/shared/pushchangetype.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/pushoperationref.md b/bank-feeds/docs/models/shared/pushoperationref.md index 7c26e1c4f..456a46d47 100644 --- a/bank-feeds/docs/models/shared/pushoperationref.md +++ b/bank-feeds/docs/models/shared/pushoperationref.md @@ -1,9 +1,10 @@ -# PushOperationRef - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| `data_type` | [Optional[shared.DataType]](../../models/shared/datatype.md) | :heavy_minus_sign: | Available data types | invoices | -| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for a push operation. | | \ No newline at end of file +# PushOperationRef + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| `additional_properties` | Dict[str, *Any*] | :heavy_check_mark: | N/A | +| `data_type` | [Optional[shared.DataType]](../../models/shared/datatype.md) | :heavy_minus_sign: | N/A | +| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for a push operation. | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/pushoperations.md b/bank-feeds/docs/models/shared/pushoperations.md index 6a06b9c2b..776ac813c 100644 --- a/bank-feeds/docs/models/shared/pushoperations.md +++ b/bank-feeds/docs/models/shared/pushoperations.md @@ -1,12 +1,12 @@ -# PushOperations - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | -| `links` | [shared.Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} | -| `page_number` | *int* | :heavy_check_mark: | Current page number. | | -| `page_size` | *int* | :heavy_check_mark: | Number of items to return in results array. | | -| `results` | List[[shared.PushOperation](../../models/shared/pushoperation.md)] | :heavy_minus_sign: | N/A | | +# PushOperations + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `links` | [shared.Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | {
"self": {
"href": "/companies"
},
"current": {
"href": "/companies?page=1\u0026pageSize=10"
}
} | +| `page_number` | *int* | :heavy_check_mark: | Current page number. | | +| `page_size` | *int* | :heavy_check_mark: | Number of items to return in results array. | | +| `results` | List[[shared.PushOperation](../../models/shared/pushoperation.md)] | :heavy_minus_sign: | N/A | | | `total_results` | *int* | :heavy_check_mark: | Total number of items. | | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/pushoperationstatus.md b/bank-feeds/docs/models/shared/pushoperationstatus.md index 15a9eb72b..c56b8cf18 100644 --- a/bank-feeds/docs/models/shared/pushoperationstatus.md +++ b/bank-feeds/docs/models/shared/pushoperationstatus.md @@ -1,21 +1,21 @@ -# PushOperationStatus - -The current status of the push operation. - -## Example Usage - -```python -from codat_bankfeeds.models.shared import PushOperationStatus - -value = PushOperationStatus.PENDING -``` - - -## Values - -| Name | Value | -| ----------- | ----------- | -| `PENDING` | Pending | -| `FAILED` | Failed | -| `SUCCESS` | Success | +# PushOperationStatus + +The current status of the push operation. + +## Example Usage + +```python +from codat_bankfeeds.models.shared import PushOperationStatus + +value = PushOperationStatus.PENDING +``` + + +## Values + +| Name | Value | +| ----------- | ----------- | +| `PENDING` | Pending | +| `FAILED` | Failed | +| `SUCCESS` | Success | | `TIMED_OUT` | TimedOut | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/pushoption.md b/bank-feeds/docs/models/shared/pushoption.md index e908d0b28..9bff99cd3 100644 --- a/bank-feeds/docs/models/shared/pushoption.md +++ b/bank-feeds/docs/models/shared/pushoption.md @@ -1,14 +1,14 @@ -# PushOption - - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | -| `description` | *Optional[str]* | :heavy_minus_sign: | A description of the property. | -| `display_name` | *str* | :heavy_check_mark: | The property's display name. | -| `options` | List[[shared.PushOptionChoice](../../models/shared/pushoptionchoice.md)] | :heavy_minus_sign: | N/A | -| `properties` | Dict[str, [shared.PushOptionProperty](../../models/shared/pushoptionproperty.md)] | :heavy_minus_sign: | N/A | -| `required` | *bool* | :heavy_check_mark: | The property is required if `True`. | -| `type` | [shared.PushOptionType](../../models/shared/pushoptiontype.md) | :heavy_check_mark: | The option type. | +# PushOption + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| `description` | *Optional[str]* | :heavy_minus_sign: | A description of the property. | +| `display_name` | *str* | :heavy_check_mark: | The property's display name. | +| `options` | List[[shared.PushOptionChoice](../../models/shared/pushoptionchoice.md)] | :heavy_minus_sign: | N/A | +| `properties` | Dict[str, [shared.PushOptionProperty](../../models/shared/pushoptionproperty.md)] | :heavy_minus_sign: | N/A | +| `required` | *bool* | :heavy_check_mark: | The property is required if `True`. | +| `type` | [shared.PushOptionType](../../models/shared/pushoptiontype.md) | :heavy_check_mark: | The option type. | | `validation` | [Optional[shared.PushValidationInfo]](../../models/shared/pushvalidationinfo.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/pushoptionchoice.md b/bank-feeds/docs/models/shared/pushoptionchoice.md index 44e988b26..8c993a020 100644 --- a/bank-feeds/docs/models/shared/pushoptionchoice.md +++ b/bank-feeds/docs/models/shared/pushoptionchoice.md @@ -1,12 +1,12 @@ -# PushOptionChoice - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | -| `description` | *Optional[str]* | :heavy_minus_sign: | A description of the property. | -| `display_name` | *Optional[str]* | :heavy_minus_sign: | The property's display name. | -| `required` | *Optional[bool]* | :heavy_minus_sign: | The property is required if `True`. | -| `type` | [Optional[shared.PushOptionType]](../../models/shared/pushoptiontype.md) | :heavy_minus_sign: | The option type. | +# PushOptionChoice + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `description` | *Optional[str]* | :heavy_minus_sign: | A description of the property. | +| `display_name` | *Optional[str]* | :heavy_minus_sign: | The property's display name. | +| `required` | *Optional[bool]* | :heavy_minus_sign: | The property is required if `True`. | +| `type` | [Optional[shared.PushOptionType]](../../models/shared/pushoptiontype.md) | :heavy_minus_sign: | The option type. | | `value` | *Optional[str]* | :heavy_minus_sign: | Allowed value for field. | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/pushoptionproperty.md b/bank-feeds/docs/models/shared/pushoptionproperty.md index 2bedd19d3..02801135b 100644 --- a/bank-feeds/docs/models/shared/pushoptionproperty.md +++ b/bank-feeds/docs/models/shared/pushoptionproperty.md @@ -1,14 +1,14 @@ -# PushOptionProperty - - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | -| `description` | *str* | :heavy_check_mark: | A description of the property. | -| `display_name` | *str* | :heavy_check_mark: | The property's display name. | -| `options` | List[[shared.PushOptionChoice](../../models/shared/pushoptionchoice.md)] | :heavy_minus_sign: | N/A | -| `properties` | Dict[str, [shared.PushOptionProperty](../../models/shared/pushoptionproperty.md)] | :heavy_minus_sign: | N/A | -| `required` | *bool* | :heavy_check_mark: | The property is required if `True`. | -| `type` | [shared.PushOptionType](../../models/shared/pushoptiontype.md) | :heavy_check_mark: | The option type. | +# PushOptionProperty + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| `description` | *str* | :heavy_check_mark: | A description of the property. | +| `display_name` | *str* | :heavy_check_mark: | The property's display name. | +| `options` | List[[shared.PushOptionChoice](../../models/shared/pushoptionchoice.md)] | :heavy_minus_sign: | N/A | +| `properties` | Dict[str, [shared.PushOptionProperty](../../models/shared/pushoptionproperty.md)] | :heavy_minus_sign: | N/A | +| `required` | *bool* | :heavy_check_mark: | The property is required if `True`. | +| `type` | [shared.PushOptionType](../../models/shared/pushoptiontype.md) | :heavy_check_mark: | The option type. | | `validation` | [Optional[shared.PushValidationInfo]](../../models/shared/pushvalidationinfo.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/pushoptiontype.md b/bank-feeds/docs/models/shared/pushoptiontype.md index 4a420a3c6..c384868cf 100644 --- a/bank-feeds/docs/models/shared/pushoptiontype.md +++ b/bank-feeds/docs/models/shared/pushoptiontype.md @@ -1,25 +1,23 @@ -# PushOptionType - -The option type. - -## Example Usage - -```python -from codat_bankfeeds.models.shared import PushOptionType - -value = PushOptionType.ARRAY -``` - - -## Values - -| Name | Value | -| ------------ | ------------ | -| `ARRAY` | Array | -| `OBJECT` | Object | -| `STRING` | String | -| `NUMBER` | Number | -| `BOOLEAN` | Boolean | -| `DATE_TIME` | DateTime | -| `FILE` | File | +# PushOptionType + +## Example Usage + +```python +from codat_bankfeeds.models.shared import PushOptionType + +value = PushOptionType.ARRAY +``` + + +## Values + +| Name | Value | +| ------------ | ------------ | +| `ARRAY` | Array | +| `OBJECT` | Object | +| `STRING` | String | +| `NUMBER` | Number | +| `BOOLEAN` | Boolean | +| `DATE_TIME` | DateTime | +| `FILE` | File | | `MULTI_PART` | MultiPart | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/pushvalidationinfo.md b/bank-feeds/docs/models/shared/pushvalidationinfo.md index 110eb3f76..ad9013935 100644 --- a/bank-feeds/docs/models/shared/pushvalidationinfo.md +++ b/bank-feeds/docs/models/shared/pushvalidationinfo.md @@ -1,9 +1,10 @@ -# PushValidationInfo - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | -| `information` | List[[shared.PushFieldValidation](../../models/shared/pushfieldvalidation.md)] | :heavy_minus_sign: | N/A | +# PushValidationInfo + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `additional_properties` | Dict[str, *Any*] | :heavy_check_mark: | N/A | +| `information` | List[[shared.PushFieldValidation](../../models/shared/pushfieldvalidation.md)] | :heavy_minus_sign: | N/A | | `warnings` | List[[shared.PushFieldValidation](../../models/shared/pushfieldvalidation.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/routinginfo.md b/bank-feeds/docs/models/shared/routinginfo.md index 284bf18fb..30454e7c2 100644 --- a/bank-feeds/docs/models/shared/routinginfo.md +++ b/bank-feeds/docs/models/shared/routinginfo.md @@ -1,11 +1,11 @@ -# RoutingInfo - -Routing information for the bank. This does not include account number. - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| `bank_code` | *OptionalNullable[str]* | :heavy_minus_sign: | The numeric identifier of the routing number | -| `type` | [OptionalNullable[shared.Type]](../../models/shared/type.md) | :heavy_minus_sign: | The type of routing number. | \ No newline at end of file +# RoutingInfo + +Routing information for the bank. This does not include account number. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | +| `bank_code` | *OptionalNullable[str]* | :heavy_minus_sign: | The numeric identifier of the routing number | +| `type` | [Optional[shared.Type]](../../models/shared/type.md) | :heavy_minus_sign: | The type of routing number. | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/security.md b/bank-feeds/docs/models/shared/security.md index 2b68bd0e7..e7a8e4384 100644 --- a/bank-feeds/docs/models/shared/security.md +++ b/bank-feeds/docs/models/shared/security.md @@ -1,8 +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 +# Security + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `auth_header` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/sourceaccount.md b/bank-feeds/docs/models/shared/sourceaccount.md index 9874b2024..49a136ecb 100644 --- a/bank-feeds/docs/models/shared/sourceaccount.md +++ b/bank-feeds/docs/models/shared/sourceaccount.md @@ -1,19 +1,20 @@ -# SourceAccount - -The target bank account in a supported accounting software for ingestion into a bank feed. - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_name` | *OptionalNullable[str]* | :heavy_minus_sign: | The bank account name. | | -| `account_number` | *OptionalNullable[str]* | :heavy_minus_sign: | The account number. | | -| `account_type` | *OptionalNullable[str]* | :heavy_minus_sign: | The type of bank account e.g. Credit. | | -| `balance` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | The latest balance for the bank account. | | -| `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. | **Example 1:** GBP
**Example 2:** USD
**Example 3:** EUR | -| `feed_start_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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `id` | *str* | :heavy_check_mark: | Unique ID for the bank account. | | -| `modified_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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `sort_code` | *OptionalNullable[str]* | :heavy_minus_sign: | The sort code. | | +# SourceAccount + +The target bank account in a supported accounting software for ingestion into a bank feed. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_name` | *OptionalNullable[str]* | :heavy_minus_sign: | The bank account name. | | +| `account_number` | *OptionalNullable[str]* | :heavy_minus_sign: | The account number. | | +| `account_type` | *OptionalNullable[str]* | :heavy_minus_sign: | The type of bank account e.g. Credit. | | +| `additional_properties` | Dict[str, *Any*] | :heavy_check_mark: | N/A | | +| `balance` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | The latest balance for the bank account. | | +| `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. | **Example 1:** GBP
**Example 2:** USD
**Example 3:** EUR | +| `feed_start_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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `id` | *str* | :heavy_check_mark: | Unique ID for the bank account. | | +| `modified_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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `sort_code` | *OptionalNullable[str]* | :heavy_minus_sign: | The sort code. | | | `status` | [OptionalNullable[shared.Status]](../../models/shared/status.md) | :heavy_minus_sign: | Status of the source account. | | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/sourceaccountbatchcreateresponse.md b/bank-feeds/docs/models/shared/sourceaccountbatchcreateresponse.md index b80d3bb89..1edfdba65 100644 --- a/bank-feeds/docs/models/shared/sourceaccountbatchcreateresponse.md +++ b/bank-feeds/docs/models/shared/sourceaccountbatchcreateresponse.md @@ -1,11 +1,11 @@ -# SourceAccountBatchCreateResponse - -Account ID and resulting object of the batch `Create source account` request. - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -| `result` | [Optional[shared.SourceAccountBatchCreateResult]](../../models/shared/sourceaccountbatchcreateresult.md) | :heavy_minus_sign: | Status details and corresponding object of the `Create account` operation. | | +# SourceAccountBatchCreateResponse + +Account ID and resulting object of the batch `Create source account` request. + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `result` | [Optional[shared.SourceAccountBatchCreateResult]](../../models/shared/sourceaccountbatchcreateresult.md) | :heavy_minus_sign: | Status details and corresponding object of the `Create account` operation. | | | `source_account_id` | *Optional[str]* | :heavy_minus_sign: | Unique ID for the source account. | 12345 | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/sourceaccountbatchcreateresult.md b/bank-feeds/docs/models/shared/sourceaccountbatchcreateresult.md index 99350601d..9e7468efa 100644 --- a/bank-feeds/docs/models/shared/sourceaccountbatchcreateresult.md +++ b/bank-feeds/docs/models/shared/sourceaccountbatchcreateresult.md @@ -1,12 +1,12 @@ -# SourceAccountBatchCreateResult - -Status details and corresponding object of the `Create account` operation. - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account` | [Optional[shared.SourceAccount]](../../models/shared/sourceaccount.md) | :heavy_minus_sign: | The target bank account in a supported accounting software for ingestion into a bank feed. | **Example 1:** {
"id": "acc-002",
"accountName": "account-081",
"sortCode": "123456",
"accountType": "Credit",
"accountNumber": "12345670",
"currency": "GBP",
"balance": 99.99,
"modifiedDate": "2023-01-09T14:14:14.1057478Z",
"status": "pending"
}
**Example 2:** {
"id": "acc-003",
"accountName": "account-095",
"sortCode": "123456",
"accountType": "Credit",
"accountNumber": "12345671",
"currency": "USD",
"balance": 0,
"modifiedDate": "2023-01-09T14:14:14.1057478Z",
"status": "pending"
} | -| `error` | *OptionalNullable[str]* | :heavy_minus_sign: | A brief description of the error. | | -| `status_code` | *Optional[int]* | :heavy_minus_sign: | The HTTP status code for the creation of the source account | | \ No newline at end of file +# SourceAccountBatchCreateResult + +Status details and corresponding object of the `Create account` operation. + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account` | [Optional[shared.SourceAccount]](../../models/shared/sourceaccount.md) | :heavy_minus_sign: | The target bank account in a supported accounting software for ingestion into a bank feed. | **Example 1:** {
"id": "acc-002",
"accountName": "account-081",
"sortCode": "123456",
"accountType": "Credit",
"accountNumber": "12345670",
"currency": "GBP",
"balance": 99.99,
"modifiedDate": "2023-01-09T14:14:14.1057478Z",
"status": "pending"
}
**Example 2:** {
"id": "acc-003",
"accountName": "account-095",
"sortCode": "123456",
"accountType": "Credit",
"accountNumber": "12345671",
"currency": "USD",
"balance": 0,
"modifiedDate": "2023-01-09T14:14:14.1057478Z",
"status": "pending"
} | +| `error` | *OptionalNullable[str]* | :heavy_minus_sign: | A brief description of the error. | | +| `status_code` | *Optional[int]* | :heavy_minus_sign: | The HTTP status code for the creation of the source account | | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/sourceaccountbatcherrorresponse.md b/bank-feeds/docs/models/shared/sourceaccountbatcherrorresponse.md index e53dc360f..7f5347058 100644 --- a/bank-feeds/docs/models/shared/sourceaccountbatcherrorresponse.md +++ b/bank-feeds/docs/models/shared/sourceaccountbatcherrorresponse.md @@ -1,11 +1,11 @@ -# SourceAccountBatchErrorResponse - -Describes the error that occured when trying to create the specified source account. - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `result` | [Optional[shared.Result]](../../models/shared/result.md) | :heavy_minus_sign: | N/A | | -| `source_account_id` | *Optional[str]* | :heavy_minus_sign: | Unique ID for the source account. | 12345 | \ No newline at end of file +# SourceAccountBatchErrorResponse + +Describes the error that occured when trying to create the specified source account. + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | +| `result` | [Optional[shared.SourceAccountBatchErrorResponseResult]](../../models/shared/sourceaccountbatcherrorresponseresult.md) | :heavy_minus_sign: | N/A | | +| `source_account_id` | *Optional[str]* | :heavy_minus_sign: | Unique ID for the source account. | 12345 | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/result.md b/bank-feeds/docs/models/shared/sourceaccountbatcherrorresponseresult.md similarity index 96% rename from bank-feeds/docs/models/shared/result.md rename to bank-feeds/docs/models/shared/sourceaccountbatcherrorresponseresult.md index b279abf71..1a47d4252 100644 --- a/bank-feeds/docs/models/shared/result.md +++ b/bank-feeds/docs/models/shared/sourceaccountbatcherrorresponseresult.md @@ -1,9 +1,9 @@ -# Result - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | -| `error` | *Optional[str]* | :heavy_minus_sign: | The error description for the attempted creation of the source account. | A bank account already exists with the same Id | +# SourceAccountBatchErrorResponseResult + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | +| `error` | *Optional[str]* | :heavy_minus_sign: | The error description for the attempted creation of the source account. | A bank account already exists with the same Id | | `status_code` | *Optional[str]* | :heavy_minus_sign: | The error status code for the attempted creation of the source account. | 409 | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/sourceaccountprototype.md b/bank-feeds/docs/models/shared/sourceaccountprototype.md index 8cbd8fa63..e4552c370 100644 --- a/bank-feeds/docs/models/shared/sourceaccountprototype.md +++ b/bank-feeds/docs/models/shared/sourceaccountprototype.md @@ -1,15 +1,15 @@ -# SourceAccountPrototype - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_name` | *OptionalNullable[str]* | :heavy_minus_sign: | The bank account name. | | -| `account_number` | *OptionalNullable[str]* | :heavy_minus_sign: | The account number. | | -| `account_type` | *OptionalNullable[str]* | :heavy_minus_sign: | The type of bank account e.g. Credit. | | -| `balance` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | The latest balance for the bank account. | | -| `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. | **Example 1:** GBP
**Example 2:** USD
**Example 3:** EUR | -| `id` | *str* | :heavy_check_mark: | Unique ID for the bank account. | | -| `modified_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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `sort_code` | *OptionalNullable[str]* | :heavy_minus_sign: | The sort code. | | \ No newline at end of file +# SourceAccountPrototype + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_name` | *OptionalNullable[str]* | :heavy_minus_sign: | The bank account name. | +| `account_number` | *OptionalNullable[str]* | :heavy_minus_sign: | The account number. | +| `account_type` | *OptionalNullable[str]* | :heavy_minus_sign: | The type of bank account e.g. Credit. | +| `balance` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | The latest balance for the bank account. | +| `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. | +| `id` | *str* | :heavy_check_mark: | Unique ID for the bank account. | +| `modified_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. | +| `sort_code` | *OptionalNullable[str]* | :heavy_minus_sign: | The sort code. | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/sourceaccountv2.md b/bank-feeds/docs/models/shared/sourceaccountv2.md index bf8b0f1ca..b81132823 100644 --- a/bank-feeds/docs/models/shared/sourceaccountv2.md +++ b/bank-feeds/docs/models/shared/sourceaccountv2.md @@ -1,21 +1,22 @@ -# SourceAccountV2 - -The target bank account in a supported accounting software for ingestion into a bank feed. - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_info` | [OptionalNullable[shared.AccountInfo]](../../models/shared/accountinfo.md) | :heavy_minus_sign: | N/A | | -| `account_name` | *str* | :heavy_check_mark: | The bank account name. | | -| `account_number` | *str* | :heavy_check_mark: | The account number. | | -| `account_type` | [shared.SourceAccountV2AccountType](../../models/shared/sourceaccountv2accounttype.md) | :heavy_check_mark: | The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard. | | -| `balance` | *Decimal* | :heavy_check_mark: | The latest balance for the bank account. | | -| `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. | **Example 1:** GBP
**Example 2:** USD
**Example 3:** EUR | -| `feed_start_date` | *OptionalNullable[str]* | :heavy_minus_sign: | In Codat's data model, dates are represented using the ISO 8601 standard. Date fields are formatted as strings; for example:
```
2020-10-08
``` | 2022-10-23 | -| `id` | *str* | :heavy_check_mark: | Unique ID for the bank account. | | -| `modified_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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `routing_info` | [Optional[shared.RoutingInfo]](../../models/shared/routinginfo.md) | :heavy_minus_sign: | Routing information for the bank. This does not include account number. | | -| `sort_code` | *OptionalNullable[str]* | :heavy_minus_sign: | The sort code. | | +# SourceAccountV2 + +The target bank account in a supported accounting software for ingestion into a bank feed. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_info` | [OptionalNullable[shared.AccountInfo]](../../models/shared/accountinfo.md) | :heavy_minus_sign: | N/A | | +| `account_name` | *str* | :heavy_check_mark: | The bank account name. | | +| `account_number` | *str* | :heavy_check_mark: | The account number. | | +| `account_type` | [shared.SourceAccountV2AccountType](../../models/shared/sourceaccountv2accounttype.md) | :heavy_check_mark: | The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard. | | +| `additional_properties` | Dict[str, *Any*] | :heavy_check_mark: | N/A | | +| `balance` | *Decimal* | :heavy_check_mark: | The latest balance for the bank account. | | +| `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. | **Example 1:** GBP
**Example 2:** USD
**Example 3:** EUR | +| `feed_start_date` | *OptionalNullable[str]* | :heavy_minus_sign: | In Codat's data model, dates are represented using the ISO 8601 standard. Date fields are formatted as strings; for example:
```
2020-10-08
``` | 2022-10-23 | +| `id` | *str* | :heavy_check_mark: | Unique ID for the bank account. | | +| `modified_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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `routing_info` | [Optional[shared.RoutingInfo]](../../models/shared/routinginfo.md) | :heavy_minus_sign: | Routing information for the bank. This does not include account number. | | +| `sort_code` | *OptionalNullable[str]* | :heavy_minus_sign: | The sort code. | | | `status` | [OptionalNullable[shared.SourceAccountV2Status]](../../models/shared/sourceaccountv2status.md) | :heavy_minus_sign: | Status of the source account. | | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/sourceaccountv2accounttype.md b/bank-feeds/docs/models/shared/sourceaccountv2accounttype.md index 89e8d43ce..c0cb6246e 100644 --- a/bank-feeds/docs/models/shared/sourceaccountv2accounttype.md +++ b/bank-feeds/docs/models/shared/sourceaccountv2accounttype.md @@ -1,22 +1,22 @@ -# SourceAccountV2AccountType - -The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard. - -## Example Usage - -```python -from codat_bankfeeds.models.shared import SourceAccountV2AccountType - -value = SourceAccountV2AccountType.CHECKING -``` - - -## Values - -| Name | Value | -| -------------- | -------------- | -| `CHECKING` | checking | -| `SAVINGS` | savings | -| `LOAN` | loan | -| `CREDIT_CARD` | creditCard | +# SourceAccountV2AccountType + +The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard. + +## Example Usage + +```python +from codat_bankfeeds.models.shared import SourceAccountV2AccountType + +value = SourceAccountV2AccountType.CHECKING +``` + + +## Values + +| Name | Value | +| -------------- | -------------- | +| `CHECKING` | checking | +| `SAVINGS` | savings | +| `LOAN` | loan | +| `CREDIT_CARD` | creditCard | | `PREPAID_CARD` | prepaidCard | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/sourceaccountv2batchcreateresponse.md b/bank-feeds/docs/models/shared/sourceaccountv2batchcreateresponse.md index 1b1814226..a68956124 100644 --- a/bank-feeds/docs/models/shared/sourceaccountv2batchcreateresponse.md +++ b/bank-feeds/docs/models/shared/sourceaccountv2batchcreateresponse.md @@ -1,11 +1,11 @@ -# SourceAccountV2BatchCreateResponse - -Account ID and resulting object of the batch `Create source account` request. - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | -| `result` | [Optional[shared.SourceAccountV2BatchCreateResult]](../../models/shared/sourceaccountv2batchcreateresult.md) | :heavy_minus_sign: | Status details and corresponding object of the `Create account` operation. | | +# SourceAccountV2BatchCreateResponse + +Account ID and resulting object of the batch `Create source account` request. + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `result` | [Optional[shared.SourceAccountV2BatchCreateResult]](../../models/shared/sourceaccountv2batchcreateresult.md) | :heavy_minus_sign: | Status details and corresponding object of the `Create account` operation. | | | `source_account_id` | *Optional[str]* | :heavy_minus_sign: | Unique ID for the source account. | 12345 | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/sourceaccountv2batchcreateresult.md b/bank-feeds/docs/models/shared/sourceaccountv2batchcreateresult.md index 460d1b533..f54c62142 100644 --- a/bank-feeds/docs/models/shared/sourceaccountv2batchcreateresult.md +++ b/bank-feeds/docs/models/shared/sourceaccountv2batchcreateresult.md @@ -1,12 +1,12 @@ -# SourceAccountV2BatchCreateResult - -Status details and corresponding object of the `Create account` operation. - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `account` | [Optional[shared.SourceAccountV2]](../../models/shared/sourceaccountv2.md) | :heavy_minus_sign: | The target bank account in a supported accounting software for ingestion into a bank feed. | **Example 1:** {
"id": "acc-001",
"accountName": "account-081",
"accountType": "checking",
"accountNumber": "12345670",
"routingInfo": {
"bankCode": 21001088,
"type": "bankcode"
},
"currency": "GBP",
"balance": 99.99,
"accountInfo": {
"description": "account description 1",
"nickname": "account 123",
"accountOpenDate": "2023-05-06",
"availableBalance": 10
},
"modifiedDate": "2024-08-02T00:00:00.000Z",
"status": "pending",
"feedStartDate": "2024-05-01"
}
**Example 2:** {
"id": "acc-002",
"accountName": "account-083",
"accountType": "savings",
"accountNumber": "23456789",
"routingInfo": {
"bankCode": 21001088,
"type": "bankcode"
},
"currency": "GBP",
"balance": 400,
"accountInfo": {
"description": "account description 2",
"nickname": "account 1290",
"accountOpenDate": "2023-05-23",
"availableBalance": 400
},
"modifiedDate": "2024-08-02T00:00:00.000Z",
"status": "pending",
"feedStartDate": "2024-05-01"
} | -| `error` | *OptionalNullable[str]* | :heavy_minus_sign: | A brief description of the error. | | -| `status_code` | *Optional[int]* | :heavy_minus_sign: | The HTTP status code for the creation of the source account | | \ No newline at end of file +# SourceAccountV2BatchCreateResult + +Status details and corresponding object of the `Create account` operation. + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account` | [Optional[shared.SourceAccountV2]](../../models/shared/sourceaccountv2.md) | :heavy_minus_sign: | The target bank account in a supported accounting software for ingestion into a bank feed. | **Example 1:** {
"id": "acc-001",
"accountName": "account-081",
"accountType": "checking",
"accountNumber": "12345670",
"routingInfo": {
"bankCode": "021001088",
"type": "bankcode"
},
"currency": "GBP",
"balance": 99.99,
"accountInfo": {
"description": "account description 1",
"nickname": "account 123",
"accountOpenDate": "2023-05-06",
"availableBalance": 10
},
"modifiedDate": "2024-08-02T00:00:00.000Z",
"status": "pending",
"feedStartDate": "2024-05-01"
}
**Example 2:** {
"id": "acc-002",
"accountName": "account-083",
"accountType": "savings",
"accountNumber": "23456789",
"routingInfo": {
"bankCode": "021001088",
"type": "bankcode"
},
"currency": "GBP",
"balance": 400,
"accountInfo": {
"description": "account description 2",
"nickname": "account 1290",
"accountOpenDate": "2023-05-23",
"availableBalance": 400
},
"modifiedDate": "2024-08-02T00:00:00.000Z",
"status": "pending",
"feedStartDate": "2024-05-01"
} | +| `error` | *OptionalNullable[str]* | :heavy_minus_sign: | A brief description of the error. | | +| `status_code` | *Optional[int]* | :heavy_minus_sign: | The HTTP status code for the creation of the source account | | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/sourceaccountv2prototype.md b/bank-feeds/docs/models/shared/sourceaccountv2prototype.md index a226c2493..a4c905c8e 100644 --- a/bank-feeds/docs/models/shared/sourceaccountv2prototype.md +++ b/bank-feeds/docs/models/shared/sourceaccountv2prototype.md @@ -1,17 +1,17 @@ -# SourceAccountV2Prototype - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_info` | [OptionalNullable[shared.AccountInfo]](../../models/shared/accountinfo.md) | :heavy_minus_sign: | N/A | | -| `account_name` | *str* | :heavy_check_mark: | The bank account name. | | -| `account_number` | *str* | :heavy_check_mark: | The account number. | | -| `account_type` | [shared.AccountType](../../models/shared/accounttype.md) | :heavy_check_mark: | The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard. | | -| `balance` | *Decimal* | :heavy_check_mark: | The latest balance for the bank account. | | -| `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. | **Example 1:** GBP
**Example 2:** USD
**Example 3:** EUR | -| `id` | *str* | :heavy_check_mark: | Unique ID for the bank account. | | -| `modified_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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `routing_info` | [Optional[shared.RoutingInfo]](../../models/shared/routinginfo.md) | :heavy_minus_sign: | Routing information for the bank. This does not include account number. | | -| `sort_code` | *OptionalNullable[str]* | :heavy_minus_sign: | The sort code. | | \ No newline at end of file +# SourceAccountV2Prototype + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_info` | [OptionalNullable[shared.AccountInfo]](../../models/shared/accountinfo.md) | :heavy_minus_sign: | N/A | +| `account_name` | *str* | :heavy_check_mark: | The bank account name. | +| `account_number` | *str* | :heavy_check_mark: | The account number. | +| `account_type` | [shared.AccountType](../../models/shared/accounttype.md) | :heavy_check_mark: | The type of bank account e.g. Credit. | +| `balance` | *Decimal* | :heavy_check_mark: | The latest balance for the bank account. | +| `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. | +| `id` | *str* | :heavy_check_mark: | Unique ID for the bank account. | +| `modified_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. | +| `routing_info` | [Optional[shared.RoutingInfo]](../../models/shared/routinginfo.md) | :heavy_minus_sign: | N/A | +| `sort_code` | *OptionalNullable[str]* | :heavy_minus_sign: | The sort code. | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/sourceaccountv2status.md b/bank-feeds/docs/models/shared/sourceaccountv2status.md index 616ab1518..5b779f824 100644 --- a/bank-feeds/docs/models/shared/sourceaccountv2status.md +++ b/bank-feeds/docs/models/shared/sourceaccountv2status.md @@ -1,22 +1,20 @@ -# SourceAccountV2Status - -Status of the source account. - -## Example Usage - -```python -from codat_bankfeeds.models.shared import SourceAccountV2Status - -value = SourceAccountV2Status.PENDING -``` - - -## Values - -| Name | Value | -| -------------- | -------------- | -| `PENDING` | pending | -| `CONNECTED` | connected | -| `CONNECTING` | connecting | -| `DISCONNECTED` | disconnected | +# SourceAccountV2Status + +## Example Usage + +```python +from codat_bankfeeds.models.shared import SourceAccountV2Status + +value = SourceAccountV2Status.PENDING +``` + + +## Values + +| Name | Value | +| -------------- | -------------- | +| `PENDING` | pending | +| `CONNECTED` | connected | +| `CONNECTING` | connecting | +| `DISCONNECTED` | disconnected | | `UNKNOWN` | unknown | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/sourceaccountwebhook.md b/bank-feeds/docs/models/shared/sourceaccountwebhook.md index 4c592891d..bf00130e9 100644 --- a/bank-feeds/docs/models/shared/sourceaccountwebhook.md +++ b/bank-feeds/docs/models/shared/sourceaccountwebhook.md @@ -1,11 +1,11 @@ -# SourceAccountWebhook - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `event_type` | *Optional[str]* | :heavy_minus_sign: | The type of event. | **Example 1:** bankFeeds.sourceAccount.connected
**Example 2:** bankFeeds.sourceAccount.disconnected | -| `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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the event. | ba29118f-5406-4e59-b05c-ba307ca38d01 | +# SourceAccountWebhook + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `event_type` | *Optional[str]* | :heavy_minus_sign: | The type of event. | **Example 1:** bankFeeds.sourceAccount.connected
**Example 2:** bankFeeds.sourceAccount.disconnected | +| `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. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the event. | ba29118f-5406-4e59-b05c-ba307ca38d01 | | `payload` | [Optional[shared.SourceAccountWebhookPayload]](../../models/shared/sourceaccountwebhookpayload.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/sourceaccountwebhookpayload.md b/bank-feeds/docs/models/shared/sourceaccountwebhookpayload.md index 5691e75d8..b404adcc2 100644 --- a/bank-feeds/docs/models/shared/sourceaccountwebhookpayload.md +++ b/bank-feeds/docs/models/shared/sourceaccountwebhookpayload.md @@ -1,11 +1,11 @@ -# SourceAccountWebhookPayload - - -## Fields - -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | -| `company_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `connection_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for a company's data connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | -| `reference_company` | [Optional[shared.CompanyReference]](../../models/shared/companyreference.md) | :heavy_minus_sign: | N/A | | -| `source_account` | [Optional[shared.SourceAccountWebhookPayloadSourceAccount]](../../models/shared/sourceaccountwebhookpayloadsourceaccount.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +# SourceAccountWebhookPayload + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | +| `company_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for your SMB in Codat. | +| `connection_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for a company's data connection. | +| `reference_company` | [Optional[shared.CompanyReference]](../../models/shared/companyreference.md) | :heavy_minus_sign: | N/A | +| `source_account` | [Optional[shared.SourceAccountWebhookPayloadSourceAccount]](../../models/shared/sourceaccountwebhookpayloadsourceaccount.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/sourceaccountwebhookpayloadsourceaccount.md b/bank-feeds/docs/models/shared/sourceaccountwebhookpayloadsourceaccount.md index b4de039c1..a0d31bb3a 100644 --- a/bank-feeds/docs/models/shared/sourceaccountwebhookpayloadsourceaccount.md +++ b/bank-feeds/docs/models/shared/sourceaccountwebhookpayloadsourceaccount.md @@ -1,17 +1,17 @@ -# SourceAccountWebhookPayloadSourceAccount - - -## Supported Types - -### `shared.SourceAccountV2` - -```python -value: shared.SourceAccountV2 = /* values here */ -``` - -### `shared.SourceAccount` - -```python -value: shared.SourceAccount = /* values here */ -``` - +# SourceAccountWebhookPayloadSourceAccount + + +## Supported Types + +### `shared.SourceAccountV2` + +```python +value: shared.SourceAccountV2 = /* values here */ +``` + +### `shared.SourceAccount` + +```python +value: shared.SourceAccount = /* values here */ +``` + diff --git a/bank-feeds/docs/models/shared/sourcetype.md b/bank-feeds/docs/models/shared/sourcetype.md index 4c491f117..0762a5f63 100644 --- a/bank-feeds/docs/models/shared/sourcetype.md +++ b/bank-feeds/docs/models/shared/sourcetype.md @@ -1,24 +1,24 @@ -# SourceType - -The type of platform of the connection. - -## Example Usage - -```python -from codat_bankfeeds.models.shared import SourceType - -value = SourceType.ACCOUNTING -``` - - -## Values - -| Name | Value | -| ------------ | ------------ | -| `ACCOUNTING` | Accounting | -| `BANKING` | Banking | -| `BANK_FEED` | BankFeed | -| `COMMERCE` | Commerce | -| `EXPENSE` | Expense | -| `OTHER` | Other | +# SourceType + +The type of platform of the connection. + +## Example Usage + +```python +from codat_bankfeeds.models.shared import SourceType + +value = SourceType.ACCOUNTING +``` + + +## 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/bank-feeds/docs/models/shared/startscheduledsyncresult.md b/bank-feeds/docs/models/shared/startscheduledsyncresult.md index 550bcf6ca..8f1e4b814 100644 --- a/bank-feeds/docs/models/shared/startscheduledsyncresult.md +++ b/bank-feeds/docs/models/shared/startscheduledsyncresult.md @@ -1,10 +1,10 @@ -# StartScheduledSyncResult - -Represents the result of an ad-hoc sync request. - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | +# StartScheduledSyncResult + +Represents the result of an ad-hoc sync request. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | | `sync_id` | *str* | :heavy_check_mark: | The unique identifier for the created sync. | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/status.md b/bank-feeds/docs/models/shared/status.md index 866d20240..5dad06274 100644 --- a/bank-feeds/docs/models/shared/status.md +++ b/bank-feeds/docs/models/shared/status.md @@ -1,22 +1,20 @@ -# Status - -Status of the source account. - -## Example Usage - -```python -from codat_bankfeeds.models.shared import Status - -value = Status.PENDING -``` - - -## Values - -| Name | Value | -| -------------- | -------------- | -| `PENDING` | pending | -| `CONNECTED` | connected | -| `CONNECTING` | connecting | -| `DISCONNECTED` | disconnected | +# Status + +## Example Usage + +```python +from codat_bankfeeds.models.shared import Status + +value = Status.PENDING +``` + + +## Values + +| Name | Value | +| -------------- | -------------- | +| `PENDING` | pending | +| `CONNECTED` | connected | +| `CONNECTING` | connecting | +| `DISCONNECTED` | disconnected | | `UNKNOWN` | unknown | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/supplementaldata.md b/bank-feeds/docs/models/shared/supplementaldata.md index 7415a8519..b0c0c829e 100644 --- a/bank-feeds/docs/models/shared/supplementaldata.md +++ b/bank-feeds/docs/models/shared/supplementaldata.md @@ -1,12 +1,12 @@ -# SupplementalData - -Supplemental data is additional data you can include in our standard data types. - -It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. - - -## Fields - -| Field | Type | Required | Description | -| --------------------------- | --------------------------- | --------------------------- | --------------------------- | -| `content` | Dict[str, Dict[str, *Any*]] | :heavy_minus_sign: | N/A | \ No newline at end of file +# SupplementalData + +Supplemental data is additional data you can include in our standard data types. + +It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. + + +## Fields + +| Field | Type | Required | Description | +| --------------------------- | --------------------------- | --------------------------- | --------------------------- | +| `content` | Dict[str, *Dict[str, Any]*] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/syncstatusresult.md b/bank-feeds/docs/models/shared/syncstatusresult.md index 2e150343d..0e1720d70 100644 --- a/bank-feeds/docs/models/shared/syncstatusresult.md +++ b/bank-feeds/docs/models/shared/syncstatusresult.md @@ -1,23 +1,23 @@ -# SyncStatusResult - -Represents the status of a managed bank feed sync. - - -## Fields - -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | -| `client_id` | *str* | :heavy_check_mark: | The ID of the client associated with the company that owns the source bank account. | | -| `company_id` | *str* | :heavy_check_mark: | The ID of the company that owns the source bank account. | | -| `company_name` | *str* | :heavy_check_mark: | The name of the company that owns the source bank account. | | -| `data_connection_id` | *str* | :heavy_check_mark: | The ID of the target accounting data connection. | | -| `error_code` | *OptionalNullable[str]* | :heavy_minus_sign: | Error code if the sync failed. | | -| `error_message` | *OptionalNullable[str]* | :heavy_minus_sign: | Error message if the sync failed. | | -| `execution_end_utc` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | The UTC timestamp when the sync execution ended, if completed (i.e. `status` is any value other than `Started`). | | -| `execution_start_utc` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | The UTC timestamp when the sync started executing. | | -| `period_end_utc` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | The end of the sync period. | | -| `period_start_utc` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | The start of the sync period. | | -| `push_operation_keys` | List[*str*] | :heavy_minus_sign: | List of write operation keys associated with the sync, if the sync resulted in write attempts. | | -| `source_account_id` | *str* | :heavy_check_mark: | The ID of the source bank account from which transactions are fetched. | | -| `status` | *str* | :heavy_check_mark: | The current status of the sync. Known values are `Started`, `Failed`, `SuccessDataPushed`, `SuccessNoDataPushed`, `PartialSuccessDataPushed`. | SuccessDataPushed | +# SyncStatusResult + +Represents the status of a managed bank feed sync. + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | +| `client_id` | *str* | :heavy_check_mark: | The ID of the client associated with the company that owns the source bank account. | | +| `company_id` | *str* | :heavy_check_mark: | The ID of the company that owns the source bank account. | | +| `company_name` | *str* | :heavy_check_mark: | The name of the company that owns the source bank account. | | +| `data_connection_id` | *str* | :heavy_check_mark: | The ID of the target accounting data connection. | | +| `error_code` | *OptionalNullable[str]* | :heavy_minus_sign: | Error code if the sync failed. | | +| `error_message` | *OptionalNullable[str]* | :heavy_minus_sign: | Error message if the sync failed. | | +| `execution_end_utc` | *OptionalNullable[datetime]* | :heavy_minus_sign: | The UTC timestamp when the sync execution ended, if completed (i.e. `status` is any value other than `Started`). | | +| `execution_start_utc` | *datetime* | :heavy_check_mark: | The UTC timestamp when the sync started executing. | | +| `period_end_utc` | *datetime* | :heavy_check_mark: | The end of the sync period. | | +| `period_start_utc` | *datetime* | :heavy_check_mark: | The start of the sync period. | | +| `push_operation_keys` | List[*str*] | :heavy_minus_sign: | List of write operation keys associated with the sync, if the sync resulted in write attempts. | | +| `source_account_id` | *str* | :heavy_check_mark: | The ID of the source bank account from which transactions are fetched. | | +| `status` | *str* | :heavy_check_mark: | The current status of the sync. Known values are `Started`, `Failed`, `SuccessDataPushed`, `SuccessNoDataPushed`, `PartialSuccessDataPushed`. | SuccessDataPushed | | `sync_id` | *str* | :heavy_check_mark: | The unique identifier for the sync. | | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/targetaccountoption.md b/bank-feeds/docs/models/shared/targetaccountoption.md index 651d5c279..00f6d2d26 100644 --- a/bank-feeds/docs/models/shared/targetaccountoption.md +++ b/bank-feeds/docs/models/shared/targetaccountoption.md @@ -1,12 +1,12 @@ -# TargetAccountOption - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------- | ---------------------------------- | ---------------------------------- | ---------------------------------- | -| `account_number` | *OptionalNullable[str]* | :heavy_minus_sign: | The account number of the account. | -| `balance` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | The balance of the account. | -| `id` | *Optional[str]* | :heavy_minus_sign: | Id of the target account. | -| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the target account. | +# TargetAccountOption + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | ---------------------------------- | +| `account_number` | *OptionalNullable[str]* | :heavy_minus_sign: | The account number of the account. | +| `balance` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | The balance of the account. | +| `id` | *Optional[str]* | :heavy_minus_sign: | Id of the target account. | +| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the target account. | | `sort_code` | *OptionalNullable[str]* | :heavy_minus_sign: | The sort code of the account. | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/type.md b/bank-feeds/docs/models/shared/type.md index d103689d1..7c09fe466 100644 --- a/bank-feeds/docs/models/shared/type.md +++ b/bank-feeds/docs/models/shared/type.md @@ -1,30 +1,28 @@ -# Type - -The type of routing number. - -## Example Usage - -```python -from codat_bankfeeds.models.shared import Type - -value = Type.RTN -``` - - -## Values - -| Name | Value | -| ---------- | ---------- | -| `RTN` | rtn | -| `ABA` | aba | -| `SWIFT` | swift | -| `BSB` | bsb | -| `IBAN` | iban | -| `NZ2` | nz2 | -| `TRNO` | trno | -| `SORTCODE` | sortcode | -| `BLZ` | blz | -| `IFSC` | ifsc | -| `BANKCODE` | bankcode | -| `APCA` | apca | +# Type + +## Example Usage + +```python +from codat_bankfeeds.models.shared import Type + +value = Type.RTN +``` + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `RTN` | rtn | +| `ABA` | aba | +| `SWIFT` | swift | +| `BSB` | bsb | +| `IBAN` | iban | +| `NZ2` | nz2 | +| `TRNO` | trno | +| `SORTCODE` | sortcode | +| `BLZ` | blz | +| `IFSC` | ifsc | +| `BANKCODE` | bankcode | +| `APCA` | apca | | `CLABE` | clabe | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/updateconnection.md b/bank-feeds/docs/models/shared/updateconnection.md new file mode 100644 index 000000000..439e3fee3 --- /dev/null +++ b/bank-feeds/docs/models/shared/updateconnection.md @@ -0,0 +1,9 @@ +# UpdateConnection + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `additional_properties` | Dict[str, *Any*] | :heavy_check_mark: | N/A | +| `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/bank-feeds/docs/models/shared/validation.md b/bank-feeds/docs/models/shared/validation.md index 4cfc544dc..b208342e2 100644 --- a/bank-feeds/docs/models/shared/validation.md +++ b/bank-feeds/docs/models/shared/validation.md @@ -1,11 +1,11 @@ -# Validation - -A human-readable object describing validation decisions Codat has made when pushing data into the platform. If a push has failed because of validation errors, they will be detailed here. - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `errors` | List[[shared.ValidationItem](../../models/shared/validationitem.md)] | :heavy_minus_sign: | N/A | +# Validation + +A human-readable object describing validation decisions Codat has made when pushing data into the platform. If a push has failed because of validation errors, they will be detailed here. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | +| `errors` | List[[shared.ValidationItem](../../models/shared/validationitem.md)] | :heavy_minus_sign: | N/A | | `warnings` | List[[shared.ValidationItem](../../models/shared/validationitem.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/bank-feeds/docs/models/shared/validationitem.md b/bank-feeds/docs/models/shared/validationitem.md index 1aaf084c9..791ee2076 100644 --- a/bank-feeds/docs/models/shared/validationitem.md +++ b/bank-feeds/docs/models/shared/validationitem.md @@ -1,10 +1,11 @@ -# ValidationItem - - -## 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. | +# ValidationItem + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | +| `additional_properties` | Dict[str, *Any*] | :heavy_check_mark: | N/A | +| `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/bank-feeds/docs/models/utils/retryconfig.md b/bank-feeds/docs/models/utils/retryconfig.md index 69dd549ec..0977111b8 100644 --- a/bank-feeds/docs/models/utils/retryconfig.md +++ b/bank-feeds/docs/models/utils/retryconfig.md @@ -1,24 +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` | +# 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/bank-feeds/docs/sdks/accountmapping/README.md b/bank-feeds/docs/sdks/accountmapping/README.md index de0526541..b95dd85bb 100644 --- a/bank-feeds/docs/sdks/accountmapping/README.md +++ b/bank-feeds/docs/sdks/accountmapping/README.md @@ -1,170 +1,170 @@ -# AccountMapping - -## Overview - -Extra functionality for building an account management UI. - -### Available Operations - -* [create](#create) - Create bank feed account mapping -* [get](#get) - List bank feed accounts - -## create - -The *Create bank account mapping* endpoint creates a new mapping between a source bank account and a potential account in the accounting software (target account). - -A bank feed account mapping is a specified link between the source account (provided by the Codat user) and the target account (the end user's account in the underlying software). - -To find valid target account options, first call the [List bank feed account mappings](https://docs.codat.io//bank-feeds-api#/operations/get-bank-account-mapping) endpoint. - -> **For custom builds only** -> -> Only use this endpoint if you are building your own account management UI. - -#### Account mapping variability - -The method of mapping the source account to the target account varies depending on the accounting software your company uses. - -#### Mapping options: - -1. **API Mapping**: Integrate the mapping journey directly into your application for a seamless user experience. -2. **Codat UI Mapping**: If you prefer a quicker setup, you can utilize Codat's provided user interface for mapping. -3. **Accounting Platform Mapping**: For some accounting software, the mapping process must be conducted within the software itself. - -### Integration-specific behavior - -| Bank Feed Integration | API Mapping | Codat UI Mapping | Accounting Platform Mapping | -| --------------------- | ----------- | ---------------- | --------------------------- | -| Xero | ✅ | ✅ | | -| FreeAgent | ✅ | ✅ | | -| Oracle NetSuite | ✅ | ✅ | | -| Exact Online (NL) | ✅ | ✅ | | -| QuickBooks Online | | | ✅ | -| Sage | | | ✅ | - -### Example Usage: Example - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.account_mapping.create(request={ - "bank_feed_account_mapping": { - "source_account_id": "acc-002", - "target_account_id": "account-081", - }, - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Malformed query - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.account_mapping.create(request={ - "bank_feed_account_mapping": { - "source_account_id": "acc-002", - "target_account_id": "account-081", - }, - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -| `request` | [operations.CreateBankAccountMappingRequest](../../models/operations/createbankaccountmappingrequest.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.BankFeedAccountMappingResponse](../../models/shared/bankfeedaccountmappingresponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## get - -The *List bank accounts* endpoint returns information about a source bank account and any current or potential target mapping accounts. - -A bank feed account mapping is a specified link between the source account (provided by the Codat user) and the target account (the end user's account in the underlying software). - -> **For custom builds only** -> -> Only use this endpoint if you are building your own account management UI. - -### Example Usage - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.account_mapping.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetBankAccountMappingRequest](../../models/operations/getbankaccountmappingrequest.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 - -**[List[shared.BankFeedMapping]](../../models/.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ----------------------- | ----------------------- | ----------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | +# AccountMapping + +## Overview + +Extra functionality for building an account management UI. + +### Available Operations + +* [create](#create) - Create bank feed account mapping +* [get](#get) - List bank feed accounts + +## create + +The *Create bank account mapping* endpoint creates a new mapping between a source bank account and a potential account in the accounting software (target account). + +A bank feed account mapping is a specified link between the source account (provided by the Codat user) and the target account (the end user's account in the underlying software). + +To find valid target account options, first call the [List bank feed account mappings](https://docs.codat.io//bank-feeds-api#/operations/get-bank-account-mapping) endpoint. + +> **For custom builds only** +> +> Only use this endpoint if you are building your own account management UI. + +#### Account mapping variability + +The method of mapping the source account to the target account varies depending on the accounting software your company uses. + +#### Mapping options: + +1. **API Mapping**: Integrate the mapping journey directly into your application for a seamless user experience. +2. **Codat UI Mapping**: If you prefer a quicker setup, you can utilize Codat's provided user interface for mapping. +3. **Accounting Platform Mapping**: For some accounting software, the mapping process must be conducted within the software itself. + +### Integration-specific behavior + +| Bank Feed Integration | API Mapping | Codat UI Mapping | Accounting Platform Mapping | +| --------------------- | ----------- | ---------------- | --------------------------- | +| Xero | ✅ | ✅ | | +| FreeAgent | ✅ | ✅ | | +| Oracle NetSuite | ✅ | ✅ | | +| Exact Online (NL) | ✅ | ✅ | | +| QuickBooks Online | | | ✅ | +| Sage | | | ✅ | + +### Example Usage: Example + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.account_mapping.create(request={ + "bank_feed_account_mapping": { + "source_account_id": "acc-002", + "target_account_id": "account-081", + }, + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` +### Example Usage: Malformed query + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.account_mapping.create(request={ + "bank_feed_account_mapping": { + "source_account_id": "acc-002", + "target_account_id": "account-081", + }, + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `request` | [operations.CreateBankAccountMappingRequest](../../models/operations/createbankaccountmappingrequest.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.BankFeedAccountMappingResponse](../../models/shared/bankfeedaccountmappingresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------- | ---------------------------- | ---------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## get + +The *List bank accounts* endpoint returns information about a source bank account and any current or potential target mapping accounts. + +A bank feed account mapping is a specified link between the source account (provided by the Codat user) and the target account (the end user's account in the underlying software). + +> **For custom builds only** +> +> Only use this endpoint if you are building your own account management UI. + +### Example Usage + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.account_mapping.get(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `request` | [operations.GetBankAccountMappingRequest](../../models/operations/getbankaccountmappingrequest.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 + +**[List[shared.BankFeedMapping]](../../models/.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------- | ----------------------- | ----------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 429 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/bank-feeds/docs/sdks/bankaccounts/README.md b/bank-feeds/docs/sdks/bankaccounts/README.md index d421cabee..183753652 100644 --- a/bank-feeds/docs/sdks/bankaccounts/README.md +++ b/bank-feeds/docs/sdks/bankaccounts/README.md @@ -1,635 +1,635 @@ -# BankAccounts - -## Overview - -Access bank accounts in an SMBs accounting software. - -### Available Operations - -* [create](#create) - Create bank account -* [get_create_model](#get_create_model) - Get create/update bank account model -* [list](#list) - List bank accounts - -## create - -The *Create bank account* endpoint creates a new [bank account](https://docs.codat.io/bank-feeds-api#/schemas/BankAccount) for a given company's connection. - -[Bank accounts](https://docs.codat.io/bank-feeds-api#/schemas/BankAccount) are financial accounts maintained by a bank or other financial institution. - -**Integration-specific behavior** - -Required data may vary by integration. To see what data to post, first call [Get create/update bank account model](https://docs.codat.io/bank-feeds-api#/operations/get-create-update-bankAccounts-model). - -### Example Usage - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.bank_accounts.create(request={ - "bank_account_prototype": { - "currency": "GBP", - "status": shared.BankAccountStatus.ACTIVE, - }, - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` - -### 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.BankAccountCreateResponse](../../models/shared/bankaccountcreateresponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## get_create_model - -The *Get create/update bank account model* endpoint returns the expected data for the request payload when creating and updating a [bank account](https://docs.codat.io/bank-feeds-api#/schemas/BankAccount) for a given company and integration. - -[Bank accounts](https://docs.codat.io/bank-feeds-api#/schemas/BankAccount) are financial accounts maintained by a bank or other financial institution. - -**Integration-specific behavior** - -See the *response examples* for integration-specific indicative models. - - -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.bank_accounts.get_create_model(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (Netherlands) - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.bank_accounts.get_create_model(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (UK) - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.bank_accounts.get_create_model(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreeAgent - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.bank_accounts.get_create_model(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: KashFlow - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.bank_accounts.get_create_model(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.bank_accounts.get_create_model(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.bank_accounts.get_create_model(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Business Cloud Accounting - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.bank_accounts.get_create_model(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sandbox - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.bank_accounts.get_create_model(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | -| `request` | [operations.GetCreateBankAccountsModelRequest](../../models/operations/getcreatebankaccountsmodelrequest.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.PushOption](../../models/shared/pushoption.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ----------------------- | ----------------------- | ----------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## list - -The *List bank accounts* endpoint returns a list of [bank accounts](https://docs.codat.io/bank-feeds-api#/schemas/BankAccount) for a given company's connection. - -[Bank accounts](https://docs.codat.io/bank-feeds-api#/schemas/BankAccount) are financial accounts maintained by a bank or other financial institution. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/bank-feeds-api#/operations/refresh-company-data). - - -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.bank_accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreeAgent - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.bank_accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: KashFlow - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.bank_accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.bank_accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.bank_accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.bank_accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.bank_accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.bank_accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Business Cloud Accounting - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.bank_accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.bank_accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.bank_accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Zoho Books - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.bank_accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `request` | [operations.ListBankAccountsRequest](../../models/operations/listbankaccountsrequest.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.BankAccounts](../../models/shared/bankaccounts.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| --------------------------------- | --------------------------------- | --------------------------------- | -| errors.ErrorMessage | 400, 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | +# BankAccounts + +## Overview + +Access bank accounts in an SMBs accounting software. + +### Available Operations + +* [create](#create) - Create bank account +* [get_create_model](#get_create_model) - Get create/update bank account model +* [list](#list) - List bank accounts + +## create + +The *Create bank account* endpoint creates a new [bank account](https://docs.codat.io/bank-feeds-api#/schemas/BankAccount) for a given company's connection. + +[Bank accounts](https://docs.codat.io/bank-feeds-api#/schemas/BankAccount) are financial accounts maintained by a bank or other financial institution. + +**Integration-specific behavior** + +Required data may vary by integration. To see what data to post, first call [Get create/update bank account model](https://docs.codat.io/bank-feeds-api#/operations/get-create-update-bankAccounts-model). + +### Example Usage + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.bank_accounts.create(request={ + "bank_account_prototype": { + "currency": "GBP", + "status": shared.BankAccountStatus.ACTIVE, + }, + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` + +### 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.BankAccountCreateResponse](../../models/shared/bankaccountcreateresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------- | ---------------------------- | ---------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## get_create_model + +The *Get create/update bank account model* endpoint returns the expected data for the request payload when creating and updating a [bank account](https://docs.codat.io/bank-feeds-api#/schemas/BankAccount) for a given company and integration. + +[Bank accounts](https://docs.codat.io/bank-feeds-api#/schemas/BankAccount) are financial accounts maintained by a bank or other financial institution. + +**Integration-specific behavior** + +See the *response examples* for integration-specific indicative models. + + +### Example Usage: Dynamics 365 Business Central + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.bank_accounts.get_create_model(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` +### Example Usage: Exact (Netherlands) + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.bank_accounts.get_create_model(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` +### Example Usage: Exact (UK) + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.bank_accounts.get_create_model(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` +### Example Usage: FreeAgent + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.bank_accounts.get_create_model(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` +### Example Usage: KashFlow + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.bank_accounts.get_create_model(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` +### Example Usage: QuickBooks Desktop + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.bank_accounts.get_create_model(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` +### Example Usage: QuickBooks Online Sandbox + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.bank_accounts.get_create_model(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` +### Example Usage: Sage Business Cloud Accounting + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.bank_accounts.get_create_model(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` +### Example Usage: Sandbox + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.bank_accounts.get_create_model(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `request` | [operations.GetCreateBankAccountsModelRequest](../../models/operations/getcreatebankaccountsmodelrequest.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.PushOption](../../models/shared/pushoption.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------- | ----------------------- | ----------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 429 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## list + +The *List bank accounts* endpoint returns a list of [bank accounts](https://docs.codat.io/bank-feeds-api#/schemas/BankAccount) for a given company's connection. + +[Bank accounts](https://docs.codat.io/bank-feeds-api#/schemas/BankAccount) are financial accounts maintained by a bank or other financial institution. + +Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/bank-feeds-api#/operations/refresh-company-data). + + +### Example Usage: Dynamics 365 Business Central + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.bank_accounts.list(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "order_by": "-modifiedDate", + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + }) + + # Handle response + print(res) + +``` +### Example Usage: FreeAgent + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.bank_accounts.list(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "order_by": "-modifiedDate", + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + }) + + # Handle response + print(res) + +``` +### Example Usage: KashFlow + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.bank_accounts.list(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "order_by": "-modifiedDate", + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + }) + + # Handle response + print(res) + +``` +### Example Usage: Oracle NetSuite + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.bank_accounts.list(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "order_by": "-modifiedDate", + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + }) + + # Handle response + print(res) + +``` +### Example Usage: QuickBooks Desktop + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.bank_accounts.list(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "order_by": "-modifiedDate", + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + }) + + # Handle response + print(res) + +``` +### Example Usage: QuickBooks Online + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.bank_accounts.list(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "order_by": "-modifiedDate", + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + }) + + # Handle response + print(res) + +``` +### Example Usage: QuickBooks Online Sandbox + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.bank_accounts.list(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "order_by": "-modifiedDate", + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + }) + + # Handle response + print(res) + +``` +### Example Usage: Sage 50 (UK) + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.bank_accounts.list(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "order_by": "-modifiedDate", + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + }) + + # Handle response + print(res) + +``` +### Example Usage: Sage Business Cloud Accounting + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.bank_accounts.list(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "order_by": "-modifiedDate", + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + }) + + # Handle response + print(res) + +``` +### Example Usage: Sage Intacct + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.bank_accounts.list(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "order_by": "-modifiedDate", + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + }) + + # Handle response + print(res) + +``` +### Example Usage: Xero + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.bank_accounts.list(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "order_by": "-modifiedDate", + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + }) + + # Handle response + print(res) + +``` +### Example Usage: Zoho Books + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.bank_accounts.list(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "order_by": "-modifiedDate", + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `request` | [operations.ListBankAccountsRequest](../../models/operations/listbankaccountsrequest.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.BankAccounts](../../models/shared/bankaccounts.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 409, 429 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/bank-feeds/docs/sdks/companies/README.md b/bank-feeds/docs/sdks/companies/README.md index 981290deb..47cffe1e2 100644 --- a/bank-feeds/docs/sdks/companies/README.md +++ b/bank-feeds/docs/sdks/companies/README.md @@ -1,620 +1,616 @@ -# Companies - -## Overview - -Create and manage your SMB users' companies. - -### Available Operations - -* [create](#create) - Create company -* [delete](#delete) - Delete a company -* [get](#get) - Get company -* [get_access_token](#get_access_token) - Get company access token -* [list](#list) - List companies -* [replace](#replace) - Replace company -* [update](#update) - Update company - -## create - -Use the *Create company* endpoint to create a new [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) that represents your customer in Codat. - -A [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) represents a business sharing access to their data. -Each company can have multiple [connections](https://docs.codat.io/bank-feeds-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: Malformed query - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.companies.create(request={ - "description": "Requested early access to the new financing scheme.", - "name": "Bank of Dave", - }) - - # Handle response - print(res) - -``` -### Example Usage: With a description - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.companies.create(request={ - "description": "Technology services, including web and app design and development", - "name": "Technicalium", - }) - - # Handle response - print(res) - -``` -### Example Usage: With a tag - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.companies.create(request={ - "description": "Requested early access to the new financing scheme.", - "name": "Bank of Dave", - }) - - # Handle response - print(res) - -``` -### Example Usage: With no description - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.companies.create(request={ - "name": "Technicalium", - }) - - # Handle response - print(res) - -``` - -### 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 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## delete - -The *Delete company* endpoint permanently deletes a [company](https://docs.codat.io/bank-feeds-api#/schemas/Company), its [connections](https://docs.codat.io/bank-feeds-api#/schemas/Connection) and any cached data. This operation is irreversible. - -A [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) represents a business sharing access to their data. -Each company can have multiple [connections](https://docs.codat.io/bank-feeds-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_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - codat_bank_feeds.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 | application/json | -| errors.ErrorMessage | 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/bank-feeds-api#/schemas/Company) represents a business sharing access to their data. -Each company can have multiple [connections](https://docs.codat.io/bank-feeds-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: Parent multi-entity company - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.companies.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Simple company - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.companies.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Subsidiary multi-entity company - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.companies.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` - -### 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 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## get_access_token - -Use the _Get company access token_ endpoint to return an access token for the specified company ID. The token is valid for one day. - -The token is required by Codat's embeddable UIs (such as [Connections SDK](https://docs.codat.io/auth-flow/optimize/connection-management) and [Link SDK](https://docs.codat.io/auth-flow/authorize-embedded-link)) to verify the identity of the user and improve the reliability of data provided by them. - -### Example Usage - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.companies.get_access_token(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetCompanyAccessTokenRequest](../../models/operations/getcompanyaccesstokenrequest.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.CompanyAccessToken](../../models/shared/companyaccesstoken.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ----------------------- | ----------------------- | ----------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## list - -The *List companies* endpoint returns a list of [companies](https://docs.codat.io/bank-feeds-api#/schemas/Company) associated to your instances. - -A [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) represents a business sharing access to their data. -Each company can have multiple [connections](https://docs.codat.io/bank-feeds-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. - -## Filter by tags - -The *List companies* endpoint supports the filtering of companies using [tags](https://docs.codat.io/using-the-api/managing-companies#add-metadata-to-a-company). It supports the following operators with [Codat’s query language](https://docs.codat.io/using-the-api/querying): - -- equals (`=`) -- not equals (`!=`) -- contains (`~`) - -For example, you can use the querying to filter companies tagged with a specific foreign key, region, or owning team: -- Foreign key: `uid = {yourCustomerId}` -- Region: `region != uk` -- Owning team and region: `region = uk && owningTeam = invoice-finance` - -### Example Usage: List of Companies - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.companies.list(request={ - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - "tags": "region=uk && team=invoice-finance", - }) - - # Handle response - print(res) - -``` -### Example Usage: One company - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.companies.list(request={ - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - "tags": "region=uk && team=invoice-finance", - }) - - # Handle response - print(res) - -``` - -### 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 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## replace - -Use the *Replace company* endpoint to replace the existing name, description, and tags of the company. Calling the endpoint will replace existing values even if new values haven't been defined in the payload. - -A [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) represents a business sharing access to their data. -Each company can have multiple [connections](https://docs.codat.io/bank-feeds-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: Unauthorized - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.companies.replace(request={ - "company_request_body": { - "description": "Requested early access to the new financing scheme.", - "name": "Bank of Dave", - }, - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Update description - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.companies.replace(request={ - "company_request_body": { - "description": "Additional documents required", - "name": "Same name", - }, - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Update name - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.companies.replace(request={ - "company_request_body": { - "name": "New Name", - }, - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `request` | [operations.ReplaceCompanyRequest](../../models/operations/replacecompanyrequest.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 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## update - -Use the *Update company* endpoint to update the name, description, or tags of the company. - -The *Update company* endpoint doesn't have any required fields. If any of the fields provided are `null` or not provided, they won't be included in the update. - -A [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) represents a business sharing access to their data. - -### Example Usage: Unauthorized - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.companies.update(request={ - "company_update_request": { - "description": "Requested early access to the new financing scheme.", - "name": "Bank of Dave", - }, - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Update name - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.companies.update(request={ - "company_update_request": { - "name": "New Name", - }, - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Update tags - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.companies.update(request={ - "company_update_request": { - "tags": { - "refrence": "new reference", - }, - }, - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` - -### 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 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | +# Companies + +## Overview + +Create and manage your SMB users' companies. + +### Available Operations + +* [create](#create) - Create company +* [delete](#delete) - Delete a company +* [get](#get) - Get company +* [get_access_token](#get_access_token) - Get company access token +* [list](#list) - List companies +* [replace](#replace) - Replace company +* [update](#update) - Update company + +## create + +Use the *Create company* endpoint to create a new [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) that represents your customer in Codat. + +A [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) represents a business sharing access to their data. +Each company can have multiple [connections](https://docs.codat.io/bank-feeds-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: Malformed query + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.companies.create(request={ + "description": "Requested early access to the new financing scheme.", + "name": "Bank of Dave", + }) + + # Handle response + print(res) + +``` +### Example Usage: With a description + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.companies.create(request={ + "description": "Technology services, including web and app design and development", + "name": "Technicalium", + }) + + # Handle response + print(res) + +``` +### Example Usage: With a tag + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.companies.create(request={ + "description": "Requested early access to the new financing scheme.", + "name": "Bank of Dave", + }) + + # Handle response + print(res) + +``` +### Example Usage: With no description + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.companies.create(request={ + "name": "Technicalium", + }) + + # Handle response + print(res) + +``` + +### 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 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## delete + +The *Delete company* endpoint permanently deletes a [company](https://docs.codat.io/bank-feeds-api#/schemas/Company), its [connections](https://docs.codat.io/bank-feeds-api#/schemas/Connection) and any cached data. This operation is irreversible. + +A [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) represents a business sharing access to their data. +Each company can have multiple [connections](https://docs.codat.io/bank-feeds-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_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + codat_bank_feeds.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 | application/json | +| errors.ErrorMessage | 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/bank-feeds-api#/schemas/Company) represents a business sharing access to their data. +Each company can have multiple [connections](https://docs.codat.io/bank-feeds-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: Parent multi-entity company + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.companies.get(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + + # Handle response + print(res) + +``` +### Example Usage: Simple company + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.companies.get(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + + # Handle response + print(res) + +``` +### Example Usage: Subsidiary multi-entity company + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.companies.get(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + + # Handle response + print(res) + +``` + +### 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 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## get_access_token + +Use the _Get company access token_ endpoint to return an access token for the specified company ID. The token is valid for one day. + +The token is required by Codat's embeddable UIs (such as [Connections SDK](https://docs.codat.io/auth-flow/optimize/connection-management) and [Link SDK](https://docs.codat.io/auth-flow/authorize-embedded-link)) to verify the identity of the user and improve the reliability of data provided by them. + +### Example Usage + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.companies.get_access_token(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `request` | [operations.GetCompanyAccessTokenRequest](../../models/operations/getcompanyaccesstokenrequest.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.CompanyAccessToken](../../models/shared/companyaccesstoken.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------- | ----------------------- | ----------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 429 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## list + +The *List companies* endpoint returns a list of [companies](https://docs.codat.io/bank-feeds-api#/schemas/Company) associated to your instances. + +A [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) represents a business sharing access to their data. +Each company can have multiple [connections](https://docs.codat.io/bank-feeds-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. + +## Filter by tags + +The *List companies* endpoint supports the filtering of companies using [tags](https://docs.codat.io/using-the-api/managing-companies#add-metadata-to-a-company). It supports the following operators with [Codat’s query language](https://docs.codat.io/using-the-api/querying): + +- equals (`=`) +- not equals (`!=`) +- contains (`~`) + +For example, you can use the querying to filter companies tagged with a specific foreign key, region, or owning team: +- Foreign key: `uid = {yourCustomerId}` +- Region: `region != uk` +- Owning team and region: `region = uk && owningTeam = invoice-finance` + +### Example Usage: List of Companies + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.companies.list(request={ + "order_by": "-modifiedDate", + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + "tags": "region=uk && team=invoice-finance", + }) + + # Handle response + print(res) + +``` +### Example Usage: One company + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.companies.list(request={ + "order_by": "-modifiedDate", + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + "tags": "region=uk && team=invoice-finance", + }) + + # Handle response + print(res) + +``` + +### 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 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## replace + +Use the *Replace company* endpoint to replace the existing name, description, and tags of the company. Calling the endpoint will replace existing values even if new values haven't been defined in the payload. + +A [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) represents a business sharing access to their data. +Each company can have multiple [connections](https://docs.codat.io/bank-feeds-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: Unauthorized + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.companies.replace(request={ + "company_request_body": { + "description": "Requested early access to the new financing scheme.", + "name": "Bank of Dave", + }, + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + + # Handle response + print(res) + +``` +### Example Usage: Update description + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.companies.replace(request={ + "company_request_body": { + "description": "Additional documents required", + "name": "Same name", + }, + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + + # Handle response + print(res) + +``` +### Example Usage: Update name + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.companies.replace(request={ + "company_request_body": { + "name": "New Name", + }, + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `request` | [operations.ReplaceCompanyRequest](../../models/operations/replacecompanyrequest.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 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## update + +Use the *Update company* endpoint to update the name, description, or tags of the company. + +The *Update company* endpoint doesn't have any required fields. If any of the fields provided are `null` or not provided, they won't be included in the update. + +A [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) represents a business sharing access to their data. + +### Example Usage: Unauthorized + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.companies.update(request={ + "company_update_request": { + "description": "Requested early access to the new financing scheme.", + "name": "Bank of Dave", + }, + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + + # Handle response + print(res) + +``` +### Example Usage: Update name + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.companies.update(request={ + "company_update_request": { + "name": "New Name", + }, + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + + # Handle response + print(res) + +``` +### Example Usage: Update tags + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.companies.update(request={ + "company_update_request": {}, + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + + # Handle response + print(res) + +``` + +### 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 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/bank-feeds/docs/sdks/companyinformation/README.md b/bank-feeds/docs/sdks/companyinformation/README.md index f035d1580..7a8220e5d 100644 --- a/bank-feeds/docs/sdks/companyinformation/README.md +++ b/bank-feeds/docs/sdks/companyinformation/README.md @@ -1,66 +1,66 @@ -# CompanyInformation - -## Overview - -Get detailed information about a company from the underlying accounting software. - -### 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. - -### Supported Integrations -| Integration | Supported | -|-----------------------|-----------| -| Oracle NetSuite | Yes | -| Xero | Yes | -| Exact | No | -| FreeAgent | No | -| Sage | No | -| QuickBooks Online | No | - -### Example Usage - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.company_information.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` - -### 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 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | +# CompanyInformation + +## Overview + +Get detailed information about a company from the underlying accounting software. + +### 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. + +### Supported Integrations +| Integration | Supported | +|-----------------------|-----------| +| Oracle NetSuite | Yes | +| Xero | Yes | +| Exact | No | +| FreeAgent | No | +| Sage | No | +| QuickBooks Online | No | + +### Example Usage + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.company_information.get(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` + +### 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 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/bank-feeds/docs/sdks/connections/README.md b/bank-feeds/docs/sdks/connections/README.md index e182b694d..c6b8c416c 100644 --- a/bank-feeds/docs/sdks/connections/README.md +++ b/bank-feeds/docs/sdks/connections/README.md @@ -1,277 +1,271 @@ -# Connections - -## Overview - -Create new and manage existing data connections for a company. - -### Available Operations - -* [create](#create) - Create connection -* [delete](#delete) - Delete connection -* [get](#get) - Get connection -* [list](#list) - List connections -* [unlink](#unlink) - Unlink connection - -## create - -Creates a connection for the company by providing a valid `platformKey`. - -Use the [List Integrations](https://docs.codat.io/platform-api#/operations/list-integrations) endpoint to access valid platform keys. - -### Example Usage: Connection - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.connections.create(request={ - "request_body": { - "platform_key": "gbol", - }, - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Unauthorized - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.connections.create(request={ - "request_body": { - "platform_key": "gbol", - }, - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` - -### 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 | application/json | -| errors.ErrorMessage | 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_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - codat_bank_feeds.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 | application/json | -| errors.ErrorMessage | 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_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.connections.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` - -### 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 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## list - -List the connections for a company. - -### Example Usage - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.connections.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` - -### 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 | application/json | -| errors.ErrorMessage | 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_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.connections.unlink(request={ - "request_body": { - "status": shared.DataConnectionStatus.UNLINKED, - }, - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` - -### 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 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | +# Connections + +## Overview + +Create new and manage existing data connections for a company. + +### Available Operations + +* [create](#create) - Create connection +* [delete](#delete) - Delete connection +* [get](#get) - Get connection +* [list](#list) - List connections +* [unlink](#unlink) - Unlink connection + +## create + +Creates a connection for the company by providing a valid `platformKey`. + +Use the [List Integrations](https://docs.codat.io/platform-api#/operations/list-integrations) endpoint to access valid platform keys. + +### Example Usage: Connection + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.connections.create(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + + # Handle response + print(res) + +``` +### Example Usage: Unauthorized + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.connections.create(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + + # Handle response + print(res) + +``` + +### 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 | application/json | +| errors.ErrorMessage | 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_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + codat_bank_feeds.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 | application/json | +| errors.ErrorMessage | 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_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.connections.get(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` + +### 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 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## list + +List the connections for a company. + +### Example Usage + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.connections.list(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "order_by": "-modifiedDate", + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + }) + + # Handle response + print(res) + +``` + +### 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 | application/json | +| errors.ErrorMessage | 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_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.connections.unlink(request={ + "request_body": { + "status": shared.DataConnectionStatus.UNLINKED, + }, + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` + +### 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 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/bank-feeds/docs/sdks/managedbankfeeds/README.md b/bank-feeds/docs/sdks/managedbankfeeds/README.md index 1814f98fd..9ec434245 100644 --- a/bank-feeds/docs/sdks/managedbankfeeds/README.md +++ b/bank-feeds/docs/sdks/managedbankfeeds/README.md @@ -1,166 +1,163 @@ -# ManagedBankFeeds - -## Overview - -Manage bank feed syncs for source accounts. - -### Available Operations - -* [get_latest_sync](#get_latest_sync) - Get latest sync -* [get_sync](#get_sync) - Get sync -* [run_ad_hoc_sync](#run_ad_hoc_sync) - Run ad-hoc sync - -## get_latest_sync - -The _Get latest sync_ endpoint returns the status for a given source account's [most recent sync](https://docs.codat.io/bank-feeds-api#/schemas/SyncStatusResult). - -A sync is a single execution that fetches bank transactions from a connected bank account and records them in the company's accounting software. - -### Example Usage - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.managed_bank_feeds.get_latest_sync(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "source_account_id": "", - }) - - assert res is not None - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetLatestManagedBankFeedSyncRequest](../../models/operations/getlatestmanagedbankfeedsyncrequest.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.SyncStatusResult](../../models/shared/syncstatusresult.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ----------------------- | ----------------------- | ----------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## get_sync - -The _Get sync_ endpoint returns the [sync status](https://docs.codat.io/bank-feeds-api#/schemas/SyncStatusResult) for a given 'syncId'. - -A sync is a single execution that fetches bank transactions from a connected bank account and records them in the company's accounting software. - -### Example Usage - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.managed_bank_feeds.get_sync(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "source_account_id": "", - "sync_id": "823d304f-a204-4760-9b5d-b8a89bf29bed", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetManagedBankFeedSyncRequest](../../models/operations/getmanagedbankfeedsyncrequest.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.SyncStatusResult](../../models/shared/syncstatusresult.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ----------------------- | ----------------------- | ----------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## run_ad_hoc_sync - -The _Run ad-hoc sync_ endpoint immediately runs a sync with a fetch period from the last successful sync to the execution time of the new sync. - -A sync is a single execution that fetches bank transactions from a connected bank account and records them in the company's accounting software. - -Use either the [_Get latest sync_](https://docs.codat.io/bank-feeds-api#/operations/get-latest-managed-bank-feed-sync) endpoint or the [_Get sync_](https://docs.codat.io/bank-feeds-api#/operations/fetch-managed-bank-feed-sync-by-id) endpoint to get the result of this sync. - -### Example Usage - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.managed_bank_feeds.run_ad_hoc_sync(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "source_account_id": "", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -| `request` | [operations.RunManagedBankFeedAdHocSyncRequest](../../models/operations/runmanagedbankfeedadhocsyncrequest.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.StartScheduledSyncResult](../../models/shared/startscheduledsyncresult.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| --------------------------------- | --------------------------------- | --------------------------------- | -| errors.ErrorMessage | 400, 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | +# ManagedBankFeeds + +## Overview + +Manage bank feed syncs for source accounts. + +### Available Operations + +* [get_latest_sync](#get_latest_sync) - Get latest sync +* [get_sync](#get_sync) - Get sync +* [run_ad_hoc_sync](#run_ad_hoc_sync) - Run ad-hoc sync + +## get_latest_sync + +The _Get latest sync_ endpoint returns the status for a given source account's [most recent sync](https://docs.codat.io/bank-feeds-api#/schemas/SyncStatusResult). + +A sync is a single execution that fetches bank transactions from a connected bank account and records them in the company's accounting software. + +### Example Usage + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.managed_bank_feeds.get_latest_sync(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "source_account_id": "", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | +| `request` | [operations.GetLatestManagedBankFeedSyncRequest](../../models/operations/getlatestmanagedbankfeedsyncrequest.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.SyncStatusResult](../../models/shared/syncstatusresult.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------- | ----------------------- | ----------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 429 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## get_sync + +The _Get sync_ endpoint returns the [sync status](https://docs.codat.io/bank-feeds-api#/schemas/SyncStatusResult) for a given 'syncId'. + +A sync is a single execution that fetches bank transactions from a connected bank account and records them in the company's accounting software. + +### Example Usage + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.managed_bank_feeds.get_sync(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "source_account_id": "", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `request` | [operations.GetManagedBankFeedSyncRequest](../../models/operations/getmanagedbankfeedsyncrequest.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.SyncStatusResult](../../models/shared/syncstatusresult.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------- | ----------------------- | ----------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 429 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## run_ad_hoc_sync + +The _Run ad-hoc sync_ endpoint immediately runs a sync with a fetch period from the last successful sync to the execution time of the new sync. + +A sync is a single execution that fetches bank transactions from a connected bank account and records them in the company's accounting software. + +Use either the [_Get latest sync_](https://docs.codat.io/bank-feeds-api#/operations/get-latest-managed-bank-feed-sync) endpoint or the [_Get sync_](https://docs.codat.io/bank-feeds-api#/operations/fetch-managed-bank-feed-sync-by-id) endpoint to get the result of this sync. + +### Example Usage + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.managed_bank_feeds.run_ad_hoc_sync(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "source_account_id": "", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `request` | [operations.RunManagedBankFeedAdHocSyncRequest](../../models/operations/runmanagedbankfeedadhocsyncrequest.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.StartScheduledSyncResult](../../models/shared/startscheduledsyncresult.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 409, 429 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/bank-feeds/docs/sdks/sourceaccounts/README.md b/bank-feeds/docs/sdks/sourceaccounts/README.md index 363a9f8f2..2cebc57d9 100644 --- a/bank-feeds/docs/sdks/sourceaccounts/README.md +++ b/bank-feeds/docs/sdks/sourceaccounts/README.md @@ -1,505 +1,477 @@ -# SourceAccounts - -## Overview - -Provide and manage lists of source bank accounts. - -### Available Operations - -* [create](#create) - Create single source account -* [create_batch](#create_batch) - Create source accounts -* [delete](#delete) - Delete source account -* [delete_credentials](#delete_credentials) - Delete all source account credentials -* [generate_credentials](#generate_credentials) - Generate source account credentials -* [generate_otp](#generate_otp) - Generate one-time password -* [list](#list) - List source accounts -* [update](#update) - Update source account - -## create - -The _Create Source Account_ endpoint allows you to create a representation of a bank account within Codat's domain. The company can then map the source account to an existing or new target account in their accounting software. - -> ### Versioning -> If you are integrating the Bank Feeds solution with Codat after August 1, 2024, please use the v2 version of the API, as detailed in the schema below. For integrations completed before August 1, 2024, select the v1 version from the schema dropdown below. - -### Example Usage: Malformed query - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.source_accounts.create(request={ - "request_body": { - "currency": "GBP", - "id": "", - "modified_date": "2022-10-23T00:00:00Z", - }, - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Version 1 - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared -from decimal import Decimal - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.source_accounts.create(request={ - "request_body": { - "account_name": "account-081", - "account_number": "12345670", - "account_type": "Credit", - "balance": Decimal("99.99"), - "currency": "GBP", - "id": "acc-002", - "modified_date": "2023-01-09T14:14:14.1057478Z", - "sort_code": "123456", - }, - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Version 2 - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.source_accounts.create(request={ - "request_body": { - "currency": "GBP", - "id": "", - "modified_date": "2022-10-23T00:00:00Z", - }, - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| `request` | [operations.CreateSourceAccountRequest](../../models/operations/createsourceaccountrequest.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 - -**[operations.CreateSourceAccountResponseBody](../../models/operations/createsourceaccountresponsebody.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## create_batch - -The _Batch create source accounts_ endpoint allows you to create multiple representations of your SMB's bank accounts within Codat's domain. The company can then map the source account to an existing or new target account in their accounting software. - -> ### Versioning -> If you are integrating the Bank Feeds solution with Codat after August 1, 2024, please use the v2 version of the API, as detailed in the schema below. For integrations completed before August 1, 2024, select the v1 version from the schema dropdown below. - -### Example Usage - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.source_accounts.create_batch(request={ - "request_body": [ - { - "currency": "GBP", - "id": "", - "modified_date": "2022-10-23T00:00:00Z", - }, - ], - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -| `request` | [operations.CreateBatchSourceAccountRequest](../../models/operations/createbatchsourceaccountrequest.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 - -**[operations.CreateBatchSourceAccountResponse](../../models/operations/createbatchsourceaccountresponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## delete - -The _Delete source account_ endpoint enables you to remove a source account. - -Removing a source account will also remove any mapping between the source bank feed bank accounts and the target bankfeed bank account. - - -### Example Usage - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - codat_bank_feeds.source_accounts.delete(request={ - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Use the SDK ... - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| `request` | [operations.DeleteSourceAccountRequest](../../models/operations/deletesourceaccountrequest.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 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## delete_credentials - -The _Delete Bank Account Credentials_ endpoint serves as a comprehensive mechanism for revoking all existing authorization credentials that a company employs to establish its Bank Feed connection. - -In cases where multiple credential sets have been generated, a single API call to this endpoint revokes all of them. - -### Example Usage - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - codat_bank_feeds.source_accounts.delete_credentials(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.DeleteBankFeedCredentialsRequest](../../models/operations/deletebankfeedcredentialsrequest.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 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## generate_credentials - -The _Generate bank account credentials_ endpoint can be used to generate credentials for QuickBooks Online to authenticate the Bank Feed in the QBO portal. Each time this endpoint is called, a new set of credentials will be generated. - -The old credentials will still be valid until the revoke credentials endpoint is used, which will revoke all credentials associated to the data connection. - -> **For QuickBooks Online only** -> -> Only call this endpoint when onboarding SMBs that use QuickBooks Online. - -### Example Usage - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.source_accounts.generate_credentials(request={ - "request_body": open("example.file", "rb"), - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| `request` | [operations.GenerateCredentialsRequest](../../models/operations/generatecredentialsrequest.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.BankAccountCredentials](../../models/shared/bankaccountcredentials.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ----------------------- | ----------------------- | ----------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## generate_otp - -The *Generate OTP* endpoint generates a one-time password (OTP) for a bank feed connection. The OTP is returned along with an expiry time, after which it will no longer be valid. - -> **For Sage only** -> -> Only call this endpoint for connections to Sage. Calling it for other integrations will return an error. - - -### Example Usage - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.source_accounts.generate_otp(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | -| `request` | [operations.GenerateOtpRequest](../../models/operations/generateotprequest.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.GenerateOtpResponse](../../models/shared/generateotpresponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## list - -The _List source accounts_ endpoint returns a list of [source accounts](https://docs.codat.io/bank-feeds-api#/schemas/BankFeedAccount) for a given company's connection. - -[Source accounts](https://docs.codat.io/bank-feeds-api#/schemas/BankFeedAccount) are the bank's bank account within Codat's domain from which transactions are synced into the accounting platform. - -> ### Versioning -> If you are integrating the Bank Feeds solution with Codat after August 1, 2024, please use the v2 version of the API, as detailed in the schema below. For integrations completed before August 1, 2024, select the v1 version from the schema dropdown below. - -### Example Usage - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.source_accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -| `request` | [operations.ListSourceAccountsRequest](../../models/operations/listsourceaccountsrequest.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 - -**[operations.ListSourceAccountsResponseBody](../../models/operations/listsourceaccountsresponsebody.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ----------------------- | ----------------------- | ----------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## update - -The _Update source account_ endpoint updates a single source account for a single data connection connected to a single company. - -### Tips and pitfalls - -* This endpoint makes it possible to update the `accountName`, `status`, and `balance` fields. - * The `status` field can only be updated to 'disconnected'. - * The `balance` field can only be updated on accounts that are **not** 'connected'. -* Updates made here apply exclusively to source accounts and will not affect target accounts in the accounting software. - -### Example Usage - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared -from decimal import Decimal - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.source_accounts.update(request={ - "source_account": { - "account_name": "account-081", - "account_number": "12345670", - "account_type": "Credit", - "balance": Decimal("99.99"), - "currency": "GBP", - "id": "acc-002", - "modified_date": "2023-01-09T14:14:14.1057478Z", - "sort_code": "123456", - "status": shared.Status.PENDING, - }, - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| `request` | [operations.UpdateSourceAccountRequest](../../models/operations/updatesourceaccountrequest.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.SourceAccount](../../models/shared/sourceaccount.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | +# SourceAccounts + +## Overview + +Provide and manage lists of source bank accounts. + +### Available Operations + +* [create](#create) - Create single source account +* [create_batch](#create_batch) - Create source accounts +* [delete](#delete) - Delete source account +* [delete_credentials](#delete_credentials) - Delete all source account credentials +* [generate_credentials](#generate_credentials) - Generate source account credentials +* [generate_otp](#generate_otp) - Generate one-time password +* [list](#list) - List source accounts +* [update](#update) - Update source account + +## create + +The _Create Source Account_ endpoint allows you to create a representation of a bank account within Codat's domain. The company can then map the source account to an existing or new target account in their accounting software. + +> ### Versioning +> If you are integrating the Bank Feeds solution with Codat after August 1, 2024, please use the v2 version of the API, as detailed in the schema below. For integrations completed before August 1, 2024, select the v1 version from the schema dropdown below. + +### Example Usage: Malformed query + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.source_accounts.create(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` +### Example Usage: Version 1 + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.source_accounts.create(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` +### Example Usage: Version 2 + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.source_accounts.create(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `request` | [operations.CreateSourceAccountRequest](../../models/operations/createsourceaccountrequest.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 + +**[operations.CreateSourceAccountResponseBody](../../models/operations/createsourceaccountresponsebody.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------- | ---------------------------- | ---------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## create_batch + +The _Batch create source accounts_ endpoint allows you to create multiple representations of your SMB's bank accounts within Codat's domain. The company can then map the source account to an existing or new target account in their accounting software. + +> ### Versioning +> If you are integrating the Bank Feeds solution with Codat after August 1, 2024, please use the v2 version of the API, as detailed in the schema below. For integrations completed before August 1, 2024, select the v1 version from the schema dropdown below. + +### Example Usage + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.source_accounts.create_batch(request={ + "request_body": [], + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `request` | [operations.CreateBatchSourceAccountRequest](../../models/operations/createbatchsourceaccountrequest.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 + +**[operations.CreateBatchSourceAccountResponse](../../models/operations/createbatchsourceaccountresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 409, 429 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## delete + +The _Delete source account_ endpoint enables you to remove a source account. + +Removing a source account will also remove any mapping between the source bank feed bank accounts and the target bankfeed bank account. + + +### Example Usage + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + codat_bank_feeds.source_accounts.delete(request={ + "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Use the SDK ... + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `request` | [operations.DeleteSourceAccountRequest](../../models/operations/deletesourceaccountrequest.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 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## delete_credentials + +The _Delete Bank Account Credentials_ endpoint serves as a comprehensive mechanism for revoking all existing authorization credentials that a company employs to establish its Bank Feed connection. + +In cases where multiple credential sets have been generated, a single API call to this endpoint revokes all of them. + +### Example Usage + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + codat_bank_feeds.source_accounts.delete_credentials(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.DeleteBankFeedCredentialsRequest](../../models/operations/deletebankfeedcredentialsrequest.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 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## generate_credentials + +The _Generate bank account credentials_ endpoint can be used to generate credentials for QuickBooks Online to authenticate the Bank Feed in the QBO portal. Each time this endpoint is called, a new set of credentials will be generated. + +The old credentials will still be valid until the revoke credentials endpoint is used, which will revoke all credentials associated to the data connection. + +> **For QuickBooks Online only** +> +> Only call this endpoint when onboarding SMBs that use QuickBooks Online. + +### Example Usage + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.source_accounts.generate_credentials(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `request` | [operations.GenerateCredentialsRequest](../../models/operations/generatecredentialsrequest.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.BankAccountCredentials](../../models/shared/bankaccountcredentials.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------- | ----------------------- | ----------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 429 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## generate_otp + +The *Generate OTP* endpoint generates a one-time password (OTP) for a bank feed connection. The OTP is returned along with an expiry time, after which it will no longer be valid. + +> **For Sage only** +> +> Only call this endpoint for connections to Sage. Calling it for other integrations will return an error. + + +### Example Usage + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.source_accounts.generate_otp(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `request` | [operations.GenerateOtpRequest](../../models/operations/generateotprequest.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.GenerateOtpResponse](../../models/shared/generateotpresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------- | ---------------------------- | ---------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## list + +The _List source accounts_ endpoint returns a list of [source accounts](https://docs.codat.io/bank-feeds-api#/schemas/BankFeedAccount) for a given company's connection. + +[Source accounts](https://docs.codat.io/bank-feeds-api#/schemas/BankFeedAccount) are the bank's bank account within Codat's domain from which transactions are synced into the accounting platform. + +> ### Versioning +> If you are integrating the Bank Feeds solution with Codat after August 1, 2024, please use the v2 version of the API, as detailed in the schema below. For integrations completed before August 1, 2024, select the v1 version from the schema dropdown below. + +### Example Usage + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.source_accounts.list(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `request` | [operations.ListSourceAccountsRequest](../../models/operations/listsourceaccountsrequest.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 + +**[operations.ListSourceAccountsResponseBody](../../models/operations/listsourceaccountsresponsebody.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------- | ----------------------- | ----------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 429 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## update + +The _Update source account_ endpoint updates a single source account for a single data connection connected to a single company. + +### Tips and pitfalls + +* This endpoint makes it possible to update the `accountName`, `status`, and `balance` fields. + * The `status` field can only be updated to 'disconnected'. + * The `balance` field can only be updated on accounts that are **not** 'connected'. +* Updates made here apply exclusively to source accounts and will not affect target accounts in the accounting software. + +### Example Usage + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared +from decimal import Decimal + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.source_accounts.update(request={ + "source_account": { + "account_name": "account-081", + "account_number": "12345670", + "account_type": "Credit", + "balance": Decimal("99.99"), + "currency": "GBP", + "id": "acc-002", + "modified_date": "2023-01-09T14:14:14.1057478Z", + "sort_code": "123456", + "status": shared.Status.PENDING, + }, + "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `request` | [operations.UpdateSourceAccountRequest](../../models/operations/updatesourceaccountrequest.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.SourceAccount](../../models/shared/sourceaccount.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------- | ---------------------------- | ---------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/bank-feeds/docs/sdks/transactions/README.md b/bank-feeds/docs/sdks/transactions/README.md index 7bac8c9c7..3c111c125 100644 --- a/bank-feeds/docs/sdks/transactions/README.md +++ b/bank-feeds/docs/sdks/transactions/README.md @@ -1,456 +1,455 @@ -# Transactions - -## Overview - -Create new bank account transactions for a company's connections, and see previous operations. - -### Available Operations - -* [create](#create) - Create bank transactions -* [get_create_model](#get_create_model) - Get create bank transactions model -* [get_create_operation](#get_create_operation) - Get create operation -* [list_create_operations](#list_create_operations) - List create operations - -## create - -The *Create bank transactions* endpoint creates new [bank transactions](https://docs.codat.io/bank-feeds-api#/schemas/BankTransactions) for a given company's connection. - -[Bank transactions](https://docs.codat.io/bank-feeds-api#/schemas/BankTransactions) are records of monetary amounts that have moved in and out of an SMB's bank account. - -**Integration-specific behavior** - -The required properties may vary based on the integration. For detailed requirements specific to each accounting software, refer to the API reference examples. -Alternatively, you can view the [Get create bank transaction model](https://docs.codat.io/bank-feeds-api#/operations/get-create-bank-transactions-model) for more information. - -### Example Usage: FreeAgent - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared -from decimal import Decimal - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.transactions.create(request={ - "create_bank_transactions": { - "account_id": "49cd5a42-b311-4750-9361-52e2ed1d4653", - "transactions": [ - { - "amount": Decimal("100"), - "date_": "2023-08-22T10:21:00", - "description": "Repayment of Credit Card", - "id": "716422529", - "transaction_type": shared.BankTransactionType.CREDIT, - }, - { - "amount": Decimal("-100"), - "date_": "2023-08-22T10:22:00", - "description": "Amazon Purchase", - "id": "716422530", - "transaction_type": shared.BankTransactionType.DEBIT, - }, - { - "amount": Decimal("-60"), - "date_": "2023-08-22T10:23:00", - "description": "Office Supplies", - "id": "716422531", - "transaction_type": shared.BankTransactionType.DEBIT, - }, - ], - }, - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Malformed query - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.transactions.create(request={ - "create_bank_transactions": { - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "transactions": [], - }, - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Bank Feeds - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared -from decimal import Decimal - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.transactions.create(request={ - "create_bank_transactions": { - "account_id": "49cd5a42-b311-4750-9361-52e2ed1d4653", - "transactions": [ - { - "amount": Decimal("100"), - "balance": Decimal("100"), - "date_": "2023-08-22T10:21:00", - "description": "Repayment of Credit Card", - "id": "716422529", - "transaction_type": shared.BankTransactionType.CREDIT, - }, - { - "amount": Decimal("-100"), - "balance": Decimal("0"), - "date_": "2023-08-22T10:22:00", - "description": "Amazon Purchase", - "id": "716422530", - "transaction_type": shared.BankTransactionType.DEBIT, - }, - { - "amount": Decimal("-60"), - "balance": Decimal("-60"), - "date_": "2023-08-22T10:23:00", - "description": "Office Supplies", - "id": "716422531", - "transaction_type": shared.BankTransactionType.DEBIT, - }, - ], - }, - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared -from decimal import Decimal - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.transactions.create(request={ - "create_bank_transactions": { - "account_id": "49cd5a42-b311-4750-9361-52e2ed1d4653", - "transactions": [ - { - "amount": Decimal("100"), - "balance": Decimal("100"), - "counterparty": "Bank of Example", - "date_": "2023-08-22T10:21:00", - "description": "Repayment of Credit Card", - "id": "716422529", - "reference": "Ref-12345", - "transaction_type": shared.BankTransactionType.CREDIT, - }, - { - "amount": Decimal("-100"), - "balance": Decimal("0"), - "counterparty": "Amazon", - "date_": "2023-08-22T10:22:00", - "description": "Amazon Purchase", - "id": "716422530", - "reference": "Ref-12346", - "transaction_type": shared.BankTransactionType.DEBIT, - }, - { - "amount": Decimal("-60"), - "balance": Decimal("-60"), - "counterparty": "Office Mart", - "date_": "2023-08-22T10:23:00", - "description": "Office Supplies", - "id": "716422531", - "reference": "Ref-12347", - "transaction_type": shared.BankTransactionType.DEBIT, - }, - ], - }, - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared -from decimal import Decimal - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.transactions.create(request={ - "create_bank_transactions": { - "account_id": "49cd5a42-b311-4750-9361-52e2ed1d4653", - "transactions": [ - { - "amount": Decimal("100"), - "balance": Decimal("100"), - "counterparty": "Bank of Example", - "date_": "2023-08-22T10:21:00", - "description": "Repayment of Credit Card", - "id": "716422529", - "reconciled": True, - "reference": "Ref-12345", - "transaction_type": shared.BankTransactionType.CREDIT, - }, - { - "amount": Decimal("-100"), - "balance": Decimal("0"), - "counterparty": "Amazon", - "date_": "2023-08-22T10:22:00", - "description": "Amazon Purchase", - "id": "716422530", - "reconciled": False, - "reference": "Ref-12346", - "transaction_type": shared.BankTransactionType.DEBIT, - }, - { - "amount": Decimal("-60"), - "balance": Decimal("-60"), - "counterparty": "Office Mart", - "date_": "2023-08-22T10:23:00", - "description": "Office Supplies", - "id": "716422531", - "reconciled": False, - "reference": "Ref-12347", - "transaction_type": shared.BankTransactionType.DEBIT, - }, - ], - }, - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | -| `request` | [operations.CreateBankTransactionsRequest](../../models/operations/createbanktransactionsrequest.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.CreateBankTransactionsResponse](../../models/shared/createbanktransactionsresponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## get_create_model - -The *Get create bank account transactions model* endpoint returns the expected data for the request payload when creating [bank account transactions](https://docs.codat.io/bank-feeds-api#/schemas/BankTransactions) for a given company and integration. - -[Bank account transactions](https://docs.codat.io/bank-feeds-api#/schemas/BankTransactions) are records of money that has moved in and out of an SMB's bank account. - -**Integration-specific behavior** - -See the *response examples* for integration-specific indicative models. - -### Example Usage - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.transactions.get_create_model(request={ - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetCreateBankTransactionsModelRequest](../../models/operations/getcreatebanktransactionsmodelrequest.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.PushOption](../../models/shared/pushoption.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ----------------------- | ----------------------- | ----------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## get_create_operation - -The **Get create operation** endpoint returns a specific [write operation](/using-the-api/push) identified by the `pushOperationKey` that was performed on the company. - -Write operations are actions that send requests to Codat, enabling the creation, updating, deletion of records, or uploading attachments in the connected accounting software. - -For bank feeds, your push operations will only relate to the `bankTransactions` data type. - -### Example Usage - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.transactions.get_create_operation(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "push_operation_key": "23a26d56-6e3d-4414-865c-4fa7ebbb43e3", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -| `request` | [operations.GetCreateOperationRequest](../../models/operations/getcreateoperationrequest.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.PushOperation](../../models/shared/pushoperation.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ----------------------- | ----------------------- | ----------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## list_create_operations - -The **List create operations** endpoint returns a list of [write operations](/using-the-api/push) performed on the company. - -Write operations are actions that send requests to Codat, enabling the creation, updating, deletion of records, or uploading attachments in the connected accounting software. - -For bank feeds, use this endpoint to view write operations related to the `bankTransactions` data type. - -### Example Usage - - -```python -from codat_bankfeeds import CodatBankFeeds -from codat_bankfeeds.models import shared - - -with CodatBankFeeds( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as codat_bank_feeds: - - res = codat_bank_feeds.transactions.list_create_operations(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | -| `request` | [operations.ListCreateOperationsRequest](../../models/operations/listcreateoperationsrequest.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.PushOperations](../../models/shared/pushoperations.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | +# Transactions + +## Overview + +Create new bank account transactions for a company's connections, and see previous operations. + +### Available Operations + +* [create](#create) - Create bank transactions +* [get_create_model](#get_create_model) - Get create bank transactions model +* [get_create_operation](#get_create_operation) - Get create operation +* [list_create_operations](#list_create_operations) - List create operations + +## create + +The *Create bank transactions* endpoint creates new [bank transactions](https://docs.codat.io/bank-feeds-api#/schemas/BankTransactions) for a given company's connection. + +[Bank transactions](https://docs.codat.io/bank-feeds-api#/schemas/BankTransactions) are records of monetary amounts that have moved in and out of an SMB's bank account. + +**Integration-specific behavior** + +The required properties may vary based on the integration. For detailed requirements specific to each accounting software, refer to the API reference examples. +Alternatively, you can view the [Get create bank transaction model](https://docs.codat.io/bank-feeds-api#/operations/get-create-bank-transactions-model) for more information. + +### Example Usage: FreeAgent + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared +from decimal import Decimal + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.transactions.create(request={ + "create_bank_transactions": { + "account_id": "49cd5a42-b311-4750-9361-52e2ed1d4653", + "transactions": [ + { + "amount": Decimal("100"), + "date_": "2023-08-22T10:21:00", + "description": "Repayment of Credit Card", + "id": "716422529", + "transaction_type": shared.BankTransactionType.CREDIT, + }, + { + "amount": Decimal("-100"), + "date_": "2023-08-22T10:22:00", + "description": "Amazon Purchase", + "id": "716422530", + "transaction_type": shared.BankTransactionType.DEBIT, + }, + { + "amount": Decimal("-60"), + "date_": "2023-08-22T10:23:00", + "description": "Office Supplies", + "id": "716422531", + "transaction_type": shared.BankTransactionType.DEBIT, + }, + ], + }, + "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` +### Example Usage: Malformed query + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.transactions.create(request={ + "create_bank_transactions": { + "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", + "transactions": [], + }, + "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` +### Example Usage: QuickBooks Online Bank Feeds + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared +from decimal import Decimal + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.transactions.create(request={ + "create_bank_transactions": { + "account_id": "49cd5a42-b311-4750-9361-52e2ed1d4653", + "transactions": [ + { + "amount": Decimal("100"), + "balance": Decimal("100"), + "date_": "2023-08-22T10:21:00", + "description": "Repayment of Credit Card", + "id": "716422529", + "transaction_type": shared.BankTransactionType.CREDIT, + }, + { + "amount": Decimal("-100"), + "balance": Decimal("0"), + "date_": "2023-08-22T10:22:00", + "description": "Amazon Purchase", + "id": "716422530", + "transaction_type": shared.BankTransactionType.DEBIT, + }, + { + "amount": Decimal("-60"), + "balance": Decimal("-60"), + "date_": "2023-08-22T10:23:00", + "description": "Office Supplies", + "id": "716422531", + "transaction_type": shared.BankTransactionType.DEBIT, + }, + ], + }, + "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` +### Example Usage: Sage + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared +from decimal import Decimal + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.transactions.create(request={ + "create_bank_transactions": { + "account_id": "49cd5a42-b311-4750-9361-52e2ed1d4653", + "transactions": [ + { + "amount": Decimal("100"), + "balance": Decimal("100"), + "counterparty": "Bank of Example", + "date_": "2023-08-22T10:21:00", + "description": "Repayment of Credit Card", + "id": "716422529", + "reference": "Ref-12345", + "transaction_type": shared.BankTransactionType.CREDIT, + }, + { + "amount": Decimal("-100"), + "balance": Decimal("0"), + "counterparty": "Amazon", + "date_": "2023-08-22T10:22:00", + "description": "Amazon Purchase", + "id": "716422530", + "reference": "Ref-12346", + "transaction_type": shared.BankTransactionType.DEBIT, + }, + { + "amount": Decimal("-60"), + "balance": Decimal("-60"), + "counterparty": "Office Mart", + "date_": "2023-08-22T10:23:00", + "description": "Office Supplies", + "id": "716422531", + "reference": "Ref-12347", + "transaction_type": shared.BankTransactionType.DEBIT, + }, + ], + }, + "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` +### Example Usage: Xero + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared +from decimal import Decimal + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.transactions.create(request={ + "create_bank_transactions": { + "account_id": "49cd5a42-b311-4750-9361-52e2ed1d4653", + "transactions": [ + { + "amount": Decimal("100"), + "balance": Decimal("100"), + "counterparty": "Bank of Example", + "date_": "2023-08-22T10:21:00", + "description": "Repayment of Credit Card", + "id": "716422529", + "reconciled": True, + "reference": "Ref-12345", + "transaction_type": shared.BankTransactionType.CREDIT, + }, + { + "amount": Decimal("-100"), + "balance": Decimal("0"), + "counterparty": "Amazon", + "date_": "2023-08-22T10:22:00", + "description": "Amazon Purchase", + "id": "716422530", + "reconciled": False, + "reference": "Ref-12346", + "transaction_type": shared.BankTransactionType.DEBIT, + }, + { + "amount": Decimal("-60"), + "balance": Decimal("-60"), + "counterparty": "Office Mart", + "date_": "2023-08-22T10:23:00", + "description": "Office Supplies", + "id": "716422531", + "reconciled": False, + "reference": "Ref-12347", + "transaction_type": shared.BankTransactionType.DEBIT, + }, + ], + }, + "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `request` | [operations.CreateBankTransactionsRequest](../../models/operations/createbanktransactionsrequest.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.CreateBankTransactionsResponse](../../models/shared/createbanktransactionsresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------- | ---------------------------- | ---------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## get_create_model + +The *Get create bank account transactions model* endpoint returns the expected data for the request payload when creating [bank account transactions](https://docs.codat.io/bank-feeds-api#/schemas/BankTransactions) for a given company and integration. + +[Bank account transactions](https://docs.codat.io/bank-feeds-api#/schemas/BankTransactions) are records of money that has moved in and out of an SMB's bank account. + +**Integration-specific behavior** + +See the *response examples* for integration-specific indicative models. + +### Example Usage + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.transactions.get_create_model(request={ + "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `request` | [operations.GetCreateBankTransactionsModelRequest](../../models/operations/getcreatebanktransactionsmodelrequest.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.PushOption](../../models/shared/pushoption.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------- | ----------------------- | ----------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 429 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## get_create_operation + +The **Get create operation** endpoint returns a specific [write operation](/using-the-api/push) identified by the `pushOperationKey` that was performed on the company. + +Write operations are actions that send requests to Codat, enabling the creation, updating, deletion of records, or uploading attachments in the connected accounting software. + +For bank feeds, your push operations will only relate to the `bankTransactions` data type. + +### Example Usage + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.transactions.get_create_operation(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `request` | [operations.GetCreateOperationRequest](../../models/operations/getcreateoperationrequest.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.PushOperation](../../models/shared/pushoperation.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------- | ----------------------- | ----------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 429 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## list_create_operations + +The **List create operations** endpoint returns a list of [write operations](/using-the-api/push) performed on the company. + +Write operations are actions that send requests to Codat, enabling the creation, updating, deletion of records, or uploading attachments in the connected accounting software. + +For bank feeds, use this endpoint to view write operations related to the `bankTransactions` data type. + +### Example Usage + + +```python +from codat_bankfeeds import CodatBankFeeds +from codat_bankfeeds.models import shared + + +with CodatBankFeeds( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as codat_bank_feeds: + + res = codat_bank_feeds.transactions.list_create_operations(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "order_by": "-modifiedDate", + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `request` | [operations.ListCreateOperationsRequest](../../models/operations/listcreateoperationsrequest.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.PushOperations](../../models/shared/pushoperations.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------- | ---------------------------- | ---------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/bank-feeds/pyproject.toml b/bank-feeds/pyproject.toml index cfd423aa9..87716b886 100644 --- a/bank-feeds/pyproject.toml +++ b/bank-feeds/pyproject.toml @@ -1,58 +1,35 @@ - [project] name = "codat-bankfeeds" -version = "12.0.1" +version = "12.0.2" description = "Set up bank feeds from accounts in your application to supported accounting software." -authors = [{ name = "Speakeasy" },] +authors = [{ name = "Codat", email = "support@codat.io" }] readme = "README-PYPI.md" -requires-python = ">=3.10" +requires-python = ">=3.8" dependencies = [ - "httpcore >=1.0.9", - "httpx >=0.28.1", - "pydantic >=2.11.2", + "urllib3 >= 1.25.3, < 3.0.0", + "python-dateutil >= 2.8.2", + "pydantic >= 2", + "typing-extensions >= 4.7.1", + "httpx >= 0.28.1", + "httpcore >= 1.0.9", ] +[project.urls] +Repository = "https://github.com/codatio/client-sdk-python.git" + [tool.poetry] -repository = "https://github.com/codatio/client-sdk-python.git" packages = [ - { include = "codat_bankfeeds", from = "src" } + { include = "codat_bankfeeds", from = "src" }, ] -include = ["py.typed", "src/codat_bankfeeds/py.typed"] - -[tool.setuptools.package-data] -"*" = ["py.typed", "src/codat_bankfeeds/py.typed"] - -[virtualenvs] -in-project = true +include = ["src/codat_bankfeeds/py.typed"] [tool.poetry.group.dev.dependencies] -mypy = "==1.15.0" -pylint = "==3.2.3" -pyright = "==1.1.398" +pytest = ">=7.2.1" +mypy = ">=1.5" [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" [tool.pytest.ini_options] -asyncio_default_fixture_loop_scope = "function" pythonpath = ["src"] - -[tool.mypy] -disable_error_code = "misc" -explicit_package_bases = true -mypy_path = "src" - -[[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/bank-feeds/src/codat_bankfeeds/__init__.py b/bank-feeds/src/codat_bankfeeds/__init__.py index 833c68cd5..a45c72953 100644 --- a/bank-feeds/src/codat_bankfeeds/__init__.py +++ b/bank-feeds/src/codat_bankfeeds/__init__.py @@ -1,4 +1,126 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +# flake8: noqa + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +__version__ = "1.0.0" + +# import apis into sdk package +from codat_bankfeeds.api.account_mapping import AccountMapping +from codat_bankfeeds.api.bank_accounts import BankAccounts +from codat_bankfeeds.api.companies import Companies +from codat_bankfeeds.api.company_information import CompanyInformation +from codat_bankfeeds.api.connections import Connections +from codat_bankfeeds.api.managed_bank_feeds import ManagedBankFeeds +from codat_bankfeeds.api.source_accounts import SourceAccounts +from codat_bankfeeds.api.transactions import Transactions + +# import ApiClient +from codat_bankfeeds.api_response import ApiResponse +from codat_bankfeeds.api_client import ApiClient +from codat_bankfeeds.configuration import Configuration +from codat_bankfeeds.exceptions import OpenApiException +from codat_bankfeeds.exceptions import ApiTypeError +from codat_bankfeeds.exceptions import ApiValueError +from codat_bankfeeds.exceptions import ApiKeyError +from codat_bankfeeds.exceptions import ApiAttributeError +from codat_bankfeeds.exceptions import ApiException + +# import models into sdk package +from codat_bankfeeds.models.access_token import AccessToken +from codat_bankfeeds.models.shared.accountinfo import AccountInfo +from codat_bankfeeds.models.accounting_bank_account import AccountingBankAccount +from codat_bankfeeds.models.shared.bankaccountcreateresponse import BankAccountCreateResponse +from codat_bankfeeds.models.bank_account_create_response_all_of_data import BankAccountCreateResponseAllOfData +from codat_bankfeeds.models.shared.bankaccountcredentials import BankAccountCredentials +from codat_bankfeeds.models.shared.bankaccountprototype import BankAccountPrototype +from codat_bankfeeds.models.shared.bankaccountstatus import BankAccountStatus +from codat_bankfeeds.models.shared.bankaccounts import BankAccounts +from codat_bankfeeds.models.shared.bankfeedaccountmapping import BankFeedAccountMapping +from codat_bankfeeds.models.shared.bankfeedaccountmappingresponse import BankFeedAccountMappingResponse +from codat_bankfeeds.models.shared.bankfeedmapping import BankFeedMapping +from codat_bankfeeds.models.bank_transaction import BankTransaction +from codat_bankfeeds.models.shared.clientratelimitwebhook import ClientRateLimitWebhook +from codat_bankfeeds.models.shared.clientratelimitwebhookpayload import ClientRateLimitWebhookPayload +from codat_bankfeeds.models.shared.companies import Companies +from codat_bankfeeds.models.shared.company import Company +from codat_bankfeeds.models.shared.companyaccesstoken import CompanyAccessToken +from codat_bankfeeds.models.company_details import CompanyDetails +from codat_bankfeeds.models.shared.companyinformation import CompanyInformation +from codat_bankfeeds.models.shared.companyreference import CompanyReference +from codat_bankfeeds.models.company_reference_links import CompanyReferenceLinks +from codat_bankfeeds.models.shared.companyrequestbody import CompanyRequestBody +from codat_bankfeeds.models.shared.companyupdaterequest import CompanyUpdateRequest +from codat_bankfeeds.models.shared.connection import Connection +from codat_bankfeeds.models.shared.connections import Connections +from codat_bankfeeds.models.shared.createbanktransactions import CreateBankTransactions +from codat_bankfeeds.models.shared.createbanktransactionsresponse import CreateBankTransactionsResponse +from codat_bankfeeds.models.create_batch_source_account201_response_inner import CreateBatchSourceAccount201ResponseInner +from codat_bankfeeds.models.create_batch_source_account207_response_inner import CreateBatchSourceAccount207ResponseInner +from codat_bankfeeds.models.create_batch_source_account_request_body import CreateBatchSourceAccountRequestBody +from codat_bankfeeds.models.create_connection_request import CreateConnectionRequest +from codat_bankfeeds.models.create_source_account200_response import CreateSourceAccount200Response +from codat_bankfeeds.models.create_source_account_request import CreateSourceAccountRequest +from codat_bankfeeds.models.shared.dataconnectionerror import DataConnectionError +from codat_bankfeeds.models.shared.dataconnectionstatus import DataConnectionStatus +from codat_bankfeeds.models.shared.datatype import DataType +from codat_bankfeeds.models.error_message import ErrorMessage +from codat_bankfeeds.models.shared.errorvalidation import ErrorValidation +from codat_bankfeeds.models.shared.errorvalidationitem import ErrorValidationItem +from codat_bankfeeds.models.shared.generateotpresponse import GenerateOtpResponse +from codat_bankfeeds.models.shared.halref import HalRef +from codat_bankfeeds.models.items import Items +from codat_bankfeeds.models.shared.links import Links +from codat_bankfeeds.models.list_source_accounts200_response import ListSourceAccounts200Response +from codat_bankfeeds.models.metadata import Metadata +from codat_bankfeeds.models.model1 import Model1 +from codat_bankfeeds.models.pull_operation import PullOperation +from codat_bankfeeds.models.pull_operations import PullOperations +from codat_bankfeeds.models.shared.pushchangetype import PushChangeType +from codat_bankfeeds.models.shared.pushfieldvalidation import PushFieldValidation +from codat_bankfeeds.models.shared.pushoperation import PushOperation +from codat_bankfeeds.models.shared.pushoperationchange import PushOperationChange +from codat_bankfeeds.models.shared.pushoperationref import PushOperationRef +from codat_bankfeeds.models.shared.pushoperationstatus import PushOperationStatus +from codat_bankfeeds.models.shared.pushoperations import PushOperations +from codat_bankfeeds.models.shared.pushoption import PushOption +from codat_bankfeeds.models.shared.pushoptionchoice import PushOptionChoice +from codat_bankfeeds.models.shared.pushoptionproperty import PushOptionProperty +from codat_bankfeeds.models.shared.pushoptiontype import PushOptionType +from codat_bankfeeds.models.shared.pushvalidationinfo import PushValidationInfo +from codat_bankfeeds.models.shared.routinginfo import RoutingInfo +from codat_bankfeeds.models.shared.sourceaccount import SourceAccount +from codat_bankfeeds.models.shared.sourceaccountbatchcreateresponse import SourceAccountBatchCreateResponse +from codat_bankfeeds.models.shared.sourceaccountbatchcreateresult import SourceAccountBatchCreateResult +from codat_bankfeeds.models.shared.sourceaccountbatcherrorresponse import SourceAccountBatchErrorResponse +from codat_bankfeeds.models.source_account_batch_error_response_result import SourceAccountBatchErrorResponseResult +from codat_bankfeeds.models.shared.sourceaccountprototype import SourceAccountPrototype +from codat_bankfeeds.models.source_account_v2 import SourceAccountV2 +from codat_bankfeeds.models.shared.sourceaccountv2batchcreateresponse import SourceAccountV2BatchCreateResponse +from codat_bankfeeds.models.shared.sourceaccountv2batchcreateresult import SourceAccountV2BatchCreateResult +from codat_bankfeeds.models.shared.sourceaccountv2prototype import SourceAccountV2Prototype +from codat_bankfeeds.models.shared.sourceaccountwebhook import SourceAccountWebhook +from codat_bankfeeds.models.shared.sourceaccountwebhookpayload import SourceAccountWebhookPayload +from codat_bankfeeds.models.shared.startscheduledsyncresult import StartScheduledSyncResult +from codat_bankfeeds.models.supplemental_data import SupplementalData +from codat_bankfeeds.models.shared.syncstatusresult import SyncStatusResult +from codat_bankfeeds.models.shared.targetaccountoption import TargetAccountOption +from codat_bankfeeds.models.update_connection import UpdateConnection +from codat_bankfeeds.models.shared.validation import Validation +from codat_bankfeeds.models.shared.validationitem import ValidationItem +from .sdk import CodatBankFeeds from ._version import ( __title__, @@ -7,11 +129,12 @@ __gen_version__, __user_agent__, ) -from .sdk import * -from .sdkconfiguration import * - - VERSION: str = __version__ -OPENAPI_DOC_VERSION = __openapi_doc_version__ -SPEAKEASY_GENERATOR_VERSION = __gen_version__ -USER_AGENT = __user_agent__ +OPENAPI_DOC_VERSION: str = __openapi_doc_version__ +USER_AGENT: str = __user_agent__ +SPEAKEASY_GENERATOR_VERSION: str = __gen_version__ + +from .utils.retries import ( + RetryConfig as RetryConfig, +) +SERVERS = ['https://api.codat.io'] diff --git a/bank-feeds/src/codat_bankfeeds/_hooks/__init__.py b/bank-feeds/src/codat_bankfeeds/_hooks/__init__.py index 2ee66cdd5..9a9b25d03 100644 --- a/bank-feeds/src/codat_bankfeeds/_hooks/__init__.py +++ b/bank-feeds/src/codat_bankfeeds/_hooks/__init__.py @@ -1,5 +1,28 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""Hooks public surface.""" -from .sdkhooks import * -from .types import * -from .registration import * +from .sdkhooks import SDKHooks, attach_hooks_to_api_client +from .types import ( + AfterErrorContext, + AfterErrorHook, + AfterSuccessContext, + AfterSuccessHook, + BeforeRequestContext, + BeforeRequestHook, + HookContext, + Hooks, + SDKInitHook, +) + +__all__ = [ + "AfterErrorContext", + "AfterErrorHook", + "AfterSuccessContext", + "AfterSuccessHook", + "BeforeRequestContext", + "BeforeRequestHook", + "HookContext", + "Hooks", + "SDKHooks", + "SDKInitHook", + "attach_hooks_to_api_client", +] diff --git a/bank-feeds/src/codat_bankfeeds/_hooks/sdkhooks.py b/bank-feeds/src/codat_bankfeeds/_hooks/sdkhooks.py index 209a30b48..d130d2d60 100644 --- a/bank-feeds/src/codat_bankfeeds/_hooks/sdkhooks.py +++ b/bank-feeds/src/codat_bankfeeds/_hooks/sdkhooks.py @@ -1,19 +1,22 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""SDKHooks registry — mirrors Speakeasy's _hooks/sdkhooks.py. -import httpx +Generated by pipeline/postprocess_generated.py — do not edit by hand. +""" + +from typing import Any, List, Optional, Tuple + +from .registration import init_hooks from .types import ( - SDKInitHook, - BeforeRequestContext, - BeforeRequestHook, - AfterSuccessContext, - AfterSuccessHook, AfterErrorContext, AfterErrorHook, + AfterSuccessContext, + AfterSuccessHook, + BeforeRequestContext, + BeforeRequestHook, + HookContext, Hooks, + SDKInitHook, ) -from .registration import init_hooks -from typing import List, Optional, Tuple -from codat_bankfeeds.httpclient import HttpClient class SDKHooks(Hooks): @@ -36,25 +39,20 @@ def register_after_success_hook(self, hook: AfterSuccessHook) -> None: 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]: + def sdk_init(self, base_url: str, client: Any) -> Tuple[str, Any]: 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: + def before_request(self, hook_ctx: BeforeRequestContext, request: Any) -> Any: 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: + def after_success(self, hook_ctx: AfterSuccessContext, response: Any) -> Any: for hook in self.after_success_hooks: out = hook.after_success(hook_ctx, response) if isinstance(out, Exception): @@ -65,12 +63,85 @@ def after_success( def after_error( self, hook_ctx: AfterErrorContext, - response: Optional[httpx.Response], + response: Optional[Any], error: Optional[Exception], - ) -> Tuple[Optional[httpx.Response], Optional[Exception]]: + ) -> Tuple[Optional[Any], 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 + + +def attach_hooks_to_api_client( + api_client: Any, + hooks: SDKHooks, + base_url: str = "", + security_source: Any = None, + auth_headers: Optional[List[Tuple[str, str]]] = None, +) -> None: + """Wrap api_client.call_api so registered hooks fire around each request. + + Notes: + - operation_id is the real spec operation id (e.g. "create-company"), + matching Speakeasy. Each generated method passes it to call_api as the + operation_id keyword; it defaults to "" only if a caller reaches + call_api without going through a generated method. The value comes from + the same source of truth the TypeScript arm uses (the x-codat-operation-id + vendor extension, set in preprocess_oas.py). + - The request and response objects are urllib3-flavoured, not httpx — + consistent with our ApiClient. Hook authors should treat them opaquely. + - security_source is the value passed to the SDK constructor. It may be a + Security model or a zero-argument callable that returns one (Speakeasy's + pattern for rotating credentials). It is resolved on every request so a + rotating credential is picked up each time, and each (field, header) in + auth_headers is set from the resolved value. + """ + original_call_api = api_client.call_api + resolved_auth_headers = auth_headers or [] + + def apply_security(headers): + if security_source is None or not resolved_auth_headers: + return + resolved = security_source() if callable(security_source) else security_source + for field_name, header_name in resolved_auth_headers: + value = getattr(resolved, field_name, None) + if value is not None: + headers[header_name] = value + + def wrapped(method, url, header_params=None, body=None, post_params=None, _request_timeout=None, operation_id=""): + headers = dict(header_params or {}) + apply_security(headers) + hook_ctx = HookContext( + config=None, + base_url=base_url, + operation_id=operation_id, + oauth2_scopes=None, + security_source=security_source, + ) + request = { + "method": method, + "url": url, + "headers": headers, + "body": body, + "post_params": post_params, + } + request = hooks.before_request(BeforeRequestContext(hook_ctx), request) + try: + response = original_call_api( + method=request["method"], + url=request["url"], + header_params=request["headers"], + body=request["body"], + post_params=request.get("post_params"), + _request_timeout=_request_timeout, + ) + except Exception as e: + new_response, new_error = hooks.after_error(AfterErrorContext(hook_ctx), None, e) + if new_error is not None: + raise new_error + return new_response + return hooks.after_success(AfterSuccessContext(hook_ctx), response) + + api_client.call_api = wrapped diff --git a/bank-feeds/src/codat_bankfeeds/_hooks/types.py b/bank-feeds/src/codat_bankfeeds/_hooks/types.py index 1064e5a91..5abf97b02 100644 --- a/bank-feeds/src/codat_bankfeeds/_hooks/types.py +++ b/bank-feeds/src/codat_bankfeeds/_hooks/types.py @@ -1,14 +1,26 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""Hooks abstract surface — mirrors Speakeasy's _hooks/types.py. + +Generated by pipeline/postprocess_generated.py — do not edit by hand. + +Class names and method signatures match Speakeasy bit-for-bit so SDK-author code +that registers hook implementations can be ported unchanged. The two deviations +from the Speakeasy SDK are intentional and documented in FEATURE-AUDIT.md: + + 1. Request/response types are typed as Any here. Speakeasy uses httpx.Request / + httpx.Response. Our OAG pipeline uses urllib3 via ApiClient, so we use Any + to avoid forcing httpx as a transitive dependency. Hook implementations + should treat the request and response parameters as opaque dicts/objects + produced by ApiClient. + 2. HookContext.config is Any. Speakeasy ships an SDKConfiguration class; we + do not. +""" from abc import ABC, abstractmethod -from codat_bankfeeds.httpclient import HttpClient -from codat_bankfeeds.sdkconfiguration import SDKConfiguration -import httpx from typing import Any, Callable, List, Optional, Tuple, Union class HookContext: - config: SDKConfiguration + config: Any base_url: str operation_id: str oauth2_scopes: Optional[List[str]] = None @@ -16,12 +28,12 @@ class HookContext: def __init__( self, - config: SDKConfiguration, + config: Any, base_url: str, operation_id: str, - oauth2_scopes: Optional[List[str]], - security_source: Optional[Union[Any, Callable[[], Any]]], - ): + oauth2_scopes: Optional[List[str]] = None, + security_source: Optional[Union[Any, Callable[[], Any]]] = None, + ) -> None: self.config = config self.base_url = base_url self.operation_id = operation_id @@ -64,24 +76,20 @@ def __init__(self, hook_ctx: HookContext): class SDKInitHook(ABC): @abstractmethod - def sdk_init(self, base_url: str, client: HttpClient) -> Tuple[str, HttpClient]: - pass + def sdk_init(self, base_url: str, client: Any) -> Tuple[str, Any]: + ... class BeforeRequestHook(ABC): @abstractmethod - def before_request( - self, hook_ctx: BeforeRequestContext, request: httpx.Request - ) -> Union[httpx.Request, Exception]: - pass + def before_request(self, hook_ctx: BeforeRequestContext, request: Any) -> Union[Any, Exception]: + ... class AfterSuccessHook(ABC): @abstractmethod - def after_success( - self, hook_ctx: AfterSuccessContext, response: httpx.Response - ) -> Union[httpx.Response, Exception]: - pass + def after_success(self, hook_ctx: AfterSuccessContext, response: Any) -> Union[Any, Exception]: + ... class AfterErrorHook(ABC): @@ -89,25 +97,25 @@ class AfterErrorHook(ABC): def after_error( self, hook_ctx: AfterErrorContext, - response: Optional[httpx.Response], + response: Optional[Any], error: Optional[Exception], - ) -> Union[Tuple[Optional[httpx.Response], Optional[Exception]], Exception]: - pass + ) -> Union[Tuple[Optional[Any], Optional[Exception]], Exception]: + ... class Hooks(ABC): @abstractmethod - def register_sdk_init_hook(self, hook: SDKInitHook): - pass + def register_sdk_init_hook(self, hook: SDKInitHook) -> None: + ... @abstractmethod - def register_before_request_hook(self, hook: BeforeRequestHook): - pass + def register_before_request_hook(self, hook: BeforeRequestHook) -> None: + ... @abstractmethod - def register_after_success_hook(self, hook: AfterSuccessHook): - pass + def register_after_success_hook(self, hook: AfterSuccessHook) -> None: + ... @abstractmethod - def register_after_error_hook(self, hook: AfterErrorHook): - pass + def register_after_error_hook(self, hook: AfterErrorHook) -> None: + ... diff --git a/bank-feeds/src/codat_bankfeeds/_httpx_transport.py b/bank-feeds/src/codat_bankfeeds/_httpx_transport.py new file mode 100644 index 000000000..68ec2095f --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/_httpx_transport.py @@ -0,0 +1,130 @@ +"""Adapter that routes SDK requests through a consumer-passed httpx.Client. + +Generated by pipeline/postprocess_generated.py — do not edit by hand. + +Exposes the same request() surface as the generated urllib3 RESTClientObject, +so the consumer's proxies, TLS settings, and instrumentation apply to every +request (the Speakeasy SDK behaviour for the `client` constructor kwarg). +""" + +import io +import json +import re + +from .exceptions import ApiException, ApiValueError + + +class HttpxRestResponse(io.IOBase): + + def __init__(self, resp) -> None: + self.response = resp + self.status = resp.status_code + self.reason = resp.reason_phrase + self.data = None + + def read(self): + if self.data is None: + self.data = self.response.content + return self.data + + def getheaders(self): + """Returns the response headers (case-insensitive mapping).""" + return self.response.headers + + def getheader(self, name, default=None): + """Returns a given response header.""" + return self.response.headers.get(name, default) + + +def _to_httpx_timeout(request_timeout): + """Map the generated stack's timeout (number or (connect, read) pair) onto + an httpx.Timeout. None means: use the passed client's own default.""" + if request_timeout is None: + return None + import httpx + + if isinstance(request_timeout, (int, float)): + return httpx.Timeout(request_timeout) + connect, read = request_timeout + return httpx.Timeout(read, connect=connect) + + +class HttpxRestClient: + + def __init__(self, client) -> None: + self.client = client + + def request( + self, + method, + url, + headers=None, + body=None, + post_params=None, + _request_timeout=None, + ): + method = method.upper() + assert method in [ + "GET", + "HEAD", + "DELETE", + "POST", + "PUT", + "PATCH", + "OPTIONS", + ] + + if post_params and body: + raise ApiValueError( + "body parameter cannot be used with post_params parameter." + ) + + post_params = post_params or [] + headers = dict(headers or {}) + + content = None + data = None + files = None + + if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]: + content_type = headers.get("Content-Type") + if not content_type or re.search("json", content_type, re.IGNORECASE): + if body is not None: + content = json.dumps(body) + elif content_type == "application/x-www-form-urlencoded": + data = dict(post_params) + elif content_type == "multipart/form-data": + # httpx must set the Content-Type itself to carry the boundary. + del headers["Content-Type"] + data = {} + files = [] + for name, value in post_params: + if isinstance(value, tuple) and len(value) == 3: + files.append((name, value)) + elif isinstance(value, dict): + data[name] = json.dumps(value) + else: + data[name] = value + elif isinstance(body, (str, bytes)): + content = body + elif content_type.startswith("text/") and isinstance(body, bool): + content = "true" if body else "false" + else: + msg = """Cannot prepare a request message for provided + arguments. Please check that your arguments match + declared content type.""" + raise ApiException(status=0, reason=msg) + + request_kwargs = {"headers": headers} + if content is not None: + request_kwargs["content"] = content + if data is not None: + request_kwargs["data"] = data + if files: + request_kwargs["files"] = files + timeout = _to_httpx_timeout(_request_timeout) + if timeout is not None: + request_kwargs["timeout"] = timeout + + resp = self.client.request(method, url, **request_kwargs) + return HttpxRestResponse(resp) diff --git a/bank-feeds/src/codat_bankfeeds/_version.py b/bank-feeds/src/codat_bankfeeds/_version.py index 2129286f5..c3768f359 100644 --- a/bank-feeds/src/codat_bankfeeds/_version.py +++ b/bank-feeds/src/codat_bankfeeds/_version.py @@ -1,12 +1,17 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""Version metadata for codat-bankfeeds. + +Generated by pipeline/postprocess_generated.py — do not edit by hand. +""" + +from __future__ import annotations import importlib.metadata __title__: str = "codat-bankfeeds" -__version__: str = "12.0.1" +__version__: str = "3.0.0" __openapi_doc_version__: str = "3.0.0" -__gen_version__: str = "2.879.13" -__user_agent__: str = "speakeasy-sdk/python 12.0.1 2.879.13 3.0.0 codat-bankfeeds" +__gen_version__: str = "codat-sdk-codegen-poc-0.1.0" +__user_agent__: str = "codat-sdk/python 3.0.0 codat-sdk-codegen-poc-0.1.0 3.0.0 codat-bankfeeds" try: if __package__ is not None: diff --git a/bank-feeds/src/codat_bankfeeds/account_mapping.py b/bank-feeds/src/codat_bankfeeds/account_mapping.py index fcbdb2457..dc44920ce 100644 --- a/bank-feeds/src/codat_bankfeeds/account_mapping.py +++ b/bank-feeds/src/codat_bankfeeds/account_mapping.py @@ -1,539 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.account_mapping — re-export of the account_mapping method group.""" -from .basesdk import BaseSDK -from codat_bankfeeds import utils -from codat_bankfeeds._hooks import HookContext -from codat_bankfeeds.models import errors, operations, shared -from codat_bankfeeds.types import BaseModel, OptionalNullable, UNSET -from codat_bankfeeds.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, List, Mapping, Optional, Union, cast - - -class AccountMapping(BaseSDK): - r"""Extra functionality for building an account management UI.""" - - def create( - self, - *, - request: Union[ - operations.CreateBankAccountMappingRequest, - operations.CreateBankAccountMappingRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.BankFeedAccountMappingResponse: - r"""Create bank feed account mapping - - The *Create bank account mapping* endpoint creates a new mapping between a source bank account and a potential account in the accounting software (target account). - - A bank feed account mapping is a specified link between the source account (provided by the Codat user) and the target account (the end user's account in the underlying software). - - To find valid target account options, first call the [List bank feed account mappings](https://docs.codat.io//bank-feeds-api#/operations/get-bank-account-mapping) endpoint. - - > **For custom builds only** - > - > Only use this endpoint if you are building your own account management UI. - - #### Account mapping variability - - The method of mapping the source account to the target account varies depending on the accounting software your company uses. - - #### Mapping options: - - 1. **API Mapping**: Integrate the mapping journey directly into your application for a seamless user experience. - 2. **Codat UI Mapping**: If you prefer a quicker setup, you can utilize Codat's provided user interface for mapping. - 3. **Accounting Platform Mapping**: For some accounting software, the mapping process must be conducted within the software itself. - - ### Integration-specific behavior - - | Bank Feed Integration | API Mapping | Codat UI Mapping | Accounting Platform Mapping | - | --------------------- | ----------- | ---------------- | --------------------------- | - | Xero | ✅ | ✅ | | - | FreeAgent | ✅ | ✅ | | - | Oracle NetSuite | ✅ | ✅ | | - | Exact Online (NL) | ✅ | ✅ | | - | QuickBooks Online | | | ✅ | - | Sage | | | ✅ | - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, operations.CreateBankAccountMappingRequest - ) - request = cast(operations.CreateBankAccountMappingRequest, request) - - req = self._build_request( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/bankFeedAccounts/mapping", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.bank_feed_account_mapping if request is not None else None, - False, - True, - "json", - Optional[shared.BankFeedAccountMapping], - ), - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="create-bank-account-mapping", - oauth2_scopes=None, - 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, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.BankFeedAccountMappingResponse, http_res - ) - if utils.match_response( - http_res, ["400", "401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - async def create_async( - self, - *, - request: Union[ - operations.CreateBankAccountMappingRequest, - operations.CreateBankAccountMappingRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.BankFeedAccountMappingResponse: - r"""Create bank feed account mapping - - The *Create bank account mapping* endpoint creates a new mapping between a source bank account and a potential account in the accounting software (target account). - - A bank feed account mapping is a specified link between the source account (provided by the Codat user) and the target account (the end user's account in the underlying software). - - To find valid target account options, first call the [List bank feed account mappings](https://docs.codat.io//bank-feeds-api#/operations/get-bank-account-mapping) endpoint. - - > **For custom builds only** - > - > Only use this endpoint if you are building your own account management UI. - - #### Account mapping variability - - The method of mapping the source account to the target account varies depending on the accounting software your company uses. - - #### Mapping options: - - 1. **API Mapping**: Integrate the mapping journey directly into your application for a seamless user experience. - 2. **Codat UI Mapping**: If you prefer a quicker setup, you can utilize Codat's provided user interface for mapping. - 3. **Accounting Platform Mapping**: For some accounting software, the mapping process must be conducted within the software itself. - - ### Integration-specific behavior - - | Bank Feed Integration | API Mapping | Codat UI Mapping | Accounting Platform Mapping | - | --------------------- | ----------- | ---------------- | --------------------------- | - | Xero | ✅ | ✅ | | - | FreeAgent | ✅ | ✅ | | - | Oracle NetSuite | ✅ | ✅ | | - | Exact Online (NL) | ✅ | ✅ | | - | QuickBooks Online | | | ✅ | - | Sage | | | ✅ | - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, operations.CreateBankAccountMappingRequest - ) - request = cast(operations.CreateBankAccountMappingRequest, request) - - req = self._build_request_async( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/bankFeedAccounts/mapping", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.bank_feed_account_mapping if request is not None else None, - False, - True, - "json", - Optional[shared.BankFeedAccountMapping], - ), - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="create-bank-account-mapping", - oauth2_scopes=None, - 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, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.BankFeedAccountMappingResponse, http_res - ) - if utils.match_response( - http_res, ["400", "401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - def get( - self, - *, - request: Union[ - operations.GetBankAccountMappingRequest, - operations.GetBankAccountMappingRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> List[shared.BankFeedMapping]: - r"""List bank feed accounts - - The *List bank accounts* endpoint returns information about a source bank account and any current or potential target mapping accounts. - - A bank feed account mapping is a specified link between the source account (provided by the Codat user) and the target account (the end user's account in the underlying software). - - > **For custom builds only** - > - > Only use this endpoint if you are building your own account management UI. - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.GetBankAccountMappingRequest) - request = cast(operations.GetBankAccountMappingRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/bankFeedAccounts/mapping", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="get-bank-account-mapping", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(List[shared.BankFeedMapping], http_res) - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - async def get_async( - self, - *, - request: Union[ - operations.GetBankAccountMappingRequest, - operations.GetBankAccountMappingRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> List[shared.BankFeedMapping]: - r"""List bank feed accounts - - The *List bank accounts* endpoint returns information about a source bank account and any current or potential target mapping accounts. - - A bank feed account mapping is a specified link between the source account (provided by the Codat user) and the target account (the end user's account in the underlying software). - - > **For custom builds only** - > - > Only use this endpoint if you are building your own account management UI. - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.GetBankAccountMappingRequest) - request = cast(operations.GetBankAccountMappingRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/bankFeedAccounts/mapping", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="get-bank-account-mapping", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(List[shared.BankFeedMapping], http_res) - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) +from codat_bankfeeds.api.account_mapping import AccountMapping diff --git a/bank-feeds/src/codat_bankfeeds/api/__init__.py b/bank-feeds/src/codat_bankfeeds/api/__init__.py new file mode 100644 index 000000000..69f72a76d --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/api/__init__.py @@ -0,0 +1,12 @@ +# flake8: noqa + +# import apis into api package +from codat_bankfeeds.api.account_mapping import AccountMapping +from codat_bankfeeds.api.bank_accounts import BankAccounts +from codat_bankfeeds.api.companies import Companies +from codat_bankfeeds.api.company_information import CompanyInformation +from codat_bankfeeds.api.connections import Connections +from codat_bankfeeds.api.managed_bank_feeds import ManagedBankFeeds +from codat_bankfeeds.api.source_accounts import SourceAccounts +from codat_bankfeeds.api.transactions import Transactions + diff --git a/bank-feeds/src/codat_bankfeeds/api/account_mapping.py b/bank-feeds/src/codat_bankfeeds/api/account_mapping.py new file mode 100644 index 000000000..2003ef674 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/api/account_mapping.py @@ -0,0 +1,500 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import asyncio +import warnings +from pydantic import BaseModel, model_serializer, validate_call, Field +from typing import Any, Dict, List, Mapping, Optional, Tuple, Union +from typing_extensions import Annotated, NotRequired, TypedDict + +from pydantic import Field +from typing import List, Optional +from typing_extensions import Annotated +from codat_bankfeeds.models.shared.companies import Companies +from codat_bankfeeds.models.shared.company import Company +from codat_bankfeeds.models.shared.connections import Connections +from codat_bankfeeds.models.shared.bankfeedaccountmapping import BankFeedAccountMapping +from codat_bankfeeds.models.shared.bankfeedaccountmappingresponse import BankFeedAccountMappingResponse +from codat_bankfeeds.models.shared.bankfeedmapping import BankFeedMapping + +from codat_bankfeeds.api_client import ApiClient, RequestSerialized +from codat_bankfeeds.api_response import ApiResponse +from codat_bankfeeds.exceptions import ApiException +from codat_bankfeeds.models.errors import ErrorMessage, SDKError +from codat_bankfeeds.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_bankfeeds.rest import RESTResponseType +from codat_bankfeeds.types import UNSET, OptionalNullable +from codat_bankfeeds.utils.retries import RetryConfig, execute_with_retries + + +class CreateBankAccountMappingRequestTypedDict(TypedDict): + """TypedDict variant of CreateBankAccountMappingRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + bank_feed_account_mapping: NotRequired[Optional[BankFeedAccountMapping]] + + +class CreateBankAccountMappingRequest(BaseModel): + """Request envelope for create_bank_account_mapping.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + bank_feed_account_mapping: Optional[BankFeedAccountMapping] = None + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class GetBankAccountMappingRequestTypedDict(TypedDict): + """TypedDict variant of GetBankAccountMappingRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + + +class GetBankAccountMappingRequest(BaseModel): + """Request envelope for get_bank_account_mapping.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class AccountMapping: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call(config={"arbitrary_types_allowed": True}) + def create( + self, + *, + request: Union['CreateBankAccountMappingRequest', 'CreateBankAccountMappingRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> BankFeedAccountMappingResponse: + """Create bank feed account mapping""" # noqa: E501 + + if isinstance(request, dict): + request = CreateBankAccountMappingRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._create_bank_account_mapping_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + bank_feed_account_mapping=request.bank_feed_account_mapping, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BankFeedAccountMappingResponse", + '400': "ErrorMessage", + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='create-bank-account-mapping', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def create_async( + self, + *, + request: Union['CreateBankAccountMappingRequest', 'CreateBankAccountMappingRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> BankFeedAccountMappingResponse: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.create( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _create_bank_account_mapping_serialize( + self, + company_id, + connection_id, + bank_feed_account_mapping, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + if connection_id is not None: + _path_params['connectionId'] = connection_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if bank_feed_account_mapping is not None: + _body_params = bank_feed_account_mapping + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/companies/{companyId}/connections/{connectionId}/bankFeedAccounts/mapping', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call(config={"arbitrary_types_allowed": True}) + def get( + self, + *, + request: Union['GetBankAccountMappingRequest', 'GetBankAccountMappingRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> List[BankFeedMapping]: + """List bank feed accounts""" # noqa: E501 + + if isinstance(request, dict): + request = GetBankAccountMappingRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._get_bank_account_mapping_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[BankFeedMapping]", + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='get-bank-account-mapping', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def get_async( + self, + *, + request: Union['GetBankAccountMappingRequest', 'GetBankAccountMappingRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> List[BankFeedMapping]: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_bank_account_mapping_serialize( + self, + company_id, + connection_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + if connection_id is not None: + _path_params['connectionId'] = connection_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/companies/{companyId}/connections/{connectionId}/bankFeedAccounts/mapping', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/bank-feeds/src/codat_bankfeeds/api/bank_accounts.py b/bank-feeds/src/codat_bankfeeds/api/bank_accounts.py new file mode 100644 index 000000000..e341ca18e --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/api/bank_accounts.py @@ -0,0 +1,758 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import asyncio +import warnings +from pydantic import BaseModel, model_serializer, validate_call, Field +from typing import Any, Dict, List, Mapping, Optional, Tuple, Union +from typing_extensions import Annotated, NotRequired, TypedDict + +from pydantic import Field +from typing import Optional +from typing_extensions import Annotated +from codat_bankfeeds.models.shared.companies import Companies +from codat_bankfeeds.models.shared.company import Company +from codat_bankfeeds.models.shared.connections import Connections +from codat_bankfeeds.models.shared.bankaccountcreateresponse import BankAccountCreateResponse +from codat_bankfeeds.models.shared.bankaccountprototype import BankAccountPrototype +from codat_bankfeeds.models.shared.bankaccounts import BankAccounts +from codat_bankfeeds.models.shared.pushoption import PushOption + +from codat_bankfeeds.api_client import ApiClient, RequestSerialized +from codat_bankfeeds.api_response import ApiResponse +from codat_bankfeeds.exceptions import ApiException +from codat_bankfeeds.models.errors import ErrorMessage, SDKError +from codat_bankfeeds.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_bankfeeds.rest import RESTResponseType +from codat_bankfeeds.types import UNSET, OptionalNullable +from codat_bankfeeds.utils.retries import RetryConfig, execute_with_retries + + +class CreateBankAccountRequestTypedDict(TypedDict): + """TypedDict variant of CreateBankAccountRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + timeout_in_minutes: NotRequired[Annotated[Optional[int], Field(description="Time limit for the push operation to complete before it is timed out.")]] + bank_account_prototype: NotRequired[Optional[BankAccountPrototype]] + + +class CreateBankAccountRequest(BaseModel): + """Request envelope for create_bank_account.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + timeout_in_minutes: Annotated[Optional[int], Field(description="Time limit for the push operation to complete before it is timed out.")] = None + bank_account_prototype: Optional[BankAccountPrototype] = None + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class GetCreateBankAccountsModelRequestTypedDict(TypedDict): + """TypedDict variant of GetCreateBankAccountsModelRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + + +class GetCreateBankAccountsModelRequest(BaseModel): + """Request envelope for get_create_bank_accounts_model.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class ListBankAccountsRequestTypedDict(TypedDict): + """TypedDict variant of ListBankAccountsRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + page: NotRequired[Annotated[Optional[int], Field(description="Page number. [Read more](https://docs.codat.io/using-the-api/paging).")]] + page_size: NotRequired[Annotated[Optional[int], Field(description="Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging).")]] + query: NotRequired[Annotated[Optional[str], Field(description="Codat query string. [Read more](https://docs.codat.io/using-the-api/querying).")]] + order_by: NotRequired[Annotated[Optional[str], Field(description="Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results).")]] + + +class ListBankAccountsRequest(BaseModel): + """Request envelope for list_bank_accounts.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + page: Annotated[Optional[int], Field(description="Page number. [Read more](https://docs.codat.io/using-the-api/paging).")] = 1 + page_size: Annotated[Optional[int], Field(description="Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging).")] = 100 + query: Annotated[Optional[str], Field(description="Codat query string. [Read more](https://docs.codat.io/using-the-api/querying).")] = None + order_by: Annotated[Optional[str], Field(description="Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results).")] = None + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class BankAccounts: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call(config={"arbitrary_types_allowed": True}) + def create( + self, + *, + request: Union['CreateBankAccountRequest', 'CreateBankAccountRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> BankAccountCreateResponse: + """Create bank account""" # noqa: E501 + + if isinstance(request, dict): + request = CreateBankAccountRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._create_bank_account_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + timeout_in_minutes=request.timeout_in_minutes, + bank_account_prototype=request.bank_account_prototype, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BankAccountCreateResponse", + '400': "ErrorMessage", + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='create-bank-account', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def create_async( + self, + *, + request: Union['CreateBankAccountRequest', 'CreateBankAccountRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> BankAccountCreateResponse: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.create( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _create_bank_account_serialize( + self, + company_id, + connection_id, + timeout_in_minutes, + bank_account_prototype, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + if connection_id is not None: + _path_params['connectionId'] = connection_id + # process the query parameters + if timeout_in_minutes is not None: + + _query_params.append(('timeoutInMinutes', timeout_in_minutes)) + + # process the header parameters + # process the form parameters + # process the body parameter + if bank_account_prototype is not None: + _body_params = bank_account_prototype + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/companies/{companyId}/connections/{connectionId}/push/bankAccounts', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call(config={"arbitrary_types_allowed": True}) + def get_create_model( + self, + *, + request: Union['GetCreateBankAccountsModelRequest', 'GetCreateBankAccountsModelRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> PushOption: + """Get create/update bank account model""" # noqa: E501 + + if isinstance(request, dict): + request = GetCreateBankAccountsModelRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._get_create_bank_accounts_model_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PushOption", + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='get-create-bankAccounts-model', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def get_create_model_async( + self, + *, + request: Union['GetCreateBankAccountsModelRequest', 'GetCreateBankAccountsModelRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> PushOption: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_create_model( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_create_bank_accounts_model_serialize( + self, + company_id, + connection_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + if connection_id is not None: + _path_params['connectionId'] = connection_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/companies/{companyId}/connections/{connectionId}/options/bankAccounts', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call(config={"arbitrary_types_allowed": True}) + def list( + self, + *, + request: Union['ListBankAccountsRequest', 'ListBankAccountsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> BankAccounts: + """List bank accounts""" # noqa: E501 + + if isinstance(request, dict): + request = ListBankAccountsRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._list_bank_accounts_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + page=request.page, + page_size=request.page_size, + query=request.query, + order_by=request.order_by, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BankAccounts", + '400': "ErrorMessage", + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '409': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='list-bank-accounts', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def list_async( + self, + *, + request: Union['ListBankAccountsRequest', 'ListBankAccountsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> BankAccounts: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.list( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _list_bank_accounts_serialize( + self, + company_id, + connection_id, + page, + page_size, + query, + order_by, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + if connection_id is not None: + _path_params['connectionId'] = connection_id + # process the query parameters + if page is not None: + + _query_params.append(('page', page)) + + if page_size is not None: + + _query_params.append(('pageSize', page_size)) + + if query is not None: + + _query_params.append(('query', query)) + + if order_by is not None: + + _query_params.append(('orderBy', order_by)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/companies/{companyId}/connections/{connectionId}/data/bankAccounts', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/bank-feeds/src/codat_bankfeeds/api/companies.py b/bank-feeds/src/codat_bankfeeds/api/companies.py new file mode 100644 index 000000000..39fdaf188 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/api/companies.py @@ -0,0 +1,1598 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import asyncio +import warnings +from pydantic import BaseModel, model_serializer, validate_call, Field +from typing import Any, Dict, List, Mapping, Optional, Tuple, Union +from typing_extensions import Annotated, NotRequired, TypedDict + +from pydantic import Field +from typing import Optional +from typing_extensions import Annotated +from codat_bankfeeds.models.shared.connections import Connections +from codat_bankfeeds.models.access_token import AccessToken +from codat_bankfeeds.models.shared.companyaccesstoken import CompanyAccessToken +from codat_bankfeeds.models.shared.companies import Companies +from codat_bankfeeds.models.shared.company import Company +from codat_bankfeeds.models.shared.companyrequestbody import CompanyRequestBody, CompanyRequestBodyTypedDict +from codat_bankfeeds.models.shared.companyupdaterequest import CompanyUpdateRequest + +from codat_bankfeeds.api_client import ApiClient, RequestSerialized +from codat_bankfeeds.api_response import ApiResponse +from codat_bankfeeds.exceptions import ApiException +from codat_bankfeeds.models.errors import ErrorMessage, SDKError +from codat_bankfeeds.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_bankfeeds.rest import RESTResponseType +from codat_bankfeeds.types import UNSET, OptionalNullable +from codat_bankfeeds.utils.retries import RetryConfig, execute_with_retries + + +class CreateCompanyRequestTypedDict(TypedDict): + """TypedDict variant of CreateCompanyRequest, for dict-literal request inputs.""" + company_request_body: NotRequired[Optional[CompanyRequestBody]] + + +class CreateCompanyRequest(BaseModel): + """Request envelope for create_company.""" + company_request_body: Optional[CompanyRequestBody] = None + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class DeleteCompanyRequestTypedDict(TypedDict): + """TypedDict variant of DeleteCompanyRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + + +class DeleteCompanyRequest(BaseModel): + """Request envelope for delete_company.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class GetCompanyRequestTypedDict(TypedDict): + """TypedDict variant of GetCompanyRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + + +class GetCompanyRequest(BaseModel): + """Request envelope for get_company.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class GetCompanyAccessTokenRequestTypedDict(TypedDict): + """TypedDict variant of GetCompanyAccessTokenRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + + +class GetCompanyAccessTokenRequest(BaseModel): + """Request envelope for get_company_access_token.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class ListCompaniesRequestTypedDict(TypedDict): + """TypedDict variant of ListCompaniesRequest, for dict-literal request inputs.""" + page: NotRequired[Annotated[Optional[int], Field(description="Page number. [Read more](https://docs.codat.io/using-the-api/paging).")]] + page_size: NotRequired[Annotated[Optional[int], Field(description="Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging).")]] + query: NotRequired[Annotated[Optional[str], Field(description="Codat query string. [Read more](https://docs.codat.io/using-the-api/querying).")]] + order_by: NotRequired[Annotated[Optional[str], Field(description="Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results).")]] + tags: NotRequired[Annotated[Optional[str], Field(description="Filter companies by tags using the \"equals\" (=), \"not equals\" (!=), and \"contains\" (~) operators with [Codat’s query language](https://docs.codat.io/using-the-api/querying).")]] + + +class ListCompaniesRequest(BaseModel): + """Request envelope for list_companies.""" + page: Annotated[Optional[int], Field(description="Page number. [Read more](https://docs.codat.io/using-the-api/paging).")] = 1 + page_size: Annotated[Optional[int], Field(description="Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging).")] = 100 + query: Annotated[Optional[str], Field(description="Codat query string. [Read more](https://docs.codat.io/using-the-api/querying).")] = None + order_by: Annotated[Optional[str], Field(description="Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results).")] = None + tags: Annotated[Optional[str], Field(description="Filter companies by tags using the \"equals\" (=), \"not equals\" (!=), and \"contains\" (~) operators with [Codat’s query language](https://docs.codat.io/using-the-api/querying).")] = None + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class ReplaceCompanyRequestTypedDict(TypedDict): + """TypedDict variant of ReplaceCompanyRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + company_request_body: NotRequired[Optional[CompanyRequestBody]] + + +class ReplaceCompanyRequest(BaseModel): + """Request envelope for replace_company.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + company_request_body: Optional[CompanyRequestBody] = None + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class UpdateCompanyRequestTypedDict(TypedDict): + """TypedDict variant of UpdateCompanyRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + company_update_request: NotRequired[Optional[CompanyUpdateRequest]] + + +class UpdateCompanyRequest(BaseModel): + """Request envelope for update_company.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + company_update_request: Optional[CompanyUpdateRequest] = None + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class Companies: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call(config={"arbitrary_types_allowed": True}) + def create( + self, + *, + request: Optional[Union[CompanyRequestBody, CompanyRequestBodyTypedDict]] = None, + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Company: + """Create company""" # noqa: E501 + + if isinstance(request, dict): + request = CompanyRequestBody.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._create_company_serialize( + company_request_body=request, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Company", + '400': "ErrorMessage", + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='create-company', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def create_async( + self, + *, + request: Optional[Union[CompanyRequestBody, CompanyRequestBodyTypedDict]] = None, + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Company: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.create( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _create_company_serialize( + self, + company_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if company_request_body is not None: + _body_params = company_request_body + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/companies', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call(config={"arbitrary_types_allowed": True}) + def delete( + self, + *, + request: Union['DeleteCompanyRequest', 'DeleteCompanyRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> None: + """Delete a company""" # noqa: E501 + + if isinstance(request, dict): + request = DeleteCompanyRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._delete_company_serialize( + company_id=request.company_id, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='delete-company', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def delete_async( + self, + *, + request: Union['DeleteCompanyRequest', 'DeleteCompanyRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> None: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.delete( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _delete_company_serialize( + self, + company_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/companies/{companyId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call(config={"arbitrary_types_allowed": True}) + def get( + self, + *, + request: Union['GetCompanyRequest', 'GetCompanyRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Company: + """Get company""" # noqa: E501 + + if isinstance(request, dict): + request = GetCompanyRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._get_company_serialize( + company_id=request.company_id, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Company", + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='get-company', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def get_async( + self, + *, + request: Union['GetCompanyRequest', 'GetCompanyRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Company: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_company_serialize( + self, + company_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/companies/{companyId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call(config={"arbitrary_types_allowed": True}) + def get_access_token( + self, + *, + request: Union['GetCompanyAccessTokenRequest', 'GetCompanyAccessTokenRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CompanyAccessToken: + """Get company access token""" # noqa: E501 + + if isinstance(request, dict): + request = GetCompanyAccessTokenRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._get_company_access_token_serialize( + company_id=request.company_id, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CompanyAccessToken", + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='get-company-access-token', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def get_access_token_async( + self, + *, + request: Union['GetCompanyAccessTokenRequest', 'GetCompanyAccessTokenRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CompanyAccessToken: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_access_token( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_company_access_token_serialize( + self, + company_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/companies/{companyId}/accessToken', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call(config={"arbitrary_types_allowed": True}) + def list( + self, + *, + request: Union['ListCompaniesRequest', 'ListCompaniesRequestTypedDict'] = ListCompaniesRequest(), + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Companies: + """List companies""" # noqa: E501 + + if isinstance(request, dict): + request = ListCompaniesRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._list_companies_serialize( + page=request.page, + page_size=request.page_size, + query=request.query, + order_by=request.order_by, + tags=request.tags, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Companies", + '400': "ErrorMessage", + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='list-companies', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def list_async( + self, + *, + request: Union['ListCompaniesRequest', 'ListCompaniesRequestTypedDict'] = ListCompaniesRequest(), + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Companies: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.list( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _list_companies_serialize( + self, + page, + page_size, + query, + order_by, + tags, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if page is not None: + + _query_params.append(('page', page)) + + if page_size is not None: + + _query_params.append(('pageSize', page_size)) + + if query is not None: + + _query_params.append(('query', query)) + + if order_by is not None: + + _query_params.append(('orderBy', order_by)) + + if tags is not None: + + _query_params.append(('tags', tags)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/companies', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call(config={"arbitrary_types_allowed": True}) + def replace( + self, + *, + request: Union['ReplaceCompanyRequest', 'ReplaceCompanyRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Company: + """Replace company""" # noqa: E501 + + if isinstance(request, dict): + request = ReplaceCompanyRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._replace_company_serialize( + company_id=request.company_id, + company_request_body=request.company_request_body, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Company", + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='replace-company', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def replace_async( + self, + *, + request: Union['ReplaceCompanyRequest', 'ReplaceCompanyRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Company: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.replace( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _replace_company_serialize( + self, + company_id, + company_request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if company_request_body is not None: + _body_params = company_request_body + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/companies/{companyId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call(config={"arbitrary_types_allowed": True}) + def update( + self, + *, + request: Union['UpdateCompanyRequest', 'UpdateCompanyRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Company: + """Update company""" # noqa: E501 + + if isinstance(request, dict): + request = UpdateCompanyRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._update_company_serialize( + company_id=request.company_id, + company_update_request=request.company_update_request, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Company", + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='update-company', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def update_async( + self, + *, + request: Union['UpdateCompanyRequest', 'UpdateCompanyRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Company: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.update( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _update_company_serialize( + self, + company_id, + company_update_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if company_update_request is not None: + _body_params = company_update_request + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='PATCH', + resource_path='/companies/{companyId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/bank-feeds/src/codat_bankfeeds/api/company_information.py b/bank-feeds/src/codat_bankfeeds/api/company_information.py new file mode 100644 index 000000000..279c200e6 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/api/company_information.py @@ -0,0 +1,264 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import asyncio +import warnings +from pydantic import BaseModel, model_serializer, validate_call, Field +from typing import Any, Dict, List, Mapping, Optional, Tuple, Union +from typing_extensions import Annotated, NotRequired, TypedDict + +from pydantic import Field +from typing_extensions import Annotated +from codat_bankfeeds.models.shared.companies import Companies +from codat_bankfeeds.models.shared.company import Company +from codat_bankfeeds.models.shared.connections import Connections +from codat_bankfeeds.models.shared.companyinformation import CompanyInformation + +from codat_bankfeeds.api_client import ApiClient, RequestSerialized +from codat_bankfeeds.api_response import ApiResponse +from codat_bankfeeds.exceptions import ApiException +from codat_bankfeeds.models.errors import ErrorMessage, SDKError +from codat_bankfeeds.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_bankfeeds.rest import RESTResponseType +from codat_bankfeeds.types import UNSET, OptionalNullable +from codat_bankfeeds.utils.retries import RetryConfig, execute_with_retries + + +class GetCompanyInformationRequestTypedDict(TypedDict): + """TypedDict variant of GetCompanyInformationRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + + +class GetCompanyInformationRequest(BaseModel): + """Request envelope for get_company_information.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class CompanyInformation: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call(config={"arbitrary_types_allowed": True}) + def get( + self, + *, + request: Union['GetCompanyInformationRequest', 'GetCompanyInformationRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CompanyInformation: + """Get company information""" # noqa: E501 + + if isinstance(request, dict): + request = GetCompanyInformationRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._get_company_information_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CompanyInformation", + '400': "ErrorMessage", + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='get-company-information', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def get_async( + self, + *, + request: Union['GetCompanyInformationRequest', 'GetCompanyInformationRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CompanyInformation: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_company_information_serialize( + self, + company_id, + connection_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + if connection_id is not None: + _path_params['connectionId'] = connection_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/companies/{companyId}/connections/{connectionId}/bankFeeds/info', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/bank-feeds/src/codat_bankfeeds/api/connections.py b/bank-feeds/src/codat_bankfeeds/api/connections.py new file mode 100644 index 000000000..80b754cfa --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/api/connections.py @@ -0,0 +1,1183 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import asyncio +import warnings +from pydantic import BaseModel, model_serializer, validate_call, Field +from typing import Any, Dict, List, Mapping, Optional, Tuple, Union +from typing_extensions import Annotated, NotRequired, TypedDict + +from pydantic import Field +from typing import Optional +from typing_extensions import Annotated +from codat_bankfeeds.models.shared.companies import Companies +from codat_bankfeeds.models.shared.company import Company +from codat_bankfeeds.models.shared.connection import Connection +from codat_bankfeeds.models.shared.connections import Connections +from codat_bankfeeds.models.create_connection_request import CreateConnectionRequest as CreateConnectionRequestBody +from codat_bankfeeds.models.update_connection import UpdateConnection + +from codat_bankfeeds.api_client import ApiClient, RequestSerialized +from codat_bankfeeds.api_response import ApiResponse +from codat_bankfeeds.exceptions import ApiException +from codat_bankfeeds.models.errors import ErrorMessage, SDKError +from codat_bankfeeds.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_bankfeeds.rest import RESTResponseType +from codat_bankfeeds.types import UNSET, OptionalNullable +from codat_bankfeeds.utils.retries import RetryConfig, execute_with_retries + + +class CreateConnectionRequestTypedDict(TypedDict): + """TypedDict variant of CreateConnectionRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + request_body: NotRequired[Optional[CreateConnectionRequestBody]] + + +class CreateConnectionRequest(BaseModel): + """Request envelope for create_connection.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + request_body: Optional[CreateConnectionRequestBody] = None + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class DeleteConnectionRequestTypedDict(TypedDict): + """TypedDict variant of DeleteConnectionRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + + +class DeleteConnectionRequest(BaseModel): + """Request envelope for delete_connection.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class GetConnectionRequestTypedDict(TypedDict): + """TypedDict variant of GetConnectionRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + + +class GetConnectionRequest(BaseModel): + """Request envelope for get_connection.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class ListConnectionsRequestTypedDict(TypedDict): + """TypedDict variant of ListConnectionsRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + page: NotRequired[Annotated[Optional[int], Field(description="Page number. [Read more](https://docs.codat.io/using-the-api/paging).")]] + page_size: NotRequired[Annotated[Optional[int], Field(description="Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging).")]] + query: NotRequired[Annotated[Optional[str], Field(description="Codat query string. [Read more](https://docs.codat.io/using-the-api/querying).")]] + order_by: NotRequired[Annotated[Optional[str], Field(description="Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results).")]] + + +class ListConnectionsRequest(BaseModel): + """Request envelope for list_connections.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + page: Annotated[Optional[int], Field(description="Page number. [Read more](https://docs.codat.io/using-the-api/paging).")] = 1 + page_size: Annotated[Optional[int], Field(description="Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging).")] = 100 + query: Annotated[Optional[str], Field(description="Codat query string. [Read more](https://docs.codat.io/using-the-api/querying).")] = None + order_by: Annotated[Optional[str], Field(description="Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results).")] = None + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class UnlinkConnectionRequestTypedDict(TypedDict): + """TypedDict variant of UnlinkConnectionRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + request_body: NotRequired[Optional[UpdateConnection]] + + +class UnlinkConnectionRequest(BaseModel): + """Request envelope for unlink_connection.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + request_body: Optional[UpdateConnection] = None + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class Connections: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call(config={"arbitrary_types_allowed": True}) + def create( + self, + *, + request: Union['CreateConnectionRequest', 'CreateConnectionRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Connection: + """Create connection""" # noqa: E501 + + if isinstance(request, dict): + request = CreateConnectionRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._create_connection_serialize( + company_id=request.company_id, + request_body=request.request_body, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Connection", + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='create-connection', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def create_async( + self, + *, + request: Union['CreateConnectionRequest', 'CreateConnectionRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Connection: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.create( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _create_connection_serialize( + self, + company_id, + request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if request_body is not None: + _body_params = request_body + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/companies/{companyId}/connections', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call(config={"arbitrary_types_allowed": True}) + def delete( + self, + *, + request: Union['DeleteConnectionRequest', 'DeleteConnectionRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> None: + """Delete connection""" # noqa: E501 + + if isinstance(request, dict): + request = DeleteConnectionRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._delete_connection_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='delete-connection', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def delete_async( + self, + *, + request: Union['DeleteConnectionRequest', 'DeleteConnectionRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> None: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.delete( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _delete_connection_serialize( + self, + company_id, + connection_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + if connection_id is not None: + _path_params['connectionId'] = connection_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/companies/{companyId}/connections/{connectionId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call(config={"arbitrary_types_allowed": True}) + def get( + self, + *, + request: Union['GetConnectionRequest', 'GetConnectionRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Connection: + """Get connection""" # noqa: E501 + + if isinstance(request, dict): + request = GetConnectionRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._get_connection_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Connection", + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='get-connection', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def get_async( + self, + *, + request: Union['GetConnectionRequest', 'GetConnectionRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Connection: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_connection_serialize( + self, + company_id, + connection_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + if connection_id is not None: + _path_params['connectionId'] = connection_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/companies/{companyId}/connections/{connectionId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call(config={"arbitrary_types_allowed": True}) + def list( + self, + *, + request: Union['ListConnectionsRequest', 'ListConnectionsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Connections: + """List connections""" # noqa: E501 + + if isinstance(request, dict): + request = ListConnectionsRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._list_connections_serialize( + company_id=request.company_id, + page=request.page, + page_size=request.page_size, + query=request.query, + order_by=request.order_by, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Connections", + '400': "ErrorMessage", + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='list-connections', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def list_async( + self, + *, + request: Union['ListConnectionsRequest', 'ListConnectionsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Connections: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.list( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _list_connections_serialize( + self, + company_id, + page, + page_size, + query, + order_by, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + # process the query parameters + if page is not None: + + _query_params.append(('page', page)) + + if page_size is not None: + + _query_params.append(('pageSize', page_size)) + + if query is not None: + + _query_params.append(('query', query)) + + if order_by is not None: + + _query_params.append(('orderBy', order_by)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/companies/{companyId}/connections', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call(config={"arbitrary_types_allowed": True}) + def unlink( + self, + *, + request: Union['UnlinkConnectionRequest', 'UnlinkConnectionRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Connection: + """Unlink connection""" # noqa: E501 + + if isinstance(request, dict): + request = UnlinkConnectionRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._unlink_connection_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + request_body=request.request_body, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Connection", + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='unlink-connection', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def unlink_async( + self, + *, + request: Union['UnlinkConnectionRequest', 'UnlinkConnectionRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Connection: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.unlink( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _unlink_connection_serialize( + self, + company_id, + connection_id, + request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + if connection_id is not None: + _path_params['connectionId'] = connection_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if request_body is not None: + _body_params = request_body + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='PATCH', + resource_path='/companies/{companyId}/connections/{connectionId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/bank-feeds/src/codat_bankfeeds/api/managed_bank_feeds.py b/bank-feeds/src/codat_bankfeeds/api/managed_bank_feeds.py new file mode 100644 index 000000000..0cfb59b39 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/api/managed_bank_feeds.py @@ -0,0 +1,721 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import asyncio +import warnings +from pydantic import BaseModel, model_serializer, validate_call, Field +from typing import Any, Dict, List, Mapping, Optional, Tuple, Union +from typing_extensions import Annotated, NotRequired, TypedDict + +from pydantic import Field +from typing_extensions import Annotated +from codat_bankfeeds.models.shared.companies import Companies +from codat_bankfeeds.models.shared.company import Company +from codat_bankfeeds.models.shared.connections import Connections +from codat_bankfeeds.models.shared.startscheduledsyncresult import StartScheduledSyncResult +from codat_bankfeeds.models.shared.syncstatusresult import SyncStatusResult + +from codat_bankfeeds.api_client import ApiClient, RequestSerialized +from codat_bankfeeds.api_response import ApiResponse +from codat_bankfeeds.exceptions import ApiException +from codat_bankfeeds.models.errors import ErrorMessage, SDKError +from codat_bankfeeds.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_bankfeeds.rest import RESTResponseType +from codat_bankfeeds.types import UNSET, OptionalNullable +from codat_bankfeeds.utils.retries import RetryConfig, execute_with_retries + + +class GetLatestManagedBankFeedSyncRequestTypedDict(TypedDict): + """TypedDict variant of GetLatestManagedBankFeedSyncRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + source_account_id: Annotated[str, Field(description="The ID of the source bank account.")] + + +class GetLatestManagedBankFeedSyncRequest(BaseModel): + """Request envelope for get_latest_managed_bank_feed_sync.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + source_account_id: Annotated[str, Field(description="The ID of the source bank account.")] + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class GetManagedBankFeedSyncRequestTypedDict(TypedDict): + """TypedDict variant of GetManagedBankFeedSyncRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + source_account_id: Annotated[str, Field(description="The ID of the source bank account.")] + sync_id: Annotated[str, Field(description="The ID of the sync.")] + + +class GetManagedBankFeedSyncRequest(BaseModel): + """Request envelope for get_managed_bank_feed_sync.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + source_account_id: Annotated[str, Field(description="The ID of the source bank account.")] + sync_id: Annotated[str, Field(description="The ID of the sync.")] + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class RunManagedBankFeedAdHocSyncRequestTypedDict(TypedDict): + """TypedDict variant of RunManagedBankFeedAdHocSyncRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + source_account_id: Annotated[str, Field(description="The ID of the source bank account.")] + + +class RunManagedBankFeedAdHocSyncRequest(BaseModel): + """Request envelope for run_managed_bank_feed_ad_hoc_sync.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + source_account_id: Annotated[str, Field(description="The ID of the source bank account.")] + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class ManagedBankFeeds: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call(config={"arbitrary_types_allowed": True}) + def get_latest_sync( + self, + *, + request: Union['GetLatestManagedBankFeedSyncRequest', 'GetLatestManagedBankFeedSyncRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Optional[SyncStatusResult]: + """Get latest sync""" # noqa: E501 + + if isinstance(request, dict): + request = GetLatestManagedBankFeedSyncRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._get_latest_managed_bank_feed_sync_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + source_account_id=request.source_account_id, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SyncStatusResult", + '204': None, + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='get-latest-managed-bank-feed-sync', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def get_latest_sync_async( + self, + *, + request: Union['GetLatestManagedBankFeedSyncRequest', 'GetLatestManagedBankFeedSyncRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Optional[SyncStatusResult]: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_latest_sync( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_latest_managed_bank_feed_sync_serialize( + self, + company_id, + connection_id, + source_account_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + if connection_id is not None: + _path_params['connectionId'] = connection_id + if source_account_id is not None: + _path_params['sourceAccountId'] = source_account_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/companies/{companyId}/connections/{connectionId}/bankFeedAccounts/{sourceAccountId}/managedBankFeeds/syncs/latest', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call(config={"arbitrary_types_allowed": True}) + def get_sync( + self, + *, + request: Union['GetManagedBankFeedSyncRequest', 'GetManagedBankFeedSyncRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> SyncStatusResult: + """Get sync""" # noqa: E501 + + if isinstance(request, dict): + request = GetManagedBankFeedSyncRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._get_managed_bank_feed_sync_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + source_account_id=request.source_account_id, + sync_id=request.sync_id, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SyncStatusResult", + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='get-managed-bank-feed-sync', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def get_sync_async( + self, + *, + request: Union['GetManagedBankFeedSyncRequest', 'GetManagedBankFeedSyncRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> SyncStatusResult: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_sync( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_managed_bank_feed_sync_serialize( + self, + company_id, + connection_id, + source_account_id, + sync_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + if connection_id is not None: + _path_params['connectionId'] = connection_id + if source_account_id is not None: + _path_params['sourceAccountId'] = source_account_id + if sync_id is not None: + _path_params['syncId'] = sync_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/companies/{companyId}/connections/{connectionId}/bankFeedAccounts/{sourceAccountId}/managedBankFeeds/syncs/{syncId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call(config={"arbitrary_types_allowed": True}) + def run_ad_hoc_sync( + self, + *, + request: Union['RunManagedBankFeedAdHocSyncRequest', 'RunManagedBankFeedAdHocSyncRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> StartScheduledSyncResult: + """Run ad-hoc sync""" # noqa: E501 + + if isinstance(request, dict): + request = RunManagedBankFeedAdHocSyncRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._run_managed_bank_feed_ad_hoc_sync_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + source_account_id=request.source_account_id, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "StartScheduledSyncResult", + '400': "ErrorMessage", + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '409': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='run-managed-bank-feed-ad-hoc-sync', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def run_ad_hoc_sync_async( + self, + *, + request: Union['RunManagedBankFeedAdHocSyncRequest', 'RunManagedBankFeedAdHocSyncRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> StartScheduledSyncResult: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.run_ad_hoc_sync( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _run_managed_bank_feed_ad_hoc_sync_serialize( + self, + company_id, + connection_id, + source_account_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + if connection_id is not None: + _path_params['connectionId'] = connection_id + if source_account_id is not None: + _path_params['sourceAccountId'] = source_account_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/companies/{companyId}/connections/{connectionId}/bankFeedAccounts/{sourceAccountId}/managedBankFeeds/syncs', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/bank-feeds/src/codat_bankfeeds/api/source_accounts.py b/bank-feeds/src/codat_bankfeeds/api/source_accounts.py new file mode 100644 index 000000000..e7acc8c52 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/api/source_accounts.py @@ -0,0 +1,1905 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import asyncio +import warnings +from pydantic import TypeAdapter, BaseModel, model_serializer, validate_call, Field +from typing import Any, Dict, List, Mapping, Optional, Tuple, Union +from typing_extensions import Annotated, NotRequired, TypedDict + +from pydantic import Field +from typing import List, Optional, Tuple, Union +from typing_extensions import Annotated +from codat_bankfeeds.models.shared.companies import Companies +from codat_bankfeeds.models.shared.company import Company +from codat_bankfeeds.models.shared.connections import Connections +from codat_bankfeeds.models.create_batch_source_account207_response_inner import CreateBatchSourceAccount207ResponseInner +from codat_bankfeeds.models.shared.bankaccountcredentials import BankAccountCredentials +from codat_bankfeeds.models.create_batch_source_account201_response_inner import CreateBatchSourceAccount201ResponseInner +from codat_bankfeeds.models.create_source_account200_response import CreateSourceAccount200Response +from codat_bankfeeds.models.shared.generateotpresponse import GenerateOtpResponse +from codat_bankfeeds.models.list_source_accounts200_response import ListSourceAccounts200Response +from codat_bankfeeds.models.shared.sourceaccount import SourceAccount + +from codat_bankfeeds.api_client import ApiClient, RequestSerialized +from codat_bankfeeds.api_response import ApiResponse +from codat_bankfeeds.exceptions import ApiException +from codat_bankfeeds.models.errors import ErrorMessage, SDKError +from codat_bankfeeds.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_bankfeeds.rest import RESTResponseType +from codat_bankfeeds.types import UNSET, OptionalNullable +from codat_bankfeeds.utils.retries import RetryConfig, execute_with_retries +from typing import Any, List, Union +from typing_extensions import TypeAliasType +from codat_bankfeeds.models.shared.sourceaccountprototype import SourceAccountPrototype +from codat_bankfeeds.models.shared.sourceaccountv2prototype import SourceAccountV2Prototype +from typing import Any, List, Union +from typing_extensions import TypeAliasType +from typing import Any, List, Union +from typing_extensions import TypeAliasType +from codat_bankfeeds.models.source_account_v2 import SourceAccountV2 +from typing import Any, List, Union +from typing_extensions import TypeAliasType +from typing import Any, List, Union +from typing_extensions import TypeAliasType +from codat_bankfeeds.models.shared.sourceaccountv2batchcreateresponse import SourceAccountV2BatchCreateResponse +from codat_bankfeeds.models.shared.sourceaccountbatchcreateresponse import SourceAccountBatchCreateResponse +from codat_bankfeeds.models.shared.sourceaccountbatcherrorresponse import SourceAccountBatchErrorResponse +ResponseBody = TypeAliasType("ResponseBody", Union[SourceAccountV2BatchCreateResponse, SourceAccountBatchCreateResponse]) +CreateBatchSourceAccountResponseBody = TypeAliasType("CreateBatchSourceAccountResponseBody", Union[SourceAccountV2BatchCreateResponse, SourceAccountBatchCreateResponse, SourceAccountBatchErrorResponse]) +CreateBatchSourceAccountResponse = TypeAliasType("CreateBatchSourceAccountResponse", Union[List[ResponseBody], List[CreateBatchSourceAccountResponseBody]]) +ListSourceAccountsResponseBody = TypeAliasType("ListSourceAccountsResponseBody", Union[List[SourceAccountV2], List[SourceAccount]]) +CreateSourceAccountResponseBody = TypeAliasType("CreateSourceAccountResponseBody", Union[SourceAccount, SourceAccountV2]) +CreateBatchSourceAccountRequestBody = TypeAliasType("CreateBatchSourceAccountRequestBody", Union[List[SourceAccountV2Prototype], List[SourceAccountPrototype]]) +CreateSourceAccountRequestBody = TypeAliasType("CreateSourceAccountRequestBody", Union[SourceAccountPrototype, SourceAccountV2Prototype]) + + +class CreateBatchSourceAccountRequestTypedDict(TypedDict): + """TypedDict variant of CreateBatchSourceAccountRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + request_body: NotRequired[Optional[CreateBatchSourceAccountRequestBody]] + + +class CreateBatchSourceAccountRequest(BaseModel): + """Request envelope for create_batch_source_account.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + request_body: Optional[CreateBatchSourceAccountRequestBody] = None + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class CreateSourceAccountRequestTypedDict(TypedDict): + """TypedDict variant of CreateSourceAccountRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + request_body: NotRequired[Optional[CreateSourceAccountRequestBody]] + + +class CreateSourceAccountRequest(BaseModel): + """Request envelope for create_source_account.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + request_body: Optional[CreateSourceAccountRequestBody] = None + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class DeleteBankFeedCredentialsRequestTypedDict(TypedDict): + """TypedDict variant of DeleteBankFeedCredentialsRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + + +class DeleteBankFeedCredentialsRequest(BaseModel): + """Request envelope for delete_bank_feed_credentials.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class DeleteSourceAccountRequestTypedDict(TypedDict): + """TypedDict variant of DeleteSourceAccountRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + account_id: Annotated[str, Field(description="Unique identifier for an account.")] + + +class DeleteSourceAccountRequest(BaseModel): + """Request envelope for delete_source_account.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + account_id: Annotated[str, Field(description="Unique identifier for an account.")] + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class GenerateCredentialsRequestTypedDict(TypedDict): + """TypedDict variant of GenerateCredentialsRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + request_body: Union[bytes, str, Tuple[str, bytes]] + + +class GenerateCredentialsRequest(BaseModel): + """Request envelope for generate_credentials.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + request_body: Union[bytes, str, Tuple[str, bytes]] + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class GenerateOtpRequestTypedDict(TypedDict): + """TypedDict variant of GenerateOtpRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + + +class GenerateOtpRequest(BaseModel): + """Request envelope for generate_otp.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class ListSourceAccountsRequestTypedDict(TypedDict): + """TypedDict variant of ListSourceAccountsRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + + +class ListSourceAccountsRequest(BaseModel): + """Request envelope for list_source_accounts.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class UpdateSourceAccountRequestTypedDict(TypedDict): + """TypedDict variant of UpdateSourceAccountRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + account_id: Annotated[str, Field(description="Unique identifier for an account.")] + source_account: NotRequired[Optional[SourceAccount]] + + +class UpdateSourceAccountRequest(BaseModel): + """Request envelope for update_source_account.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + account_id: Annotated[str, Field(description="Unique identifier for an account.")] + source_account: Optional[SourceAccount] = None + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class SourceAccounts: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call(config={"arbitrary_types_allowed": True}) + def create_batch( + self, + *, + request: Union['CreateBatchSourceAccountRequest', 'CreateBatchSourceAccountRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CreateBatchSourceAccountResponse: + """Create source accounts""" # noqa: E501 + + if isinstance(request, dict): + request = CreateBatchSourceAccountRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._create_batch_source_account_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + request_body=request.request_body, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': None, + '207': None, + '400': "ErrorMessage", + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '409': "List[CreateBatchSourceAccount207ResponseInner]", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='create-batch-source-account', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + _union_status = str(getattr(response_data, "status", "")) + if _union_status == "201": + return TypeAdapter(List[ResponseBody]).validate_json(response_data.data) + if _union_status == "207": + return TypeAdapter(List[CreateBatchSourceAccountResponseBody]).validate_json(response_data.data) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def create_batch_async( + self, + *, + request: Union['CreateBatchSourceAccountRequest', 'CreateBatchSourceAccountRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CreateBatchSourceAccountResponse: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.create_batch( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _create_batch_source_account_serialize( + self, + company_id, + connection_id, + request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + if connection_id is not None: + _path_params['connectionId'] = connection_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if request_body is not None: + _body_params = request_body + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/companies/{companyId}/connections/{connectionId}/connectionInfo/bankFeedAccounts/batch', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call(config={"arbitrary_types_allowed": True}) + def create( + self, + *, + request: Union['CreateSourceAccountRequest', 'CreateSourceAccountRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CreateSourceAccountResponseBody: + """Create single source account""" # noqa: E501 + + if isinstance(request, dict): + request = CreateSourceAccountRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._create_source_account_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + request_body=request.request_body, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '400': "ErrorMessage", + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='create-source-account', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + _union_status = str(getattr(response_data, "status", "")) + if _union_status == "200": + return TypeAdapter(CreateSourceAccountResponseBody).validate_json(response_data.data) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def create_async( + self, + *, + request: Union['CreateSourceAccountRequest', 'CreateSourceAccountRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CreateSourceAccountResponseBody: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.create( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _create_source_account_serialize( + self, + company_id, + connection_id, + request_body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + if connection_id is not None: + _path_params['connectionId'] = connection_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if request_body is not None: + _body_params = request_body + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/companies/{companyId}/connections/{connectionId}/connectionInfo/bankFeedAccounts', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call(config={"arbitrary_types_allowed": True}) + def delete_credentials( + self, + *, + request: Union['DeleteBankFeedCredentialsRequest', 'DeleteBankFeedCredentialsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> None: + """Delete all source account credentials""" # noqa: E501 + + if isinstance(request, dict): + request = DeleteBankFeedCredentialsRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._delete_bank_feed_credentials_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='delete-bank-feed-credentials', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def delete_credentials_async( + self, + *, + request: Union['DeleteBankFeedCredentialsRequest', 'DeleteBankFeedCredentialsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> None: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.delete_credentials( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _delete_bank_feed_credentials_serialize( + self, + company_id, + connection_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + if connection_id is not None: + _path_params['connectionId'] = connection_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/companies/{companyId}/connections/{connectionId}/connectionInfo/bankFeedAccounts/credentials', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call(config={"arbitrary_types_allowed": True}) + def delete( + self, + *, + request: Union['DeleteSourceAccountRequest', 'DeleteSourceAccountRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> None: + """Delete source account""" # noqa: E501 + + if isinstance(request, dict): + request = DeleteSourceAccountRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._delete_source_account_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + account_id=request.account_id, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='delete-source-account', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def delete_async( + self, + *, + request: Union['DeleteSourceAccountRequest', 'DeleteSourceAccountRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> None: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.delete( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _delete_source_account_serialize( + self, + company_id, + connection_id, + account_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + if connection_id is not None: + _path_params['connectionId'] = connection_id + if account_id is not None: + _path_params['accountId'] = account_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/companies/{companyId}/connections/{connectionId}/connectionInfo/bankFeedAccounts/{accountId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call(config={"arbitrary_types_allowed": True}) + def generate_credentials( + self, + *, + request: Union['GenerateCredentialsRequest', 'GenerateCredentialsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> BankAccountCredentials: + """Generate source account credentials""" # noqa: E501 + + if isinstance(request, dict): + request = GenerateCredentialsRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._generate_credentials_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + body=request.request_body, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BankAccountCredentials", + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='generate-credentials', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def generate_credentials_async( + self, + *, + request: Union['GenerateCredentialsRequest', 'GenerateCredentialsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> BankAccountCredentials: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.generate_credentials( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _generate_credentials_serialize( + self, + company_id, + connection_id, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + if connection_id is not None: + _path_params['connectionId'] = connection_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + if isinstance(body, str): + with open(body, "rb") as _fp: + _body_params = _fp.read() + elif isinstance(body, tuple): + _body_params = body[1] + else: + _body_params = body.decode("utf-8") if isinstance(body, (bytes, bytearray)) else body + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/companies/{companyId}/connections/{connectionId}/connectionInfo/bankFeedAccounts/credentials', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call(config={"arbitrary_types_allowed": True}) + def generate_otp( + self, + *, + request: Union['GenerateOtpRequest', 'GenerateOtpRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> GenerateOtpResponse: + """Generate one-time password""" # noqa: E501 + + if isinstance(request, dict): + request = GenerateOtpRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._generate_otp_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GenerateOtpResponse", + '400': "ErrorMessage", + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='generate-otp', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def generate_otp_async( + self, + *, + request: Union['GenerateOtpRequest', 'GenerateOtpRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> GenerateOtpResponse: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.generate_otp( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _generate_otp_serialize( + self, + company_id, + connection_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + if connection_id is not None: + _path_params['connectionId'] = connection_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/companies/{companyId}/connections/{connectionId}/bankFeeds/otp', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call(config={"arbitrary_types_allowed": True}) + def list( + self, + *, + request: Union['ListSourceAccountsRequest', 'ListSourceAccountsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> ListSourceAccountsResponseBody: + """List source accounts""" # noqa: E501 + + if isinstance(request, dict): + request = ListSourceAccountsRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._list_source_accounts_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': None, + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='list-source-accounts', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + _union_status = str(getattr(response_data, "status", "")) + if _union_status == "200": + return TypeAdapter(ListSourceAccountsResponseBody).validate_json(response_data.data) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def list_async( + self, + *, + request: Union['ListSourceAccountsRequest', 'ListSourceAccountsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> ListSourceAccountsResponseBody: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.list( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _list_source_accounts_serialize( + self, + company_id, + connection_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + if connection_id is not None: + _path_params['connectionId'] = connection_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/companies/{companyId}/connections/{connectionId}/connectionInfo/bankFeedAccounts', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call(config={"arbitrary_types_allowed": True}) + def update( + self, + *, + request: Union['UpdateSourceAccountRequest', 'UpdateSourceAccountRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> SourceAccount: + """Update source account""" # noqa: E501 + + if isinstance(request, dict): + request = UpdateSourceAccountRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._update_source_account_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + account_id=request.account_id, + source_account=request.source_account, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SourceAccount", + '400': "ErrorMessage", + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='update-source-account', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def update_async( + self, + *, + request: Union['UpdateSourceAccountRequest', 'UpdateSourceAccountRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> SourceAccount: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.update( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _update_source_account_serialize( + self, + company_id, + connection_id, + account_id, + source_account, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + if connection_id is not None: + _path_params['connectionId'] = connection_id + if account_id is not None: + _path_params['accountId'] = account_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if source_account is not None: + _body_params = source_account + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='PATCH', + resource_path='/companies/{companyId}/connections/{connectionId}/connectionInfo/bankFeedAccounts/{accountId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/bank-feeds/src/codat_bankfeeds/api/transactions.py b/bank-feeds/src/codat_bankfeeds/api/transactions.py new file mode 100644 index 000000000..0ceb4f1ce --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/api/transactions.py @@ -0,0 +1,987 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import asyncio +import warnings +from pydantic import BaseModel, model_serializer, validate_call, Field +from typing import Any, Dict, List, Mapping, Optional, Tuple, Union +from typing_extensions import Annotated, NotRequired, TypedDict + +from pydantic import Field +from typing import Optional +from typing_extensions import Annotated +from codat_bankfeeds.models.shared.companies import Companies +from codat_bankfeeds.models.shared.company import Company +from codat_bankfeeds.models.shared.connections import Connections +from codat_bankfeeds.models.shared.createbanktransactions import CreateBankTransactions +from codat_bankfeeds.models.shared.createbanktransactionsresponse import CreateBankTransactionsResponse +from codat_bankfeeds.models.shared.pushoperation import PushOperation +from codat_bankfeeds.models.shared.pushoperations import PushOperations +from codat_bankfeeds.models.shared.pushoption import PushOption + +from codat_bankfeeds.api_client import ApiClient, RequestSerialized +from codat_bankfeeds.api_response import ApiResponse +from codat_bankfeeds.exceptions import ApiException +from codat_bankfeeds.models.errors import ErrorMessage, SDKError +from codat_bankfeeds.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_bankfeeds.rest import RESTResponseType +from codat_bankfeeds.types import UNSET, OptionalNullable +from codat_bankfeeds.utils.retries import RetryConfig, execute_with_retries + + +class CreateBankTransactionsRequestTypedDict(TypedDict): + """TypedDict variant of CreateBankTransactionsRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + account_id: Annotated[str, Field(description="Unique identifier for an account.")] + timeout_in_minutes: NotRequired[Annotated[Optional[int], Field(description="Time limit for the push operation to complete before it is timed out.")]] + allow_sync_on_push_complete: NotRequired[Annotated[Optional[bool], Field(description="Allow a sync upon push completion.")]] + create_bank_transactions: NotRequired[Optional[CreateBankTransactions]] + + +class CreateBankTransactionsRequest(BaseModel): + """Request envelope for create_bank_transactions.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + account_id: Annotated[str, Field(description="Unique identifier for an account.")] + timeout_in_minutes: Annotated[Optional[int], Field(description="Time limit for the push operation to complete before it is timed out.")] = None + allow_sync_on_push_complete: Annotated[Optional[bool], Field(description="Allow a sync upon push completion.")] = True + create_bank_transactions: Optional[CreateBankTransactions] = None + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class GetCreateBankTransactionsModelRequestTypedDict(TypedDict): + """TypedDict variant of GetCreateBankTransactionsModelRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + account_id: Annotated[str, Field(description="Unique identifier for an account.")] + + +class GetCreateBankTransactionsModelRequest(BaseModel): + """Request envelope for get_create_bank_transactions_model.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + account_id: Annotated[str, Field(description="Unique identifier for an account.")] + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class GetCreateOperationRequestTypedDict(TypedDict): + """TypedDict variant of GetCreateOperationRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + push_operation_key: Annotated[str, Field(description="Push operation key.")] + + +class GetCreateOperationRequest(BaseModel): + """Request envelope for get_create_operation.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + push_operation_key: Annotated[str, Field(description="Push operation key.")] + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class ListCreateOperationsRequestTypedDict(TypedDict): + """TypedDict variant of ListCreateOperationsRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + page: NotRequired[Annotated[Optional[int], Field(description="Page number. [Read more](https://docs.codat.io/using-the-api/paging).")]] + page_size: NotRequired[Annotated[Optional[int], Field(description="Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging).")]] + query: NotRequired[Annotated[Optional[str], Field(description="Codat query string. [Read more](https://docs.codat.io/using-the-api/querying).")]] + order_by: NotRequired[Annotated[Optional[str], Field(description="Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results).")]] + + +class ListCreateOperationsRequest(BaseModel): + """Request envelope for list_create_operations.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + page: Annotated[Optional[int], Field(description="Page number. [Read more](https://docs.codat.io/using-the-api/paging).")] = 1 + page_size: Annotated[Optional[int], Field(description="Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging).")] = 100 + query: Annotated[Optional[str], Field(description="Codat query string. [Read more](https://docs.codat.io/using-the-api/querying).")] = None + order_by: Annotated[Optional[str], Field(description="Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results).")] = None + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + + +class Transactions: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call(config={"arbitrary_types_allowed": True}) + def create( + self, + *, + request: Union['CreateBankTransactionsRequest', 'CreateBankTransactionsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CreateBankTransactionsResponse: + """Create bank transactions""" # noqa: E501 + + if isinstance(request, dict): + request = CreateBankTransactionsRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._create_bank_transactions_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + account_id=request.account_id, + timeout_in_minutes=request.timeout_in_minutes, + allow_sync_on_push_complete=request.allow_sync_on_push_complete, + create_bank_transactions=request.create_bank_transactions, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CreateBankTransactionsResponse", + '400': "ErrorMessage", + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='create-bank-transactions', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def create_async( + self, + *, + request: Union['CreateBankTransactionsRequest', 'CreateBankTransactionsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CreateBankTransactionsResponse: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.create( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _create_bank_transactions_serialize( + self, + company_id, + connection_id, + account_id, + timeout_in_minutes, + allow_sync_on_push_complete, + create_bank_transactions, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + if connection_id is not None: + _path_params['connectionId'] = connection_id + if account_id is not None: + _path_params['accountId'] = account_id + # process the query parameters + if timeout_in_minutes is not None: + + _query_params.append(('timeoutInMinutes', timeout_in_minutes)) + + if allow_sync_on_push_complete is not None: + + _query_params.append(('allowSyncOnPushComplete', allow_sync_on_push_complete)) + + # process the header parameters + # process the form parameters + # process the body parameter + if create_bank_transactions is not None: + _body_params = create_bank_transactions + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/companies/{companyId}/connections/{connectionId}/push/bankAccounts/{accountId}/bankTransactions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call(config={"arbitrary_types_allowed": True}) + def get_create_model( + self, + *, + request: Union['GetCreateBankTransactionsModelRequest', 'GetCreateBankTransactionsModelRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> PushOption: + """Get create bank transactions model""" # noqa: E501 + + if isinstance(request, dict): + request = GetCreateBankTransactionsModelRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._get_create_bank_transactions_model_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + account_id=request.account_id, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PushOption", + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='get-create-bank-transactions-model', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def get_create_model_async( + self, + *, + request: Union['GetCreateBankTransactionsModelRequest', 'GetCreateBankTransactionsModelRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> PushOption: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_create_model( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_create_bank_transactions_model_serialize( + self, + company_id, + connection_id, + account_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + if connection_id is not None: + _path_params['connectionId'] = connection_id + if account_id is not None: + _path_params['accountId'] = account_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/companies/{companyId}/connections/{connectionId}/options/bankAccounts/{accountId}/bankTransactions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call(config={"arbitrary_types_allowed": True}) + def get_create_operation( + self, + *, + request: Union['GetCreateOperationRequest', 'GetCreateOperationRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> PushOperation: + """Get create operation""" # noqa: E501 + + if isinstance(request, dict): + request = GetCreateOperationRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._get_create_operation_serialize( + company_id=request.company_id, + push_operation_key=request.push_operation_key, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PushOperation", + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='get-create-operation', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def get_create_operation_async( + self, + *, + request: Union['GetCreateOperationRequest', 'GetCreateOperationRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> PushOperation: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_create_operation( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_create_operation_serialize( + self, + company_id, + push_operation_key, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + if push_operation_key is not None: + _path_params['pushOperationKey'] = push_operation_key + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/companies/{companyId}/push/{pushOperationKey}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call(config={"arbitrary_types_allowed": True}) + def list_create_operations( + self, + *, + request: Union['ListCreateOperationsRequest', 'ListCreateOperationsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> PushOperations: + """List create operations""" # noqa: E501 + + if isinstance(request, dict): + request = ListCreateOperationsRequest.model_validate(request) + + _effective_timeout_ms = timeout_ms if timeout_ms is not None else getattr(self, "_sdk_timeout_ms", None) + _timeout_s = (_effective_timeout_ms / 1000.0) if _effective_timeout_ms is not None else None + _request_timeout = (_timeout_s, _timeout_s) if _timeout_s is not None else None + _server_override_token = None + if server_url is not None: + _server_override_token = self.api_client.configuration.host + self.api_client.configuration.host = server_url + try: + _param = self._list_create_operations_serialize( + company_id=request.company_id, + page=request.page, + page_size=request.page_size, + query=request.query, + order_by=request.order_by, + _request_auth=None, + _content_type=None, + _headers=dict(http_headers) if http_headers else None, + _host_index=0, + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PushOperations", + '400': "ErrorMessage", + '401': "ErrorMessage", + '402': "ErrorMessage", + '403': "ErrorMessage", + '404': "ErrorMessage", + '429': "ErrorMessage", + '500': "ErrorMessage", + '503': "ErrorMessage", + } + finally: + if _server_override_token is not None: + self.api_client.configuration.host = _server_override_token + + _effective_retries = retries if not isinstance(retries, type(UNSET)) else getattr(self, "_sdk_retry_config", None) + if isinstance(_effective_retries, type(UNSET)): + _effective_retries = None + + def _do_call(): + try: + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout, + operation_id='list-create-operations', + ) + response_data.read() + _result = self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + # Speakeasy raises SDKError for any status the operation does not document, + # including an unexpected 2xx; OAG's response_deserialize would instead return + # None. Match Speakeasy: if neither the exact status nor its NXX wildcard is + # documented, raise. A documented no-content status is a key mapping to None, + # so it stays and returns None. + _ok_status = getattr(response_data, "status", None) + if (str(_ok_status) not in _response_types_map + and f"{str(_ok_status)[0]}XX" not in _response_types_map): + _ok_body = getattr(response_data, "data", b"") or b"" + raise SDKError( + "Unexpected response received", + raw_response=response_data, + status_code=_ok_status, + body=_ok_body.decode("utf-8", "replace") if isinstance(_ok_body, (bytes, bytearray)) else str(_ok_body), + headers=dict(response_data.getheaders() or {}), + ) + return _result.data + except ApiException as _e: + _body = getattr(_e, "body", "") or "" + _status = getattr(_e, "status", 0) or 0 + _headers = dict(getattr(_e, "headers", None) or {}) + # Raise the typed Codat ErrorMessage only for the statuses this operation + # documents as ErrorMessage, matching Speakeasy (which raises SDKError for any + # undocumented status). Consumers can then do + # `except errors.ErrorMessage as e: e.data.correlation_id`. + if _response_types_map.get(str(_status)) == "ErrorMessage" and _body: + try: + _err_data = _ErrorMessageDataSchema.model_validate_json(_body) + except Exception: + _err_data = None + if _err_data is not None: + raise ErrorMessage( + data=_err_data, + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + raise SDKError( + message=getattr(_e, "reason", None) or str(_e), + status_code=_status, + body=_body, + headers=_headers, + raw_response=_e, + ) from _e + + return execute_with_retries(_do_call, _effective_retries) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def list_create_operations_async( + self, + *, + request: Union['ListCreateOperationsRequest', 'ListCreateOperationsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> PushOperations: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.list_create_operations( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _list_create_operations_serialize( + self, + company_id, + page, + page_size, + query, + order_by, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if company_id is not None: + _path_params['companyId'] = company_id + # process the query parameters + if page is not None: + + _query_params.append(('page', page)) + + if page_size is not None: + + _query_params.append(('pageSize', page_size)) + + if query is not None: + + _query_params.append(('query', query)) + + if order_by is not None: + + _query_params.append(('orderBy', order_by)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/companies/{companyId}/push', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/bank-feeds/src/codat_bankfeeds/api_client.py b/bank-feeds/src/codat_bankfeeds/api_client.py new file mode 100644 index 000000000..3f1ec032e --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/api_client.py @@ -0,0 +1,803 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import datetime +from dateutil.parser import parse +from enum import Enum +import decimal +import json +import mimetypes +import os +import re +import tempfile + +from urllib.parse import quote +from typing import Tuple, Optional, List, Dict, Union +from pydantic import SecretStr + +from codat_bankfeeds.configuration import Configuration +from codat_bankfeeds.api_response import ApiResponse, T as ApiResponseT +import codat_bankfeeds.models +from codat_bankfeeds import rest +from codat_bankfeeds.exceptions import ( + ApiValueError, + ApiException, + BadRequestException, + UnauthorizedException, + ForbiddenException, + NotFoundException, + ServiceException +) + +RequestSerialized = Tuple[str, str, Dict[str, str], Optional[str], List[str]] + +class ApiClient: + """Generic API client for OpenAPI client library builds. + + OpenAPI generic API client. This client handles the client- + server communication, and is invariant across implementations. Specifics of + the methods and models for each application are generated from the OpenAPI + templates. + + :param configuration: .Configuration object for this client + :param header_name: a header to pass when making calls to the API. + :param header_value: a header value to pass when making calls to + the API. + :param cookie: a cookie to include in the header when making calls + to the API + """ + + PRIMITIVE_TYPES = (float, bool, bytes, str, int) + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int, # TODO remove as only py3 is supported? + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'decimal': decimal.Decimal, + 'object': object, + } + _pool = None + + def __init__( + self, + configuration=None, + header_name=None, + header_value=None, + cookie=None + ) -> None: + # use default configuration if none is provided + if configuration is None: + configuration = Configuration.get_default() + self.configuration = configuration + + self.rest_client = rest.RESTClientObject(configuration) + self.default_headers = {} + if header_name is not None: + self.default_headers[header_name] = header_value + self.cookie = cookie + # Set default User-Agent. + self.user_agent = 'OpenAPI-Generator/1.0.0/python' + self.client_side_validation = configuration.client_side_validation + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + pass + + @property + def user_agent(self): + """User agent for this API client""" + return self.default_headers['User-Agent'] + + @user_agent.setter + def user_agent(self, value): + self.default_headers['User-Agent'] = value + + def set_default_header(self, header_name, header_value): + self.default_headers[header_name] = header_value + + + _default = None + + @classmethod + def get_default(cls): + """Return new instance of ApiClient. + + This method returns newly created, based on default constructor, + object of ApiClient class or returns a copy of default + ApiClient. + + :return: The ApiClient object. + """ + if cls._default is None: + cls._default = ApiClient() + return cls._default + + @classmethod + def set_default(cls, default): + """Set default instance of ApiClient. + + It stores default ApiClient. + + :param default: object of ApiClient. + """ + cls._default = default + + def param_serialize( + self, + method, + resource_path, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, auth_settings=None, + collection_formats=None, + _host=None, + _request_auth=None + ) -> RequestSerialized: + + """Builds the HTTP request params needed by the request. + :param method: Method to call. + :param resource_path: Path to method endpoint. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :return: tuple of form (path, http_method, query_params, header_params, + body, post_params, files) + """ + + config = self.configuration + + # header parameters + header_params = header_params or {} + header_params.update(self.default_headers) + if self.cookie: + header_params['Cookie'] = self.cookie + if header_params: + header_params = self.sanitize_for_serialization(header_params) + header_params = dict( + self.parameters_to_tuples(header_params,collection_formats) + ) + + # path parameters + if path_params: + path_params = self.sanitize_for_serialization(path_params) + path_params = self.parameters_to_tuples( + path_params, + collection_formats + ) + for k, v in path_params: + # specified safe chars, encode everything + resource_path = resource_path.replace( + '{%s}' % k, + quote(str(v), safe=config.safe_chars_for_path_param) + ) + + # post parameters + if post_params or files: + post_params = post_params if post_params else [] + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples( + post_params, + collection_formats + ) + if files: + post_params.extend(self.files_parameters(files)) + + # auth setting + self.update_params_for_auth( + header_params, + query_params, + auth_settings, + resource_path, + method, + body, + request_auth=_request_auth + ) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + if _host is None or self.configuration.ignore_operation_servers: + url = self.configuration.host + resource_path + else: + # use server/host defined in path or operation instead + url = _host + resource_path + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + url_query = self.parameters_to_url_query( + query_params, + collection_formats + ) + url += "?" + url_query + + return method, url, header_params, body, post_params + + + def call_api( + self, + method, + url, + header_params=None, + body=None, + post_params=None, + _request_timeout=None, + operation_id=None, + ) -> rest.RESTResponse: + """Makes the HTTP request (synchronous) + :param method: Method to call. + :param url: Path to method endpoint. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param _request_timeout: timeout setting for this request. + :return: RESTResponse + """ + + try: + # perform request and return response + response_data = self.rest_client.request( + method, url, + headers=header_params, + body=body, post_params=post_params, + _request_timeout=_request_timeout + ) + + except ApiException as e: + raise e + + return response_data + + def response_deserialize( + self, + response_data: rest.RESTResponse, + response_types_map: Optional[Dict[str, ApiResponseT]]=None + ) -> ApiResponse[ApiResponseT]: + """Deserializes response into an object. + :param response_data: RESTResponse object to be deserialized. + :param response_types_map: dict of response types. + :return: ApiResponse + """ + + msg = "RESTResponse.read() must be called before passing it to response_deserialize()" + assert response_data.data is not None, msg + + response_type = response_types_map.get(str(response_data.status), None) + if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: + # if not found, look for '1XX', '2XX', etc. + response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) + + # deserialize response data + response_text = None + return_data = None + try: + if response_type == "bytearray": + return_data = response_data.data + elif response_type == "file": + return_data = self.__deserialize_file(response_data) + elif response_type is not None: + match = None + content_type = response_data.getheader('content-type') + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_text = response_data.data.decode(encoding) + return_data = self.deserialize(response_text, response_type, content_type) + finally: + if not 200 <= response_data.status <= 299: + raise ApiException.from_response( + http_resp=response_data, + body=response_text, + data=return_data, + ) + + return ApiResponse( + status_code = response_data.status, + data = return_data, + headers = response_data.getheaders(), + raw_data = response_data.data + ) + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + + If obj is None, return None. + If obj is SecretStr, return obj.get_secret_value() + If obj is str, int, long, float, bool, return directly. + If obj is datetime.datetime, datetime.date + convert to string in iso8601 format. + If obj is decimal.Decimal return string representation. + If obj is list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is OpenAPI model, return the properties dict. + + :param obj: The data to serialize. + :return: The serialized form of data. + """ + if obj is None: + return None + elif isinstance(obj, Enum): + return obj.value + elif isinstance(obj, SecretStr): + return obj.get_secret_value() + elif isinstance(obj, self.PRIMITIVE_TYPES): + return obj + elif isinstance(obj, list): + return [ + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ] + elif isinstance(obj, tuple): + return tuple( + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ) + elif isinstance(obj, (datetime.datetime, datetime.date)): + return obj.isoformat() + elif isinstance(obj, decimal.Decimal): + return str(obj) + + elif isinstance(obj, dict): + obj_dict = obj + else: + # Convert model obj to dict except + # attributes `openapi_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')): + obj_dict = obj.to_dict() + else: + obj_dict = obj.__dict__ + + return { + key: self.sanitize_for_serialization(val) + for key, val in obj_dict.items() + } + + def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]): + """Deserializes response into an object. + + :param response: RESTResponse object to be deserialized. + :param response_type: class literal for + deserialized object, or string of class name. + :param content_type: content type of response. + + :return: deserialized object. + """ + + # fetch data from response object + if content_type is None: + try: + data = json.loads(response_text) + except ValueError: + data = response_text + elif re.match(r'^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE): + if response_text == "": + data = "" + else: + data = json.loads(response_text) + elif re.match(r'^text\/[a-z.+-]+\s*(;|$)', content_type, re.IGNORECASE): + data = response_text + else: + raise ApiException( + status=0, + reason="Unsupported content type: {0}".format(content_type) + ) + + return self.__deserialize(data, response_type) + + def __deserialize(self, data, klass): + """Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. + """ + if data is None: + return None + + if isinstance(klass, str): + if klass.startswith('List['): + m = re.match(r'List\[(.*)]', klass) + assert m is not None, "Malformed List type definition" + sub_kls = m.group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('Dict['): + m = re.match(r'Dict\[([^,]*), (.*)]', klass) + assert m is not None, "Malformed Dict type definition" + sub_kls = m.group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in data.items()} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + else: + klass = getattr(codat_bankfeeds.models, klass) + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass == object: + return self.__deserialize_object(data) + elif klass == datetime.date: + return self.__deserialize_date(data) + elif klass == datetime.datetime: + return self.__deserialize_datetime(data) + elif klass == decimal.Decimal: + return decimal.Decimal(data) + elif issubclass(klass, Enum): + return self.__deserialize_enum(data, klass) + else: + return self.__deserialize_model(data, klass) + + def parameters_to_tuples(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, value) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(str(value) for value in v))) + else: + new_params.append((k, v)) + return new_params + + def parameters_to_url_query(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: URL query string (e.g. a=Hello%20World&b=123) + """ + new_params: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + if isinstance(v, bool): + v = str(v).lower() + if isinstance(v, (int, float)): + v = str(v) + if isinstance(v, dict): + v = json.dumps(v) + + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, str(value)) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(quote(str(value)) for value in v)) + ) + else: + new_params.append((k, quote(str(v)))) + + return "&".join(["=".join(map(str, item)) for item in new_params]) + + def files_parameters( + self, + files: Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]], + ): + """Builds form parameters. + + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + for k, v in files.items(): + mimetype = None + if isinstance(v, str): + with open(v, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + elif isinstance(v, bytes): + filename = k + filedata = v + elif isinstance(v, tuple): + if len(v) == 3: + filename, filedata, mimetype = v + else: + filename, filedata = v + elif isinstance(v, list): + for file_param in v: + params.extend(self.files_parameters({k: file_param})) + continue + else: + raise ValueError("Unsupported file value") + mimetype = mimetype or ( + mimetypes.guess_type(filename)[0] + or 'application/octet-stream' + ) + params.append( + tuple([k, tuple([filename, filedata, mimetype])]) + ) + return params + + def select_header_accept(self, accepts: List[str]) -> Optional[str]: + """Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return None + + for accept in accepts: + if re.search('json', accept, re.IGNORECASE): + return accept + + return accepts[0] + + def select_header_content_type(self, content_types): + """Returns `Content-Type` based on an array of content_types provided. + + :param content_types: List of content-types. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return None + + for content_type in content_types: + if re.search('json', content_type, re.IGNORECASE): + return content_type + + return content_types[0] + + def update_params_for_auth( + self, + headers, + queries, + auth_settings, + resource_path, + method, + body, + request_auth=None + ) -> None: + """Updates header and query params based on authentication setting. + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :param auth_settings: Authentication setting identifiers list. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param request_auth: if set, the provided settings will + override the token in the configuration. + """ + if not auth_settings: + return + + if request_auth: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + request_auth + ) + else: + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + auth_setting + ) + + def _apply_auth_params( + self, + headers, + queries, + resource_path, + method, + body, + auth_setting + ) -> None: + """Updates the request parameters based on a single auth_setting + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param auth_setting: auth settings for the endpoint + """ + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + queries.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) + + def __deserialize_file(self, response): + """Deserializes body to file + + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + handle file downloading + save response body into a tmp file and return the instance + + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + content_disposition = response.getheader("Content-Disposition") + if content_disposition: + m = re.search( + r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition + ) + assert m is not None, "Unexpected 'content-disposition' header value" + filename = m.group(1) + path = os.path.join(os.path.dirname(path), filename) + + with open(path, "wb") as f: + f.write(response.data) + + return path + + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. + + :param data: str. + :param klass: class literal. + + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return str(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return an original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + return parse(string).date() + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason="Failed to parse `{0}` as date object".format(string) + ) + + def __deserialize_datetime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + return parse(string) + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as datetime object" + .format(string) + ) + ) + + def __deserialize_enum(self, data, klass): + """Deserializes primitive type to enum. + + :param data: primitive type. + :param klass: class literal. + :return: enum value. + """ + try: + return klass(data) + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as `{1}`" + .format(data, klass) + ) + ) + + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. + + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + return klass.from_dict(data) diff --git a/bank-feeds/src/codat_bankfeeds/api_response.py b/bank-feeds/src/codat_bankfeeds/api_response.py new file mode 100644 index 000000000..8a1236a62 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/api_response.py @@ -0,0 +1,21 @@ +"""API response object.""" + +from __future__ import annotations +from typing import Optional, Generic, Mapping, TypeVar +from pydantic import Field, BaseModel + +T = TypeVar("T") + +class ApiResponse(BaseModel, Generic[T]): + """ + API response object + """ + + status_code: int = Field(description="HTTP status code") + headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers") + data: T = Field(description="Deserialized data given the data type") + raw_data: bytes = Field(description="Raw data (HTTP response body)") + + model_config = { + "arbitrary_types_allowed": True + } diff --git a/bank-feeds/src/codat_bankfeeds/bank_accounts.py b/bank-feeds/src/codat_bankfeeds/bank_accounts.py index 51cc920e9..3062b76e1 100644 --- a/bank-feeds/src/codat_bankfeeds/bank_accounts.py +++ b/bank-feeds/src/codat_bankfeeds/bank_accounts.py @@ -1,725 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.bank_accounts — re-export of the bank_accounts method group.""" -from .basesdk import BaseSDK -from codat_bankfeeds import utils -from codat_bankfeeds._hooks import HookContext -from codat_bankfeeds.models import errors, operations, shared -from codat_bankfeeds.types import BaseModel, OptionalNullable, UNSET -from codat_bankfeeds.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class BankAccounts(BaseSDK): - r"""Access bank accounts in an SMBs accounting software.""" - - def create( - self, - *, - request: Union[ - operations.CreateBankAccountRequest, - operations.CreateBankAccountRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.BankAccountCreateResponse: - r"""Create bank account - - The *Create bank account* endpoint creates a new [bank account](https://docs.codat.io/bank-feeds-api#/schemas/BankAccount) for a given company's connection. - - [Bank accounts](https://docs.codat.io/bank-feeds-api#/schemas/BankAccount) are financial accounts maintained by a bank or other financial institution. - - **Integration-specific behavior** - - Required data may vary by integration. To see what data to post, first call [Get create/update bank account model](https://docs.codat.io/bank-feeds-api#/operations/get-create-update-bankAccounts-model). - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - 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}/push/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", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.bank_account_prototype if request is not None else None, - False, - True, - "json", - Optional[shared.BankAccountPrototype], - ), - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="create-bank-account", - oauth2_scopes=None, - 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, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.BankAccountCreateResponse, http_res) - if utils.match_response( - http_res, ["400", "401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", 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, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.BankAccountCreateResponse: - r"""Create bank account - - The *Create bank account* endpoint creates a new [bank account](https://docs.codat.io/bank-feeds-api#/schemas/BankAccount) for a given company's connection. - - [Bank accounts](https://docs.codat.io/bank-feeds-api#/schemas/BankAccount) are financial accounts maintained by a bank or other financial institution. - - **Integration-specific behavior** - - Required data may vary by integration. To see what data to post, first call [Get create/update bank account model](https://docs.codat.io/bank-feeds-api#/operations/get-create-update-bankAccounts-model). - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - 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}/push/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", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.bank_account_prototype if request is not None else None, - False, - True, - "json", - Optional[shared.BankAccountPrototype], - ), - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="create-bank-account", - oauth2_scopes=None, - 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, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.BankAccountCreateResponse, http_res) - if utils.match_response( - http_res, ["400", "401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - def get_create_model( - self, - *, - request: Union[ - operations.GetCreateBankAccountsModelRequest, - operations.GetCreateBankAccountsModelRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.PushOption: - r"""Get create/update bank account model - - The *Get create/update bank account model* endpoint returns the expected data for the request payload when creating and updating a [bank account](https://docs.codat.io/bank-feeds-api#/schemas/BankAccount) for a given company and integration. - - [Bank accounts](https://docs.codat.io/bank-feeds-api#/schemas/BankAccount) are financial accounts maintained by a bank or other financial institution. - - **Integration-specific behavior** - - See the *response examples* for integration-specific indicative models. - - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, operations.GetCreateBankAccountsModelRequest - ) - request = cast(operations.GetCreateBankAccountsModelRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/options/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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="get-create-bankAccounts-model", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.PushOption, http_res) - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - async def get_create_model_async( - self, - *, - request: Union[ - operations.GetCreateBankAccountsModelRequest, - operations.GetCreateBankAccountsModelRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.PushOption: - r"""Get create/update bank account model - - The *Get create/update bank account model* endpoint returns the expected data for the request payload when creating and updating a [bank account](https://docs.codat.io/bank-feeds-api#/schemas/BankAccount) for a given company and integration. - - [Bank accounts](https://docs.codat.io/bank-feeds-api#/schemas/BankAccount) are financial accounts maintained by a bank or other financial institution. - - **Integration-specific behavior** - - See the *response examples* for integration-specific indicative models. - - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, operations.GetCreateBankAccountsModelRequest - ) - request = cast(operations.GetCreateBankAccountsModelRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/options/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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="get-create-bankAccounts-model", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.PushOption, http_res) - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - def list( - self, - *, - request: Union[ - operations.ListBankAccountsRequest, - operations.ListBankAccountsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.BankAccounts: - r"""List bank accounts - - The *List bank accounts* endpoint returns a list of [bank accounts](https://docs.codat.io/bank-feeds-api#/schemas/BankAccount) for a given company's connection. - - [Bank accounts](https://docs.codat.io/bank-feeds-api#/schemas/BankAccount) are financial accounts maintained by a bank or other financial institution. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/bank-feeds-api#/operations/refresh-company-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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.ListBankAccountsRequest) - request = cast(operations.ListBankAccountsRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="list-bank-accounts", - oauth2_scopes=None, - 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, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.BankAccounts, http_res) - if utils.match_response( - http_res, - ["400", "401", "402", "403", "404", "409", "429"], - "application/json", - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - async def list_async( - self, - *, - request: Union[ - operations.ListBankAccountsRequest, - operations.ListBankAccountsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.BankAccounts: - r"""List bank accounts - - The *List bank accounts* endpoint returns a list of [bank accounts](https://docs.codat.io/bank-feeds-api#/schemas/BankAccount) for a given company's connection. - - [Bank accounts](https://docs.codat.io/bank-feeds-api#/schemas/BankAccount) are financial accounts maintained by a bank or other financial institution. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/bank-feeds-api#/operations/refresh-company-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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.ListBankAccountsRequest) - request = cast(operations.ListBankAccountsRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="list-bank-accounts", - oauth2_scopes=None, - 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, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.BankAccounts, http_res) - if utils.match_response( - http_res, - ["400", "401", "402", "403", "404", "409", "429"], - "application/json", - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) +from codat_bankfeeds.api.bank_accounts import BankAccounts diff --git a/bank-feeds/src/codat_bankfeeds/basesdk.py b/bank-feeds/src/codat_bankfeeds/basesdk.py deleted file mode 100644 index f16dd9ca3..000000000 --- a/bank-feeds/src/codat_bankfeeds/basesdk.py +++ /dev/null @@ -1,396 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from .sdkconfiguration import SDKConfiguration -from codat_bankfeeds import utils -from codat_bankfeeds._hooks import ( - AfterErrorContext, - AfterSuccessContext, - BeforeRequestContext, -) -from codat_bankfeeds.models import errors -from codat_bankfeeds.utils import ( - RetryConfig, - SerializedRequestBody, - get_body_content, - run_sync_in_thread, -) -import httpx -from typing import Callable, List, Mapping, Optional, Tuple -from urllib.parse import parse_qs, urlparse - - -class BaseSDK: - sdk_configuration: SDKConfiguration - parent_ref: Optional[object] = None - """ - Reference to the root SDK instance, if any. This will prevent it from - being garbage collected while there are active streams. - """ - - def __init__( - self, - sdk_config: SDKConfiguration, - parent_ref: Optional[object] = None, - ) -> None: - self.sdk_configuration = sdk_config - self.parent_ref = parent_ref - - 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, - http_headers: Optional[Mapping[str, str]] = None, - allow_empty_value: Optional[List[str]] = None, - allowed_fields: Optional[List[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, - http_headers, - allow_empty_value, - allowed_fields, - ) - - 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, - http_headers: Optional[Mapping[str, str]] = None, - allow_empty_value: Optional[List[str]] = None, - allowed_fields: Optional[List[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, - http_headers, - allow_empty_value, - allowed_fields, - ) - - 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, - http_headers: Optional[Mapping[str, str]] = None, - allow_empty_value: Optional[List[str]] = None, - allowed_fields: Optional[List[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, - allow_empty_value, - ) - else: - # Pick up the query parameter from the override so they can be - # preserved when building the request later on (necessary as of - # httpx 0.28). - parsed_override = urlparse(str(url_override)) - query_params = parse_qs(parsed_override.query, keep_blank_values=True) - - 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, allowed_fields - ) - headers = {**headers, **security_headers} - query_params = {**query_params, **security_query_params} - - serialized_request_body = SerializedRequestBody() - 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 - - if http_headers is not None: - for header, value in http_headers.items(): - headers[header] = value - - 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 if timeout is not None else httpx.USE_CLIENT_DEFAULT, - ) - - 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 - - hooks = self.sdk_configuration.__dict__["_hooks"] - - def do(): - http_res = None - try: - req = hooks.before_request(BeforeRequestContext(hook_ctx), request) - if "timeout" in request.extensions and "timeout" not in req.extensions: - req.extensions["timeout"] = request.extensions["timeout"] - logger.debug( - "Request:\nMethod: %s\nURL: %s\nHeaders: %s\nBody: %s", - req.method, - req.url, - req.headers, - get_body_content(req), - ) - - if client is None: - raise ValueError("client is required") - - http_res = client.send(req, stream=stream) - except Exception as e: - _, e = 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.NoResponseError("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 = 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", http_res) - - 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 = 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 - - hooks = self.sdk_configuration.__dict__["_hooks"] - - async def do(): - http_res = None - try: - req = await run_sync_in_thread( - hooks.before_request, BeforeRequestContext(hook_ctx), request - ) - - if "timeout" in request.extensions and "timeout" not in req.extensions: - req.extensions["timeout"] = request.extensions["timeout"] - logger.debug( - "Request:\nMethod: %s\nURL: %s\nHeaders: %s\nBody: %s", - req.method, - req.url, - req.headers, - get_body_content(req), - ) - - if client is None: - raise ValueError("client is required") - - http_res = await client.send(req, stream=stream) - except Exception as e: - _, e = await run_sync_in_thread( - 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.NoResponseError("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 = await run_sync_in_thread( - 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", http_res) - - 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 = await run_sync_in_thread( - hooks.after_success, AfterSuccessContext(hook_ctx), http_res - ) - - return http_res diff --git a/bank-feeds/src/codat_bankfeeds/companies.py b/bank-feeds/src/codat_bankfeeds/companies.py index e83965f92..d68ac0486 100644 --- a/bank-feeds/src/codat_bankfeeds/companies.py +++ b/bank-feeds/src/codat_bankfeeds/companies.py @@ -1,1625 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.companies — re-export of the companies method group.""" -from .basesdk import BaseSDK -from codat_bankfeeds import utils -from codat_bankfeeds._hooks import HookContext -from codat_bankfeeds.models import errors, operations, shared -from codat_bankfeeds.types import BaseModel, OptionalNullable, UNSET -from codat_bankfeeds.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class Companies(BaseSDK): - r"""Create and manage your SMB users' companies.""" - - 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, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.Company: - r"""Create company - - Use the *Create company* endpoint to create a new [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) that represents your customer in Codat. - - A [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) represents a business sharing access to their data. - Each company can have multiple [connections](https://docs.codat.io/bank-feeds-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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request, False, True, "json", Optional[shared.CompanyRequestBody] - ), - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="create-company", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "400", - "401", - "402", - "403", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Company, http_res) - if utils.match_response( - http_res, ["400", "401", "402", "403", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", 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, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.Company: - r"""Create company - - Use the *Create company* endpoint to create a new [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) that represents your customer in Codat. - - A [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) represents a business sharing access to their data. - Each company can have multiple [connections](https://docs.codat.io/bank-feeds-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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request, False, True, "json", Optional[shared.CompanyRequestBody] - ), - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="create-company", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "400", - "401", - "402", - "403", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Company, http_res) - if utils.match_response( - http_res, ["400", "401", "402", "403", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", 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, - http_headers: Optional[Mapping[str, str]] = None, - ): - r"""Delete a company - - The *Delete company* endpoint permanently deletes a [company](https://docs.codat.io/bank-feeds-api#/schemas/Company), its [connections](https://docs.codat.io/bank-feeds-api#/schemas/Connection) and any cached data. This operation is irreversible. - - A [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) represents a business sharing access to their data. - Each company can have multiple [connections](https://docs.codat.io/bank-feeds-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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="delete-company", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "204", "*"): - return - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", 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, - http_headers: Optional[Mapping[str, str]] = None, - ): - r"""Delete a company - - The *Delete company* endpoint permanently deletes a [company](https://docs.codat.io/bank-feeds-api#/schemas/Company), its [connections](https://docs.codat.io/bank-feeds-api#/schemas/Connection) and any cached data. This operation is irreversible. - - A [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) represents a business sharing access to their data. - Each company can have multiple [connections](https://docs.codat.io/bank-feeds-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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="delete-company", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "204", "*"): - return - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", 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, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.Company: - r"""Get company - - The *Get company* endpoint returns a single company for a given `companyId`. - - A [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) represents a business sharing access to their data. - Each company can have multiple [connections](https://docs.codat.io/bank-feeds-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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="get-company", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Company, http_res) - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", 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, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.Company: - r"""Get company - - The *Get company* endpoint returns a single company for a given `companyId`. - - A [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) represents a business sharing access to their data. - Each company can have multiple [connections](https://docs.codat.io/bank-feeds-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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="get-company", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Company, http_res) - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - def get_access_token( - self, - *, - request: Union[ - operations.GetCompanyAccessTokenRequest, - operations.GetCompanyAccessTokenRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CompanyAccessToken: - r"""Get company access token - - Use the _Get company access token_ endpoint to return an access token for the specified company ID. The token is valid for one day. - - The token is required by Codat's embeddable UIs (such as [Connections SDK](https://docs.codat.io/auth-flow/optimize/connection-management) and [Link SDK](https://docs.codat.io/auth-flow/authorize-embedded-link)) to verify the identity of the user and improve the reliability of data provided by them. - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.GetCompanyAccessTokenRequest) - request = cast(operations.GetCompanyAccessTokenRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/accessToken", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="get-company-access-token", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CompanyAccessToken, http_res) - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - async def get_access_token_async( - self, - *, - request: Union[ - operations.GetCompanyAccessTokenRequest, - operations.GetCompanyAccessTokenRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CompanyAccessToken: - r"""Get company access token - - Use the _Get company access token_ endpoint to return an access token for the specified company ID. The token is valid for one day. - - The token is required by Codat's embeddable UIs (such as [Connections SDK](https://docs.codat.io/auth-flow/optimize/connection-management) and [Link SDK](https://docs.codat.io/auth-flow/authorize-embedded-link)) to verify the identity of the user and improve the reliability of data provided by them. - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.GetCompanyAccessTokenRequest) - request = cast(operations.GetCompanyAccessTokenRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/accessToken", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="get-company-access-token", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CompanyAccessToken, http_res) - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - 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, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.Companies: - r"""List companies - - The *List companies* endpoint returns a list of [companies](https://docs.codat.io/bank-feeds-api#/schemas/Company) associated to your instances. - - A [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) represents a business sharing access to their data. - Each company can have multiple [connections](https://docs.codat.io/bank-feeds-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. - - ## Filter by tags - - The *List companies* endpoint supports the filtering of companies using [tags](https://docs.codat.io/using-the-api/managing-companies#add-metadata-to-a-company). It supports the following operators with [Codat’s query language](https://docs.codat.io/using-the-api/querying): - - - equals (`=`) - - not equals (`!=`) - - contains (`~`) - - For example, you can use the querying to filter companies tagged with a specific foreign key, region, or owning team: - - Foreign key: `uid = {yourCustomerId}` - - Region: `region != uk` - - Owning team and region: `region = uk && owningTeam = invoice-finance` - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="list-companies", - oauth2_scopes=None, - 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, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Companies, http_res) - if utils.match_response( - http_res, ["400", "401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", 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, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.Companies: - r"""List companies - - The *List companies* endpoint returns a list of [companies](https://docs.codat.io/bank-feeds-api#/schemas/Company) associated to your instances. - - A [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) represents a business sharing access to their data. - Each company can have multiple [connections](https://docs.codat.io/bank-feeds-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. - - ## Filter by tags - - The *List companies* endpoint supports the filtering of companies using [tags](https://docs.codat.io/using-the-api/managing-companies#add-metadata-to-a-company). It supports the following operators with [Codat’s query language](https://docs.codat.io/using-the-api/querying): - - - equals (`=`) - - not equals (`!=`) - - contains (`~`) - - For example, you can use the querying to filter companies tagged with a specific foreign key, region, or owning team: - - Foreign key: `uid = {yourCustomerId}` - - Region: `region != uk` - - Owning team and region: `region = uk && owningTeam = invoice-finance` - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="list-companies", - oauth2_scopes=None, - 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, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Companies, http_res) - if utils.match_response( - http_res, ["400", "401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - def replace( - self, - *, - request: Union[ - operations.ReplaceCompanyRequest, operations.ReplaceCompanyRequestTypedDict - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.Company: - r"""Replace company - - Use the *Replace company* endpoint to replace the existing name, description, and tags of the company. Calling the endpoint will replace existing values even if new values haven't been defined in the payload. - - A [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) represents a business sharing access to their data. - Each company can have multiple [connections](https://docs.codat.io/bank-feeds-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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.ReplaceCompanyRequest) - request = cast(operations.ReplaceCompanyRequest, 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.company_request_body if request is not None else None, - False, - True, - "json", - Optional[shared.CompanyRequestBody], - ), - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="replace-company", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Company, http_res) - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - async def replace_async( - self, - *, - request: Union[ - operations.ReplaceCompanyRequest, operations.ReplaceCompanyRequestTypedDict - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.Company: - r"""Replace company - - Use the *Replace company* endpoint to replace the existing name, description, and tags of the company. Calling the endpoint will replace existing values even if new values haven't been defined in the payload. - - A [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) represents a business sharing access to their data. - Each company can have multiple [connections](https://docs.codat.io/bank-feeds-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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.ReplaceCompanyRequest) - request = cast(operations.ReplaceCompanyRequest, 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.company_request_body if request is not None else None, - False, - True, - "json", - Optional[shared.CompanyRequestBody], - ), - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="replace-company", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Company, http_res) - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", 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, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.Company: - r"""Update company - - Use the *Update company* endpoint to update the name, description, or tags of the company. - - The *Update company* endpoint doesn't have any required fields. If any of the fields provided are `null` or not provided, they won't be included in the update. - - A [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) represents a business sharing access to 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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.UpdateCompanyRequest) - request = cast(operations.UpdateCompanyRequest, request) - - req = self._build_request( - method="PATCH", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.company_update_request if request is not None else None, - False, - True, - "json", - Optional[shared.CompanyUpdateRequest], - ), - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="update-company", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Company, http_res) - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", 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, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.Company: - r"""Update company - - Use the *Update company* endpoint to update the name, description, or tags of the company. - - The *Update company* endpoint doesn't have any required fields. If any of the fields provided are `null` or not provided, they won't be included in the update. - - A [company](https://docs.codat.io/bank-feeds-api#/schemas/Company) represents a business sharing access to 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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.UpdateCompanyRequest) - request = cast(operations.UpdateCompanyRequest, request) - - req = self._build_request_async( - method="PATCH", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.company_update_request if request is not None else None, - False, - True, - "json", - Optional[shared.CompanyUpdateRequest], - ), - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="update-company", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Company, http_res) - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) +from codat_bankfeeds.api.companies import Companies diff --git a/bank-feeds/src/codat_bankfeeds/company_information.py b/bank-feeds/src/codat_bankfeeds/company_information.py index b1882861e..e845e0ad9 100644 --- a/bank-feeds/src/codat_bankfeeds/company_information.py +++ b/bank-feeds/src/codat_bankfeeds/company_information.py @@ -1,251 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.company_information — re-export of the company_information method group.""" -from .basesdk import BaseSDK -from codat_bankfeeds import utils -from codat_bankfeeds._hooks import HookContext -from codat_bankfeeds.models import errors, operations, shared -from codat_bankfeeds.types import BaseModel, OptionalNullable, UNSET -from codat_bankfeeds.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class CompanyInformation(BaseSDK): - r"""Get detailed information about a company from the underlying accounting software.""" - - def get( - self, - *, - request: Union[ - operations.GetCompanyInformationRequest, - operations.GetCompanyInformationRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = 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. - - ### Supported Integrations - | Integration | Supported | - |-----------------------|-----------| - | Oracle NetSuite | Yes | - | Xero | Yes | - | Exact | No | - | FreeAgent | No | - | Sage | No | - | QuickBooks Online | No | - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - 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}/bankFeeds/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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="get-company-information", - oauth2_scopes=None, - 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, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CompanyInformation, http_res) - if utils.match_response( - http_res, ["400", "401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", 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, - http_headers: Optional[Mapping[str, str]] = 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. - - ### Supported Integrations - | Integration | Supported | - |-----------------------|-----------| - | Oracle NetSuite | Yes | - | Xero | Yes | - | Exact | No | - | FreeAgent | No | - | Sage | No | - | QuickBooks Online | No | - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - 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}/bankFeeds/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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="get-company-information", - oauth2_scopes=None, - 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, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CompanyInformation, http_res) - if utils.match_response( - http_res, ["400", "401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) +from codat_bankfeeds.api.company_information import CompanyInformation diff --git a/bank-feeds/src/codat_bankfeeds/configuration.py b/bank-feeds/src/codat_bankfeeds/configuration.py new file mode 100644 index 000000000..d289dcf69 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/configuration.py @@ -0,0 +1,596 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import copy +import http.client as httplib +import logging +from logging import FileHandler +import multiprocessing +import sys +from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict +from typing_extensions import NotRequired, Self + +import urllib3 + + +JSON_SCHEMA_VALIDATION_KEYWORDS = { + 'multipleOf', 'maximum', 'exclusiveMaximum', + 'minimum', 'exclusiveMinimum', 'maxLength', + 'minLength', 'pattern', 'maxItems', 'minItems' +} + +ServerVariablesT = Dict[str, str] + +GenericAuthSetting = TypedDict( + "GenericAuthSetting", + { + "type": str, + "in": str, + "key": str, + "value": str, + }, +) + + +OAuth2AuthSetting = TypedDict( + "OAuth2AuthSetting", + { + "type": Literal["oauth2"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +APIKeyAuthSetting = TypedDict( + "APIKeyAuthSetting", + { + "type": Literal["api_key"], + "in": str, + "key": str, + "value": Optional[str], + }, +) + + +BasicAuthSetting = TypedDict( + "BasicAuthSetting", + { + "type": Literal["basic"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": Optional[str], + }, +) + + +BearerFormatAuthSetting = TypedDict( + "BearerFormatAuthSetting", + { + "type": Literal["bearer"], + "in": Literal["header"], + "format": Literal["JWT"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +BearerAuthSetting = TypedDict( + "BearerAuthSetting", + { + "type": Literal["bearer"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +HTTPSignatureAuthSetting = TypedDict( + "HTTPSignatureAuthSetting", + { + "type": Literal["http-signature"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": None, + }, +) + + +AuthSettings = TypedDict( + "AuthSettings", + { + "auth_header": APIKeyAuthSetting, + }, + total=False, +) + + +class HostSettingVariable(TypedDict): + description: str + default_value: str + enum_values: List[str] + + +class HostSetting(TypedDict): + url: str + description: str + variables: NotRequired[Dict[str, HostSettingVariable]] + + +class Configuration: + """This class contains various settings of the API client. + + :param host: Base url. + :param ignore_operation_servers + Boolean to ignore operation servers for the API client. + Config will use `host` as the base url regardless of the operation servers. + :param api_key: Dict to store API key(s). + Each entry in the dict specifies an API key. + The dict key is the name of the security scheme in the OAS specification. + The dict value is the API key secret. + :param api_key_prefix: Dict to store API prefix (e.g. Bearer). + The dict key is the name of the security scheme in the OAS specification. + The dict value is an API key prefix when generating the auth data. + :param username: Username for HTTP basic authentication. + :param password: Password for HTTP basic authentication. + :param access_token: Access token. + :param server_index: Index to servers configuration. + :param server_variables: Mapping with string values to replace variables in + templated server configuration. The validation of enums is performed for + variables with defined enum values before. + :param server_operation_index: Mapping from operation ID to an index to server + configuration. + :param server_operation_variables: Mapping from operation ID to a mapping with + string values to replace variables in templated server configuration. + The validation of enums is performed for variables with defined enum + values before. + :param ssl_ca_cert: str - the path to a file of concatenated CA certificates + in PEM format. + :param retries: Number of retries for API requests. + + :Example: + + API Key Authentication Example. + Given the following security scheme in the OpenAPI specification: + components: + securitySchemes: + cookieAuth: # name for the security scheme + type: apiKey + in: cookie + name: JSESSIONID # cookie name + + You can programmatically set the cookie: + +conf = codat_bankfeeds.Configuration( + api_key={'cookieAuth': 'abc123'} + api_key_prefix={'cookieAuth': 'JSESSIONID'} +) + + The following cookie will be added to the HTTP request: + Cookie: JSESSIONID abc123 + """ + + _default: ClassVar[Optional[Self]] = None + + def __init__( + self, + host: Optional[str]=None, + api_key: Optional[Dict[str, str]]=None, + api_key_prefix: Optional[Dict[str, str]]=None, + username: Optional[str]=None, + password: Optional[str]=None, + access_token: Optional[str]=None, + server_index: Optional[int]=None, + server_variables: Optional[ServerVariablesT]=None, + server_operation_index: Optional[Dict[int, int]]=None, + server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None, + ignore_operation_servers: bool=False, + ssl_ca_cert: Optional[str]=None, + retries: Optional[int] = None, + *, + debug: Optional[bool] = None, + ) -> None: + """Constructor + """ + self._base_path = "https://api.codat.io" if host is None else host + """Default Base url + """ + self.server_index = 0 if server_index is None and host is None else server_index + self.server_operation_index = server_operation_index or {} + """Default server index + """ + self.server_variables = server_variables or {} + self.server_operation_variables = server_operation_variables or {} + """Default server variables + """ + self.ignore_operation_servers = ignore_operation_servers + """Ignore operation servers + """ + self.temp_folder_path = None + """Temp file folder for downloading files + """ + # Authentication Settings + self.api_key = {} + if api_key: + self.api_key = api_key + """dict to store API key(s) + """ + self.api_key_prefix = {} + if api_key_prefix: + self.api_key_prefix = api_key_prefix + """dict to store API prefix (e.g. Bearer) + """ + self.refresh_api_key_hook = None + """function hook to refresh API key if expired + """ + self.username = username + """Username for HTTP basic authentication + """ + self.password = password + """Password for HTTP basic authentication + """ + self.access_token = access_token + """Access token + """ + self.logger = {} + """Logging Settings + """ + self.logger["package_logger"] = logging.getLogger("codat_bankfeeds") + self.logger["urllib3_logger"] = logging.getLogger("urllib3") + self.logger_format = '%(asctime)s %(levelname)s %(message)s' + """Log format + """ + self.logger_stream_handler = None + """Log stream handler + """ + self.logger_file_handler: Optional[FileHandler] = None + """Log file handler + """ + self.logger_file = None + """Debug file location + """ + if debug is not None: + self.debug = debug + else: + self.__debug = False + """Debug switch + """ + + self.verify_ssl = True + """SSL/TLS verification + Set this to false to skip verifying SSL certificate when calling API + from https server. + """ + self.ssl_ca_cert = ssl_ca_cert + """Set this to customize the certificate file to verify the peer. + """ + self.cert_file = None + """client certificate file + """ + self.key_file = None + """client key file + """ + self.assert_hostname = None + """Set this to True/False to enable/disable SSL hostname verification. + """ + self.tls_server_name = None + """SSL/TLS Server Name Indication (SNI) + Set this to the SNI value expected by the server. + """ + + self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 + """urllib3 connection pool's maximum number of connections saved + per pool. urllib3 uses 1 connection as default value, but this is + not the best value when you are making a lot of possibly parallel + requests to the same host, which is often the case here. + cpu_count * 5 is used as default value to increase performance. + """ + + self.proxy: Optional[str] = None + """Proxy URL + """ + self.proxy_headers = None + """Proxy headers + """ + self.safe_chars_for_path_param = '' + """Safe chars for path_param + """ + self.retries = retries + """Adding retries to override urllib3 default value 3 + """ + # Enable client side validation + self.client_side_validation = True + + self.socket_options = None + """Options to pass down to the underlying urllib3 socket + """ + + self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z" + """datetime format + """ + + self.date_format = "%Y-%m-%d" + """date format + """ + + def __deepcopy__(self, memo: Dict[int, Any]) -> Self: + cls = self.__class__ + result = cls.__new__(cls) + memo[id(self)] = result + for k, v in self.__dict__.items(): + if k not in ('logger', 'logger_file_handler'): + setattr(result, k, copy.deepcopy(v, memo)) + # shallow copy of loggers + result.logger = copy.copy(self.logger) + # use setters to configure loggers + result.logger_file = self.logger_file + result.debug = self.debug + return result + + def __setattr__(self, name: str, value: Any) -> None: + object.__setattr__(self, name, value) + + @classmethod + def set_default(cls, default: Optional[Self]) -> None: + """Set default instance of configuration. + + It stores default configuration, which can be + returned by get_default_copy method. + + :param default: object of Configuration + """ + cls._default = default + + @classmethod + def get_default_copy(cls) -> Self: + """Deprecated. Please use `get_default` instead. + + Deprecated. Please use `get_default` instead. + + :return: The configuration object. + """ + return cls.get_default() + + @classmethod + def get_default(cls) -> Self: + """Return the default configuration. + + This method returns newly created, based on default constructor, + object of Configuration class or returns a copy of default + configuration. + + :return: The configuration object. + """ + if cls._default is None: + cls._default = cls() + return cls._default + + @property + def logger_file(self) -> Optional[str]: + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + return self.__logger_file + + @logger_file.setter + def logger_file(self, value: Optional[str]) -> None: + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + self.__logger_file = value + if self.__logger_file: + # If set logging file, + # then add file handler and remove stream handler. + self.logger_file_handler = logging.FileHandler(self.__logger_file) + self.logger_file_handler.setFormatter(self.logger_formatter) + for _, logger in self.logger.items(): + logger.addHandler(self.logger_file_handler) + + @property + def debug(self) -> bool: + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + return self.__debug + + @debug.setter + def debug(self, value: bool) -> None: + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + self.__debug = value + if self.__debug: + # if debug status is True, turn on debug logging + for _, logger in self.logger.items(): + logger.setLevel(logging.DEBUG) + # turn on httplib debug + httplib.HTTPConnection.debuglevel = 1 + else: + # if debug status is False, turn off debug logging, + # setting log level to default `logging.WARNING` + for _, logger in self.logger.items(): + logger.setLevel(logging.WARNING) + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 + + @property + def logger_format(self) -> str: + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + return self.__logger_format + + @logger_format.setter + def logger_format(self, value: str) -> None: + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + self.__logger_format = value + self.logger_formatter = logging.Formatter(self.__logger_format) + + def get_api_key_with_prefix(self, identifier: str, alias: Optional[str]=None) -> Optional[str]: + """Gets API key (with prefix if set). + + :param identifier: The identifier of apiKey. + :param alias: The alternative identifier of apiKey. + :return: The token for api key authentication. + """ + if self.refresh_api_key_hook is not None: + self.refresh_api_key_hook(self) + key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) + if key: + prefix = self.api_key_prefix.get(identifier) + if prefix: + return "%s %s" % (prefix, key) + else: + return key + + return None + + def get_basic_auth_token(self) -> Optional[str]: + """Gets HTTP basic authentication header (string). + + :return: The token for basic HTTP authentication. + """ + username = "" + if self.username is not None: + username = self.username + password = "" + if self.password is not None: + password = self.password + return urllib3.util.make_headers( + basic_auth=username + ':' + password + ).get('authorization') + + def auth_settings(self)-> AuthSettings: + """Gets Auth Settings dict for api client. + + :return: The Auth Settings information dict. + """ + auth: AuthSettings = {} + if 'auth_header' in self.api_key: + auth['auth_header'] = { + 'type': 'api_key', + 'in': 'header', + 'key': 'Authorization', + 'value': self.get_api_key_with_prefix( + 'auth_header', + ), + } + return auth + + def to_debug_report(self) -> str: + """Gets the essential information for debugging. + + :return: The report for debugging. + """ + return "Python SDK Debug Report:\n"\ + "OS: {env}\n"\ + "Python Version: {pyversion}\n"\ + "Version of the API: 3.0.0\n"\ + "SDK Package Version: 1.0.0".\ + format(env=sys.platform, pyversion=sys.version) + + def get_host_settings(self) -> List[HostSetting]: + """Gets an array of host settings + + :return: An array of host settings + """ + return [ + { + 'url': "https://api.codat.io", + 'description': "Production", + } + ] + + def get_host_from_settings( + self, + index: Optional[int], + variables: Optional[ServerVariablesT]=None, + servers: Optional[List[HostSetting]]=None, + ) -> str: + """Gets host URL based on the index and variables + :param index: array index of the host settings + :param variables: hash of variable and the corresponding value + :param servers: an array of host settings or None + :return: URL based on host settings + """ + if index is None: + return self._base_path + + variables = {} if variables is None else variables + servers = self.get_host_settings() if servers is None else servers + + try: + server = servers[index] + except IndexError: + raise ValueError( + "Invalid index {0} when selecting the host settings. " + "Must be less than {1}".format(index, len(servers))) + + url = server['url'] + + # go through variables and replace placeholders + for variable_name, variable in server.get('variables', {}).items(): + used_value = variables.get( + variable_name, variable['default_value']) + + if 'enum_values' in variable \ + and used_value not in variable['enum_values']: + raise ValueError( + "The variable `{0}` in the host URL has invalid value " + "{1}. Must be {2}.".format( + variable_name, variables[variable_name], + variable['enum_values'])) + + url = url.replace("{" + variable_name + "}", used_value) + + return url + + @property + def host(self) -> str: + """Return generated host.""" + return self.get_host_from_settings(self.server_index, variables=self.server_variables) + + @host.setter + def host(self, value: str) -> None: + """Fix base path.""" + self._base_path = value + self.server_index = None diff --git a/bank-feeds/src/codat_bankfeeds/connections.py b/bank-feeds/src/codat_bankfeeds/connections.py index 38553983f..b4d245224 100644 --- a/bank-feeds/src/codat_bankfeeds/connections.py +++ b/bank-feeds/src/codat_bankfeeds/connections.py @@ -1,1127 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.connections — re-export of the connections method group.""" -from .basesdk import BaseSDK -from codat_bankfeeds import utils -from codat_bankfeeds._hooks import HookContext -from codat_bankfeeds.models import errors, operations, shared -from codat_bankfeeds.types import BaseModel, OptionalNullable, UNSET -from codat_bankfeeds.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class Connections(BaseSDK): - r"""Create new and manage existing data connections for a company.""" - - def create( - self, - *, - request: Union[ - operations.CreateConnectionRequest, - operations.CreateConnectionRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = 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/platform-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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.request_body if request is not None else None, - False, - True, - "json", - Optional[operations.CreateConnectionRequestBody], - ), - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="create-connection", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Connection, http_res) - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", 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, - http_headers: Optional[Mapping[str, str]] = 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/platform-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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.request_body if request is not None else None, - False, - True, - "json", - Optional[operations.CreateConnectionRequestBody], - ), - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="create-connection", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Connection, http_res) - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", 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, - http_headers: Optional[Mapping[str, str]] = 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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="delete-connection", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "*"): - return - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", 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, - http_headers: Optional[Mapping[str, str]] = 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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="delete-connection", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "*"): - return - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", 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, - http_headers: Optional[Mapping[str, str]] = 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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="get-connection", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Connection, http_res) - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", 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, - http_headers: Optional[Mapping[str, str]] = 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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="get-connection", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Connection, http_res) - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - def list( - self, - *, - request: Union[ - operations.ListConnectionsRequest, - operations.ListConnectionsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = 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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="list-connections", - oauth2_scopes=None, - 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, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Connections, http_res) - if utils.match_response( - http_res, ["400", "401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", 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, - http_headers: Optional[Mapping[str, str]] = 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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="list-connections", - oauth2_scopes=None, - 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, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Connections, http_res) - if utils.match_response( - http_res, ["400", "401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", 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, - http_headers: Optional[Mapping[str, str]] = 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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.request_body if request is not None else None, - False, - True, - "json", - Optional[operations.UnlinkConnectionUpdateConnection], - ), - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="unlink-connection", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Connection, http_res) - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", 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, - http_headers: Optional[Mapping[str, str]] = 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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.request_body if request is not None else None, - False, - True, - "json", - Optional[operations.UnlinkConnectionUpdateConnection], - ), - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="unlink-connection", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Connection, http_res) - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) +from codat_bankfeeds.api.connections import Connections diff --git a/bank-feeds/src/codat_bankfeeds/exceptions.py b/bank-feeds/src/codat_bankfeeds/exceptions.py new file mode 100644 index 000000000..a64cbf52e --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/exceptions.py @@ -0,0 +1,200 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from typing import Any, Optional +from typing_extensions import Self + +class OpenApiException(Exception): + """The base exception class for all OpenAPIExceptions""" + + +class ApiTypeError(OpenApiException, TypeError): + def __init__(self, msg, path_to_item=None, valid_classes=None, + key_type=None) -> None: + """ Raises an exception for TypeErrors + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list): a list of keys an indices to get to the + current_item + None if unset + valid_classes (tuple): the primitive classes that current item + should be an instance of + None if unset + key_type (bool): False if our value is a value in a dict + True if it is a key in a dict + False if our item is an item in a list + None if unset + """ + self.path_to_item = path_to_item + self.valid_classes = valid_classes + self.key_type = key_type + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiTypeError, self).__init__(full_msg) + + +class ApiValueError(OpenApiException, ValueError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list) the path to the exception in the + received_data dict. None if unset + """ + + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiValueError, self).__init__(full_msg) + + +class ApiAttributeError(OpenApiException, AttributeError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Raised when an attribute reference or assignment fails. + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiAttributeError, self).__init__(full_msg) + + +class ApiKeyError(OpenApiException, KeyError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiKeyError, self).__init__(full_msg) + + +class ApiException(OpenApiException): + + def __init__( + self, + status=None, + reason=None, + http_resp=None, + *, + body: Optional[str] = None, + data: Optional[Any] = None, + ) -> None: + self.status = status + self.reason = reason + self.body = body + self.data = data + self.headers = None + + if http_resp: + if self.status is None: + self.status = http_resp.status + if self.reason is None: + self.reason = http_resp.reason + if self.body is None: + try: + self.body = http_resp.data.decode('utf-8') + except Exception: + pass + self.headers = http_resp.getheaders() + + @classmethod + def from_response( + cls, + *, + http_resp, + body: Optional[str], + data: Optional[Any], + ) -> Self: + if http_resp.status == 400: + raise BadRequestException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 401: + raise UnauthorizedException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 403: + raise ForbiddenException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 404: + raise NotFoundException(http_resp=http_resp, body=body, data=data) + + if 500 <= http_resp.status <= 599: + raise ServiceException(http_resp=http_resp, body=body, data=data) + raise ApiException(http_resp=http_resp, body=body, data=data) + + def __str__(self): + """Custom error messages for exception""" + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format( + self.headers) + + if self.data or self.body: + error_message += "HTTP response body: {0}\n".format(self.data or self.body) + + return error_message + + +class BadRequestException(ApiException): + pass + + +class NotFoundException(ApiException): + pass + + +class UnauthorizedException(ApiException): + pass + + +class ForbiddenException(ApiException): + pass + + +class ServiceException(ApiException): + pass + + +def render_path(path_to_item): + """Returns a string representation of a path""" + result = "" + for pth in path_to_item: + if isinstance(pth, int): + result += "[{0}]".format(pth) + else: + result += "['{0}']".format(pth) + return result diff --git a/bank-feeds/src/codat_bankfeeds/managed_bank_feeds.py b/bank-feeds/src/codat_bankfeeds/managed_bank_feeds.py index 79c78d8bb..1b6000872 100644 --- a/bank-feeds/src/codat_bankfeeds/managed_bank_feeds.py +++ b/bank-feeds/src/codat_bankfeeds/managed_bank_feeds.py @@ -1,697 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.managed_bank_feeds — re-export of the managed_bank_feeds method group.""" -from .basesdk import BaseSDK -from codat_bankfeeds import utils -from codat_bankfeeds._hooks import HookContext -from codat_bankfeeds.models import errors, operations, shared -from codat_bankfeeds.types import BaseModel, OptionalNullable, UNSET -from codat_bankfeeds.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class ManagedBankFeeds(BaseSDK): - r"""Manage bank feed syncs for source accounts.""" - - def get_latest_sync( - self, - *, - request: Union[ - operations.GetLatestManagedBankFeedSyncRequest, - operations.GetLatestManagedBankFeedSyncRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> Optional[shared.SyncStatusResult]: - r"""Get latest sync - - The _Get latest sync_ endpoint returns the status for a given source account's [most recent sync](https://docs.codat.io/bank-feeds-api#/schemas/SyncStatusResult). - - A sync is a single execution that fetches bank transactions from a connected bank account and records them in the company's 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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, operations.GetLatestManagedBankFeedSyncRequest - ) - request = cast(operations.GetLatestManagedBankFeedSyncRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/bankFeedAccounts/{sourceAccountId}/managedBankFeeds/syncs/latest", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="get-latest-managed-bank-feed-sync", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.SyncStatusResult, http_res) - if utils.match_response(http_res, "204", "*"): - return None - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - async def get_latest_sync_async( - self, - *, - request: Union[ - operations.GetLatestManagedBankFeedSyncRequest, - operations.GetLatestManagedBankFeedSyncRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> Optional[shared.SyncStatusResult]: - r"""Get latest sync - - The _Get latest sync_ endpoint returns the status for a given source account's [most recent sync](https://docs.codat.io/bank-feeds-api#/schemas/SyncStatusResult). - - A sync is a single execution that fetches bank transactions from a connected bank account and records them in the company's 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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, operations.GetLatestManagedBankFeedSyncRequest - ) - request = cast(operations.GetLatestManagedBankFeedSyncRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/bankFeedAccounts/{sourceAccountId}/managedBankFeeds/syncs/latest", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="get-latest-managed-bank-feed-sync", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.SyncStatusResult, http_res) - if utils.match_response(http_res, "204", "*"): - return None - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - def get_sync( - self, - *, - request: Union[ - operations.GetManagedBankFeedSyncRequest, - operations.GetManagedBankFeedSyncRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.SyncStatusResult: - r"""Get sync - - The _Get sync_ endpoint returns the [sync status](https://docs.codat.io/bank-feeds-api#/schemas/SyncStatusResult) for a given 'syncId'. - - A sync is a single execution that fetches bank transactions from a connected bank account and records them in the company's 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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.GetManagedBankFeedSyncRequest) - request = cast(operations.GetManagedBankFeedSyncRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/bankFeedAccounts/{sourceAccountId}/managedBankFeeds/syncs/{syncId}", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="get-managed-bank-feed-sync", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.SyncStatusResult, http_res) - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - async def get_sync_async( - self, - *, - request: Union[ - operations.GetManagedBankFeedSyncRequest, - operations.GetManagedBankFeedSyncRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.SyncStatusResult: - r"""Get sync - - The _Get sync_ endpoint returns the [sync status](https://docs.codat.io/bank-feeds-api#/schemas/SyncStatusResult) for a given 'syncId'. - - A sync is a single execution that fetches bank transactions from a connected bank account and records them in the company's 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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.GetManagedBankFeedSyncRequest) - request = cast(operations.GetManagedBankFeedSyncRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/bankFeedAccounts/{sourceAccountId}/managedBankFeeds/syncs/{syncId}", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="get-managed-bank-feed-sync", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.SyncStatusResult, http_res) - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - def run_ad_hoc_sync( - self, - *, - request: Union[ - operations.RunManagedBankFeedAdHocSyncRequest, - operations.RunManagedBankFeedAdHocSyncRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.StartScheduledSyncResult: - r"""Run ad-hoc sync - - The _Run ad-hoc sync_ endpoint immediately runs a sync with a fetch period from the last successful sync to the execution time of the new sync. - - A sync is a single execution that fetches bank transactions from a connected bank account and records them in the company's accounting software. - - Use either the [_Get latest sync_](https://docs.codat.io/bank-feeds-api#/operations/get-latest-managed-bank-feed-sync) endpoint or the [_Get sync_](https://docs.codat.io/bank-feeds-api#/operations/fetch-managed-bank-feed-sync-by-id) endpoint to get the result of this sync. - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, operations.RunManagedBankFeedAdHocSyncRequest - ) - request = cast(operations.RunManagedBankFeedAdHocSyncRequest, request) - - req = self._build_request( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/bankFeedAccounts/{sourceAccountId}/managedBankFeeds/syncs", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="run-managed-bank-feed-ad-hoc-sync", - oauth2_scopes=None, - 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, - ) - - response_data: Any = None - if utils.match_response(http_res, "201", "application/json"): - return unmarshal_json_response(shared.StartScheduledSyncResult, http_res) - if utils.match_response( - http_res, - ["400", "401", "402", "403", "404", "409", "429"], - "application/json", - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - async def run_ad_hoc_sync_async( - self, - *, - request: Union[ - operations.RunManagedBankFeedAdHocSyncRequest, - operations.RunManagedBankFeedAdHocSyncRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.StartScheduledSyncResult: - r"""Run ad-hoc sync - - The _Run ad-hoc sync_ endpoint immediately runs a sync with a fetch period from the last successful sync to the execution time of the new sync. - - A sync is a single execution that fetches bank transactions from a connected bank account and records them in the company's accounting software. - - Use either the [_Get latest sync_](https://docs.codat.io/bank-feeds-api#/operations/get-latest-managed-bank-feed-sync) endpoint or the [_Get sync_](https://docs.codat.io/bank-feeds-api#/operations/fetch-managed-bank-feed-sync-by-id) endpoint to get the result of this sync. - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, operations.RunManagedBankFeedAdHocSyncRequest - ) - request = cast(operations.RunManagedBankFeedAdHocSyncRequest, request) - - req = self._build_request_async( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/bankFeedAccounts/{sourceAccountId}/managedBankFeeds/syncs", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="run-managed-bank-feed-ad-hoc-sync", - oauth2_scopes=None, - 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, - ) - - response_data: Any = None - if utils.match_response(http_res, "201", "application/json"): - return unmarshal_json_response(shared.StartScheduledSyncResult, http_res) - if utils.match_response( - http_res, - ["400", "401", "402", "403", "404", "409", "429"], - "application/json", - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) +from codat_bankfeeds.api.managed_bank_feeds import ManagedBankFeeds diff --git a/bank-feeds/src/codat_bankfeeds/models/__init__.py b/bank-feeds/src/codat_bankfeeds/models/__init__.py index 5fd38d0ff..18a974804 100644 --- a/bank-feeds/src/codat_bankfeeds/models/__init__.py +++ b/bank-feeds/src/codat_bankfeeds/models/__init__.py @@ -1,23 +1,98 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from typing import Any, TYPE_CHECKING +# flake8: noqa +""" + Bank Feeds -from codat_bankfeeds.utils.dynamic_imports import lazy_getattr, lazy_dir + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -if TYPE_CHECKING: - from . import errors, operations, shared + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) -# package + Do not edit the class manually. +""" # noqa: E501 -_sub_packages = ["errors", "operations", "shared"] - - -def __getattr__(attr_name: str) -> Any: - return lazy_getattr( - attr_name, package=__package__, dynamic_imports={}, sub_packages=_sub_packages - ) - - -def __dir__(): - return lazy_dir(dynamic_imports={}, sub_packages=_sub_packages) +# import models into model package +from codat_bankfeeds.models.access_token import AccessToken +from codat_bankfeeds.models.shared.accountinfo import AccountInfo +from codat_bankfeeds.models.accounting_bank_account import AccountingBankAccount +from codat_bankfeeds.models.shared.bankaccountcreateresponse import BankAccountCreateResponse +from codat_bankfeeds.models.bank_account_create_response_all_of_data import BankAccountCreateResponseAllOfData +from codat_bankfeeds.models.shared.bankaccountcredentials import BankAccountCredentials +from codat_bankfeeds.models.shared.bankaccountprototype import BankAccountPrototype +from codat_bankfeeds.models.shared.bankaccountstatus import BankAccountStatus +from codat_bankfeeds.models.shared.bankaccounts import BankAccounts +from codat_bankfeeds.models.shared.bankfeedaccountmapping import BankFeedAccountMapping +from codat_bankfeeds.models.shared.bankfeedaccountmappingresponse import BankFeedAccountMappingResponse +from codat_bankfeeds.models.shared.bankfeedmapping import BankFeedMapping +from codat_bankfeeds.models.bank_transaction import BankTransaction +from codat_bankfeeds.models.shared.clientratelimitwebhook import ClientRateLimitWebhook +from codat_bankfeeds.models.shared.clientratelimitwebhookpayload import ClientRateLimitWebhookPayload +from codat_bankfeeds.models.shared.companies import Companies +from codat_bankfeeds.models.shared.company import Company +from codat_bankfeeds.models.shared.companyaccesstoken import CompanyAccessToken +from codat_bankfeeds.models.company_details import CompanyDetails +from codat_bankfeeds.models.shared.companyinformation import CompanyInformation +from codat_bankfeeds.models.shared.companyreference import CompanyReference +from codat_bankfeeds.models.company_reference_links import CompanyReferenceLinks +from codat_bankfeeds.models.shared.companyrequestbody import CompanyRequestBody +from codat_bankfeeds.models.shared.companyupdaterequest import CompanyUpdateRequest +from codat_bankfeeds.models.shared.connection import Connection +from codat_bankfeeds.models.shared.connections import Connections +from codat_bankfeeds.models.shared.createbanktransactions import CreateBankTransactions +from codat_bankfeeds.models.shared.createbanktransactionsresponse import CreateBankTransactionsResponse +from codat_bankfeeds.models.create_batch_source_account201_response_inner import CreateBatchSourceAccount201ResponseInner +from codat_bankfeeds.models.create_batch_source_account207_response_inner import CreateBatchSourceAccount207ResponseInner +from codat_bankfeeds.models.create_batch_source_account_request_body import CreateBatchSourceAccountRequestBody +from codat_bankfeeds.models.create_connection_request import CreateConnectionRequest +from codat_bankfeeds.models.create_source_account200_response import CreateSourceAccount200Response +from codat_bankfeeds.models.create_source_account_request import CreateSourceAccountRequest +from codat_bankfeeds.models.shared.dataconnectionerror import DataConnectionError +from codat_bankfeeds.models.shared.dataconnectionstatus import DataConnectionStatus +from codat_bankfeeds.models.shared.datatype import DataType +from codat_bankfeeds.models.error_message import ErrorMessage +from codat_bankfeeds.models.shared.errorvalidation import ErrorValidation +from codat_bankfeeds.models.shared.errorvalidationitem import ErrorValidationItem +from codat_bankfeeds.models.shared.generateotpresponse import GenerateOtpResponse +from codat_bankfeeds.models.shared.halref import HalRef +from codat_bankfeeds.models.items import Items +from codat_bankfeeds.models.shared.links import Links +from codat_bankfeeds.models.list_source_accounts200_response import ListSourceAccounts200Response +from codat_bankfeeds.models.metadata import Metadata +from codat_bankfeeds.models.model1 import Model1 +from codat_bankfeeds.models.pull_operation import PullOperation +from codat_bankfeeds.models.pull_operations import PullOperations +from codat_bankfeeds.models.shared.pushchangetype import PushChangeType +from codat_bankfeeds.models.shared.pushfieldvalidation import PushFieldValidation +from codat_bankfeeds.models.shared.pushoperation import PushOperation +from codat_bankfeeds.models.shared.pushoperationchange import PushOperationChange +from codat_bankfeeds.models.shared.pushoperationref import PushOperationRef +from codat_bankfeeds.models.shared.pushoperationstatus import PushOperationStatus +from codat_bankfeeds.models.shared.pushoperations import PushOperations +from codat_bankfeeds.models.shared.pushoption import PushOption +from codat_bankfeeds.models.shared.pushoptionchoice import PushOptionChoice +from codat_bankfeeds.models.shared.pushoptionproperty import PushOptionProperty +from codat_bankfeeds.models.shared.pushoptiontype import PushOptionType +from codat_bankfeeds.models.shared.pushvalidationinfo import PushValidationInfo +from codat_bankfeeds.models.shared.routinginfo import RoutingInfo +from codat_bankfeeds.models.shared.sourceaccount import SourceAccount +from codat_bankfeeds.models.shared.sourceaccountbatchcreateresponse import SourceAccountBatchCreateResponse +from codat_bankfeeds.models.shared.sourceaccountbatchcreateresult import SourceAccountBatchCreateResult +from codat_bankfeeds.models.shared.sourceaccountbatcherrorresponse import SourceAccountBatchErrorResponse +from codat_bankfeeds.models.source_account_batch_error_response_result import SourceAccountBatchErrorResponseResult +from codat_bankfeeds.models.shared.sourceaccountprototype import SourceAccountPrototype +from codat_bankfeeds.models.source_account_v2 import SourceAccountV2 +from codat_bankfeeds.models.shared.sourceaccountv2batchcreateresponse import SourceAccountV2BatchCreateResponse +from codat_bankfeeds.models.shared.sourceaccountv2batchcreateresult import SourceAccountV2BatchCreateResult +from codat_bankfeeds.models.shared.sourceaccountv2prototype import SourceAccountV2Prototype +from codat_bankfeeds.models.shared.sourceaccountwebhook import SourceAccountWebhook +from codat_bankfeeds.models.shared.sourceaccountwebhookpayload import SourceAccountWebhookPayload +from codat_bankfeeds.models.shared.startscheduledsyncresult import StartScheduledSyncResult +from codat_bankfeeds.models.supplemental_data import SupplementalData +from codat_bankfeeds.models.shared.syncstatusresult import SyncStatusResult +from codat_bankfeeds.models.shared.targetaccountoption import TargetAccountOption +from codat_bankfeeds.models.update_connection import UpdateConnection +from codat_bankfeeds.models.shared.validation import Validation +from codat_bankfeeds.models.shared.validationitem import ValidationItem diff --git a/bank-feeds/src/codat_bankfeeds/models/_compat/__init__.py b/bank-feeds/src/codat_bankfeeds/models/_compat/__init__.py new file mode 100644 index 000000000..70271e525 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/_compat/__init__.py @@ -0,0 +1,3 @@ +"""Leaf modules holding Speakeasy-name compat enums. Nothing here imports from the +package, so a flat model can import these without triggering models/shared/__init__ +(which re-exports flat models and would form an import cycle).""" diff --git a/bank-feeds/src/codat_bankfeeds/models/_compat/sourceaccountv2.py b/bank-feeds/src/codat_bankfeeds/models/_compat/sourceaccountv2.py new file mode 100644 index 000000000..6536b837b --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/_compat/sourceaccountv2.py @@ -0,0 +1,12 @@ +from __future__ import annotations + +from enum import Enum + + +class SourceAccountV2AccountType(str, Enum): + """Speakeasy-name compat for AccountType (matched by value set).""" + CHECKING = 'checking' + SAVINGS = 'savings' + LOAN = 'loan' + CREDIT_CARD = 'creditCard' + PREPAID_CARD = 'prepaidCard' diff --git a/bank-feeds/src/codat_bankfeeds/models/access_token.py b/bank-feeds/src/codat_bankfeeds/models/access_token.py new file mode 100644 index 000000000..f237a969e --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/access_token.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class AccessToken(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + """ + AccessToken + """ # noqa: E501 + expires_in: int = Field(description="The number of seconds until the access token expires.", alias="expiresIn") + access_token: str = Field(description="The access token for the company.", alias="accessToken") + token_type: str = Field(description="The type of token.", alias="tokenType") + __properties: ClassVar[List[str]] = ["expiresIn", "accessToken", "tokenType"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AccessToken from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccessToken from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "expiresIn": obj.get("expiresIn"), + "accessToken": obj.get("accessToken"), + "tokenType": obj.get("tokenType") + }) + return _obj + + + + + +class AccessTokenTypedDict(TypedDict): + """TypedDict variant of AccessToken, for dict-literal request/response inputs.""" + expires_in: NotRequired[int] + access_token: NotRequired[str] + token_type: NotRequired[str] diff --git a/bank-feeds/src/codat_bankfeeds/models/accounting_bank_account.py b/bank-feeds/src/codat_bankfeeds/models/accounting_bank_account.py new file mode 100644 index 000000000..5b504c624 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/accounting_bank_account.py @@ -0,0 +1,175 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from decimal import Decimal +from codat_bankfeeds.utils.serializers import serialize_decimal, validate_decimal +from codat_bankfeeds.models.bank_accounts_bank_account_type import BankAccountsBankAccountType +import pprint +import re # noqa: F401 +import json + +from pydantic import BeforeValidator, PlainSerializer, BaseModel, ConfigDict, Field, field_validator, model_serializer +from typing import Annotated, Any, ClassVar, Dict, List, Optional, Union +from codat_bankfeeds.models.shared.bankaccountstatus import BankAccountStatus +from codat_bankfeeds.models.metadata import Metadata, MetadataTypedDict +from codat_bankfeeds.models.supplemental_data import SupplementalData, SupplementalDataTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_bankfeeds.models.bank_account_create_response_bank_account_type import BankAccountCreateResponseBankAccountType +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL +class AccountingBankAccount(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'accountName', 'accountNumber', 'account_name', 'account_number', 'availableBalance', 'available_balance', 'balance', 'iBan', 'i_ban', 'institution', 'nominalCode', 'nominal_code', 'overdraftLimit', 'overdraft_limit', 'sortCode', 'sort_code'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + > **Accessing Bank Accounts through Banking API** > > This datatype was originally used for accessing bank account data both in accounting integrations and open banking aggregators. > > To view bank account data through the Banking API, please refer to the new [Banking: Account](https://docs.codat.io/bank-feeds-api#/schemas/Account) data type. ## Overview A list of bank accounts associated with a company and a specific data connection. Bank accounts data includes: * The name and ID of the account in the accounting software. * The currency and balance of the account. * The sort code and account number. + """ # noqa: E501 + account_name: OptionalNullable[str] = Field(default=UNSET, description="Name of the bank account in the accounting software.", alias="accountName") + account_type: Optional[BankAccountCreateResponseBankAccountType] = Field(default=None, description="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.", alias="accountType") + nominal_code: OptionalNullable[str] = Field(default=UNSET, description="Code used to identify each nominal account for a business.", alias="nominalCode") + sort_code: OptionalNullable[str] = Field(default=UNSET, description="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.", alias="sortCode") + account_number: OptionalNullable[str] = Field(default=UNSET, description="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. FreeAgent integrations For Credit accounts, only the last four digits are required. For other types, the field is optional.", alias="accountNumber") + i_ban: OptionalNullable[str] = Field(default=UNSET, description="International bank account number of the account. Often used when making or receiving international payments.", alias="iBan") + currency: Optional[str] = Field(default=None, description="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.") + balance: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Balance of the bank account.") + institution: OptionalNullable[str] = Field(default=UNSET, description="The institution of the bank account.") + available_balance: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Total available balance of the bank account as reported by the underlying data source. This may take into account overdrafts or pending transactions for example.", alias="availableBalance") + overdraft_limit: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Pre-arranged overdraft limit of the account. The value is always positive. For example, an overdraftLimit of `1000` means that the balance of the account can go down to `-1000`.", alias="overdraftLimit") + status: Optional[BankAccountStatus] = None + id: Optional[str] = Field(default=None, description="Identifier for the account, unique for the company in the accounting software.") + metadata: Optional[Metadata] = None + supplemental_data: Optional[SupplementalData] = Field(default=None, alias="supplementalData") + modified_date: Optional[str] = Field(default=None, description="The date when the record was last fetched from the accounting software, commerce software, or open banking provider and updated in Codat’s data cache. Use it to identify and retrieve records that have changed since your last fetch. For example, filtering `modifiedDate` to today will provide new records updated in Codat today. This date is populated for all data types except for attachments, balance sheets, company information, and profit & loss reports ([read more](https://docs.codat.io/using-the-api/modified-dates#modified-date)). In Codat's data model, dates and times are represented using the ISO 8601 standard.", alias="modifiedDate") + source_modified_date: Optional[str] = Field(default=None, description="The date when a record was last modified in the accounting software, usually by the business or a business process. For example, when payments are made against an invoice. It is not populated ([read more](https://docs.codat.io/using-the-api/modified-dates#source-modified-date)) when: - Pulling attachments - The accounting software does not provide modification dates for a data type - A record has been deleted from the source platform and Codat doesn't have a record of when the deletion occurred - A record has been voided. For certain platforms that soft delete records, `isDeleted` metadata is used to identify void records In Codat's data model, dates and times are represented using the ISO 8601 standard.", alias="sourceModifiedDate") + __properties: ClassVar[List[str]] = ["accountName", "accountType", "nominalCode", "sortCode", "accountNumber", "iBan", "currency", "balance", "institution", "availableBalance", "overdraftLimit", "status", "id", "metadata", "supplementalData", "modifiedDate", "sourceModifiedDate"] + + @field_validator('account_type') + def account_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['Unknown', 'Credit', 'Debit']): + raise ValueError("must be one of enum values ('Unknown', 'Credit', 'Debit')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AccountingBankAccount from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of supplemental_data + if self.supplemental_data: + _dict['supplementalData'] = self.supplemental_data.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountingBankAccount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "accountName": obj.get("accountName"), + "accountType": obj.get("accountType"), + "nominalCode": obj.get("nominalCode"), + "sortCode": obj.get("sortCode"), + "accountNumber": obj.get("accountNumber"), + "iBan": obj.get("iBan"), + "currency": obj.get("currency"), + "balance": obj.get("balance"), + "institution": obj.get("institution"), + "availableBalance": obj.get("availableBalance"), + "overdraftLimit": obj.get("overdraftLimit"), + "status": obj.get("status"), + "id": obj.get("id"), + "metadata": Metadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "supplementalData": SupplementalData.from_dict(obj["supplementalData"]) if obj.get("supplementalData") is not None else None, + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate") + }) + return _obj + + + + + +class AccountingBankAccountTypedDict(TypedDict): + """TypedDict variant of AccountingBankAccount, for dict-literal request/response inputs.""" + account_name: NotRequired[Optional[str]] + account_type: NotRequired[Optional[BankAccountCreateResponseBankAccountType]] + nominal_code: NotRequired[Optional[str]] + sort_code: NotRequired[Optional[str]] + account_number: NotRequired[Optional[str]] + i_ban: NotRequired[Optional[str]] + currency: NotRequired[Optional[str]] + balance: NotRequired[Optional[Decimal]] + institution: NotRequired[Optional[str]] + available_balance: NotRequired[Optional[Decimal]] + overdraft_limit: NotRequired[Optional[Decimal]] + status: NotRequired[Optional[BankAccountStatus]] + id: NotRequired[Optional[str]] + metadata: NotRequired[Optional[MetadataTypedDict]] + supplemental_data: NotRequired[Optional[SupplementalDataTypedDict]] + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] diff --git a/bank-feeds/src/codat_bankfeeds/models/bank_account_create_response_all_of_data.py b/bank-feeds/src/codat_bankfeeds/models/bank_account_create_response_all_of_data.py new file mode 100644 index 000000000..463a1a95a --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/bank_account_create_response_all_of_data.py @@ -0,0 +1,5 @@ +from __future__ import annotations + +from codat_bankfeeds.models.accounting_bank_account import AccountingBankAccount as BankAccountCreateResponseAllOfData, AccountingBankAccountTypedDict as BankAccountCreateResponseAllOfDataTypedDict + +__all__ = ["BankAccountCreateResponseAllOfData", "BankAccountCreateResponseAllOfDataTypedDict"] diff --git a/bank-feeds/src/codat_bankfeeds/models/bank_account_create_response_bank_account_type.py b/bank-feeds/src/codat_bankfeeds/models/bank_account_create_response_bank_account_type.py new file mode 100644 index 000000000..c2cdaae38 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/bank_account_create_response_bank_account_type.py @@ -0,0 +1,10 @@ +from __future__ import annotations + +from enum import Enum + + +class BankAccountCreateResponseBankAccountType(str, Enum): + """BankAccountCreateResponseBankAccountType enum (lifted from inline OAS enum).""" + UNKNOWN = 'Unknown' + CREDIT = 'Credit' + DEBIT = 'Debit' diff --git a/bank-feeds/src/codat_bankfeeds/models/bank_account_type.py b/bank-feeds/src/codat_bankfeeds/models/bank_account_type.py new file mode 100644 index 000000000..7626a6785 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/bank_account_type.py @@ -0,0 +1,10 @@ +from __future__ import annotations + +from enum import Enum + + +class BankAccountType(str, Enum): + """BankAccountType enum (lifted from inline OAS enum).""" + UNKNOWN = 'Unknown' + CREDIT = 'Credit' + DEBIT = 'Debit' diff --git a/bank-feeds/src/codat_bankfeeds/models/bank_accounts_bank_account_type.py b/bank-feeds/src/codat_bankfeeds/models/bank_accounts_bank_account_type.py new file mode 100644 index 000000000..35c1e2622 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/bank_accounts_bank_account_type.py @@ -0,0 +1,10 @@ +from __future__ import annotations + +from enum import Enum + + +class BankAccountsBankAccountType(str, Enum): + """BankAccountsBankAccountType enum (lifted from inline OAS enum).""" + UNKNOWN = 'Unknown' + CREDIT = 'Credit' + DEBIT = 'Debit' diff --git a/bank-feeds/src/codat_bankfeeds/models/bank_transaction.py b/bank-feeds/src/codat_bankfeeds/models/bank_transaction.py new file mode 100644 index 000000000..e9c154f61 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/bank_transaction.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from decimal import Decimal +from codat_bankfeeds.utils.serializers import serialize_decimal, validate_decimal +from codat_bankfeeds.models.bank_transaction_type import BankTransactionType +import pprint +import re # noqa: F401 +import json + +from pydantic import BeforeValidator, PlainSerializer, BaseModel, ConfigDict, Field, field_validator, model_serializer +from typing import Annotated, Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class BankTransaction(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + """ + BankTransaction + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="Identifier for the bank account transaction, unique for the company in the accounting software.") + date_: Optional[str] = Field(default=None, description="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: ``` 2023-08-22T10:21:00 2023-08-22 ``` When pushing bank transaction data to Codat, the date is treated as a local date. This means: - The date/time is used exactly as provided, without any timezone conversion. - If a timezone offset is included (e.g., `2023-08-22T10:21:00-05:00`), the offset will be ignored and only the local date/time portion will be used. - We recommend providing dates without a timezone suffix for clarity (e.g., `2023-08-22T10:21:00` rather than `2023-08-22T10:21:00Z`).", alias="date") + description: Optional[str] = Field(default=None, description="Description of the bank transaction.") + counterparty: Optional[str] = Field(default=None, description="The giving or receiving party such as a person or organization.") + reference: Optional[str] = Field(default=None, description="An optional reference to the bank transaction.") + reconciled: Optional[bool] = Field(default=None, description="`True` if the bank transaction has been [reconciled](https://www.xero.com/uk/guides/what-is-bank-reconciliation/) in the accounting software.") + amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The amount transacted in the bank transaction.") + balance: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The remaining balance in the account with ID `accountId`. This field is optional for QuickBooks Online but is required for Xero, Sage, NetSuite, Exact, and FreeAgent.") + transaction_type: Optional[BankTransactionType] = Field(default=None, description="Type of transaction for the bank statement line.", alias="transactionType") + __properties: ClassVar[List[str]] = ["id", "date", "description", "counterparty", "reference", "reconciled", "amount", "balance", "transactionType"] + + @field_validator('transaction_type') + def transaction_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['Unknown', 'Credit', 'Debit', 'Int', 'Div', 'Fee', 'SerChg', 'Dep', 'Atm', 'Pos', 'Xfer', 'Check', 'Payment', 'Cash', 'DirectDep', 'DirectDebit', 'RepeatPmt', 'Other']): + raise ValueError("must be one of enum values ('Unknown', 'Credit', 'Debit', 'Int', 'Div', 'Fee', 'SerChg', 'Dep', 'Atm', 'Pos', 'Xfer', 'Check', 'Payment', 'Cash', 'DirectDep', 'DirectDebit', 'RepeatPmt', 'Other')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BankTransaction from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BankTransaction from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "date": obj.get("date"), + "description": obj.get("description"), + "counterparty": obj.get("counterparty"), + "reference": obj.get("reference"), + "reconciled": obj.get("reconciled"), + "amount": obj.get("amount"), + "balance": obj.get("balance"), + "transactionType": obj.get("transactionType") + }) + return _obj + + + + + +class BankTransactionTypedDict(TypedDict): + """TypedDict variant of BankTransaction, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + date_: NotRequired[Optional[str]] + description: NotRequired[Optional[str]] + counterparty: NotRequired[Optional[str]] + reference: NotRequired[Optional[str]] + reconciled: NotRequired[Optional[bool]] + amount: NotRequired[Optional[Decimal]] + balance: NotRequired[Optional[Decimal]] + transaction_type: NotRequired[Optional[BankTransactionType]] diff --git a/bank-feeds/src/codat_bankfeeds/models/bank_transaction_type.py b/bank-feeds/src/codat_bankfeeds/models/bank_transaction_type.py new file mode 100644 index 000000000..4ea7c4827 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/bank_transaction_type.py @@ -0,0 +1,25 @@ +from __future__ import annotations + +from enum import Enum + + +class BankTransactionType(str, Enum): + """BankTransactionType enum (lifted from inline OAS enum).""" + UNKNOWN = 'Unknown' + CREDIT = 'Credit' + DEBIT = 'Debit' + INT = 'Int' + DIV = 'Div' + FEE = 'Fee' + SER_CHG = 'SerChg' + DEP = 'Dep' + ATM = 'Atm' + POS = 'Pos' + XFER = 'Xfer' + CHECK = 'Check' + PAYMENT = 'Payment' + CASH = 'Cash' + DIRECT_DEP = 'DirectDep' + DIRECT_DEBIT = 'DirectDebit' + REPEAT_PMT = 'RepeatPmt' + OTHER = 'Other' diff --git a/bank-feeds/src/codat_bankfeeds/models/company_details.py b/bank-feeds/src/codat_bankfeeds/models/company_details.py new file mode 100644 index 000000000..6e4b9781c --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/company_details.py @@ -0,0 +1,141 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict +from codat_bankfeeds.models.shared.companyreference import CompanyReference, CompanyReferenceTypedDict +from typing import Optional, Set +from typing_extensions import Self + +class CompanyDetails(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + """ + CompanyDetails + """ # noqa: E501 + id: str = Field(description="Unique identifier for your SMB in Codat.") + name: str = Field(description="The name of the company") + description: Optional[str] = Field(default=None, description="A description of the property.") + redirect: str = Field(description="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.") + last_sync: Optional[str] = Field(default=None, description="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.", alias="lastSync") + created: Optional[str] = Field(default=None, description="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: Optional[str] = Field(default=None, description="Name of user that created the company in Codat.", alias="createdByUserName") + products: Optional[List[str]] = Field(default=None, description="An array of products that are currently enabled for the company.") + tags: Optional[Dict[str, str]] = Field(default=None, description="A collection of user-defined key-value pairs that store custom metadata against the company.") + reference_parent_company: Optional[CompanyReference] = Field(default=None, description="The parent entity or controlling organization of this company. Null if the company has no parent.", alias="referenceParentCompany") + reference_subsidiary_companies: Optional[List[CompanyReference]] = Field(default=None, description="A list of subsidiary companies owned or controlled by this entity. Empty if the company has no children.", alias="referenceSubsidiaryCompanies") + __properties: ClassVar[List[str]] = ["id", "name", "description", "redirect", "lastSync", "created", "createdByUserName", "products", "tags", "referenceParentCompany", "referenceSubsidiaryCompanies"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CompanyDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of reference_parent_company + if self.reference_parent_company: + _dict['referenceParentCompany'] = self.reference_parent_company.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in reference_subsidiary_companies (list) + _items = [] + if self.reference_subsidiary_companies: + for _item_reference_subsidiary_companies in self.reference_subsidiary_companies: + if _item_reference_subsidiary_companies: + _items.append(_item_reference_subsidiary_companies.to_dict()) + _dict['referenceSubsidiaryCompanies'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CompanyDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "description": obj.get("description"), + "redirect": obj.get("redirect"), + "lastSync": obj.get("lastSync"), + "created": obj.get("created"), + "createdByUserName": obj.get("createdByUserName"), + "products": obj.get("products"), + "tags": obj.get("tags"), + "referenceParentCompany": CompanyReference.from_dict(obj["referenceParentCompany"]) if obj.get("referenceParentCompany") is not None else None, + "referenceSubsidiaryCompanies": [CompanyReference.from_dict(_item) for _item in obj["referenceSubsidiaryCompanies"]] if obj.get("referenceSubsidiaryCompanies") is not None else None + }) + return _obj + + + + + +class CompanyDetailsTypedDict(TypedDict): + """TypedDict variant of CompanyDetails, for dict-literal request/response inputs.""" + id: NotRequired[str] + name: NotRequired[str] + description: NotRequired[Optional[str]] + redirect: NotRequired[str] + last_sync: NotRequired[Optional[str]] + created: NotRequired[Optional[str]] + created_by_user_name: NotRequired[Optional[str]] + products: NotRequired[Optional[List[str]]] + tags: NotRequired[Optional[Dict[str, str]]] + reference_parent_company: NotRequired[Optional[CompanyReferenceTypedDict]] + reference_subsidiary_companies: NotRequired[Optional[List[CompanyReferenceTypedDict]]] diff --git a/bank-feeds/src/codat_bankfeeds/models/company_reference_links.py b/bank-feeds/src/codat_bankfeeds/models/company_reference_links.py new file mode 100644 index 000000000..c2494356e --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/company_reference_links.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class CompanyReferenceLinks(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + """ + A collection of links for the company. + """ # noqa: E501 + portal: Optional[str] = Field(default=None, description="Link to the company page in the portal.") + __properties: ClassVar[List[str]] = ["portal"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CompanyReferenceLinks from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CompanyReferenceLinks from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "portal": obj.get("portal") + }) + return _obj + + + + + +class CompanyReferenceLinksTypedDict(TypedDict): + """TypedDict variant of CompanyReferenceLinks, for dict-literal request/response inputs.""" + portal: NotRequired[Optional[str]] diff --git a/bank-feeds/src/codat_bankfeeds/models/create_batch_source_account201_response_inner.py b/bank-feeds/src/codat_bankfeeds/models/create_batch_source_account201_response_inner.py new file mode 100644 index 000000000..eb10e4d59 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/create_batch_source_account201_response_inner.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, ValidationError, field_validator, model_serializer +from typing import Any, List, Optional +from codat_bankfeeds.models.shared.sourceaccountbatchcreateresponse import SourceAccountBatchCreateResponse, SourceAccountBatchCreateResponseTypedDict +from codat_bankfeeds.models.shared.sourceaccountv2batchcreateresponse import SourceAccountV2BatchCreateResponse, SourceAccountV2BatchCreateResponseTypedDict +from pydantic import Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self, NotRequired, TypedDict + +CREATEBATCHSOURCEACCOUNT201RESPONSEINNER_ONE_OF_SCHEMAS = ["SourceAccountBatchCreateResponse", "SourceAccountV2BatchCreateResponse"] + +class CreateBatchSourceAccount201ResponseInner(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + """ + CreateBatchSourceAccount201ResponseInner + """ + # data type: SourceAccountV2BatchCreateResponse + oneof_schema_1_validator: Optional[SourceAccountV2BatchCreateResponse] = None + # data type: SourceAccountBatchCreateResponse + oneof_schema_2_validator: Optional[SourceAccountBatchCreateResponse] = None + actual_instance: Optional[Union[SourceAccountBatchCreateResponse, SourceAccountV2BatchCreateResponse]] = None + one_of_schemas: Set[str] = { "SourceAccountBatchCreateResponse", "SourceAccountV2BatchCreateResponse" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = CreateBatchSourceAccount201ResponseInner.model_construct() + error_messages = [] + match = 0 + # validate data type: SourceAccountV2BatchCreateResponse + if not isinstance(v, SourceAccountV2BatchCreateResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `SourceAccountV2BatchCreateResponse`") + else: + match += 1 + # validate data type: SourceAccountBatchCreateResponse + if not isinstance(v, SourceAccountBatchCreateResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `SourceAccountBatchCreateResponse`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in CreateBatchSourceAccount201ResponseInner with oneOf schemas: SourceAccountBatchCreateResponse, SourceAccountV2BatchCreateResponse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in CreateBatchSourceAccount201ResponseInner with oneOf schemas: SourceAccountBatchCreateResponse, SourceAccountV2BatchCreateResponse. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into SourceAccountV2BatchCreateResponse + try: + instance.actual_instance = SourceAccountV2BatchCreateResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into SourceAccountBatchCreateResponse + try: + instance.actual_instance = SourceAccountBatchCreateResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into CreateBatchSourceAccount201ResponseInner with oneOf schemas: SourceAccountBatchCreateResponse, SourceAccountV2BatchCreateResponse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into CreateBatchSourceAccount201ResponseInner with oneOf schemas: SourceAccountBatchCreateResponse, SourceAccountV2BatchCreateResponse. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], SourceAccountBatchCreateResponse, SourceAccountV2BatchCreateResponse]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + + + + +class CreateBatchSourceAccount201ResponseInnerTypedDict(TypedDict): + """TypedDict variant of CreateBatchSourceAccount201ResponseInner, for dict-literal request/response inputs.""" + oneof_schema_1_validator: NotRequired[Optional[SourceAccountV2BatchCreateResponseTypedDict]] + oneof_schema_2_validator: NotRequired[Optional[SourceAccountBatchCreateResponseTypedDict]] + actual_instance: NotRequired[Optional[Union[SourceAccountBatchCreateResponseTypedDict, SourceAccountV2BatchCreateResponseTypedDict]]] + one_of_schemas: NotRequired[Set[str]] diff --git a/bank-feeds/src/codat_bankfeeds/models/create_batch_source_account207_response_inner.py b/bank-feeds/src/codat_bankfeeds/models/create_batch_source_account207_response_inner.py new file mode 100644 index 000000000..ab73eb6d9 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/create_batch_source_account207_response_inner.py @@ -0,0 +1,167 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, ValidationError, field_validator, model_serializer +from typing import Any, List, Optional +from codat_bankfeeds.models.shared.sourceaccountbatchcreateresponse import SourceAccountBatchCreateResponse, SourceAccountBatchCreateResponseTypedDict +from codat_bankfeeds.models.shared.sourceaccountbatcherrorresponse import SourceAccountBatchErrorResponse, SourceAccountBatchErrorResponseTypedDict +from codat_bankfeeds.models.shared.sourceaccountv2batchcreateresponse import SourceAccountV2BatchCreateResponse, SourceAccountV2BatchCreateResponseTypedDict +from pydantic import Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self, NotRequired, TypedDict + +CREATEBATCHSOURCEACCOUNT207RESPONSEINNER_ONE_OF_SCHEMAS = ["SourceAccountBatchCreateResponse", "SourceAccountBatchErrorResponse", "SourceAccountV2BatchCreateResponse"] + +class CreateBatchSourceAccount207ResponseInner(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + """ + CreateBatchSourceAccount207ResponseInner + """ + # data type: SourceAccountV2BatchCreateResponse + oneof_schema_1_validator: Optional[SourceAccountV2BatchCreateResponse] = None + # data type: SourceAccountBatchCreateResponse + oneof_schema_2_validator: Optional[SourceAccountBatchCreateResponse] = None + # data type: SourceAccountBatchErrorResponse + oneof_schema_3_validator: Optional[SourceAccountBatchErrorResponse] = None + actual_instance: Optional[Union[SourceAccountBatchCreateResponse, SourceAccountBatchErrorResponse, SourceAccountV2BatchCreateResponse]] = None + one_of_schemas: Set[str] = { "SourceAccountBatchCreateResponse", "SourceAccountBatchErrorResponse", "SourceAccountV2BatchCreateResponse" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = CreateBatchSourceAccount207ResponseInner.model_construct() + error_messages = [] + match = 0 + # validate data type: SourceAccountV2BatchCreateResponse + if not isinstance(v, SourceAccountV2BatchCreateResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `SourceAccountV2BatchCreateResponse`") + else: + match += 1 + # validate data type: SourceAccountBatchCreateResponse + if not isinstance(v, SourceAccountBatchCreateResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `SourceAccountBatchCreateResponse`") + else: + match += 1 + # validate data type: SourceAccountBatchErrorResponse + if not isinstance(v, SourceAccountBatchErrorResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `SourceAccountBatchErrorResponse`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in CreateBatchSourceAccount207ResponseInner with oneOf schemas: SourceAccountBatchCreateResponse, SourceAccountBatchErrorResponse, SourceAccountV2BatchCreateResponse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in CreateBatchSourceAccount207ResponseInner with oneOf schemas: SourceAccountBatchCreateResponse, SourceAccountBatchErrorResponse, SourceAccountV2BatchCreateResponse. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into SourceAccountV2BatchCreateResponse + try: + instance.actual_instance = SourceAccountV2BatchCreateResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into SourceAccountBatchCreateResponse + try: + instance.actual_instance = SourceAccountBatchCreateResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into SourceAccountBatchErrorResponse + try: + instance.actual_instance = SourceAccountBatchErrorResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into CreateBatchSourceAccount207ResponseInner with oneOf schemas: SourceAccountBatchCreateResponse, SourceAccountBatchErrorResponse, SourceAccountV2BatchCreateResponse. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into CreateBatchSourceAccount207ResponseInner with oneOf schemas: SourceAccountBatchCreateResponse, SourceAccountBatchErrorResponse, SourceAccountV2BatchCreateResponse. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], SourceAccountBatchCreateResponse, SourceAccountBatchErrorResponse, SourceAccountV2BatchCreateResponse]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + + + + +class CreateBatchSourceAccount207ResponseInnerTypedDict(TypedDict): + """TypedDict variant of CreateBatchSourceAccount207ResponseInner, for dict-literal request/response inputs.""" + oneof_schema_1_validator: NotRequired[Optional[SourceAccountV2BatchCreateResponseTypedDict]] + oneof_schema_2_validator: NotRequired[Optional[SourceAccountBatchCreateResponseTypedDict]] + oneof_schema_3_validator: NotRequired[Optional[SourceAccountBatchErrorResponseTypedDict]] + actual_instance: NotRequired[Optional[Union[SourceAccountBatchCreateResponseTypedDict, SourceAccountBatchErrorResponseTypedDict, SourceAccountV2BatchCreateResponseTypedDict]]] + one_of_schemas: NotRequired[Set[str]] diff --git a/bank-feeds/src/codat_bankfeeds/models/create_batch_source_account_request_body.py b/bank-feeds/src/codat_bankfeeds/models/create_batch_source_account_request_body.py new file mode 100644 index 000000000..ce703fe2b --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/create_batch_source_account_request_body.py @@ -0,0 +1,160 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, ValidationError, field_validator, model_serializer +from typing import Any, List, Optional +from codat_bankfeeds.models.shared.sourceaccountprototype import SourceAccountPrototype, SourceAccountPrototypeTypedDict +from codat_bankfeeds.models.shared.sourceaccountv2prototype import SourceAccountV2Prototype, SourceAccountV2PrototypeTypedDict +from pydantic import Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self, NotRequired, TypedDict + +CREATEBATCHSOURCEACCOUNTREQUESTBODY_ONE_OF_SCHEMAS = ["List[SourceAccountPrototype]", "List[SourceAccountV2Prototype]"] + +class CreateBatchSourceAccountRequestBody(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + """ + CreateBatchSourceAccountRequestBody + """ + # data type: List[SourceAccountV2Prototype] + oneof_schema_1_validator: Optional[List[SourceAccountV2Prototype]] = None + # data type: List[SourceAccountPrototype] + oneof_schema_2_validator: Optional[List[SourceAccountPrototype]] = None + actual_instance: Optional[Union[List[SourceAccountPrototype], List[SourceAccountV2Prototype]]] = None + one_of_schemas: Set[str] = { "List[SourceAccountPrototype]", "List[SourceAccountV2Prototype]" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = CreateBatchSourceAccountRequestBody.model_construct() + error_messages = [] + match = 0 + # validate data type: List[SourceAccountV2Prototype] + try: + instance.oneof_schema_1_validator = v + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # validate data type: List[SourceAccountPrototype] + try: + instance.oneof_schema_2_validator = v + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in CreateBatchSourceAccountRequestBody with oneOf schemas: List[SourceAccountPrototype], List[SourceAccountV2Prototype]. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in CreateBatchSourceAccountRequestBody with oneOf schemas: List[SourceAccountPrototype], List[SourceAccountV2Prototype]. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into List[SourceAccountV2Prototype] + try: + # validation + instance.oneof_schema_1_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.oneof_schema_1_validator + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into List[SourceAccountPrototype] + try: + # validation + instance.oneof_schema_2_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.oneof_schema_2_validator + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into CreateBatchSourceAccountRequestBody with oneOf schemas: List[SourceAccountPrototype], List[SourceAccountV2Prototype]. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into CreateBatchSourceAccountRequestBody with oneOf schemas: List[SourceAccountPrototype], List[SourceAccountV2Prototype]. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], List[SourceAccountPrototype], List[SourceAccountV2Prototype]]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + + + + +class CreateBatchSourceAccountRequestBodyTypedDict(TypedDict): + """TypedDict variant of CreateBatchSourceAccountRequestBody, for dict-literal request/response inputs.""" + oneof_schema_1_validator: NotRequired[Optional[List[SourceAccountV2PrototypeTypedDict]]] + oneof_schema_2_validator: NotRequired[Optional[List[SourceAccountPrototypeTypedDict]]] + actual_instance: NotRequired[Optional[Union[List[SourceAccountPrototypeTypedDict], List[SourceAccountV2PrototypeTypedDict]]]] + one_of_schemas: NotRequired[Set[str]] diff --git a/bank-feeds/src/codat_bankfeeds/models/create_connection_request.py b/bank-feeds/src/codat_bankfeeds/models/create_connection_request.py new file mode 100644 index 000000000..4609bcae2 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/create_connection_request.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, field_validator, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict +from typing import Optional, Set +from typing_extensions import Self + +class CreateConnectionRequest(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + """ + CreateConnectionRequest + """ # noqa: E501 + platform_key: Optional[str] = Field(default=None, description="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.", alias="platformKey") + __properties: ClassVar[List[str]] = ["platformKey"] + + @field_validator('platform_key') + def platform_key_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"[a-z]{4}", value): + raise ValueError(r"must validate the regular expression /[a-z]{4}/") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CreateConnectionRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreateConnectionRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "platformKey": obj.get("platformKey") + }) + return _obj + + + + + +class CreateConnectionRequestTypedDict(TypedDict): + """TypedDict variant of CreateConnectionRequest, for dict-literal request/response inputs.""" + platform_key: NotRequired[Optional[str]] diff --git a/bank-feeds/src/codat_bankfeeds/models/create_source_account200_response.py b/bank-feeds/src/codat_bankfeeds/models/create_source_account200_response.py new file mode 100644 index 000000000..e39543fb0 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/create_source_account200_response.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, ValidationError, field_validator, model_serializer +from typing import Any, List, Optional +from codat_bankfeeds.models.shared.sourceaccount import SourceAccount, SourceAccountTypedDict +from codat_bankfeeds.models.source_account_v2 import SourceAccountV2, SourceAccountV2TypedDict +from pydantic import Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self, NotRequired, TypedDict + +CREATESOURCEACCOUNT200RESPONSE_ONE_OF_SCHEMAS = ["SourceAccount", "SourceAccountV2"] + +class CreateSourceAccount200Response(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + """ + CreateSourceAccount200Response + """ + # data type: SourceAccountV2 + oneof_schema_1_validator: Optional[SourceAccountV2] = None + # data type: SourceAccount + oneof_schema_2_validator: Optional[SourceAccount] = None + actual_instance: Optional[Union[SourceAccount, SourceAccountV2]] = None + one_of_schemas: Set[str] = { "SourceAccount", "SourceAccountV2" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = CreateSourceAccount200Response.model_construct() + error_messages = [] + match = 0 + # validate data type: SourceAccountV2 + if not isinstance(v, SourceAccountV2): + error_messages.append(f"Error! Input type `{type(v)}` is not `SourceAccountV2`") + else: + match += 1 + # validate data type: SourceAccount + if not isinstance(v, SourceAccount): + error_messages.append(f"Error! Input type `{type(v)}` is not `SourceAccount`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in CreateSourceAccount200Response with oneOf schemas: SourceAccount, SourceAccountV2. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in CreateSourceAccount200Response with oneOf schemas: SourceAccount, SourceAccountV2. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into SourceAccountV2 + try: + instance.actual_instance = SourceAccountV2.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into SourceAccount + try: + instance.actual_instance = SourceAccount.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into CreateSourceAccount200Response with oneOf schemas: SourceAccount, SourceAccountV2. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into CreateSourceAccount200Response with oneOf schemas: SourceAccount, SourceAccountV2. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], SourceAccount, SourceAccountV2]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + + + + +class CreateSourceAccount200ResponseTypedDict(TypedDict): + """TypedDict variant of CreateSourceAccount200Response, for dict-literal request/response inputs.""" + oneof_schema_1_validator: NotRequired[Optional[SourceAccountV2TypedDict]] + oneof_schema_2_validator: NotRequired[Optional[SourceAccountTypedDict]] + actual_instance: NotRequired[Optional[Union[SourceAccountTypedDict, SourceAccountV2TypedDict]]] + one_of_schemas: NotRequired[Set[str]] diff --git a/bank-feeds/src/codat_bankfeeds/models/create_source_account_request.py b/bank-feeds/src/codat_bankfeeds/models/create_source_account_request.py new file mode 100644 index 000000000..cbbd3ed6c --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/create_source_account_request.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, ValidationError, field_validator, model_serializer +from typing import Any, List, Optional +from codat_bankfeeds.models.shared.sourceaccountprototype import SourceAccountPrototype, SourceAccountPrototypeTypedDict +from codat_bankfeeds.models.shared.sourceaccountv2prototype import SourceAccountV2Prototype, SourceAccountV2PrototypeTypedDict +from pydantic import Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self, NotRequired, TypedDict + +CREATESOURCEACCOUNTREQUEST_ONE_OF_SCHEMAS = ["SourceAccountPrototype", "SourceAccountV2Prototype"] + +class CreateSourceAccountRequest(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + """ + CreateSourceAccountRequest + """ + # data type: SourceAccountV2Prototype + oneof_schema_1_validator: Optional[SourceAccountV2Prototype] = None + # data type: SourceAccountPrototype + oneof_schema_2_validator: Optional[SourceAccountPrototype] = None + actual_instance: Optional[Union[SourceAccountPrototype, SourceAccountV2Prototype]] = None + one_of_schemas: Set[str] = { "SourceAccountPrototype", "SourceAccountV2Prototype" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = CreateSourceAccountRequest.model_construct() + error_messages = [] + match = 0 + # validate data type: SourceAccountV2Prototype + if not isinstance(v, SourceAccountV2Prototype): + error_messages.append(f"Error! Input type `{type(v)}` is not `SourceAccountV2Prototype`") + else: + match += 1 + # validate data type: SourceAccountPrototype + if not isinstance(v, SourceAccountPrototype): + error_messages.append(f"Error! Input type `{type(v)}` is not `SourceAccountPrototype`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in CreateSourceAccountRequest with oneOf schemas: SourceAccountPrototype, SourceAccountV2Prototype. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in CreateSourceAccountRequest with oneOf schemas: SourceAccountPrototype, SourceAccountV2Prototype. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into SourceAccountV2Prototype + try: + instance.actual_instance = SourceAccountV2Prototype.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into SourceAccountPrototype + try: + instance.actual_instance = SourceAccountPrototype.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into CreateSourceAccountRequest with oneOf schemas: SourceAccountPrototype, SourceAccountV2Prototype. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into CreateSourceAccountRequest with oneOf schemas: SourceAccountPrototype, SourceAccountV2Prototype. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], SourceAccountPrototype, SourceAccountV2Prototype]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + + + + +class CreateSourceAccountRequestTypedDict(TypedDict): + """TypedDict variant of CreateSourceAccountRequest, for dict-literal request/response inputs.""" + oneof_schema_1_validator: NotRequired[Optional[SourceAccountV2PrototypeTypedDict]] + oneof_schema_2_validator: NotRequired[Optional[SourceAccountPrototypeTypedDict]] + actual_instance: NotRequired[Optional[Union[SourceAccountPrototypeTypedDict, SourceAccountV2PrototypeTypedDict]]] + one_of_schemas: NotRequired[Set[str]] diff --git a/bank-feeds/src/codat_bankfeeds/models/dataset_status.py b/bank-feeds/src/codat_bankfeeds/models/dataset_status.py new file mode 100644 index 000000000..2b657c709 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/dataset_status.py @@ -0,0 +1,28 @@ +from __future__ import annotations + +from enum import Enum + + +class DatasetStatus(str, Enum): + """DatasetStatus enum (lifted from inline OAS enum).""" + INITIAL = 'Initial' + QUEUED = 'Queued' + FETCHING = 'Fetching' + MAP_QUEUED = 'MapQueued' + MAPPING = 'Mapping' + COMPLETE = 'Complete' + FETCH_ERROR = 'FetchError' + MAP_ERROR = 'MapError' + INTERNAL_ERROR = 'InternalError' + PROCESSING_QUEUED = 'ProcessingQueued' + PROCESSING = 'Processing' + PROCESSING_ERROR = 'ProcessingError' + VALIDATION_QUEUED = 'ValidationQueued' + VALIDATING = 'Validating' + VALIDATION_ERROR = 'ValidationError' + AUTH_ERROR = 'AuthError' + CANCELLED = 'Cancelled' + NOT_SUPPORTED = 'NotSupported' + RATE_LIMIT_ERROR = 'RateLimitError' + PERMISSIONS_ERROR = 'PermissionsError' + PREREQUISITE_NOT_MET = 'PrerequisiteNotMet' diff --git a/bank-feeds/src/codat_bankfeeds/models/error_message.py b/bank-feeds/src/codat_bankfeeds/models/error_message.py new file mode 100644 index 000000000..17ad91681 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/error_message.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_bankfeeds.models.shared.errorvalidation import ErrorValidation, ErrorValidationTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class ErrorMessage(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + """ + ErrorMessage + """ # noqa: E501 + status_code: Optional[int] = Field(default=None, description="The HTTP status code returned by the error.", alias="statusCode") + service: Optional[str] = Field(default=None, description="Codat's service the returned the error.") + error: Optional[str] = Field(default=None, description="A brief description of the error.") + correlation_id: Optional[str] = Field(default=None, description="Unique identifier used to propagate to all downstream services and determine the source of the error.", alias="correlationId") + validation: Optional[ErrorValidation] = None + can_be_retried: Optional[str] = Field(default=None, description="`True` if the error occurred transiently and can be retried.", alias="canBeRetried") + detailed_error_code: Optional[int] = Field(default=None, description="Machine readable error code used to automate processes based on the code returned.", alias="detailedErrorCode") + __properties: ClassVar[List[str]] = ["statusCode", "service", "error", "correlationId", "validation", "canBeRetried", "detailedErrorCode"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ErrorMessage from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of validation + if self.validation: + _dict['validation'] = self.validation.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ErrorMessage from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "statusCode": obj.get("statusCode"), + "service": obj.get("service"), + "error": obj.get("error"), + "correlationId": obj.get("correlationId"), + "validation": ErrorValidation.from_dict(obj["validation"]) if obj.get("validation") is not None else None, + "canBeRetried": obj.get("canBeRetried"), + "detailedErrorCode": obj.get("detailedErrorCode") + }) + return _obj + + + + + +class ErrorMessageTypedDict(TypedDict): + """TypedDict variant of ErrorMessage, for dict-literal request/response inputs.""" + status_code: NotRequired[Optional[int]] + service: NotRequired[Optional[str]] + error: NotRequired[Optional[str]] + correlation_id: NotRequired[Optional[str]] + validation: NotRequired[Optional[ErrorValidationTypedDict]] + can_be_retried: NotRequired[Optional[str]] + detailed_error_code: NotRequired[Optional[int]] diff --git a/bank-feeds/src/codat_bankfeeds/models/error_status.py b/bank-feeds/src/codat_bankfeeds/models/error_status.py new file mode 100644 index 000000000..ecf0a01b7 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/error_status.py @@ -0,0 +1,9 @@ +from __future__ import annotations + +from enum import Enum + + +class ErrorStatus(str, Enum): + """ErrorStatus enum (lifted from inline OAS enum).""" + ACTIVE = 'Active' + RESOLVED = 'Resolved' diff --git a/bank-feeds/src/codat_bankfeeds/models/errors/__init__.py b/bank-feeds/src/codat_bankfeeds/models/errors/__init__.py index f00964bb7..effc0e3cf 100644 --- a/bank-feeds/src/codat_bankfeeds/models/errors/__init__.py +++ b/bank-feeds/src/codat_bankfeeds/models/errors/__init__.py @@ -1,39 +1,16 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.errors — Speakeasy-shape exception hierarchy.""" from .codatbankfeedserror import CodatBankFeedsError -from typing import Any, TYPE_CHECKING - -from codat_bankfeeds.utils.dynamic_imports import lazy_getattr, lazy_dir - -if TYPE_CHECKING: - from .errormessage import ErrorMessage, ErrorMessageData - from .no_response_error import NoResponseError - from .responsevalidationerror import ResponseValidationError - from .sdkerror import SDKError +from .sdkerror import SDKError +from .errormessage import ErrorMessage, ErrorMessageData +from .no_response_error import NoResponseError +from .responsevalidationerror import ResponseValidationError __all__ = [ "CodatBankFeedsError", + "SDKError", "ErrorMessage", "ErrorMessageData", "NoResponseError", "ResponseValidationError", - "SDKError", ] - -_dynamic_imports: dict[str, str] = { - "ErrorMessage": ".errormessage", - "ErrorMessageData": ".errormessage", - "NoResponseError": ".no_response_error", - "ResponseValidationError": ".responsevalidationerror", - "SDKError": ".sdkerror", -} - - -def __getattr__(attr_name: str) -> Any: - return lazy_getattr( - attr_name, package=__package__, dynamic_imports=_dynamic_imports - ) - - -def __dir__(): - return lazy_dir(dynamic_imports=_dynamic_imports) diff --git a/bank-feeds/src/codat_bankfeeds/models/errors/codatbankfeedserror.py b/bank-feeds/src/codat_bankfeeds/models/errors/codatbankfeedserror.py index 98392b95d..7a4b82702 100644 --- a/bank-feeds/src/codat_bankfeeds/models/errors/codatbankfeedserror.py +++ b/bank-feeds/src/codat_bankfeeds/models/errors/codatbankfeedserror.py @@ -1,30 +1,72 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""Base error class for codat_bankfeeds. -import httpx -from typing import Optional +Generated by pipeline/postprocess_generated.py — do not edit by hand. +""" + +from __future__ import annotations + +from collections.abc import Mapping as _AbcMapping from dataclasses import dataclass, field +from typing import Any, Iterator, Mapping, Optional + + +class CaseInsensitiveHeaders(_AbcMapping): + """Read-only header mapping with case-insensitive lookup, matching the + httpx.Headers a Speakeasy consumer reads. urllib3 hands the POC original-case + keys, so `err.headers["content-type"]` would miss a `Content-Type` header on a + plain dict; here keys are stored lower-cased and lookups are lower-cased too, so + exact-, lower- and mixed-case lookups all match and iteration yields lower-case + keys, exactly as httpx.Headers does.""" + + def __init__(self, data: Optional[Mapping[str, str]] = None) -> None: + self._store = {str(k).lower(): v for k, v in dict(data or {}).items()} + + def __getitem__(self, key: str) -> str: + return self._store[str(key).lower()] + + def __iter__(self) -> Iterator[str]: + return iter(self._store) + + def __len__(self) -> int: + return len(self._store) + + def __repr__(self) -> str: + return f"CaseInsensitiveHeaders({self._store!r})" @dataclass(unsafe_hash=True) class CodatBankFeedsError(Exception): - """The base class for all HTTP error responses.""" + """The base class for all SDK errors.""" message: str - status_code: int - body: str - headers: httpx.Headers = field(hash=False) - raw_response: httpx.Response = field(hash=False) + status_code: int = 0 + body: str = "" + headers: Mapping[str, str] = field(default_factory=dict, hash=False) + raw_response: Optional[Any] = field(default=None, hash=False) def __init__( - self, message: str, raw_response: httpx.Response, body: Optional[str] = None - ): + self, + message: str, + raw_response: Optional[Any] = None, + body: Optional[str] = None, + status_code: Optional[int] = None, + headers: Optional[Mapping[str, str]] = None, + ) -> None: + # `raw_response` is the 2nd positional arg to match Speakeasy + # (`CodatBankFeedsError(message, raw_response, body)`). status_code / body / + # headers are derived from raw_response when not passed explicitly. + if status_code is None: + status_code = getattr(raw_response, "status_code", None) or getattr(raw_response, "status", None) or 0 + if body is None: + body = (getattr(raw_response, "text", "") if raw_response is not None else "") or "" + if headers is None: + headers = getattr(raw_response, "headers", None) object.__setattr__(self, "message", message) - object.__setattr__(self, "status_code", raw_response.status_code) - object.__setattr__( - self, "body", body if body is not None else raw_response.text - ) - object.__setattr__(self, "headers", raw_response.headers) + object.__setattr__(self, "status_code", status_code) + object.__setattr__(self, "body", body or "") + object.__setattr__(self, "headers", CaseInsensitiveHeaders(headers)) object.__setattr__(self, "raw_response", raw_response) + super().__init__(message) - def __str__(self): + def __str__(self) -> str: return self.message diff --git a/bank-feeds/src/codat_bankfeeds/models/errors/errormessage.py b/bank-feeds/src/codat_bankfeeds/models/errors/errormessage.py index 6379daa91..fd4d10d5f 100644 --- a/bank-feeds/src/codat_bankfeeds/models/errors/errormessage.py +++ b/bank-feeds/src/codat_bankfeeds/models/errors/errormessage.py @@ -1,51 +1,41 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""ErrorMessage — typed exception raised for structured Codat API errors. + +Raised when an HTTP response body parses against the ErrorMessage schema +(i.e. Codat-shaped error envelopes with correlationId, statusCode, etc.). +""" from __future__ import annotations -from codat_bankfeeds.models.errors import CodatBankFeedsError -from codat_bankfeeds.models.shared import errorvalidation as shared_errorvalidation -from codat_bankfeeds.types import BaseModel, OptionalNullable, UNSET -from dataclasses import dataclass, field -import httpx -import pydantic -from typing import Optional -from typing_extensions import Annotated - - -class ErrorMessageData(BaseModel): - can_be_retried: Annotated[Optional[str], pydantic.Field(alias="canBeRetried")] = ( - None - ) - r"""`True` if the error occurred transiently and can be retried.""" - 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.""" - 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.""" - error: Optional[str] = None - r"""A brief description of the error.""" - service: Optional[str] = None - r"""Codat's service the returned the error.""" - status_code: Annotated[Optional[int], pydantic.Field(alias="statusCode")] = None - r"""The HTTP status code returned by 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.""" - - -@dataclass(unsafe_hash=True) + +from typing import Any, Mapping, Optional + +from .codatbankfeedserror import CodatBankFeedsError +from codat_bankfeeds.models.error_message import ErrorMessage as ErrorMessageData + + class ErrorMessage(CodatBankFeedsError): - r"""Your `query` parameter was not correctly formed""" + """Typed Codat API error response. Access structured fields via `.data`.""" - data: ErrorMessageData = field(hash=False) + data: ErrorMessageData def __init__( self, data: ErrorMessageData, - raw_response: httpx.Response, + raw_response: Optional[Any] = None, body: Optional[str] = None, - ): - message = body or raw_response.text - super().__init__(message, raw_response, body) - object.__setattr__(self, "data", data) + status_code: Optional[int] = None, + headers: Optional[Mapping[str, str]] = None, + ) -> None: + # `raw_response` is the 2nd positional arg to match Speakeasy + # (`ErrorMessage(data, raw_response, body)`). + message = body or str(data) + super().__init__( + message, + raw_response=raw_response, + body=body, + status_code=status_code, + headers=headers, + ) + self.data = data + + +__all__ = ["ErrorMessage", "ErrorMessageData"] diff --git a/bank-feeds/src/codat_bankfeeds/models/errors/no_response_error.py b/bank-feeds/src/codat_bankfeeds/models/errors/no_response_error.py index 1deab64bc..acea02af8 100644 --- a/bank-feeds/src/codat_bankfeeds/models/errors/no_response_error.py +++ b/bank-feeds/src/codat_bankfeeds/models/errors/no_response_error.py @@ -1,4 +1,6 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""NoResponseError — raised when the HTTP client never receives a response (timeout, dropped connection, DNS failure).""" + +from __future__ import annotations from dataclasses import dataclass @@ -9,9 +11,12 @@ class NoResponseError(Exception): message: str - def __init__(self, message: str = "No response received"): + def __init__(self, message: str = "No response received") -> None: object.__setattr__(self, "message", message) super().__init__(message) - def __str__(self): + def __str__(self) -> str: return self.message + + +__all__ = ["NoResponseError"] diff --git a/bank-feeds/src/codat_bankfeeds/models/errors/responsevalidationerror.py b/bank-feeds/src/codat_bankfeeds/models/errors/responsevalidationerror.py index 158c49443..1508b8d5a 100644 --- a/bank-feeds/src/codat_bankfeeds/models/errors/responsevalidationerror.py +++ b/bank-feeds/src/codat_bankfeeds/models/errors/responsevalidationerror.py @@ -1,27 +1,42 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""ResponseValidationError — raised when a successful HTTP response body cannot be parsed against the expected response model.""" -import httpx -from typing import Optional -from dataclasses import dataclass +from __future__ import annotations -from codat_bankfeeds.models.errors import CodatBankFeedsError +from typing import Any, Mapping, Optional + +from .codatbankfeedserror import CodatBankFeedsError -@dataclass(unsafe_hash=True) class ResponseValidationError(CodatBankFeedsError): - """Error raised when there is a type mismatch between the response data and the expected Pydantic model.""" + """Raised on a pydantic ValidationError when deserialising a Codat response body.""" def __init__( self, message: str, - raw_response: httpx.Response, - cause: Exception, - body: Optional[str] = None, - ): - message = f"{message}: {cause}" - super().__init__(message, raw_response, body) + raw_response: Optional[Any] = None, + cause: Optional[Exception] = None, + body: str = "", + status_code: Optional[int] = None, + headers: Optional[Mapping[str, str]] = None, + ) -> None: + # `raw_response` is the 2nd positional arg, `cause` the 3rd, to match + # Speakeasy (`ResponseValidationError(message, raw_response, cause, body)`). + full_message = f"{message}: {cause}" + super().__init__( + full_message, + raw_response=raw_response, + body=body, + status_code=status_code, + headers=headers, + ) + # Surface the underlying pydantic ValidationError via the standard `__cause__` mechanism + # so callers can do `except errors.ResponseValidationError as e: print(e.cause)`. + self.__cause__ = cause @property - def cause(self): - """Normally the Pydantic ValidationError""" + def cause(self) -> Optional[BaseException]: + """Normally the underlying pydantic ValidationError.""" return self.__cause__ + + +__all__ = ["ResponseValidationError"] diff --git a/bank-feeds/src/codat_bankfeeds/models/errors/sdkerror.py b/bank-feeds/src/codat_bankfeeds/models/errors/sdkerror.py index a126b6d68..54f6b796d 100644 --- a/bank-feeds/src/codat_bankfeeds/models/errors/sdkerror.py +++ b/bank-feeds/src/codat_bankfeeds/models/errors/sdkerror.py @@ -1,40 +1,39 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""SDKError — fallback exception for any HTTP error.""" -import httpx -from typing import Optional -from dataclasses import dataclass +from __future__ import annotations + +from typing import Any, Mapping, Optional + +from .codatbankfeedserror import CodatBankFeedsError -from codat_bankfeeds.models.errors import CodatBankFeedsError MAX_MESSAGE_LEN = 10_000 -@dataclass(unsafe_hash=True) class SDKError(CodatBankFeedsError): """The fallback error class if no more specific error class is matched.""" def __init__( - self, message: str, raw_response: httpx.Response, body: Optional[str] = None - ): - body_display = body or raw_response.text or '""' - + self, + message: str, + raw_response: Optional[Any] = None, + body: Optional[str] = None, + status_code: Optional[int] = None, + headers: Optional[Mapping[str, str]] = None, + ) -> None: + # `raw_response` is the 2nd positional arg to match Speakeasy + # (`SDKError(message, raw_response, body)`); existing consumer code that + # re-raises via `SDKError(msg, response)` then stores the response in + # `raw_response`, not `status_code`. status_code / body are derived from + # raw_response when not passed explicitly. + if status_code is None: + status_code = getattr(raw_response, "status_code", None) or getattr(raw_response, "status", None) or 0 + body_display = body or (getattr(raw_response, "text", "") if raw_response is not None else "") or "" if message: message += ": " - message += f"Status {raw_response.status_code}" - - headers = raw_response.headers - content_type = headers.get("content-type", '""') - if content_type != "application/json": - if " " in content_type: - content_type = f'"{content_type}"' - message += f" Content-Type {content_type}" - - if len(body_display) > MAX_MESSAGE_LEN: - truncated = body_display[:MAX_MESSAGE_LEN] - remaining = len(body_display) - MAX_MESSAGE_LEN - body_display = f"{truncated}...and {remaining} more chars" - - message += f". Body: {body_display}" - message = message.strip() - - super().__init__(message, raw_response, body) + message += f"Status {status_code}" + if body_display: + if len(body_display) > MAX_MESSAGE_LEN: + body_display = body_display[:MAX_MESSAGE_LEN] + f"...and {len(body_display) - MAX_MESSAGE_LEN} more chars" + message += f". Body: {body_display}" + super().__init__(message.strip(), status_code=status_code, body=body or "", headers=headers, raw_response=raw_response) diff --git a/bank-feeds/src/codat_bankfeeds/models/items.py b/bank-feeds/src/codat_bankfeeds/models/items.py new file mode 100644 index 000000000..d08768ae6 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/items.py @@ -0,0 +1,169 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from decimal import Decimal +from codat_bankfeeds.utils.serializers import serialize_decimal, validate_decimal +from codat_bankfeeds.models.items_bank_account_type import ItemsBankAccountType +import pprint +import re # noqa: F401 +import json + +from pydantic import BeforeValidator, PlainSerializer, BaseModel, ConfigDict, Field, field_validator, model_serializer +from typing import Annotated, Any, ClassVar, Dict, List, Optional, Union +from codat_bankfeeds.models.shared.bankaccountstatus import BankAccountStatus +from codat_bankfeeds.models.metadata import Metadata, MetadataTypedDict +from codat_bankfeeds.models.supplemental_data import SupplementalData, SupplementalDataTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class Items(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + """ + > **Accessing Bank Accounts through Banking API** > > This datatype was originally used for accessing bank account data both in accounting integrations and open banking aggregators. > > To view bank account data through the Banking API, please refer to the new [Banking: Account](https://docs.codat.io/bank-feeds-api#/schemas/Account) data type. ## Overview A list of bank accounts associated with a company and a specific data connection. Bank accounts data includes: * The name and ID of the account in the accounting software. * The currency and balance of the account. * The sort code and account number. + """ # noqa: E501 + account_name: Optional[str] = Field(default=None, description="Name of the bank account in the accounting software.", alias="accountName") + account_type: Optional[str] = Field(default=None, description="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.", alias="accountType") + nominal_code: Optional[str] = Field(default=None, description="Code used to identify each nominal account for a business.", alias="nominalCode") + sort_code: Optional[str] = Field(default=None, description="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.", alias="sortCode") + account_number: Optional[str] = Field(default=None, description="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. FreeAgent integrations For Credit accounts, only the last four digits are required. For other types, the field is optional.", alias="accountNumber") + i_ban: Optional[str] = Field(default=None, description="International bank account number of the account. Often used when making or receiving international payments.", alias="iBan") + currency: Optional[str] = Field(default=None, description="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.") + balance: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Balance of the bank account.") + institution: Optional[str] = Field(default=None, description="The institution of the bank account.") + available_balance: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Total available balance of the bank account as reported by the underlying data source. This may take into account overdrafts or pending transactions for example.", alias="availableBalance") + overdraft_limit: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Pre-arranged overdraft limit of the account. The value is always positive. For example, an overdraftLimit of `1000` means that the balance of the account can go down to `-1000`.", alias="overdraftLimit") + status: Optional[BankAccountStatus] = None + id: Optional[str] = Field(default=None, description="Identifier for the account, unique for the company in the accounting software.") + metadata: Optional[Metadata] = None + supplemental_data: Optional[SupplementalData] = Field(default=None, alias="supplementalData") + modified_date: Optional[str] = Field(default=None, description="The date when the record was last fetched from the accounting software, commerce software, or open banking provider and updated in Codat’s data cache. Use it to identify and retrieve records that have changed since your last fetch. For example, filtering `modifiedDate` to today will provide new records updated in Codat today. This date is populated for all data types except for attachments, balance sheets, company information, and profit & loss reports ([read more](https://docs.codat.io/using-the-api/modified-dates#modified-date)). In Codat's data model, dates and times are represented using the ISO 8601 standard.", alias="modifiedDate") + source_modified_date: Optional[str] = Field(default=None, description="The date when a record was last modified in the accounting software, usually by the business or a business process. For example, when payments are made against an invoice. It is not populated ([read more](https://docs.codat.io/using-the-api/modified-dates#source-modified-date)) when: - Pulling attachments - The accounting software does not provide modification dates for a data type - A record has been deleted from the source platform and Codat doesn't have a record of when the deletion occurred - A record has been voided. For certain platforms that soft delete records, `isDeleted` metadata is used to identify void records In Codat's data model, dates and times are represented using the ISO 8601 standard.", alias="sourceModifiedDate") + __properties: ClassVar[List[str]] = ["accountName", "accountType", "nominalCode", "sortCode", "accountNumber", "iBan", "currency", "balance", "institution", "availableBalance", "overdraftLimit", "status", "id", "metadata", "supplementalData", "modifiedDate", "sourceModifiedDate"] + + @field_validator('account_type') + def account_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['Unknown', 'Credit', 'Debit']): + raise ValueError("must be one of enum values ('Unknown', 'Credit', 'Debit')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Items from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + # override the default output from pydantic by calling `to_dict()` of supplemental_data + if self.supplemental_data: + _dict['supplementalData'] = self.supplemental_data.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Items from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "accountName": obj.get("accountName"), + "accountType": obj.get("accountType"), + "nominalCode": obj.get("nominalCode"), + "sortCode": obj.get("sortCode"), + "accountNumber": obj.get("accountNumber"), + "iBan": obj.get("iBan"), + "currency": obj.get("currency"), + "balance": obj.get("balance"), + "institution": obj.get("institution"), + "availableBalance": obj.get("availableBalance"), + "overdraftLimit": obj.get("overdraftLimit"), + "status": obj.get("status"), + "id": obj.get("id"), + "metadata": Metadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "supplementalData": SupplementalData.from_dict(obj["supplementalData"]) if obj.get("supplementalData") is not None else None, + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate") + }) + return _obj + + + + + +class ItemsTypedDict(TypedDict): + """TypedDict variant of Items, for dict-literal request/response inputs.""" + account_name: NotRequired[Optional[str]] + account_type: NotRequired[Optional[str]] + nominal_code: NotRequired[Optional[str]] + sort_code: NotRequired[Optional[str]] + account_number: NotRequired[Optional[str]] + i_ban: NotRequired[Optional[str]] + currency: NotRequired[Optional[str]] + balance: NotRequired[Optional[Decimal]] + institution: NotRequired[Optional[str]] + available_balance: NotRequired[Optional[Decimal]] + overdraft_limit: NotRequired[Optional[Decimal]] + status: NotRequired[Optional[BankAccountStatus]] + id: NotRequired[Optional[str]] + metadata: NotRequired[Optional[MetadataTypedDict]] + supplemental_data: NotRequired[Optional[SupplementalDataTypedDict]] + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] diff --git a/bank-feeds/src/codat_bankfeeds/models/items_bank_account_type.py b/bank-feeds/src/codat_bankfeeds/models/items_bank_account_type.py new file mode 100644 index 000000000..c41c23cab --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/items_bank_account_type.py @@ -0,0 +1,10 @@ +from __future__ import annotations + +from enum import Enum + + +class ItemsBankAccountType(str, Enum): + """ItemsBankAccountType enum (lifted from inline OAS enum).""" + UNKNOWN = 'Unknown' + CREDIT = 'Credit' + DEBIT = 'Debit' diff --git a/bank-feeds/src/codat_bankfeeds/models/list_source_accounts200_response.py b/bank-feeds/src/codat_bankfeeds/models/list_source_accounts200_response.py new file mode 100644 index 000000000..7c3be6054 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/list_source_accounts200_response.py @@ -0,0 +1,43 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, ValidationError, field_validator, model_serializer +from typing import Any, List, Optional +from codat_bankfeeds.models.shared.sourceaccount import SourceAccount, SourceAccountTypedDict +from pydantic import Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self, NotRequired, TypedDict + +LISTSOURCEACCOUNTS200RESPONSE_ONE_OF_SCHEMAS = ["List[SourceAccount]"] + +# Collapsed by postprocess: degenerate oneOf branch — OAG emitted a oneOf wrapper for what the OAS +# specifies as a single `List[SourceAccount]` schema. Speakeasy types it as the +# bare underlying type. See collapse_identical_oneof_wrappers in +# pipeline/postprocess_generated.py. +ListSourceAccounts200Response = List[SourceAccount] + + + + + +class ListSourceAccounts200ResponseTypedDict(TypedDict): + """TypedDict variant of ListSourceAccounts200Response, for dict-literal request/response inputs.""" + oneof_schema_1_validator: NotRequired[Optional[List[SourceAccountTypedDict]]] + oneof_schema_2_validator: NotRequired[Optional[List[SourceAccountTypedDict]]] + actual_instance: NotRequired[Optional[Union[List[SourceAccountTypedDict]]]] + one_of_schemas: NotRequired[Set[str]] diff --git a/bank-feeds/src/codat_bankfeeds/models/metadata.py b/bank-feeds/src/codat_bankfeeds/models/metadata.py new file mode 100644 index 000000000..04c11469d --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/metadata.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL +class Metadata(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'isDeleted', 'is_deleted'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + Metadata + """ # noqa: E501 + is_deleted: OptionalNullable[bool] = Field(default=UNSET, description="Indicates whether the record has been deleted in the third-party system this record originated from.", alias="isDeleted") + __properties: ClassVar[List[str]] = ["isDeleted"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Metadata from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Metadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "isDeleted": obj.get("isDeleted") + }) + return _obj + + + + + +class MetadataTypedDict(TypedDict): + """TypedDict variant of Metadata, for dict-literal request/response inputs.""" + is_deleted: NotRequired[Optional[bool]] diff --git a/bank-feeds/src/codat_bankfeeds/models/model1.py b/bank-feeds/src/codat_bankfeeds/models/model1.py new file mode 100644 index 000000000..a511aac79 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/model1.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated, NotRequired, TypedDict +from codat_bankfeeds.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self + +class Model1(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + """ + Model1 + """ # noqa: E501 + page_number: int = Field(description="Current page number.", alias="pageNumber") + page_size: int = Field(description="Number of items to return in results array.", alias="pageSize") + total_results: int = Field(description="Total number of items.", alias="totalResults") + links: Links = Field(alias="_links") + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Model1 from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of links + if self.links: + _dict['_links'] = self.links.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Model1 from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "pageNumber": obj.get("pageNumber"), + "pageSize": obj.get("pageSize"), + "totalResults": obj.get("totalResults"), + "_links": Links.from_dict(obj["_links"]) if obj.get("_links") is not None else None + }) + return _obj + + + + + +class Model1TypedDict(TypedDict): + """TypedDict variant of Model1, for dict-literal request/response inputs.""" + page_number: NotRequired[int] + page_size: NotRequired[int] + total_results: NotRequired[int] + links: NotRequired[LinksTypedDict] diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/__init__.py b/bank-feeds/src/codat_bankfeeds/models/operations/__init__.py index 679ef499b..4824f5a36 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/__init__.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/__init__.py @@ -1,312 +1,110 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations — re-exports of per-operation request envelopes.""" -from typing import Any, TYPE_CHECKING +from codat_bankfeeds.api.account_mapping import ( + CreateBankAccountMappingRequest, + CreateBankAccountMappingRequestTypedDict, + GetBankAccountMappingRequest, + GetBankAccountMappingRequestTypedDict, +) +from codat_bankfeeds.api.bank_accounts import ( + CreateBankAccountRequest, + CreateBankAccountRequestTypedDict, + GetCreateBankAccountsModelRequest, + GetCreateBankAccountsModelRequestTypedDict, + ListBankAccountsRequest, + ListBankAccountsRequestTypedDict, +) +from codat_bankfeeds.api.companies import ( + CreateCompanyRequest, + CreateCompanyRequestTypedDict, + DeleteCompanyRequest, + DeleteCompanyRequestTypedDict, + GetCompanyAccessTokenRequest, + GetCompanyAccessTokenRequestTypedDict, + GetCompanyRequest, + GetCompanyRequestTypedDict, + ListCompaniesRequest, + ListCompaniesRequestTypedDict, + ReplaceCompanyRequest, + ReplaceCompanyRequestTypedDict, + UpdateCompanyRequest, + UpdateCompanyRequestTypedDict, +) +from codat_bankfeeds.api.company_information import ( + GetCompanyInformationRequest, + GetCompanyInformationRequestTypedDict, +) +from codat_bankfeeds.api.connections import ( + CreateConnectionRequest, + CreateConnectionRequestTypedDict, + DeleteConnectionRequest, + DeleteConnectionRequestTypedDict, + GetConnectionRequest, + GetConnectionRequestTypedDict, + ListConnectionsRequest, + ListConnectionsRequestTypedDict, + UnlinkConnectionRequest, + UnlinkConnectionRequestTypedDict, +) +from codat_bankfeeds.api.managed_bank_feeds import ( + GetLatestManagedBankFeedSyncRequest, + GetLatestManagedBankFeedSyncRequestTypedDict, + GetManagedBankFeedSyncRequest, + GetManagedBankFeedSyncRequestTypedDict, + RunManagedBankFeedAdHocSyncRequest, + RunManagedBankFeedAdHocSyncRequestTypedDict, +) +from codat_bankfeeds.api.source_accounts import ( + CreateBatchSourceAccountRequest, + CreateBatchSourceAccountRequestTypedDict, + CreateSourceAccountRequest, + CreateSourceAccountRequestTypedDict, + DeleteBankFeedCredentialsRequest, + DeleteBankFeedCredentialsRequestTypedDict, + DeleteSourceAccountRequest, + DeleteSourceAccountRequestTypedDict, + GenerateCredentialsRequest, + GenerateCredentialsRequestTypedDict, + GenerateOtpRequest, + GenerateOtpRequestTypedDict, + ListSourceAccountsRequest, + ListSourceAccountsRequestTypedDict, + UpdateSourceAccountRequest, + UpdateSourceAccountRequestTypedDict, +) +from codat_bankfeeds.api.transactions import ( + CreateBankTransactionsRequest, + CreateBankTransactionsRequestTypedDict, + GetCreateBankTransactionsModelRequest, + GetCreateBankTransactionsModelRequestTypedDict, + GetCreateOperationRequest, + GetCreateOperationRequestTypedDict, + ListCreateOperationsRequest, + ListCreateOperationsRequestTypedDict, +) -from codat_bankfeeds.utils.dynamic_imports import lazy_getattr, lazy_dir +# Speakeasy request-body class names (aliases to POC body classes). +from codat_bankfeeds.models.create_batch_source_account_request_body import CreateBatchSourceAccountRequestBody as CreateBatchSourceAccountCreateBatchSourceAccountRequestBody +from codat_bankfeeds.models.create_connection_request import CreateConnectionRequest as CreateConnectionRequestBody +from codat_bankfeeds.models.update_connection import UpdateConnection as UnlinkConnectionUpdateConnection -if TYPE_CHECKING: - from .create_bank_account import ( - CreateBankAccountRequest, - CreateBankAccountRequestTypedDict, - ) - from .create_bank_account_mapping import ( - CreateBankAccountMappingRequest, - CreateBankAccountMappingRequestTypedDict, - ) - from .create_bank_transactions import ( - CreateBankTransactionsRequest, - CreateBankTransactionsRequestTypedDict, - ) - from .create_batch_source_account import ( - CreateBatchSourceAccountRequest, - CreateBatchSourceAccountRequestBody, - CreateBatchSourceAccountRequestBodyTypedDict, - CreateBatchSourceAccountRequestTypedDict, - CreateBatchSourceAccountResponse, - CreateBatchSourceAccountResponseBody, - CreateBatchSourceAccountResponseBodyTypedDict, - CreateBatchSourceAccountResponseTypedDict, - ResponseBody, - ResponseBodyTypedDict, - ) - from .create_connection import ( - CreateConnectionRequest, - CreateConnectionRequestBody, - CreateConnectionRequestBodyTypedDict, - CreateConnectionRequestTypedDict, - ) - from .create_source_account import ( - CreateSourceAccountRequest, - CreateSourceAccountRequestBody, - CreateSourceAccountRequestBodyTypedDict, - CreateSourceAccountRequestTypedDict, - CreateSourceAccountResponseBody, - CreateSourceAccountResponseBodyTypedDict, - ) - from .delete_bank_feed_credentials import ( - DeleteBankFeedCredentialsRequest, - DeleteBankFeedCredentialsRequestTypedDict, - ) - from .delete_company import DeleteCompanyRequest, DeleteCompanyRequestTypedDict - from .delete_connection import ( - DeleteConnectionRequest, - DeleteConnectionRequestTypedDict, - ) - from .delete_source_account import ( - DeleteSourceAccountRequest, - DeleteSourceAccountRequestTypedDict, - ) - from .generate_credentials import ( - GenerateCredentialsRequest, - GenerateCredentialsRequestTypedDict, - ) - from .generate_otp import GenerateOtpRequest, GenerateOtpRequestTypedDict - from .get_bank_account_mapping import ( - GetBankAccountMappingRequest, - GetBankAccountMappingRequestTypedDict, - ) - from .get_company import GetCompanyRequest, GetCompanyRequestTypedDict - from .get_company_access_token import ( - GetCompanyAccessTokenRequest, - GetCompanyAccessTokenRequestTypedDict, - ) - from .get_company_information import ( - GetCompanyInformationRequest, - GetCompanyInformationRequestTypedDict, - ) - from .get_connection import GetConnectionRequest, GetConnectionRequestTypedDict - from .get_create_bank_transactions_model import ( - GetCreateBankTransactionsModelRequest, - GetCreateBankTransactionsModelRequestTypedDict, - ) - from .get_create_bankaccounts_model import ( - GetCreateBankAccountsModelRequest, - GetCreateBankAccountsModelRequestTypedDict, - ) - from .get_create_operation import ( - GetCreateOperationRequest, - GetCreateOperationRequestTypedDict, - ) - from .get_latest_managed_bank_feed_sync import ( - GetLatestManagedBankFeedSyncRequest, - GetLatestManagedBankFeedSyncRequestTypedDict, - ) - from .get_managed_bank_feed_sync import ( - GetManagedBankFeedSyncRequest, - GetManagedBankFeedSyncRequestTypedDict, - ) - from .list_bank_accounts import ( - ListBankAccountsRequest, - ListBankAccountsRequestTypedDict, - ) - from .list_companies import ListCompaniesRequest, ListCompaniesRequestTypedDict - from .list_connections import ( - ListConnectionsRequest, - ListConnectionsRequestTypedDict, - ) - from .list_create_operations import ( - ListCreateOperationsRequest, - ListCreateOperationsRequestTypedDict, - ) - from .list_source_accounts import ( - ListSourceAccountsRequest, - ListSourceAccountsRequestTypedDict, - ListSourceAccountsResponseBody, - ListSourceAccountsResponseBodyTypedDict, - ) - from .replace_company import ReplaceCompanyRequest, ReplaceCompanyRequestTypedDict - from .run_managed_bank_feed_ad_hoc_sync import ( - RunManagedBankFeedAdHocSyncRequest, - RunManagedBankFeedAdHocSyncRequestTypedDict, - ) - from .unlink_connection import ( - UnlinkConnectionRequest, - UnlinkConnectionRequestTypedDict, - UnlinkConnectionUpdateConnection, - UnlinkConnectionUpdateConnectionTypedDict, - ) - from .update_company import UpdateCompanyRequest, UpdateCompanyRequestTypedDict - from .update_source_account import ( - UpdateSourceAccountRequest, - UpdateSourceAccountRequestTypedDict, - ) +# Speakeasy operations names POC defines elsewhere (response bodies, op-param enums). +from codat_bankfeeds.models.operations.create_batch_source_account_request_body import CreateBatchSourceAccountRequestBody +from codat_bankfeeds.models.operations.create_batch_source_account_request_body_typed_dict import CreateBatchSourceAccountRequestBodyTypedDict +from codat_bankfeeds.models.operations.create_batch_source_account_response_body import CreateBatchSourceAccountResponseBody +from codat_bankfeeds.models.operations.create_batch_source_account_response_body_typed_dict import CreateBatchSourceAccountResponseBodyTypedDict +from codat_bankfeeds.models.operations.create_source_account_request_body import CreateSourceAccountRequestBody +from codat_bankfeeds.models.operations.create_source_account_request_body_typed_dict import CreateSourceAccountRequestBodyTypedDict +from codat_bankfeeds.models.operations.create_source_account_response_body import CreateSourceAccountResponseBody +from codat_bankfeeds.models.operations.create_source_account_response_body_typed_dict import CreateSourceAccountResponseBodyTypedDict +from codat_bankfeeds.models.operations.list_source_accounts_response_body import ListSourceAccountsResponseBody +from codat_bankfeeds.models.operations.list_source_accounts_response_body_typed_dict import ListSourceAccountsResponseBodyTypedDict +from codat_bankfeeds.models.operations.response_body import ResponseBody +from codat_bankfeeds.models.operations.response_body_typed_dict import ResponseBodyTypedDict +from codat_bankfeeds.models.operations.create_batch_source_account_response import CreateBatchSourceAccountResponse +from codat_bankfeeds.models.operations.create_batch_source_account_response_typed_dict import CreateBatchSourceAccountResponseTypedDict -__all__ = [ - "CreateBankAccountMappingRequest", - "CreateBankAccountMappingRequestTypedDict", - "CreateBankAccountRequest", - "CreateBankAccountRequestTypedDict", - "CreateBankTransactionsRequest", - "CreateBankTransactionsRequestTypedDict", - "CreateBatchSourceAccountRequest", - "CreateBatchSourceAccountRequestBody", - "CreateBatchSourceAccountRequestBodyTypedDict", - "CreateBatchSourceAccountRequestTypedDict", - "CreateBatchSourceAccountResponse", - "CreateBatchSourceAccountResponseBody", - "CreateBatchSourceAccountResponseBodyTypedDict", - "CreateBatchSourceAccountResponseTypedDict", - "CreateConnectionRequest", - "CreateConnectionRequestBody", - "CreateConnectionRequestBodyTypedDict", - "CreateConnectionRequestTypedDict", - "CreateSourceAccountRequest", - "CreateSourceAccountRequestBody", - "CreateSourceAccountRequestBodyTypedDict", - "CreateSourceAccountRequestTypedDict", - "CreateSourceAccountResponseBody", - "CreateSourceAccountResponseBodyTypedDict", - "DeleteBankFeedCredentialsRequest", - "DeleteBankFeedCredentialsRequestTypedDict", - "DeleteCompanyRequest", - "DeleteCompanyRequestTypedDict", - "DeleteConnectionRequest", - "DeleteConnectionRequestTypedDict", - "DeleteSourceAccountRequest", - "DeleteSourceAccountRequestTypedDict", - "GenerateCredentialsRequest", - "GenerateCredentialsRequestTypedDict", - "GenerateOtpRequest", - "GenerateOtpRequestTypedDict", - "GetBankAccountMappingRequest", - "GetBankAccountMappingRequestTypedDict", - "GetCompanyAccessTokenRequest", - "GetCompanyAccessTokenRequestTypedDict", - "GetCompanyInformationRequest", - "GetCompanyInformationRequestTypedDict", - "GetCompanyRequest", - "GetCompanyRequestTypedDict", - "GetConnectionRequest", - "GetConnectionRequestTypedDict", - "GetCreateBankAccountsModelRequest", - "GetCreateBankAccountsModelRequestTypedDict", - "GetCreateBankTransactionsModelRequest", - "GetCreateBankTransactionsModelRequestTypedDict", - "GetCreateOperationRequest", - "GetCreateOperationRequestTypedDict", - "GetLatestManagedBankFeedSyncRequest", - "GetLatestManagedBankFeedSyncRequestTypedDict", - "GetManagedBankFeedSyncRequest", - "GetManagedBankFeedSyncRequestTypedDict", - "ListBankAccountsRequest", - "ListBankAccountsRequestTypedDict", - "ListCompaniesRequest", - "ListCompaniesRequestTypedDict", - "ListConnectionsRequest", - "ListConnectionsRequestTypedDict", - "ListCreateOperationsRequest", - "ListCreateOperationsRequestTypedDict", - "ListSourceAccountsRequest", - "ListSourceAccountsRequestTypedDict", - "ListSourceAccountsResponseBody", - "ListSourceAccountsResponseBodyTypedDict", - "ReplaceCompanyRequest", - "ReplaceCompanyRequestTypedDict", - "ResponseBody", - "ResponseBodyTypedDict", - "RunManagedBankFeedAdHocSyncRequest", - "RunManagedBankFeedAdHocSyncRequestTypedDict", - "UnlinkConnectionRequest", - "UnlinkConnectionRequestTypedDict", - "UnlinkConnectionUpdateConnection", - "UnlinkConnectionUpdateConnectionTypedDict", - "UpdateCompanyRequest", - "UpdateCompanyRequestTypedDict", - "UpdateSourceAccountRequest", - "UpdateSourceAccountRequestTypedDict", -] - -_dynamic_imports: dict[str, str] = { - "CreateBankAccountRequest": ".create_bank_account", - "CreateBankAccountRequestTypedDict": ".create_bank_account", - "CreateBankAccountMappingRequest": ".create_bank_account_mapping", - "CreateBankAccountMappingRequestTypedDict": ".create_bank_account_mapping", - "CreateBankTransactionsRequest": ".create_bank_transactions", - "CreateBankTransactionsRequestTypedDict": ".create_bank_transactions", - "CreateBatchSourceAccountRequest": ".create_batch_source_account", - "CreateBatchSourceAccountRequestBody": ".create_batch_source_account", - "CreateBatchSourceAccountRequestBodyTypedDict": ".create_batch_source_account", - "CreateBatchSourceAccountRequestTypedDict": ".create_batch_source_account", - "CreateBatchSourceAccountResponse": ".create_batch_source_account", - "CreateBatchSourceAccountResponseBody": ".create_batch_source_account", - "CreateBatchSourceAccountResponseBodyTypedDict": ".create_batch_source_account", - "CreateBatchSourceAccountResponseTypedDict": ".create_batch_source_account", - "ResponseBody": ".create_batch_source_account", - "ResponseBodyTypedDict": ".create_batch_source_account", - "CreateConnectionRequest": ".create_connection", - "CreateConnectionRequestBody": ".create_connection", - "CreateConnectionRequestBodyTypedDict": ".create_connection", - "CreateConnectionRequestTypedDict": ".create_connection", - "CreateSourceAccountRequest": ".create_source_account", - "CreateSourceAccountRequestBody": ".create_source_account", - "CreateSourceAccountRequestBodyTypedDict": ".create_source_account", - "CreateSourceAccountRequestTypedDict": ".create_source_account", - "CreateSourceAccountResponseBody": ".create_source_account", - "CreateSourceAccountResponseBodyTypedDict": ".create_source_account", - "DeleteBankFeedCredentialsRequest": ".delete_bank_feed_credentials", - "DeleteBankFeedCredentialsRequestTypedDict": ".delete_bank_feed_credentials", - "DeleteCompanyRequest": ".delete_company", - "DeleteCompanyRequestTypedDict": ".delete_company", - "DeleteConnectionRequest": ".delete_connection", - "DeleteConnectionRequestTypedDict": ".delete_connection", - "DeleteSourceAccountRequest": ".delete_source_account", - "DeleteSourceAccountRequestTypedDict": ".delete_source_account", - "GenerateCredentialsRequest": ".generate_credentials", - "GenerateCredentialsRequestTypedDict": ".generate_credentials", - "GenerateOtpRequest": ".generate_otp", - "GenerateOtpRequestTypedDict": ".generate_otp", - "GetBankAccountMappingRequest": ".get_bank_account_mapping", - "GetBankAccountMappingRequestTypedDict": ".get_bank_account_mapping", - "GetCompanyRequest": ".get_company", - "GetCompanyRequestTypedDict": ".get_company", - "GetCompanyAccessTokenRequest": ".get_company_access_token", - "GetCompanyAccessTokenRequestTypedDict": ".get_company_access_token", - "GetCompanyInformationRequest": ".get_company_information", - "GetCompanyInformationRequestTypedDict": ".get_company_information", - "GetConnectionRequest": ".get_connection", - "GetConnectionRequestTypedDict": ".get_connection", - "GetCreateBankTransactionsModelRequest": ".get_create_bank_transactions_model", - "GetCreateBankTransactionsModelRequestTypedDict": ".get_create_bank_transactions_model", - "GetCreateBankAccountsModelRequest": ".get_create_bankaccounts_model", - "GetCreateBankAccountsModelRequestTypedDict": ".get_create_bankaccounts_model", - "GetCreateOperationRequest": ".get_create_operation", - "GetCreateOperationRequestTypedDict": ".get_create_operation", - "GetLatestManagedBankFeedSyncRequest": ".get_latest_managed_bank_feed_sync", - "GetLatestManagedBankFeedSyncRequestTypedDict": ".get_latest_managed_bank_feed_sync", - "GetManagedBankFeedSyncRequest": ".get_managed_bank_feed_sync", - "GetManagedBankFeedSyncRequestTypedDict": ".get_managed_bank_feed_sync", - "ListBankAccountsRequest": ".list_bank_accounts", - "ListBankAccountsRequestTypedDict": ".list_bank_accounts", - "ListCompaniesRequest": ".list_companies", - "ListCompaniesRequestTypedDict": ".list_companies", - "ListConnectionsRequest": ".list_connections", - "ListConnectionsRequestTypedDict": ".list_connections", - "ListCreateOperationsRequest": ".list_create_operations", - "ListCreateOperationsRequestTypedDict": ".list_create_operations", - "ListSourceAccountsRequest": ".list_source_accounts", - "ListSourceAccountsRequestTypedDict": ".list_source_accounts", - "ListSourceAccountsResponseBody": ".list_source_accounts", - "ListSourceAccountsResponseBodyTypedDict": ".list_source_accounts", - "ReplaceCompanyRequest": ".replace_company", - "ReplaceCompanyRequestTypedDict": ".replace_company", - "RunManagedBankFeedAdHocSyncRequest": ".run_managed_bank_feed_ad_hoc_sync", - "RunManagedBankFeedAdHocSyncRequestTypedDict": ".run_managed_bank_feed_ad_hoc_sync", - "UnlinkConnectionRequest": ".unlink_connection", - "UnlinkConnectionRequestTypedDict": ".unlink_connection", - "UnlinkConnectionUpdateConnection": ".unlink_connection", - "UnlinkConnectionUpdateConnectionTypedDict": ".unlink_connection", - "UpdateCompanyRequest": ".update_company", - "UpdateCompanyRequestTypedDict": ".update_company", - "UpdateSourceAccountRequest": ".update_source_account", - "UpdateSourceAccountRequestTypedDict": ".update_source_account", -} - - -def __getattr__(attr_name: str) -> Any: - return lazy_getattr( - attr_name, package=__package__, dynamic_imports=_dynamic_imports - ) - - -def __dir__(): - return lazy_dir(dynamic_imports=_dynamic_imports) +# Speakeasy TypedDict companions for aliased names. +from codat_bankfeeds.models.create_batch_source_account_request_body import CreateBatchSourceAccountRequestBodyTypedDict as CreateBatchSourceAccountCreateBatchSourceAccountRequestBodyTypedDict +from codat_bankfeeds.models.create_connection_request import CreateConnectionRequestTypedDict as CreateConnectionRequestBodyTypedDict +from codat_bankfeeds.models.update_connection import UpdateConnectionTypedDict as UnlinkConnectionUpdateConnectionTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/create_bank_account.py b/bank-feeds/src/codat_bankfeeds/models/operations/create_bank_account.py index f8c4eb886..74ae4464e 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/create_bank_account.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/create_bank_account.py @@ -1,73 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.create_bank_account — re-export of the create_bank_account operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.models.shared import ( - bankaccountprototype as shared_bankaccountprototype, -) -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -from codat_bankfeeds.utils import ( - FieldMetadata, - PathParamMetadata, - QueryParamMetadata, - RequestMetadata, -) -import pydantic -from pydantic import model_serializer -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.""" - bank_account_prototype: NotRequired[ - shared_bankaccountprototype.BankAccountPrototypeTypedDict - ] - timeout_in_minutes: NotRequired[int] - r"""Time limit for the push operation to complete before it is timed out.""" - - -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.""" - - bank_account_prototype: Annotated[ - Optional[shared_bankaccountprototype.BankAccountPrototype], - FieldMetadata(request=RequestMetadata(media_type="application/json")), - ] = None - - timeout_in_minutes: Annotated[ - Optional[int], - pydantic.Field(alias="timeoutInMinutes"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Time limit for the push operation to complete before it is timed out.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["bankAccountPrototype", "timeoutInMinutes"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m +from codat_bankfeeds.api.bank_accounts import CreateBankAccountRequest +from codat_bankfeeds.api.bank_accounts import CreateBankAccountRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/create_bank_account_mapping.py b/bank-feeds/src/codat_bankfeeds/models/operations/create_bank_account_mapping.py index 7113a5787..701dcaae0 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/create_bank_account_mapping.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/create_bank_account_mapping.py @@ -1,59 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.create_bank_account_mapping — re-export of the create_bank_account_mapping operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.models.shared import ( - bankfeedaccountmapping as shared_bankfeedaccountmapping, -) -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -from codat_bankfeeds.utils import FieldMetadata, PathParamMetadata, RequestMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class CreateBankAccountMappingRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - bank_feed_account_mapping: NotRequired[ - shared_bankfeedaccountmapping.BankFeedAccountMappingTypedDict - ] - - -class CreateBankAccountMappingRequest(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.""" - - bank_feed_account_mapping: Annotated[ - Optional[shared_bankfeedaccountmapping.BankFeedAccountMapping], - FieldMetadata(request=RequestMetadata(media_type="application/json")), - ] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["BankFeedAccountMapping"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m +from codat_bankfeeds.api.account_mapping import CreateBankAccountMappingRequest +from codat_bankfeeds.api.account_mapping import CreateBankAccountMappingRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/create_bank_transactions.py b/bank-feeds/src/codat_bankfeeds/models/operations/create_bank_transactions.py index ab520e65d..e873c97e7 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/create_bank_transactions.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/create_bank_transactions.py @@ -1,93 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.create_bank_transactions — re-export of the create_bank_transactions operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.models.shared import ( - createbanktransactions as shared_createbanktransactions, -) -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -from codat_bankfeeds.utils import ( - FieldMetadata, - PathParamMetadata, - QueryParamMetadata, - RequestMetadata, -) -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class CreateBankTransactionsRequestTypedDict(TypedDict): - account_id: str - r"""Unique identifier for an account.""" - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - create_bank_transactions: NotRequired[ - shared_createbanktransactions.CreateBankTransactionsTypedDict - ] - allow_sync_on_push_complete: NotRequired[bool] - r"""Allow a sync upon push completion.""" - timeout_in_minutes: NotRequired[int] - r"""Time limit for the push operation to complete before it is timed out.""" - - -class CreateBankTransactionsRequest(BaseModel): - account_id: Annotated[ - str, - pydantic.Field(alias="accountId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for an account.""" - - 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.""" - - create_bank_transactions: Annotated[ - Optional[shared_createbanktransactions.CreateBankTransactions], - FieldMetadata(request=RequestMetadata(media_type="application/json")), - ] = None - - allow_sync_on_push_complete: Annotated[ - Optional[bool], - pydantic.Field(alias="allowSyncOnPushComplete"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = True - r"""Allow a sync upon push completion.""" - - timeout_in_minutes: Annotated[ - Optional[int], - pydantic.Field(alias="timeoutInMinutes"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Time limit for the push operation to complete before it is timed out.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["CreateBankTransactions", "allowSyncOnPushComplete", "timeoutInMinutes"] - ) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m +from codat_bankfeeds.api.transactions import CreateBankTransactionsRequest +from codat_bankfeeds.api.transactions import CreateBankTransactionsRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/create_batch_source_account.py b/bank-feeds/src/codat_bankfeeds/models/operations/create_batch_source_account.py index cb1f61030..506ad2c87 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/create_batch_source_account.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/create_batch_source_account.py @@ -1,131 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.create_batch_source_account — re-export of the create_batch_source_account operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.models.shared import ( - sourceaccountbatchcreateresponse as shared_sourceaccountbatchcreateresponse, - sourceaccountbatcherrorresponse as shared_sourceaccountbatcherrorresponse, - sourceaccountprototype as shared_sourceaccountprototype, - sourceaccountv2batchcreateresponse as shared_sourceaccountv2batchcreateresponse, - sourceaccountv2prototype as shared_sourceaccountv2prototype, -) -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -from codat_bankfeeds.utils import FieldMetadata, PathParamMetadata, RequestMetadata -import pydantic -from pydantic import model_serializer -from typing import List, Optional, Union -from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict - - -CreateBatchSourceAccountRequestBodyTypedDict = TypeAliasType( - "CreateBatchSourceAccountRequestBodyTypedDict", - Union[ - List[shared_sourceaccountv2prototype.SourceAccountV2PrototypeTypedDict], - List[shared_sourceaccountprototype.SourceAccountPrototypeTypedDict], - ], -) - - -CreateBatchSourceAccountRequestBody = TypeAliasType( - "CreateBatchSourceAccountRequestBody", - Union[ - List[shared_sourceaccountv2prototype.SourceAccountV2Prototype], - List[shared_sourceaccountprototype.SourceAccountPrototype], - ], -) - - -class CreateBatchSourceAccountRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - request_body: NotRequired[CreateBatchSourceAccountRequestBodyTypedDict] - - -class CreateBatchSourceAccountRequest(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[CreateBatchSourceAccountRequestBody], - FieldMetadata(request=RequestMetadata(media_type="application/json")), - ] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["RequestBody"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -CreateBatchSourceAccountResponseBodyTypedDict = TypeAliasType( - "CreateBatchSourceAccountResponseBodyTypedDict", - Union[ - shared_sourceaccountv2batchcreateresponse.SourceAccountV2BatchCreateResponseTypedDict, - shared_sourceaccountbatchcreateresponse.SourceAccountBatchCreateResponseTypedDict, - shared_sourceaccountbatcherrorresponse.SourceAccountBatchErrorResponseTypedDict, - ], -) - - -CreateBatchSourceAccountResponseBody = TypeAliasType( - "CreateBatchSourceAccountResponseBody", - Union[ - shared_sourceaccountv2batchcreateresponse.SourceAccountV2BatchCreateResponse, - shared_sourceaccountbatchcreateresponse.SourceAccountBatchCreateResponse, - shared_sourceaccountbatcherrorresponse.SourceAccountBatchErrorResponse, - ], -) - - -ResponseBodyTypedDict = TypeAliasType( - "ResponseBodyTypedDict", - Union[ - shared_sourceaccountv2batchcreateresponse.SourceAccountV2BatchCreateResponseTypedDict, - shared_sourceaccountbatchcreateresponse.SourceAccountBatchCreateResponseTypedDict, - ], -) - - -ResponseBody = TypeAliasType( - "ResponseBody", - Union[ - shared_sourceaccountv2batchcreateresponse.SourceAccountV2BatchCreateResponse, - shared_sourceaccountbatchcreateresponse.SourceAccountBatchCreateResponse, - ], -) - - -CreateBatchSourceAccountResponseTypedDict = TypeAliasType( - "CreateBatchSourceAccountResponseTypedDict", - Union[ - List[ResponseBodyTypedDict], List[CreateBatchSourceAccountResponseBodyTypedDict] - ], -) - - -CreateBatchSourceAccountResponse = TypeAliasType( - "CreateBatchSourceAccountResponse", - Union[List[ResponseBody], List[CreateBatchSourceAccountResponseBody]], -) +from codat_bankfeeds.api.source_accounts import CreateBatchSourceAccountRequest +from codat_bankfeeds.api.source_accounts import CreateBatchSourceAccountRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/create_batch_source_account_request_body.py b/bank-feeds/src/codat_bankfeeds/models/operations/create_batch_source_account_request_body.py new file mode 100644 index 000000000..a0c729acf --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/operations/create_batch_source_account_request_body.py @@ -0,0 +1,7 @@ +from __future__ import annotations +from typing import Union, List +from typing_extensions import TypeAliasType +from codat_bankfeeds.models.shared.sourceaccountv2prototype import SourceAccountV2Prototype +from codat_bankfeeds.models.shared.sourceaccountprototype import SourceAccountPrototype + +CreateBatchSourceAccountRequestBody = TypeAliasType("CreateBatchSourceAccountRequestBody", Union[List[SourceAccountV2Prototype], List[SourceAccountPrototype]]) diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/create_batch_source_account_request_body_typed_dict.py b/bank-feeds/src/codat_bankfeeds/models/operations/create_batch_source_account_request_body_typed_dict.py new file mode 100644 index 000000000..1841ca70c --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/operations/create_batch_source_account_request_body_typed_dict.py @@ -0,0 +1,7 @@ +from __future__ import annotations +from typing import Union, List +from typing_extensions import TypeAliasType +from codat_bankfeeds.models.shared.sourceaccountv2prototype import SourceAccountV2PrototypeTypedDict +from codat_bankfeeds.models.shared.sourceaccountprototype import SourceAccountPrototypeTypedDict + +CreateBatchSourceAccountRequestBodyTypedDict = TypeAliasType("CreateBatchSourceAccountRequestBodyTypedDict", Union[List[SourceAccountV2PrototypeTypedDict], List[SourceAccountPrototypeTypedDict]]) diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/create_batch_source_account_response.py b/bank-feeds/src/codat_bankfeeds/models/operations/create_batch_source_account_response.py new file mode 100644 index 000000000..1849643ea --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/operations/create_batch_source_account_response.py @@ -0,0 +1,7 @@ +from __future__ import annotations +from typing import Union, List +from typing_extensions import TypeAliasType +from codat_bankfeeds.models.operations.response_body import ResponseBody +from codat_bankfeeds.models.operations.create_batch_source_account_response_body import CreateBatchSourceAccountResponseBody + +CreateBatchSourceAccountResponse = TypeAliasType("CreateBatchSourceAccountResponse", Union[List[ResponseBody], List[CreateBatchSourceAccountResponseBody]]) diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/create_batch_source_account_response_body.py b/bank-feeds/src/codat_bankfeeds/models/operations/create_batch_source_account_response_body.py new file mode 100644 index 000000000..6cd2a464f --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/operations/create_batch_source_account_response_body.py @@ -0,0 +1,8 @@ +from __future__ import annotations +from typing import Union +from typing_extensions import TypeAliasType +from codat_bankfeeds.models.shared.sourceaccountv2batchcreateresponse import SourceAccountV2BatchCreateResponse +from codat_bankfeeds.models.shared.sourceaccountbatchcreateresponse import SourceAccountBatchCreateResponse +from codat_bankfeeds.models.shared.sourceaccountbatcherrorresponse import SourceAccountBatchErrorResponse + +CreateBatchSourceAccountResponseBody = TypeAliasType("CreateBatchSourceAccountResponseBody", Union[SourceAccountV2BatchCreateResponse, SourceAccountBatchCreateResponse, SourceAccountBatchErrorResponse]) diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/create_batch_source_account_response_body_typed_dict.py b/bank-feeds/src/codat_bankfeeds/models/operations/create_batch_source_account_response_body_typed_dict.py new file mode 100644 index 000000000..b7fa26793 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/operations/create_batch_source_account_response_body_typed_dict.py @@ -0,0 +1,8 @@ +from __future__ import annotations +from typing import Union +from typing_extensions import TypeAliasType +from codat_bankfeeds.models.shared.sourceaccountv2batchcreateresponse import SourceAccountV2BatchCreateResponseTypedDict +from codat_bankfeeds.models.shared.sourceaccountbatchcreateresponse import SourceAccountBatchCreateResponseTypedDict +from codat_bankfeeds.models.shared.sourceaccountbatcherrorresponse import SourceAccountBatchErrorResponseTypedDict + +CreateBatchSourceAccountResponseBodyTypedDict = TypeAliasType("CreateBatchSourceAccountResponseBodyTypedDict", Union[SourceAccountV2BatchCreateResponseTypedDict, SourceAccountBatchCreateResponseTypedDict, SourceAccountBatchErrorResponseTypedDict]) diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/create_batch_source_account_response_typed_dict.py b/bank-feeds/src/codat_bankfeeds/models/operations/create_batch_source_account_response_typed_dict.py new file mode 100644 index 000000000..f80ac344e --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/operations/create_batch_source_account_response_typed_dict.py @@ -0,0 +1,7 @@ +from __future__ import annotations +from typing import Union, List +from typing_extensions import TypeAliasType +from codat_bankfeeds.models.operations.response_body_typed_dict import ResponseBodyTypedDict +from codat_bankfeeds.models.operations.create_batch_source_account_response_body_typed_dict import CreateBatchSourceAccountResponseBodyTypedDict + +CreateBatchSourceAccountResponseTypedDict = TypeAliasType("CreateBatchSourceAccountResponseTypedDict", Union[List[ResponseBodyTypedDict], List[CreateBatchSourceAccountResponseBodyTypedDict]]) diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/create_connection.py b/bank-feeds/src/codat_bankfeeds/models/operations/create_connection.py index 8b8e800c5..9f5e9f990 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/create_connection.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/create_connection.py @@ -1,77 +1,6 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.create_connection — re-export of the create_connection operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -from codat_bankfeeds.utils import FieldMetadata, PathParamMetadata, RequestMetadata -import pydantic -from pydantic import model_serializer -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.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["platformKey"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -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 - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["RequestBody"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -try: - CreateConnectionRequestBody.model_rebuild() -except NameError: - pass +from codat_bankfeeds.api.connections import CreateConnectionRequest +from codat_bankfeeds.models.create_connection_request import CreateConnectionRequest as CreateConnectionRequestBody +from codat_bankfeeds.models.create_connection_request import CreateConnectionRequestTypedDict as CreateConnectionRequestBodyTypedDict +from codat_bankfeeds.api.connections import CreateConnectionRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/create_source_account.py b/bank-feeds/src/codat_bankfeeds/models/operations/create_source_account.py index bfd399a41..4b45efd78 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/create_source_account.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/create_source_account.py @@ -1,95 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.create_source_account — re-export of the create_source_account operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.models.shared import ( - sourceaccount as shared_sourceaccount, - sourceaccountprototype as shared_sourceaccountprototype, - sourceaccountv2 as shared_sourceaccountv2, - sourceaccountv2prototype as shared_sourceaccountv2prototype, -) -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -from codat_bankfeeds.utils import FieldMetadata, PathParamMetadata, RequestMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional, Union -from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict - - -CreateSourceAccountRequestBodyTypedDict = TypeAliasType( - "CreateSourceAccountRequestBodyTypedDict", - Union[ - shared_sourceaccountprototype.SourceAccountPrototypeTypedDict, - shared_sourceaccountv2prototype.SourceAccountV2PrototypeTypedDict, - ], -) - - -CreateSourceAccountRequestBody = TypeAliasType( - "CreateSourceAccountRequestBody", - Union[ - shared_sourceaccountprototype.SourceAccountPrototype, - shared_sourceaccountv2prototype.SourceAccountV2Prototype, - ], -) - - -class CreateSourceAccountRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - request_body: NotRequired[CreateSourceAccountRequestBodyTypedDict] - - -class CreateSourceAccountRequest(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[CreateSourceAccountRequestBody], - FieldMetadata(request=RequestMetadata(media_type="application/json")), - ] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["RequestBody"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -CreateSourceAccountResponseBodyTypedDict = TypeAliasType( - "CreateSourceAccountResponseBodyTypedDict", - Union[ - shared_sourceaccount.SourceAccountTypedDict, - shared_sourceaccountv2.SourceAccountV2TypedDict, - ], -) -r"""Success""" - - -CreateSourceAccountResponseBody = TypeAliasType( - "CreateSourceAccountResponseBody", - Union[shared_sourceaccount.SourceAccount, shared_sourceaccountv2.SourceAccountV2], -) -r"""Success""" +from codat_bankfeeds.api.source_accounts import CreateSourceAccountRequest +from codat_bankfeeds.api.source_accounts import CreateSourceAccountRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/create_source_account_request_body.py b/bank-feeds/src/codat_bankfeeds/models/operations/create_source_account_request_body.py new file mode 100644 index 000000000..56306260f --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/operations/create_source_account_request_body.py @@ -0,0 +1,7 @@ +from __future__ import annotations +from typing import Union +from typing_extensions import TypeAliasType +from codat_bankfeeds.models.shared.sourceaccountprototype import SourceAccountPrototype +from codat_bankfeeds.models.shared.sourceaccountv2prototype import SourceAccountV2Prototype + +CreateSourceAccountRequestBody = TypeAliasType("CreateSourceAccountRequestBody", Union[SourceAccountPrototype, SourceAccountV2Prototype]) diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/create_source_account_request_body_typed_dict.py b/bank-feeds/src/codat_bankfeeds/models/operations/create_source_account_request_body_typed_dict.py new file mode 100644 index 000000000..e4d32c557 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/operations/create_source_account_request_body_typed_dict.py @@ -0,0 +1,7 @@ +from __future__ import annotations +from typing import Union +from typing_extensions import TypeAliasType +from codat_bankfeeds.models.shared.sourceaccountprototype import SourceAccountPrototypeTypedDict +from codat_bankfeeds.models.shared.sourceaccountv2prototype import SourceAccountV2PrototypeTypedDict + +CreateSourceAccountRequestBodyTypedDict = TypeAliasType("CreateSourceAccountRequestBodyTypedDict", Union[SourceAccountPrototypeTypedDict, SourceAccountV2PrototypeTypedDict]) diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/create_source_account_response_body.py b/bank-feeds/src/codat_bankfeeds/models/operations/create_source_account_response_body.py new file mode 100644 index 000000000..704963bee --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/operations/create_source_account_response_body.py @@ -0,0 +1,7 @@ +from __future__ import annotations +from typing import Union +from typing_extensions import TypeAliasType +from codat_bankfeeds.models.shared.sourceaccount import SourceAccount +from codat_bankfeeds.models.source_account_v2 import SourceAccountV2 + +CreateSourceAccountResponseBody = TypeAliasType("CreateSourceAccountResponseBody", Union[SourceAccount, SourceAccountV2]) diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/create_source_account_response_body_typed_dict.py b/bank-feeds/src/codat_bankfeeds/models/operations/create_source_account_response_body_typed_dict.py new file mode 100644 index 000000000..74c8bac89 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/operations/create_source_account_response_body_typed_dict.py @@ -0,0 +1,7 @@ +from __future__ import annotations +from typing import Union +from typing_extensions import TypeAliasType +from codat_bankfeeds.models.shared.sourceaccount import SourceAccountTypedDict +from codat_bankfeeds.models.source_account_v2 import SourceAccountV2TypedDict + +CreateSourceAccountResponseBodyTypedDict = TypeAliasType("CreateSourceAccountResponseBodyTypedDict", Union[SourceAccountTypedDict, SourceAccountV2TypedDict]) diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/delete_bank_feed_credentials.py b/bank-feeds/src/codat_bankfeeds/models/operations/delete_bank_feed_credentials.py index 96ddae439..3f275585b 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/delete_bank_feed_credentials.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/delete_bank_feed_credentials.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.delete_bank_feed_credentials — re-export of the delete_bank_feed_credentials operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.types import BaseModel -from codat_bankfeeds.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class DeleteBankFeedCredentialsRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - - -class DeleteBankFeedCredentialsRequest(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.""" +from codat_bankfeeds.api.source_accounts import DeleteBankFeedCredentialsRequest +from codat_bankfeeds.api.source_accounts import DeleteBankFeedCredentialsRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/delete_company.py b/bank-feeds/src/codat_bankfeeds/models/operations/delete_company.py index 603f1a4b0..8c974d507 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/delete_company.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/delete_company.py @@ -1,21 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.delete_company — re-export of the delete_company operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.types import BaseModel -from codat_bankfeeds.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.""" +from codat_bankfeeds.api.companies import DeleteCompanyRequest +from codat_bankfeeds.api.companies import DeleteCompanyRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/delete_connection.py b/bank-feeds/src/codat_bankfeeds/models/operations/delete_connection.py index f001b4e8f..0e91a67b5 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/delete_connection.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/delete_connection.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.delete_connection — re-export of the delete_connection operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.types import BaseModel -from codat_bankfeeds.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.""" +from codat_bankfeeds.api.connections import DeleteConnectionRequest +from codat_bankfeeds.api.connections import DeleteConnectionRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/delete_source_account.py b/bank-feeds/src/codat_bankfeeds/models/operations/delete_source_account.py index e95000292..6f83bab62 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/delete_source_account.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/delete_source_account.py @@ -1,39 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.delete_source_account — re-export of the delete_source_account operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.types import BaseModel -from codat_bankfeeds.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class DeleteSourceAccountRequestTypedDict(TypedDict): - account_id: str - r"""Unique identifier for an account.""" - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - - -class DeleteSourceAccountRequest(BaseModel): - account_id: Annotated[ - str, - pydantic.Field(alias="accountId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for an account.""" - - 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.""" +from codat_bankfeeds.api.source_accounts import DeleteSourceAccountRequest +from codat_bankfeeds.api.source_accounts import DeleteSourceAccountRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/generate_credentials.py b/bank-feeds/src/codat_bankfeeds/models/operations/generate_credentials.py index 98ee6117c..01ad0cfd3 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/generate_credentials.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/generate_credentials.py @@ -1,38 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.generate_credentials — re-export of the generate_credentials operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.types import BaseModel -from codat_bankfeeds.utils import FieldMetadata, PathParamMetadata, RequestMetadata -import io -import pydantic -from typing import IO, Union -from typing_extensions import Annotated, TypedDict - - -class GenerateCredentialsRequestTypedDict(TypedDict): - request_body: Union[bytes, IO[bytes], io.BufferedReader] - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - - -class GenerateCredentialsRequest(BaseModel): - request_body: Annotated[ - Union[bytes, IO[bytes], io.BufferedReader], - FieldMetadata(request=RequestMetadata(media_type="application/json")), - ] - - 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.""" +from codat_bankfeeds.api.source_accounts import GenerateCredentialsRequest +from codat_bankfeeds.api.source_accounts import GenerateCredentialsRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/generate_otp.py b/bank-feeds/src/codat_bankfeeds/models/operations/generate_otp.py index a59f9e0ec..b41abedea 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/generate_otp.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/generate_otp.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.generate_otp — re-export of the generate_otp operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.types import BaseModel -from codat_bankfeeds.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GenerateOtpRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - - -class GenerateOtpRequest(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.""" +from codat_bankfeeds.api.source_accounts import GenerateOtpRequest +from codat_bankfeeds.api.source_accounts import GenerateOtpRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/get_bank_account_mapping.py b/bank-feeds/src/codat_bankfeeds/models/operations/get_bank_account_mapping.py index 81a370680..7cf7bad78 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/get_bank_account_mapping.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/get_bank_account_mapping.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.get_bank_account_mapping — re-export of the get_bank_account_mapping operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.types import BaseModel -from codat_bankfeeds.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetBankAccountMappingRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - - -class GetBankAccountMappingRequest(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.""" +from codat_bankfeeds.api.account_mapping import GetBankAccountMappingRequest +from codat_bankfeeds.api.account_mapping import GetBankAccountMappingRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/get_company.py b/bank-feeds/src/codat_bankfeeds/models/operations/get_company.py index 995cff62a..c8068ebe2 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/get_company.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/get_company.py @@ -1,21 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.get_company — re-export of the get_company operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.types import BaseModel -from codat_bankfeeds.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.""" +from codat_bankfeeds.api.companies import GetCompanyRequest +from codat_bankfeeds.api.companies import GetCompanyRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/get_company_access_token.py b/bank-feeds/src/codat_bankfeeds/models/operations/get_company_access_token.py index 5e77aaef8..9c673d9ea 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/get_company_access_token.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/get_company_access_token.py @@ -1,21 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.get_company_access_token — re-export of the get_company_access_token operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.types import BaseModel -from codat_bankfeeds.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetCompanyAccessTokenRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - - -class GetCompanyAccessTokenRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" +from codat_bankfeeds.api.companies import GetCompanyAccessTokenRequest +from codat_bankfeeds.api.companies import GetCompanyAccessTokenRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/get_company_information.py b/bank-feeds/src/codat_bankfeeds/models/operations/get_company_information.py index e972201b2..6399cff78 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/get_company_information.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/get_company_information.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.get_company_information — re-export of the get_company_information operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.types import BaseModel -from codat_bankfeeds.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.""" +from codat_bankfeeds.api.company_information import GetCompanyInformationRequest +from codat_bankfeeds.api.company_information import GetCompanyInformationRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/get_connection.py b/bank-feeds/src/codat_bankfeeds/models/operations/get_connection.py index 61af0cf95..7477f8b49 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/get_connection.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/get_connection.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.get_connection — re-export of the get_connection operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.types import BaseModel -from codat_bankfeeds.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.""" +from codat_bankfeeds.api.connections import GetConnectionRequest +from codat_bankfeeds.api.connections import GetConnectionRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/get_create_bank_transactions_model.py b/bank-feeds/src/codat_bankfeeds/models/operations/get_create_bank_transactions_model.py index 5c726dd9e..ed841a732 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/get_create_bank_transactions_model.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/get_create_bank_transactions_model.py @@ -1,39 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.get_create_bank_transactions_model — re-export of the get_create_bank_transactions_model operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.types import BaseModel -from codat_bankfeeds.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetCreateBankTransactionsModelRequestTypedDict(TypedDict): - account_id: str - r"""Unique identifier for an account.""" - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - - -class GetCreateBankTransactionsModelRequest(BaseModel): - account_id: Annotated[ - str, - pydantic.Field(alias="accountId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for an account.""" - - 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.""" +from codat_bankfeeds.api.transactions import GetCreateBankTransactionsModelRequest +from codat_bankfeeds.api.transactions import GetCreateBankTransactionsModelRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/get_create_bankaccounts_model.py b/bank-feeds/src/codat_bankfeeds/models/operations/get_create_bankaccounts_model.py index 2fda827b1..1eab8d5a4 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/get_create_bankaccounts_model.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/get_create_bankaccounts_model.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.get_create_bankaccounts_model — re-export of the get_create_bankaccounts_model operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.types import BaseModel -from codat_bankfeeds.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetCreateBankAccountsModelRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - - -class GetCreateBankAccountsModelRequest(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.""" +from codat_bankfeeds.api.bank_accounts import GetCreateBankAccountsModelRequest +from codat_bankfeeds.api.bank_accounts import GetCreateBankAccountsModelRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/get_create_operation.py b/bank-feeds/src/codat_bankfeeds/models/operations/get_create_operation.py index d223112e2..3d3c26b16 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/get_create_operation.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/get_create_operation.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.get_create_operation — re-export of the get_create_operation operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.types import BaseModel -from codat_bankfeeds.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetCreateOperationRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - push_operation_key: str - r"""Push operation key.""" - - -class GetCreateOperationRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - push_operation_key: Annotated[ - str, - pydantic.Field(alias="pushOperationKey"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Push operation key.""" +from codat_bankfeeds.api.transactions import GetCreateOperationRequest +from codat_bankfeeds.api.transactions import GetCreateOperationRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/get_latest_managed_bank_feed_sync.py b/bank-feeds/src/codat_bankfeeds/models/operations/get_latest_managed_bank_feed_sync.py index 6110a18eb..2be28c0ee 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/get_latest_managed_bank_feed_sync.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/get_latest_managed_bank_feed_sync.py @@ -1,39 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.get_latest_managed_bank_feed_sync — re-export of the get_latest_managed_bank_feed_sync operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.types import BaseModel -from codat_bankfeeds.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetLatestManagedBankFeedSyncRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - source_account_id: str - r"""The ID of the source bank account.""" - - -class GetLatestManagedBankFeedSyncRequest(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.""" - - source_account_id: Annotated[ - str, - pydantic.Field(alias="sourceAccountId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""The ID of the source bank account.""" +from codat_bankfeeds.api.managed_bank_feeds import GetLatestManagedBankFeedSyncRequest +from codat_bankfeeds.api.managed_bank_feeds import GetLatestManagedBankFeedSyncRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/get_managed_bank_feed_sync.py b/bank-feeds/src/codat_bankfeeds/models/operations/get_managed_bank_feed_sync.py index 0df09922b..597007065 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/get_managed_bank_feed_sync.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/get_managed_bank_feed_sync.py @@ -1,48 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.get_managed_bank_feed_sync — re-export of the get_managed_bank_feed_sync operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.types import BaseModel -from codat_bankfeeds.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetManagedBankFeedSyncRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - source_account_id: str - r"""The ID of the source bank account.""" - sync_id: str - r"""The ID of the sync.""" - - -class GetManagedBankFeedSyncRequest(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.""" - - source_account_id: Annotated[ - str, - pydantic.Field(alias="sourceAccountId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""The ID of the source bank account.""" - - sync_id: Annotated[ - str, - pydantic.Field(alias="syncId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""The ID of the sync.""" +from codat_bankfeeds.api.managed_bank_feeds import GetManagedBankFeedSyncRequest +from codat_bankfeeds.api.managed_bank_feeds import GetManagedBankFeedSyncRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/list_bank_accounts.py b/bank-feeds/src/codat_bankfeeds/models/operations/list_bank_accounts.py index 2750daf94..1d105708a 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/list_bank_accounts.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/list_bank_accounts.py @@ -1,82 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.list_bank_accounts — re-export of the list_bank_accounts operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -from codat_bankfeeds.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListBankAccountsRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - order_by: NotRequired[str] - r"""Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results).""" - 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).""" - - -class ListBankAccountsRequest(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.""" - - 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).""" - - 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).""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["orderBy", "page", "pageSize", "query"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m +from codat_bankfeeds.api.bank_accounts import ListBankAccountsRequest +from codat_bankfeeds.api.bank_accounts import ListBankAccountsRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/list_companies.py b/bank-feeds/src/codat_bankfeeds/models/operations/list_companies.py index 7d9a5e7dd..113525644 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/list_companies.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/list_companies.py @@ -1,72 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.list_companies — re-export of the list_companies operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -from codat_bankfeeds.utils import FieldMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListCompaniesRequestTypedDict(TypedDict): - order_by: NotRequired[str] - r"""Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results).""" - 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).""" - tags: NotRequired[str] - r"""Filter companies by tags using the \"equals\" (=), \"not equals\" (!=), and \"contains\" (~) operators with [Codat’s query language](https://docs.codat.io/using-the-api/querying).""" - - -class ListCompaniesRequest(BaseModel): - 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).""" - - 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).""" - - tags: Annotated[ - Optional[str], - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Filter companies by tags using the \"equals\" (=), \"not equals\" (!=), and \"contains\" (~) operators with [Codat’s query language](https://docs.codat.io/using-the-api/querying).""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["orderBy", "page", "pageSize", "query", "tags"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m +from codat_bankfeeds.api.companies import ListCompaniesRequest +from codat_bankfeeds.api.companies import ListCompaniesRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/list_connections.py b/bank-feeds/src/codat_bankfeeds/models/operations/list_connections.py index 77af3653c..9b2371c7b 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/list_connections.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/list_connections.py @@ -1,73 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.list_connections — re-export of the list_connections operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -from codat_bankfeeds.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListConnectionsRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - order_by: NotRequired[str] - r"""Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results).""" - 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).""" - - -class ListConnectionsRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - 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).""" - - 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).""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["orderBy", "page", "pageSize", "query"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m +from codat_bankfeeds.api.connections import ListConnectionsRequest +from codat_bankfeeds.api.connections import ListConnectionsRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/list_create_operations.py b/bank-feeds/src/codat_bankfeeds/models/operations/list_create_operations.py index bb7484405..f79d428cd 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/list_create_operations.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/list_create_operations.py @@ -1,73 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.list_create_operations — re-export of the list_create_operations operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -from codat_bankfeeds.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListCreateOperationsRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - order_by: NotRequired[str] - r"""Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results).""" - 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).""" - - -class ListCreateOperationsRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - 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).""" - - 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).""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["orderBy", "page", "pageSize", "query"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m +from codat_bankfeeds.api.transactions import ListCreateOperationsRequest +from codat_bankfeeds.api.transactions import ListCreateOperationsRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/list_source_accounts.py b/bank-feeds/src/codat_bankfeeds/models/operations/list_source_accounts.py index 0381b397a..12a67bd53 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/list_source_accounts.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/list_source_accounts.py @@ -1,55 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.list_source_accounts — re-export of the list_source_accounts operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.models.shared import ( - sourceaccount as shared_sourceaccount, - sourceaccountv2 as shared_sourceaccountv2, -) -from codat_bankfeeds.types import BaseModel -from codat_bankfeeds.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing import List, Union -from typing_extensions import Annotated, TypeAliasType, TypedDict - - -class ListSourceAccountsRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - - -class ListSourceAccountsRequest(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.""" - - -ListSourceAccountsResponseBodyTypedDict = TypeAliasType( - "ListSourceAccountsResponseBodyTypedDict", - Union[ - List[shared_sourceaccountv2.SourceAccountV2TypedDict], - List[shared_sourceaccount.SourceAccountTypedDict], - ], -) -r"""Success""" - - -ListSourceAccountsResponseBody = TypeAliasType( - "ListSourceAccountsResponseBody", - Union[ - List[shared_sourceaccountv2.SourceAccountV2], - List[shared_sourceaccount.SourceAccount], - ], -) -r"""Success""" +from codat_bankfeeds.api.source_accounts import ListSourceAccountsRequest +from codat_bankfeeds.api.source_accounts import ListSourceAccountsRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/list_source_accounts_response_body.py b/bank-feeds/src/codat_bankfeeds/models/operations/list_source_accounts_response_body.py new file mode 100644 index 000000000..eea1f41df --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/operations/list_source_accounts_response_body.py @@ -0,0 +1,7 @@ +from __future__ import annotations +from typing import Union, List +from typing_extensions import TypeAliasType +from codat_bankfeeds.models.source_account_v2 import SourceAccountV2 +from codat_bankfeeds.models.shared.sourceaccount import SourceAccount + +ListSourceAccountsResponseBody = TypeAliasType("ListSourceAccountsResponseBody", Union[List[SourceAccountV2], List[SourceAccount]]) diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/list_source_accounts_response_body_typed_dict.py b/bank-feeds/src/codat_bankfeeds/models/operations/list_source_accounts_response_body_typed_dict.py new file mode 100644 index 000000000..e85b11d7a --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/operations/list_source_accounts_response_body_typed_dict.py @@ -0,0 +1,7 @@ +from __future__ import annotations +from typing import Union, List +from typing_extensions import TypeAliasType +from codat_bankfeeds.models.source_account_v2 import SourceAccountV2TypedDict +from codat_bankfeeds.models.shared.sourceaccount import SourceAccountTypedDict + +ListSourceAccountsResponseBodyTypedDict = TypeAliasType("ListSourceAccountsResponseBodyTypedDict", Union[List[SourceAccountV2TypedDict], List[SourceAccountTypedDict]]) diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/replace_company.py b/bank-feeds/src/codat_bankfeeds/models/operations/replace_company.py index 5ee3617d1..ea60e3592 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/replace_company.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/replace_company.py @@ -1,50 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.replace_company — re-export of the replace_company operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.models.shared import ( - companyrequestbody as shared_companyrequestbody, -) -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -from codat_bankfeeds.utils import FieldMetadata, PathParamMetadata, RequestMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ReplaceCompanyRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - company_request_body: NotRequired[ - shared_companyrequestbody.CompanyRequestBodyTypedDict - ] - - -class ReplaceCompanyRequest(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 - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["CompanyRequestBody"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m +from codat_bankfeeds.api.companies import ReplaceCompanyRequest +from codat_bankfeeds.api.companies import ReplaceCompanyRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/response_body.py b/bank-feeds/src/codat_bankfeeds/models/operations/response_body.py new file mode 100644 index 000000000..eb9ab4eab --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/operations/response_body.py @@ -0,0 +1,7 @@ +from __future__ import annotations +from typing import Union +from typing_extensions import TypeAliasType +from codat_bankfeeds.models.shared.sourceaccountv2batchcreateresponse import SourceAccountV2BatchCreateResponse +from codat_bankfeeds.models.shared.sourceaccountbatchcreateresponse import SourceAccountBatchCreateResponse + +ResponseBody = TypeAliasType("ResponseBody", Union[SourceAccountV2BatchCreateResponse, SourceAccountBatchCreateResponse]) diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/response_body_typed_dict.py b/bank-feeds/src/codat_bankfeeds/models/operations/response_body_typed_dict.py new file mode 100644 index 000000000..88f7c5b39 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/operations/response_body_typed_dict.py @@ -0,0 +1,7 @@ +from __future__ import annotations +from typing import Union +from typing_extensions import TypeAliasType +from codat_bankfeeds.models.shared.sourceaccountv2batchcreateresponse import SourceAccountV2BatchCreateResponseTypedDict +from codat_bankfeeds.models.shared.sourceaccountbatchcreateresponse import SourceAccountBatchCreateResponseTypedDict + +ResponseBodyTypedDict = TypeAliasType("ResponseBodyTypedDict", Union[SourceAccountV2BatchCreateResponseTypedDict, SourceAccountBatchCreateResponseTypedDict]) diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/run_managed_bank_feed_ad_hoc_sync.py b/bank-feeds/src/codat_bankfeeds/models/operations/run_managed_bank_feed_ad_hoc_sync.py index 21a6bad5f..7e5afb9e9 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/run_managed_bank_feed_ad_hoc_sync.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/run_managed_bank_feed_ad_hoc_sync.py @@ -1,39 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.run_managed_bank_feed_ad_hoc_sync — re-export of the run_managed_bank_feed_ad_hoc_sync operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.types import BaseModel -from codat_bankfeeds.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class RunManagedBankFeedAdHocSyncRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - source_account_id: str - r"""The ID of the source bank account.""" - - -class RunManagedBankFeedAdHocSyncRequest(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.""" - - source_account_id: Annotated[ - str, - pydantic.Field(alias="sourceAccountId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""The ID of the source bank account.""" +from codat_bankfeeds.api.managed_bank_feeds import RunManagedBankFeedAdHocSyncRequest +from codat_bankfeeds.api.managed_bank_feeds import RunManagedBankFeedAdHocSyncRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/unlink_connection.py b/bank-feeds/src/codat_bankfeeds/models/operations/unlink_connection.py index a5edde12f..b517757ea 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/unlink_connection.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/unlink_connection.py @@ -1,83 +1,6 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.unlink_connection — re-export of the unlink_connection operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.models.shared import ( - dataconnectionstatus as shared_dataconnectionstatus, -) -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -from codat_bankfeeds.utils import FieldMetadata, PathParamMetadata, RequestMetadata -import pydantic -from pydantic import model_serializer -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.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["status"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -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 - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["RequestBody"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m +from codat_bankfeeds.api.connections import UnlinkConnectionRequest +from codat_bankfeeds.api.connections import UnlinkConnectionRequestTypedDict +from codat_bankfeeds.models.update_connection import UpdateConnection as UnlinkConnectionUpdateConnection +from codat_bankfeeds.models.update_connection import UpdateConnectionTypedDict as UnlinkConnectionUpdateConnectionTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/update_company.py b/bank-feeds/src/codat_bankfeeds/models/operations/update_company.py index 66a2bb521..b3629cc87 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/update_company.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/update_company.py @@ -1,50 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.update_company — re-export of the update_company operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.models.shared import ( - companyupdaterequest as shared_companyupdaterequest, -) -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -from codat_bankfeeds.utils import FieldMetadata, PathParamMetadata, RequestMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class UpdateCompanyRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - company_update_request: NotRequired[ - shared_companyupdaterequest.CompanyUpdateRequestTypedDict - ] - - -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_update_request: Annotated[ - Optional[shared_companyupdaterequest.CompanyUpdateRequest], - FieldMetadata(request=RequestMetadata(media_type="application/json")), - ] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["CompanyUpdateRequest"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m +from codat_bankfeeds.api.companies import UpdateCompanyRequest +from codat_bankfeeds.api.companies import UpdateCompanyRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/operations/update_source_account.py b/bank-feeds/src/codat_bankfeeds/models/operations/update_source_account.py index aac6aff4d..4df126543 100644 --- a/bank-feeds/src/codat_bankfeeds/models/operations/update_source_account.py +++ b/bank-feeds/src/codat_bankfeeds/models/operations/update_source_account.py @@ -1,64 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.operations.update_source_account — re-export of the update_source_account operation envelope.""" -from __future__ import annotations -from codat_bankfeeds.models.shared import sourceaccount as shared_sourceaccount -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -from codat_bankfeeds.utils import FieldMetadata, PathParamMetadata, RequestMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class UpdateSourceAccountRequestTypedDict(TypedDict): - account_id: str - r"""Unique identifier for an account.""" - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - source_account: NotRequired[shared_sourceaccount.SourceAccountTypedDict] - - -class UpdateSourceAccountRequest(BaseModel): - account_id: Annotated[ - str, - pydantic.Field(alias="accountId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for an account.""" - - 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.""" - - source_account: Annotated[ - Optional[shared_sourceaccount.SourceAccount], - FieldMetadata(request=RequestMetadata(media_type="application/json")), - ] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["SourceAccount"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m +from codat_bankfeeds.api.source_accounts import UpdateSourceAccountRequest +from codat_bankfeeds.api.source_accounts import UpdateSourceAccountRequestTypedDict diff --git a/bank-feeds/src/codat_bankfeeds/models/pull_operation.py b/bank-feeds/src/codat_bankfeeds/models/pull_operation.py new file mode 100644 index 000000000..461e64194 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/pull_operation.py @@ -0,0 +1,140 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from codat_bankfeeds.models.dataset_status import DatasetStatus +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, field_validator, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class PullOperation(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + """ + Information about a queued, in progress or completed pull operation. *Formally called `dataset`* + """ # noqa: E501 + id: str = Field(description="Unique identifier of the pull operation.") + company_id: str = Field(description="Unique identifier of the company associated to this pull operation.", alias="companyId") + connection_id: str = Field(description="Unique identifier of the connection associated to this pull operation.", alias="connectionId") + data_type: str = Field(description="The data type you are requesting in a pull operation.", alias="dataType") + status: DatasetStatus = Field(description="The current status of the dataset.") + status_description: Optional[str] = Field(default=None, description="Additional information about the dataset status.", alias="statusDescription") + error_message: Optional[str] = Field(default=None, description="A message about a transient or persistent error returned by Codat or the source platform.", alias="errorMessage") + requested: str = Field(description="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.") + completed: Optional[str] = Field(default=None, description="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.") + progress: int = Field(description="An integer signifying the progress of the pull operation.") + is_completed: bool = Field(description="`True` if the pull operation is completed successfully. The `isCompleted` property is not queryable. To filter failed pull operations, query by `status!=Complete&&status!=NotSupported` instead.", alias="isCompleted") + is_errored: bool = Field(description="`True` if the pull operation entered an error state.", alias="isErrored") + __properties: ClassVar[List[str]] = ["id", "companyId", "connectionId", "dataType", "status", "statusDescription", "errorMessage", "requested", "completed", "progress", "isCompleted", "isErrored"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['Initial', 'Queued', 'Fetching', 'MapQueued', 'Mapping', 'Complete', 'FetchError', 'MapError', 'InternalError', 'ProcessingQueued', 'Processing', 'ProcessingError', 'ValidationQueued', 'Validating', 'ValidationError', 'AuthError', 'Cancelled', 'NotSupported', 'RateLimitError', 'PermissionsError', 'PrerequisiteNotMet']): + raise ValueError("must be one of enum values ('Initial', 'Queued', 'Fetching', 'MapQueued', 'Mapping', 'Complete', 'FetchError', 'MapError', 'InternalError', 'ProcessingQueued', 'Processing', 'ProcessingError', 'ValidationQueued', 'Validating', 'ValidationError', 'AuthError', 'Cancelled', 'NotSupported', 'RateLimitError', 'PermissionsError', 'PrerequisiteNotMet')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PullOperation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PullOperation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "companyId": obj.get("companyId"), + "connectionId": obj.get("connectionId"), + "dataType": obj.get("dataType"), + "status": obj.get("status"), + "statusDescription": obj.get("statusDescription"), + "errorMessage": obj.get("errorMessage"), + "requested": obj.get("requested"), + "completed": obj.get("completed"), + "progress": obj.get("progress"), + "isCompleted": obj.get("isCompleted"), + "isErrored": obj.get("isErrored") + }) + return _obj + + + + + +class PullOperationTypedDict(TypedDict): + """TypedDict variant of PullOperation, for dict-literal request/response inputs.""" + id: NotRequired[str] + company_id: NotRequired[str] + connection_id: NotRequired[str] + data_type: NotRequired[str] + status: NotRequired[DatasetStatus] + status_description: NotRequired[Optional[str]] + error_message: NotRequired[Optional[str]] + requested: NotRequired[str] + completed: NotRequired[Optional[str]] + progress: NotRequired[int] + is_completed: NotRequired[bool] + is_errored: NotRequired[bool] diff --git a/bank-feeds/src/codat_bankfeeds/models/pull_operations.py b/bank-feeds/src/codat_bankfeeds/models/pull_operations.py new file mode 100644 index 000000000..5fbecd9d5 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/pull_operations.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict +from codat_bankfeeds.models.shared.links import Links, LinksTypedDict +from codat_bankfeeds.models.pull_operation import PullOperation, PullOperationTypedDict +from typing import Optional, Set +from typing_extensions import Self + +class PullOperations(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + """ + PullOperations + """ # noqa: E501 + page_number: int = Field(description="Current page number.", alias="pageNumber") + page_size: int = Field(description="Number of items to return in results array.", alias="pageSize") + total_results: int = Field(description="Total number of items.", alias="totalResults") + links: Links = Field(alias="_links") + results: Optional[List[PullOperation]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PullOperations from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of links + if self.links: + _dict['_links'] = self.links.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PullOperations from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "pageNumber": obj.get("pageNumber"), + "pageSize": obj.get("pageSize"), + "totalResults": obj.get("totalResults"), + "_links": Links.from_dict(obj["_links"]) if obj.get("_links") is not None else None, + "results": [PullOperation.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + + + + +class PullOperationsTypedDict(TypedDict): + """TypedDict variant of PullOperations, for dict-literal request/response inputs.""" + page_number: NotRequired[int] + page_size: NotRequired[int] + total_results: NotRequired[int] + links: NotRequired[LinksTypedDict] + results: NotRequired[Optional[List[PullOperationTypedDict]]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/__init__.py b/bank-feeds/src/codat_bankfeeds/models/shared/__init__.py index f4430d2d2..12cf9769b 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/__init__.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/__init__.py @@ -1,475 +1,390 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.models.shared — domain-shared models.""" -from typing import Any, TYPE_CHECKING - -from codat_bankfeeds.utils.dynamic_imports import lazy_getattr, lazy_dir +from importlib import import_module +from typing import TYPE_CHECKING if TYPE_CHECKING: - from .accountinfo import AccountInfo, AccountInfoTypedDict - from .accounttype import AccountType - from .bankaccountcreateresponse import ( - AccountingBankAccount, - AccountingBankAccountTypedDict, - BankAccountCreateResponse, - BankAccountCreateResponseBankAccountType, - BankAccountCreateResponseTypedDict, - Metadata, - MetadataTypedDict, - SupplementalData, - SupplementalDataTypedDict, - ) - from .bankaccountcredentials import ( - BankAccountCredentials, - BankAccountCredentialsTypedDict, - ) - from .bankaccountprototype import ( - BankAccountPrototype, - BankAccountPrototypeTypedDict, - BankAccountType, - ) - from .bankaccounts import ( - BankAccounts, - BankAccountsAccountingBankAccount, - BankAccountsAccountingBankAccountTypedDict, - BankAccountsBankAccountType, - BankAccountsMetadata, - BankAccountsMetadataTypedDict, - BankAccountsSupplementalData, - BankAccountsSupplementalDataTypedDict, - BankAccountsTypedDict, - ) - from .bankaccountstatus import BankAccountStatus - from .bankfeedaccountmapping import ( - BankFeedAccountMapping, - BankFeedAccountMappingTypedDict, - ) - from .bankfeedaccountmappingresponse import ( - BankFeedAccountMappingResponse, - BankFeedAccountMappingResponseTypedDict, - ) - from .bankfeedmapping import BankFeedMapping, BankFeedMappingTypedDict - from .banktransactions import ( - BankTransactionType, - BankTransactions, - BankTransactionsTypedDict, - ) - from .clientratelimitwebhook import ( - ClientRateLimitWebhook, - ClientRateLimitWebhookTypedDict, - ) - from .clientratelimitwebhookpayload import ( - ClientRateLimitWebhookPayload, - ClientRateLimitWebhookPayloadTypedDict, - ) - from .companies import Companies, CompaniesTypedDict - from .company import Company, CompanyTypedDict - from .companyaccesstoken import CompanyAccessToken, CompanyAccessTokenTypedDict - from .companyinformation import CompanyInformation, CompanyInformationTypedDict - from .companyreference import ( - CompanyReference, - CompanyReferenceLinks, - CompanyReferenceLinksTypedDict, - CompanyReferenceTypedDict, - ) - from .companyrequestbody import CompanyRequestBody, CompanyRequestBodyTypedDict - from .companyupdaterequest import ( - CompanyUpdateRequest, - CompanyUpdateRequestTypedDict, - ) - from .connection import Connection, ConnectionTypedDict, SourceType - from .connections import Connections, ConnectionsTypedDict - from .createbanktransactions import ( - CreateBankTransactions, - CreateBankTransactionsTypedDict, - ) - from .createbanktransactionsresponse import ( - CreateBankTransactionsResponse, - CreateBankTransactionsResponseTypedDict, - ) - from .dataconnectionerror import ( - DataConnectionError, - DataConnectionErrorTypedDict, - ErrorStatus, - ) - from .dataconnectionstatus import DataConnectionStatus - from .datatype import DataType - from .errorvalidation import ErrorValidation, ErrorValidationTypedDict - from .errorvalidationitem import ErrorValidationItem, ErrorValidationItemTypedDict - from .generateotpresponse import GenerateOtpResponse, GenerateOtpResponseTypedDict - from .halref import HalRef, HalRefTypedDict - from .links import Links, LinksTypedDict - from .pushchangetype import PushChangeType - from .pushfieldvalidation import PushFieldValidation, PushFieldValidationTypedDict - from .pushoperation import PushOperation, PushOperationTypedDict - from .pushoperationchange import PushOperationChange, PushOperationChangeTypedDict - from .pushoperationref import PushOperationRef, PushOperationRefTypedDict - from .pushoperations import PushOperations, PushOperationsTypedDict - from .pushoperationstatus import PushOperationStatus - from .pushoption import PushOption, PushOptionTypedDict - from .pushoptionchoice import PushOptionChoice, PushOptionChoiceTypedDict - from .pushoptionproperty import PushOptionProperty, PushOptionPropertyTypedDict - from .pushoptiontype import PushOptionType - from .pushvalidationinfo import PushValidationInfo, PushValidationInfoTypedDict - from .routinginfo import RoutingInfo, RoutingInfoTypedDict, Type from .security import Security, SecurityTypedDict - from .sourceaccount import SourceAccount, SourceAccountTypedDict, Status - from .sourceaccountbatchcreateresponse import ( - SourceAccountBatchCreateResponse, - SourceAccountBatchCreateResponseTypedDict, - ) - from .sourceaccountbatchcreateresult import ( - SourceAccountBatchCreateResult, - SourceAccountBatchCreateResultTypedDict, - ) - from .sourceaccountbatcherrorresponse import ( - Result, - ResultTypedDict, - SourceAccountBatchErrorResponse, - SourceAccountBatchErrorResponseTypedDict, - ) - from .sourceaccountprototype import ( - SourceAccountPrototype, - SourceAccountPrototypeTypedDict, - ) - from .sourceaccountv2 import ( - SourceAccountV2, - SourceAccountV2AccountType, - SourceAccountV2Status, - SourceAccountV2TypedDict, - ) - from .sourceaccountv2batchcreateresponse import ( - SourceAccountV2BatchCreateResponse, - SourceAccountV2BatchCreateResponseTypedDict, - ) - from .sourceaccountv2batchcreateresult import ( - SourceAccountV2BatchCreateResult, - SourceAccountV2BatchCreateResultTypedDict, - ) - from .sourceaccountv2prototype import ( - SourceAccountV2Prototype, - SourceAccountV2PrototypeTypedDict, - ) - from .sourceaccountwebhook import ( - SourceAccountWebhook, - SourceAccountWebhookTypedDict, - ) - from .sourceaccountwebhookpayload import ( - SourceAccountWebhookPayload, - SourceAccountWebhookPayloadSourceAccount, - SourceAccountWebhookPayloadSourceAccountTypedDict, - SourceAccountWebhookPayloadTypedDict, - ) - from .startscheduledsyncresult import ( - StartScheduledSyncResult, - StartScheduledSyncResultTypedDict, - ) - from .syncstatusresult import SyncStatusResult, SyncStatusResultTypedDict - from .targetaccountoption import TargetAccountOption, TargetAccountOptionTypedDict - from .validation import Validation, ValidationTypedDict - from .validationitem import ValidationItem, ValidationItemTypedDict - -__all__ = [ - "AccountInfo", - "AccountInfoTypedDict", - "AccountType", - "AccountingBankAccount", - "AccountingBankAccountTypedDict", - "BankAccountCreateResponse", - "BankAccountCreateResponseBankAccountType", - "BankAccountCreateResponseTypedDict", - "BankAccountCredentials", - "BankAccountCredentialsTypedDict", - "BankAccountPrototype", - "BankAccountPrototypeTypedDict", - "BankAccountStatus", - "BankAccountType", - "BankAccounts", - "BankAccountsAccountingBankAccount", - "BankAccountsAccountingBankAccountTypedDict", - "BankAccountsBankAccountType", - "BankAccountsMetadata", - "BankAccountsMetadataTypedDict", - "BankAccountsSupplementalData", - "BankAccountsSupplementalDataTypedDict", - "BankAccountsTypedDict", - "BankFeedAccountMapping", - "BankFeedAccountMappingResponse", - "BankFeedAccountMappingResponseTypedDict", - "BankFeedAccountMappingTypedDict", - "BankFeedMapping", - "BankFeedMappingTypedDict", - "BankTransactionType", - "BankTransactions", - "BankTransactionsTypedDict", - "ClientRateLimitWebhook", - "ClientRateLimitWebhookPayload", - "ClientRateLimitWebhookPayloadTypedDict", - "ClientRateLimitWebhookTypedDict", - "Companies", - "CompaniesTypedDict", - "Company", - "CompanyAccessToken", - "CompanyAccessTokenTypedDict", - "CompanyInformation", - "CompanyInformationTypedDict", - "CompanyReference", - "CompanyReferenceLinks", - "CompanyReferenceLinksTypedDict", - "CompanyReferenceTypedDict", - "CompanyRequestBody", - "CompanyRequestBodyTypedDict", - "CompanyTypedDict", - "CompanyUpdateRequest", - "CompanyUpdateRequestTypedDict", - "Connection", - "ConnectionTypedDict", - "Connections", - "ConnectionsTypedDict", - "CreateBankTransactions", - "CreateBankTransactionsResponse", - "CreateBankTransactionsResponseTypedDict", - "CreateBankTransactionsTypedDict", - "DataConnectionError", - "DataConnectionErrorTypedDict", - "DataConnectionStatus", - "DataType", - "ErrorStatus", - "ErrorValidation", - "ErrorValidationItem", - "ErrorValidationItemTypedDict", - "ErrorValidationTypedDict", - "GenerateOtpResponse", - "GenerateOtpResponseTypedDict", - "HalRef", - "HalRefTypedDict", - "Links", - "LinksTypedDict", - "Metadata", - "MetadataTypedDict", - "PushChangeType", - "PushFieldValidation", - "PushFieldValidationTypedDict", - "PushOperation", - "PushOperationChange", - "PushOperationChangeTypedDict", - "PushOperationRef", - "PushOperationRefTypedDict", - "PushOperationStatus", - "PushOperationTypedDict", - "PushOperations", - "PushOperationsTypedDict", - "PushOption", - "PushOptionChoice", - "PushOptionChoiceTypedDict", - "PushOptionProperty", - "PushOptionPropertyTypedDict", - "PushOptionType", - "PushOptionTypedDict", - "PushValidationInfo", - "PushValidationInfoTypedDict", - "Result", - "ResultTypedDict", - "RoutingInfo", - "RoutingInfoTypedDict", - "Security", - "SecurityTypedDict", - "SourceAccount", - "SourceAccountBatchCreateResponse", - "SourceAccountBatchCreateResponseTypedDict", - "SourceAccountBatchCreateResult", - "SourceAccountBatchCreateResultTypedDict", - "SourceAccountBatchErrorResponse", - "SourceAccountBatchErrorResponseTypedDict", - "SourceAccountPrototype", - "SourceAccountPrototypeTypedDict", - "SourceAccountTypedDict", - "SourceAccountV2", - "SourceAccountV2AccountType", - "SourceAccountV2BatchCreateResponse", - "SourceAccountV2BatchCreateResponseTypedDict", - "SourceAccountV2BatchCreateResult", - "SourceAccountV2BatchCreateResultTypedDict", - "SourceAccountV2Prototype", - "SourceAccountV2PrototypeTypedDict", - "SourceAccountV2Status", - "SourceAccountV2TypedDict", - "SourceAccountWebhook", - "SourceAccountWebhookPayload", - "SourceAccountWebhookPayloadSourceAccount", - "SourceAccountWebhookPayloadSourceAccountTypedDict", - "SourceAccountWebhookPayloadTypedDict", - "SourceAccountWebhookTypedDict", - "SourceType", - "StartScheduledSyncResult", - "StartScheduledSyncResultTypedDict", - "Status", - "SupplementalData", - "SupplementalDataTypedDict", - "SyncStatusResult", - "SyncStatusResultTypedDict", - "TargetAccountOption", - "TargetAccountOptionTypedDict", - "Type", - "Validation", - "ValidationItem", - "ValidationItemTypedDict", - "ValidationTypedDict", -] + from codat_bankfeeds.models.access_token import AccessToken, AccessTokenTypedDict + from codat_bankfeeds.models.shared.accountinfo import AccountInfo, AccountInfoTypedDict + from codat_bankfeeds.models.shared.accounttype import AccountType + from codat_bankfeeds.models.accounting_bank_account import AccountingBankAccount, AccountingBankAccountTypedDict + from codat_bankfeeds.models.shared.bankaccountcreateresponse import BankAccountCreateResponse, BankAccountCreateResponseTypedDict + from codat_bankfeeds.models.bank_account_create_response_all_of_data import BankAccountCreateResponseAllOfData, BankAccountCreateResponseAllOfDataTypedDict + from codat_bankfeeds.models.bank_account_create_response_bank_account_type import BankAccountCreateResponseBankAccountType + from codat_bankfeeds.models.shared.bankaccountcredentials import BankAccountCredentials, BankAccountCredentialsTypedDict + from codat_bankfeeds.models.shared.bankaccountprototype import BankAccountPrototype, BankAccountPrototypeTypedDict + from codat_bankfeeds.models.shared.bankaccountstatus import BankAccountStatus + from codat_bankfeeds.models.bank_account_type import BankAccountType + from codat_bankfeeds.models.shared.bankaccounts import BankAccounts, BankAccountsTypedDict + from codat_bankfeeds.models.bank_accounts_bank_account_type import BankAccountsBankAccountType + from codat_bankfeeds.models.shared.bankfeedaccountmapping import BankFeedAccountMapping, BankFeedAccountMappingTypedDict + from codat_bankfeeds.models.shared.bankfeedaccountmappingresponse import BankFeedAccountMappingResponse, BankFeedAccountMappingResponseTypedDict + from codat_bankfeeds.models.shared.bankfeedmapping import BankFeedMapping, BankFeedMappingTypedDict + from codat_bankfeeds.models.bank_transaction import BankTransaction, BankTransactionTypedDict + from codat_bankfeeds.models.bank_transaction_type import BankTransactionType + from codat_bankfeeds.models.shared.clientratelimitwebhook import ClientRateLimitWebhook, ClientRateLimitWebhookTypedDict + from codat_bankfeeds.models.shared.clientratelimitwebhookpayload import ClientRateLimitWebhookPayload, ClientRateLimitWebhookPayloadTypedDict + from codat_bankfeeds.models.shared.companies import Companies, CompaniesTypedDict + from codat_bankfeeds.models.shared.company import Company, CompanyTypedDict + from codat_bankfeeds.models.shared.companyaccesstoken import CompanyAccessToken, CompanyAccessTokenTypedDict + from codat_bankfeeds.models.company_details import CompanyDetails, CompanyDetailsTypedDict + from codat_bankfeeds.models.shared.companyinformation import CompanyInformation, CompanyInformationTypedDict + from codat_bankfeeds.models.shared.companyreference import CompanyReference, CompanyReferenceTypedDict + from codat_bankfeeds.models.company_reference_links import CompanyReferenceLinks, CompanyReferenceLinksTypedDict + from codat_bankfeeds.models.shared.companyrequestbody import CompanyRequestBody, CompanyRequestBodyTypedDict + from codat_bankfeeds.models.shared.companyupdaterequest import CompanyUpdateRequest, CompanyUpdateRequestTypedDict + from codat_bankfeeds.models.shared.connection import Connection, ConnectionTypedDict + from codat_bankfeeds.models.shared.connections import Connections, ConnectionsTypedDict + from codat_bankfeeds.models.shared.createbanktransactions import CreateBankTransactions, CreateBankTransactionsTypedDict + from codat_bankfeeds.models.shared.createbanktransactionsresponse import CreateBankTransactionsResponse, CreateBankTransactionsResponseTypedDict + from codat_bankfeeds.models.create_batch_source_account201_response_inner import CreateBatchSourceAccount201ResponseInner, CreateBatchSourceAccount201ResponseInnerTypedDict + from codat_bankfeeds.models.create_batch_source_account207_response_inner import CreateBatchSourceAccount207ResponseInner, CreateBatchSourceAccount207ResponseInnerTypedDict + from codat_bankfeeds.models.create_batch_source_account_request_body import CreateBatchSourceAccountRequestBody, CreateBatchSourceAccountRequestBodyTypedDict + from codat_bankfeeds.models.create_connection_request import CreateConnectionRequest, CreateConnectionRequestTypedDict + from codat_bankfeeds.models.create_source_account200_response import CreateSourceAccount200Response, CreateSourceAccount200ResponseTypedDict + from codat_bankfeeds.models.create_source_account_request import CreateSourceAccountRequest, CreateSourceAccountRequestTypedDict + from codat_bankfeeds.models.shared.dataconnectionerror import DataConnectionError, DataConnectionErrorTypedDict + from codat_bankfeeds.models.shared.dataconnectionstatus import DataConnectionStatus + from codat_bankfeeds.models.shared.datatype import DataType + from codat_bankfeeds.models.dataset_status import DatasetStatus + from codat_bankfeeds.models.error_message import ErrorMessage, ErrorMessageTypedDict + from codat_bankfeeds.models.error_status import ErrorStatus + from codat_bankfeeds.models.shared.errorvalidation import ErrorValidation, ErrorValidationTypedDict + from codat_bankfeeds.models.shared.errorvalidationitem import ErrorValidationItem, ErrorValidationItemTypedDict + from codat_bankfeeds.models.shared.generateotpresponse import GenerateOtpResponse, GenerateOtpResponseTypedDict + from codat_bankfeeds.models.shared.halref import HalRef, HalRefTypedDict + from codat_bankfeeds.models.items import Items, ItemsTypedDict + from codat_bankfeeds.models.items_bank_account_type import ItemsBankAccountType + from codat_bankfeeds.models.shared.links import Links, LinksTypedDict + from codat_bankfeeds.models.list_source_accounts200_response import ListSourceAccounts200Response, ListSourceAccounts200ResponseTypedDict + from codat_bankfeeds.models.metadata import Metadata, MetadataTypedDict + from codat_bankfeeds.models.model1 import Model1, Model1TypedDict + from codat_bankfeeds.models.pull_operation import PullOperation, PullOperationTypedDict + from codat_bankfeeds.models.pull_operations import PullOperations, PullOperationsTypedDict + from codat_bankfeeds.models.shared.pushchangetype import PushChangeType + from codat_bankfeeds.models.shared.pushfieldvalidation import PushFieldValidation, PushFieldValidationTypedDict + from codat_bankfeeds.models.shared.pushoperation import PushOperation, PushOperationTypedDict + from codat_bankfeeds.models.shared.pushoperationchange import PushOperationChange, PushOperationChangeTypedDict + from codat_bankfeeds.models.shared.pushoperationref import PushOperationRef, PushOperationRefTypedDict + from codat_bankfeeds.models.shared.pushoperationstatus import PushOperationStatus + from codat_bankfeeds.models.shared.pushoperations import PushOperations, PushOperationsTypedDict + from codat_bankfeeds.models.shared.pushoption import PushOption, PushOptionTypedDict + from codat_bankfeeds.models.shared.pushoptionchoice import PushOptionChoice, PushOptionChoiceTypedDict + from codat_bankfeeds.models.shared.pushoptionproperty import PushOptionProperty, PushOptionPropertyTypedDict + from codat_bankfeeds.models.shared.pushoptiontype import PushOptionType + from codat_bankfeeds.models.shared.pushvalidationinfo import PushValidationInfo, PushValidationInfoTypedDict + from codat_bankfeeds.models.shared.routinginfo import RoutingInfo, RoutingInfoTypedDict + from codat_bankfeeds.models.shared.sourceaccount import SourceAccount, SourceAccountTypedDict + from codat_bankfeeds.models.shared.sourceaccountbatchcreateresponse import SourceAccountBatchCreateResponse, SourceAccountBatchCreateResponseTypedDict + from codat_bankfeeds.models.shared.sourceaccountbatchcreateresult import SourceAccountBatchCreateResult, SourceAccountBatchCreateResultTypedDict + from codat_bankfeeds.models.shared.sourceaccountbatcherrorresponse import SourceAccountBatchErrorResponse, SourceAccountBatchErrorResponseTypedDict + from codat_bankfeeds.models.source_account_batch_error_response_result import SourceAccountBatchErrorResponseResult, SourceAccountBatchErrorResponseResultTypedDict + from codat_bankfeeds.models.shared.sourceaccountprototype import SourceAccountPrototype, SourceAccountPrototypeTypedDict + from codat_bankfeeds.models.source_account_v2 import SourceAccountV2, SourceAccountV2TypedDict + from codat_bankfeeds.models.shared.sourceaccountv2batchcreateresponse import SourceAccountV2BatchCreateResponse, SourceAccountV2BatchCreateResponseTypedDict + from codat_bankfeeds.models.shared.sourceaccountv2batchcreateresult import SourceAccountV2BatchCreateResult, SourceAccountV2BatchCreateResultTypedDict + from codat_bankfeeds.models.shared.sourceaccountv2prototype import SourceAccountV2Prototype, SourceAccountV2PrototypeTypedDict + from codat_bankfeeds.models.source_account_v2_status import SourceAccountV2Status + from codat_bankfeeds.models.shared.sourceaccountwebhook import SourceAccountWebhook, SourceAccountWebhookTypedDict + from codat_bankfeeds.models.shared.sourceaccountwebhookpayload import SourceAccountWebhookPayload, SourceAccountWebhookPayloadTypedDict + from codat_bankfeeds.models.source_type import SourceType + from codat_bankfeeds.models.shared.startscheduledsyncresult import StartScheduledSyncResult, StartScheduledSyncResultTypedDict + from codat_bankfeeds.models.status import Status + from codat_bankfeeds.models.supplemental_data import SupplementalData, SupplementalDataTypedDict + from codat_bankfeeds.models.shared.syncstatusresult import SyncStatusResult, SyncStatusResultTypedDict + from codat_bankfeeds.models.shared.targetaccountoption import TargetAccountOption, TargetAccountOptionTypedDict + from codat_bankfeeds.models.type import Type + from codat_bankfeeds.models.update_connection import UpdateConnection, UpdateConnectionTypedDict + from codat_bankfeeds.models.shared.validation import Validation, ValidationTypedDict + from codat_bankfeeds.models.shared.validationitem import ValidationItem, ValidationItemTypedDict + from codat_bankfeeds.models.shared.sourceaccountv2 import SourceAccountV2AccountType + from codat_bankfeeds.models.shared.accountinfo import AccountInfoTypedDict as AccountInfoTypedDict + from codat_bankfeeds.models.shared.accounttype import AccountType as AccountType + from codat_bankfeeds.models.accounting_bank_account import AccountingBankAccountTypedDict as AccountingBankAccountTypedDict + from codat_bankfeeds.models.bank_account_create_response_bank_account_type import BankAccountCreateResponseBankAccountType as BankAccountCreateResponseBankAccountType + from codat_bankfeeds.models.shared.bankaccountcreateresponse import BankAccountCreateResponseTypedDict as BankAccountCreateResponseTypedDict + from codat_bankfeeds.models.shared.bankaccountcredentials import BankAccountCredentialsTypedDict as BankAccountCredentialsTypedDict + from codat_bankfeeds.models.shared.bankaccountprototype import BankAccountPrototypeTypedDict as BankAccountPrototypeTypedDict + from codat_bankfeeds.models.shared.bankaccountstatus import BankAccountStatus as BankAccountStatus + from codat_bankfeeds.models.bank_account_type import BankAccountType as BankAccountType + from codat_bankfeeds.models.accounting_bank_account import AccountingBankAccount as BankAccountsAccountingBankAccount + from codat_bankfeeds.models.accounting_bank_account import AccountingBankAccountTypedDict as BankAccountsAccountingBankAccountTypedDict + from codat_bankfeeds.models.bank_accounts_bank_account_type import BankAccountsBankAccountType as BankAccountsBankAccountType + from codat_bankfeeds.models.metadata import Metadata as BankAccountsMetadata + from codat_bankfeeds.models.metadata import MetadataTypedDict as BankAccountsMetadataTypedDict + from codat_bankfeeds.models.supplemental_data import SupplementalData as BankAccountsSupplementalData + from codat_bankfeeds.models.supplemental_data import SupplementalDataTypedDict as BankAccountsSupplementalDataTypedDict + from codat_bankfeeds.models.shared.bankaccounts import BankAccountsTypedDict as BankAccountsTypedDict + from codat_bankfeeds.models.shared.bankfeedaccountmappingresponse import BankFeedAccountMappingResponseTypedDict as BankFeedAccountMappingResponseTypedDict + from codat_bankfeeds.models.shared.bankfeedaccountmapping import BankFeedAccountMappingTypedDict as BankFeedAccountMappingTypedDict + from codat_bankfeeds.models.shared.bankfeedmapping import BankFeedMappingTypedDict as BankFeedMappingTypedDict + from codat_bankfeeds.models.bank_transaction_type import BankTransactionType as BankTransactionType + from codat_bankfeeds.models.bank_transaction import BankTransaction as BankTransactions + from codat_bankfeeds.models.bank_transaction import BankTransactionTypedDict as BankTransactionsTypedDict + from codat_bankfeeds.models.shared.clientratelimitwebhookpayload import ClientRateLimitWebhookPayloadTypedDict as ClientRateLimitWebhookPayloadTypedDict + from codat_bankfeeds.models.shared.clientratelimitwebhook import ClientRateLimitWebhookTypedDict as ClientRateLimitWebhookTypedDict + from codat_bankfeeds.models.shared.companies import CompaniesTypedDict as CompaniesTypedDict + from codat_bankfeeds.models.shared.companyaccesstoken import CompanyAccessTokenTypedDict as CompanyAccessTokenTypedDict + from codat_bankfeeds.models.shared.companyinformation import CompanyInformationTypedDict as CompanyInformationTypedDict + from codat_bankfeeds.models.company_reference_links import CompanyReferenceLinksTypedDict as CompanyReferenceLinksTypedDict + from codat_bankfeeds.models.shared.companyreference import CompanyReferenceTypedDict as CompanyReferenceTypedDict + from codat_bankfeeds.models.shared.companyrequestbody import CompanyRequestBodyTypedDict as CompanyRequestBodyTypedDict + from codat_bankfeeds.models.shared.company import CompanyTypedDict as CompanyTypedDict + from codat_bankfeeds.models.shared.companyupdaterequest import CompanyUpdateRequestTypedDict as CompanyUpdateRequestTypedDict + from codat_bankfeeds.models.shared.connection import ConnectionTypedDict as ConnectionTypedDict + from codat_bankfeeds.models.shared.connections import ConnectionsTypedDict as ConnectionsTypedDict + from codat_bankfeeds.models.shared.createbanktransactionsresponse import CreateBankTransactionsResponseTypedDict as CreateBankTransactionsResponseTypedDict + from codat_bankfeeds.models.shared.createbanktransactions import CreateBankTransactionsTypedDict as CreateBankTransactionsTypedDict + from codat_bankfeeds.models.shared.dataconnectionerror import DataConnectionErrorTypedDict as DataConnectionErrorTypedDict + from codat_bankfeeds.models.shared.dataconnectionstatus import DataConnectionStatus as DataConnectionStatus + from codat_bankfeeds.models.shared.datatype import DataType as DataType + from codat_bankfeeds.models.error_status import ErrorStatus as ErrorStatus + from codat_bankfeeds.models.shared.errorvalidationitem import ErrorValidationItemTypedDict as ErrorValidationItemTypedDict + from codat_bankfeeds.models.shared.errorvalidation import ErrorValidationTypedDict as ErrorValidationTypedDict + from codat_bankfeeds.models.shared.generateotpresponse import GenerateOtpResponseTypedDict as GenerateOtpResponseTypedDict + from codat_bankfeeds.models.shared.halref import HalRefTypedDict as HalRefTypedDict + from codat_bankfeeds.models.shared.links import LinksTypedDict as LinksTypedDict + from codat_bankfeeds.models.metadata import MetadataTypedDict as MetadataTypedDict + from codat_bankfeeds.models.shared.pushchangetype import PushChangeType as PushChangeType + from codat_bankfeeds.models.shared.pushfieldvalidation import PushFieldValidationTypedDict as PushFieldValidationTypedDict + from codat_bankfeeds.models.shared.pushoperationchange import PushOperationChangeTypedDict as PushOperationChangeTypedDict + from codat_bankfeeds.models.shared.pushoperationref import PushOperationRefTypedDict as PushOperationRefTypedDict + from codat_bankfeeds.models.shared.pushoperationstatus import PushOperationStatus as PushOperationStatus + from codat_bankfeeds.models.shared.pushoperation import PushOperationTypedDict as PushOperationTypedDict + from codat_bankfeeds.models.shared.pushoperations import PushOperationsTypedDict as PushOperationsTypedDict + from codat_bankfeeds.models.shared.pushoptionchoice import PushOptionChoiceTypedDict as PushOptionChoiceTypedDict + from codat_bankfeeds.models.shared.pushoptionproperty import PushOptionPropertyTypedDict as PushOptionPropertyTypedDict + from codat_bankfeeds.models.shared.pushoptiontype import PushOptionType as PushOptionType + from codat_bankfeeds.models.shared.pushoption import PushOptionTypedDict as PushOptionTypedDict + from codat_bankfeeds.models.shared.pushvalidationinfo import PushValidationInfoTypedDict as PushValidationInfoTypedDict + from codat_bankfeeds.models.source_account_batch_error_response_result import SourceAccountBatchErrorResponseResult as Result + from codat_bankfeeds.models.source_account_batch_error_response_result import SourceAccountBatchErrorResponseResultTypedDict as ResultTypedDict + from codat_bankfeeds.models.shared.routinginfo import RoutingInfoTypedDict as RoutingInfoTypedDict + from codat_bankfeeds.models.shared.security import Security as Security + from codat_bankfeeds.models.shared.security import SecurityTypedDict as SecurityTypedDict + from codat_bankfeeds.models.shared.sourceaccountbatchcreateresponse import SourceAccountBatchCreateResponseTypedDict as SourceAccountBatchCreateResponseTypedDict + from codat_bankfeeds.models.shared.sourceaccountbatchcreateresult import SourceAccountBatchCreateResultTypedDict as SourceAccountBatchCreateResultTypedDict + from codat_bankfeeds.models.shared.sourceaccountbatcherrorresponse import SourceAccountBatchErrorResponseTypedDict as SourceAccountBatchErrorResponseTypedDict + from codat_bankfeeds.models.shared.sourceaccountprototype import SourceAccountPrototypeTypedDict as SourceAccountPrototypeTypedDict + from codat_bankfeeds.models.shared.sourceaccount import SourceAccountTypedDict as SourceAccountTypedDict + from codat_bankfeeds.models.shared.sourceaccountv2 import SourceAccountV2AccountType as SourceAccountV2AccountType + from codat_bankfeeds.models.shared.sourceaccountv2batchcreateresponse import SourceAccountV2BatchCreateResponseTypedDict as SourceAccountV2BatchCreateResponseTypedDict + from codat_bankfeeds.models.shared.sourceaccountv2batchcreateresult import SourceAccountV2BatchCreateResultTypedDict as SourceAccountV2BatchCreateResultTypedDict + from codat_bankfeeds.models.shared.sourceaccountv2prototype import SourceAccountV2PrototypeTypedDict as SourceAccountV2PrototypeTypedDict + from codat_bankfeeds.models.source_account_v2_status import SourceAccountV2Status as SourceAccountV2Status + from codat_bankfeeds.models.source_account_v2 import SourceAccountV2TypedDict as SourceAccountV2TypedDict + from codat_bankfeeds.models.shared.sourceaccountwebhookpayload import SourceAccountWebhookPayloadTypedDict as SourceAccountWebhookPayloadTypedDict + from codat_bankfeeds.models.shared.sourceaccountwebhook import SourceAccountWebhookTypedDict as SourceAccountWebhookTypedDict + from codat_bankfeeds.models.source_type import SourceType as SourceType + from codat_bankfeeds.models.shared.startscheduledsyncresult import StartScheduledSyncResultTypedDict as StartScheduledSyncResultTypedDict + from codat_bankfeeds.models.status import Status as Status + from codat_bankfeeds.models.supplemental_data import SupplementalDataTypedDict as SupplementalDataTypedDict + from codat_bankfeeds.models.shared.syncstatusresult import SyncStatusResultTypedDict as SyncStatusResultTypedDict + from codat_bankfeeds.models.shared.targetaccountoption import TargetAccountOptionTypedDict as TargetAccountOptionTypedDict + from codat_bankfeeds.models.type import Type as Type + from codat_bankfeeds.models.shared.validationitem import ValidationItemTypedDict as ValidationItemTypedDict + from codat_bankfeeds.models.shared.validation import ValidationTypedDict as ValidationTypedDict + from codat_bankfeeds.models.shared.source_account_webhook_payload_source_account import SourceAccountWebhookPayloadSourceAccount + from codat_bankfeeds.models.shared.source_account_webhook_payload_source_account_typed_dict import SourceAccountWebhookPayloadSourceAccountTypedDict -_dynamic_imports: dict[str, str] = { - "AccountInfo": ".accountinfo", - "AccountInfoTypedDict": ".accountinfo", - "AccountType": ".accounttype", - "AccountingBankAccount": ".bankaccountcreateresponse", - "AccountingBankAccountTypedDict": ".bankaccountcreateresponse", - "BankAccountCreateResponse": ".bankaccountcreateresponse", - "BankAccountCreateResponseBankAccountType": ".bankaccountcreateresponse", - "BankAccountCreateResponseTypedDict": ".bankaccountcreateresponse", - "Metadata": ".bankaccountcreateresponse", - "MetadataTypedDict": ".bankaccountcreateresponse", - "SupplementalData": ".bankaccountcreateresponse", - "SupplementalDataTypedDict": ".bankaccountcreateresponse", - "BankAccountCredentials": ".bankaccountcredentials", - "BankAccountCredentialsTypedDict": ".bankaccountcredentials", - "BankAccountPrototype": ".bankaccountprototype", - "BankAccountPrototypeTypedDict": ".bankaccountprototype", - "BankAccountType": ".bankaccountprototype", - "BankAccounts": ".bankaccounts", - "BankAccountsAccountingBankAccount": ".bankaccounts", - "BankAccountsAccountingBankAccountTypedDict": ".bankaccounts", - "BankAccountsBankAccountType": ".bankaccounts", - "BankAccountsMetadata": ".bankaccounts", - "BankAccountsMetadataTypedDict": ".bankaccounts", - "BankAccountsSupplementalData": ".bankaccounts", - "BankAccountsSupplementalDataTypedDict": ".bankaccounts", - "BankAccountsTypedDict": ".bankaccounts", - "BankAccountStatus": ".bankaccountstatus", - "BankFeedAccountMapping": ".bankfeedaccountmapping", - "BankFeedAccountMappingTypedDict": ".bankfeedaccountmapping", - "BankFeedAccountMappingResponse": ".bankfeedaccountmappingresponse", - "BankFeedAccountMappingResponseTypedDict": ".bankfeedaccountmappingresponse", - "BankFeedMapping": ".bankfeedmapping", - "BankFeedMappingTypedDict": ".bankfeedmapping", - "BankTransactionType": ".banktransactions", - "BankTransactions": ".banktransactions", - "BankTransactionsTypedDict": ".banktransactions", - "ClientRateLimitWebhook": ".clientratelimitwebhook", - "ClientRateLimitWebhookTypedDict": ".clientratelimitwebhook", - "ClientRateLimitWebhookPayload": ".clientratelimitwebhookpayload", - "ClientRateLimitWebhookPayloadTypedDict": ".clientratelimitwebhookpayload", - "Companies": ".companies", - "CompaniesTypedDict": ".companies", - "Company": ".company", - "CompanyTypedDict": ".company", - "CompanyAccessToken": ".companyaccesstoken", - "CompanyAccessTokenTypedDict": ".companyaccesstoken", - "CompanyInformation": ".companyinformation", - "CompanyInformationTypedDict": ".companyinformation", - "CompanyReference": ".companyreference", - "CompanyReferenceLinks": ".companyreference", - "CompanyReferenceLinksTypedDict": ".companyreference", - "CompanyReferenceTypedDict": ".companyreference", - "CompanyRequestBody": ".companyrequestbody", - "CompanyRequestBodyTypedDict": ".companyrequestbody", - "CompanyUpdateRequest": ".companyupdaterequest", - "CompanyUpdateRequestTypedDict": ".companyupdaterequest", - "Connection": ".connection", - "ConnectionTypedDict": ".connection", - "SourceType": ".connection", - "Connections": ".connections", - "ConnectionsTypedDict": ".connections", - "CreateBankTransactions": ".createbanktransactions", - "CreateBankTransactionsTypedDict": ".createbanktransactions", - "CreateBankTransactionsResponse": ".createbanktransactionsresponse", - "CreateBankTransactionsResponseTypedDict": ".createbanktransactionsresponse", - "DataConnectionError": ".dataconnectionerror", - "DataConnectionErrorTypedDict": ".dataconnectionerror", - "ErrorStatus": ".dataconnectionerror", - "DataConnectionStatus": ".dataconnectionstatus", - "DataType": ".datatype", - "ErrorValidation": ".errorvalidation", - "ErrorValidationTypedDict": ".errorvalidation", - "ErrorValidationItem": ".errorvalidationitem", - "ErrorValidationItemTypedDict": ".errorvalidationitem", - "GenerateOtpResponse": ".generateotpresponse", - "GenerateOtpResponseTypedDict": ".generateotpresponse", - "HalRef": ".halref", - "HalRefTypedDict": ".halref", - "Links": ".links", - "LinksTypedDict": ".links", - "PushChangeType": ".pushchangetype", - "PushFieldValidation": ".pushfieldvalidation", - "PushFieldValidationTypedDict": ".pushfieldvalidation", - "PushOperation": ".pushoperation", - "PushOperationTypedDict": ".pushoperation", - "PushOperationChange": ".pushoperationchange", - "PushOperationChangeTypedDict": ".pushoperationchange", - "PushOperationRef": ".pushoperationref", - "PushOperationRefTypedDict": ".pushoperationref", - "PushOperations": ".pushoperations", - "PushOperationsTypedDict": ".pushoperations", - "PushOperationStatus": ".pushoperationstatus", - "PushOption": ".pushoption", - "PushOptionTypedDict": ".pushoption", - "PushOptionChoice": ".pushoptionchoice", - "PushOptionChoiceTypedDict": ".pushoptionchoice", - "PushOptionProperty": ".pushoptionproperty", - "PushOptionPropertyTypedDict": ".pushoptionproperty", - "PushOptionType": ".pushoptiontype", - "PushValidationInfo": ".pushvalidationinfo", - "PushValidationInfoTypedDict": ".pushvalidationinfo", - "RoutingInfo": ".routinginfo", - "RoutingInfoTypedDict": ".routinginfo", - "Type": ".routinginfo", - "Security": ".security", - "SecurityTypedDict": ".security", - "SourceAccount": ".sourceaccount", - "SourceAccountTypedDict": ".sourceaccount", - "Status": ".sourceaccount", - "SourceAccountBatchCreateResponse": ".sourceaccountbatchcreateresponse", - "SourceAccountBatchCreateResponseTypedDict": ".sourceaccountbatchcreateresponse", - "SourceAccountBatchCreateResult": ".sourceaccountbatchcreateresult", - "SourceAccountBatchCreateResultTypedDict": ".sourceaccountbatchcreateresult", - "Result": ".sourceaccountbatcherrorresponse", - "ResultTypedDict": ".sourceaccountbatcherrorresponse", - "SourceAccountBatchErrorResponse": ".sourceaccountbatcherrorresponse", - "SourceAccountBatchErrorResponseTypedDict": ".sourceaccountbatcherrorresponse", - "SourceAccountPrototype": ".sourceaccountprototype", - "SourceAccountPrototypeTypedDict": ".sourceaccountprototype", - "SourceAccountV2": ".sourceaccountv2", - "SourceAccountV2AccountType": ".sourceaccountv2", - "SourceAccountV2Status": ".sourceaccountv2", - "SourceAccountV2TypedDict": ".sourceaccountv2", - "SourceAccountV2BatchCreateResponse": ".sourceaccountv2batchcreateresponse", - "SourceAccountV2BatchCreateResponseTypedDict": ".sourceaccountv2batchcreateresponse", - "SourceAccountV2BatchCreateResult": ".sourceaccountv2batchcreateresult", - "SourceAccountV2BatchCreateResultTypedDict": ".sourceaccountv2batchcreateresult", - "SourceAccountV2Prototype": ".sourceaccountv2prototype", - "SourceAccountV2PrototypeTypedDict": ".sourceaccountv2prototype", - "SourceAccountWebhook": ".sourceaccountwebhook", - "SourceAccountWebhookTypedDict": ".sourceaccountwebhook", - "SourceAccountWebhookPayload": ".sourceaccountwebhookpayload", - "SourceAccountWebhookPayloadSourceAccount": ".sourceaccountwebhookpayload", - "SourceAccountWebhookPayloadSourceAccountTypedDict": ".sourceaccountwebhookpayload", - "SourceAccountWebhookPayloadTypedDict": ".sourceaccountwebhookpayload", - "StartScheduledSyncResult": ".startscheduledsyncresult", - "StartScheduledSyncResultTypedDict": ".startscheduledsyncresult", - "SyncStatusResult": ".syncstatusresult", - "SyncStatusResultTypedDict": ".syncstatusresult", - "TargetAccountOption": ".targetaccountoption", - "TargetAccountOptionTypedDict": ".targetaccountoption", - "Validation": ".validation", - "ValidationTypedDict": ".validation", - "ValidationItem": ".validationitem", - "ValidationItemTypedDict": ".validationitem", +_dynamic_imports: dict[str, tuple[str, str]] = { + 'AccessToken': ('codat_bankfeeds.models.access_token', 'AccessToken'), + 'AccessTokenTypedDict': ('codat_bankfeeds.models.access_token', 'AccessTokenTypedDict'), + 'AccountInfo': ('codat_bankfeeds.models.shared.accountinfo', 'AccountInfo'), + 'AccountInfoTypedDict': ('codat_bankfeeds.models.shared.accountinfo', 'AccountInfoTypedDict'), + 'AccountType': ('codat_bankfeeds.models.shared.accounttype', 'AccountType'), + 'AccountingBankAccount': ('codat_bankfeeds.models.accounting_bank_account', 'AccountingBankAccount'), + 'AccountingBankAccountTypedDict': ('codat_bankfeeds.models.accounting_bank_account', 'AccountingBankAccountTypedDict'), + 'BankAccountCreateResponse': ('codat_bankfeeds.models.shared.bankaccountcreateresponse', 'BankAccountCreateResponse'), + 'BankAccountCreateResponseAllOfData': ('codat_bankfeeds.models.bank_account_create_response_all_of_data', 'BankAccountCreateResponseAllOfData'), + 'BankAccountCreateResponseAllOfDataTypedDict': ('codat_bankfeeds.models.bank_account_create_response_all_of_data', 'BankAccountCreateResponseAllOfDataTypedDict'), + 'BankAccountCreateResponseBankAccountType': ('codat_bankfeeds.models.bank_account_create_response_bank_account_type', 'BankAccountCreateResponseBankAccountType'), + 'BankAccountCreateResponseTypedDict': ('codat_bankfeeds.models.shared.bankaccountcreateresponse', 'BankAccountCreateResponseTypedDict'), + 'BankAccountCredentials': ('codat_bankfeeds.models.shared.bankaccountcredentials', 'BankAccountCredentials'), + 'BankAccountCredentialsTypedDict': ('codat_bankfeeds.models.shared.bankaccountcredentials', 'BankAccountCredentialsTypedDict'), + 'BankAccountPrototype': ('codat_bankfeeds.models.shared.bankaccountprototype', 'BankAccountPrototype'), + 'BankAccountPrototypeTypedDict': ('codat_bankfeeds.models.shared.bankaccountprototype', 'BankAccountPrototypeTypedDict'), + 'BankAccountStatus': ('codat_bankfeeds.models.shared.bankaccountstatus', 'BankAccountStatus'), + 'BankAccountType': ('codat_bankfeeds.models.bank_account_type', 'BankAccountType'), + 'BankAccounts': ('codat_bankfeeds.models.shared.bankaccounts', 'BankAccounts'), + 'BankAccountsAccountingBankAccount': ('codat_bankfeeds.models.accounting_bank_account', 'AccountingBankAccount'), + 'BankAccountsAccountingBankAccountTypedDict': ('codat_bankfeeds.models.accounting_bank_account', 'AccountingBankAccountTypedDict'), + 'BankAccountsBankAccountType': ('codat_bankfeeds.models.bank_accounts_bank_account_type', 'BankAccountsBankAccountType'), + 'BankAccountsMetadata': ('codat_bankfeeds.models.metadata', 'Metadata'), + 'BankAccountsMetadataTypedDict': ('codat_bankfeeds.models.metadata', 'MetadataTypedDict'), + 'BankAccountsSupplementalData': ('codat_bankfeeds.models.supplemental_data', 'SupplementalData'), + 'BankAccountsSupplementalDataTypedDict': ('codat_bankfeeds.models.supplemental_data', 'SupplementalDataTypedDict'), + 'BankAccountsTypedDict': ('codat_bankfeeds.models.shared.bankaccounts', 'BankAccountsTypedDict'), + 'BankFeedAccountMapping': ('codat_bankfeeds.models.shared.bankfeedaccountmapping', 'BankFeedAccountMapping'), + 'BankFeedAccountMappingResponse': ('codat_bankfeeds.models.shared.bankfeedaccountmappingresponse', 'BankFeedAccountMappingResponse'), + 'BankFeedAccountMappingResponseTypedDict': ('codat_bankfeeds.models.shared.bankfeedaccountmappingresponse', 'BankFeedAccountMappingResponseTypedDict'), + 'BankFeedAccountMappingTypedDict': ('codat_bankfeeds.models.shared.bankfeedaccountmapping', 'BankFeedAccountMappingTypedDict'), + 'BankFeedMapping': ('codat_bankfeeds.models.shared.bankfeedmapping', 'BankFeedMapping'), + 'BankFeedMappingTypedDict': ('codat_bankfeeds.models.shared.bankfeedmapping', 'BankFeedMappingTypedDict'), + 'BankTransaction': ('codat_bankfeeds.models.bank_transaction', 'BankTransaction'), + 'BankTransactionType': ('codat_bankfeeds.models.bank_transaction_type', 'BankTransactionType'), + 'BankTransactionTypedDict': ('codat_bankfeeds.models.bank_transaction', 'BankTransactionTypedDict'), + 'BankTransactions': ('codat_bankfeeds.models.bank_transaction', 'BankTransaction'), + 'BankTransactionsTypedDict': ('codat_bankfeeds.models.bank_transaction', 'BankTransactionTypedDict'), + 'ClientRateLimitWebhook': ('codat_bankfeeds.models.shared.clientratelimitwebhook', 'ClientRateLimitWebhook'), + 'ClientRateLimitWebhookPayload': ('codat_bankfeeds.models.shared.clientratelimitwebhookpayload', 'ClientRateLimitWebhookPayload'), + 'ClientRateLimitWebhookPayloadTypedDict': ('codat_bankfeeds.models.shared.clientratelimitwebhookpayload', 'ClientRateLimitWebhookPayloadTypedDict'), + 'ClientRateLimitWebhookTypedDict': ('codat_bankfeeds.models.shared.clientratelimitwebhook', 'ClientRateLimitWebhookTypedDict'), + 'Companies': ('codat_bankfeeds.models.shared.companies', 'Companies'), + 'CompaniesTypedDict': ('codat_bankfeeds.models.shared.companies', 'CompaniesTypedDict'), + 'Company': ('codat_bankfeeds.models.shared.company', 'Company'), + 'CompanyAccessToken': ('codat_bankfeeds.models.shared.companyaccesstoken', 'CompanyAccessToken'), + 'CompanyAccessTokenTypedDict': ('codat_bankfeeds.models.shared.companyaccesstoken', 'CompanyAccessTokenTypedDict'), + 'CompanyDetails': ('codat_bankfeeds.models.company_details', 'CompanyDetails'), + 'CompanyDetailsTypedDict': ('codat_bankfeeds.models.company_details', 'CompanyDetailsTypedDict'), + 'CompanyInformation': ('codat_bankfeeds.models.shared.companyinformation', 'CompanyInformation'), + 'CompanyInformationTypedDict': ('codat_bankfeeds.models.shared.companyinformation', 'CompanyInformationTypedDict'), + 'CompanyReference': ('codat_bankfeeds.models.shared.companyreference', 'CompanyReference'), + 'CompanyReferenceLinks': ('codat_bankfeeds.models.company_reference_links', 'CompanyReferenceLinks'), + 'CompanyReferenceLinksTypedDict': ('codat_bankfeeds.models.company_reference_links', 'CompanyReferenceLinksTypedDict'), + 'CompanyReferenceTypedDict': ('codat_bankfeeds.models.shared.companyreference', 'CompanyReferenceTypedDict'), + 'CompanyRequestBody': ('codat_bankfeeds.models.shared.companyrequestbody', 'CompanyRequestBody'), + 'CompanyRequestBodyTypedDict': ('codat_bankfeeds.models.shared.companyrequestbody', 'CompanyRequestBodyTypedDict'), + 'CompanyTypedDict': ('codat_bankfeeds.models.shared.company', 'CompanyTypedDict'), + 'CompanyUpdateRequest': ('codat_bankfeeds.models.shared.companyupdaterequest', 'CompanyUpdateRequest'), + 'CompanyUpdateRequestTypedDict': ('codat_bankfeeds.models.shared.companyupdaterequest', 'CompanyUpdateRequestTypedDict'), + 'Connection': ('codat_bankfeeds.models.shared.connection', 'Connection'), + 'ConnectionTypedDict': ('codat_bankfeeds.models.shared.connection', 'ConnectionTypedDict'), + 'Connections': ('codat_bankfeeds.models.shared.connections', 'Connections'), + 'ConnectionsTypedDict': ('codat_bankfeeds.models.shared.connections', 'ConnectionsTypedDict'), + 'CreateBankTransactions': ('codat_bankfeeds.models.shared.createbanktransactions', 'CreateBankTransactions'), + 'CreateBankTransactionsResponse': ('codat_bankfeeds.models.shared.createbanktransactionsresponse', 'CreateBankTransactionsResponse'), + 'CreateBankTransactionsResponseTypedDict': ('codat_bankfeeds.models.shared.createbanktransactionsresponse', 'CreateBankTransactionsResponseTypedDict'), + 'CreateBankTransactionsTypedDict': ('codat_bankfeeds.models.shared.createbanktransactions', 'CreateBankTransactionsTypedDict'), + 'CreateBatchSourceAccount201ResponseInner': ('codat_bankfeeds.models.create_batch_source_account201_response_inner', 'CreateBatchSourceAccount201ResponseInner'), + 'CreateBatchSourceAccount201ResponseInnerTypedDict': ('codat_bankfeeds.models.create_batch_source_account201_response_inner', 'CreateBatchSourceAccount201ResponseInnerTypedDict'), + 'CreateBatchSourceAccount207ResponseInner': ('codat_bankfeeds.models.create_batch_source_account207_response_inner', 'CreateBatchSourceAccount207ResponseInner'), + 'CreateBatchSourceAccount207ResponseInnerTypedDict': ('codat_bankfeeds.models.create_batch_source_account207_response_inner', 'CreateBatchSourceAccount207ResponseInnerTypedDict'), + 'CreateBatchSourceAccountRequestBody': ('codat_bankfeeds.models.create_batch_source_account_request_body', 'CreateBatchSourceAccountRequestBody'), + 'CreateBatchSourceAccountRequestBodyTypedDict': ('codat_bankfeeds.models.create_batch_source_account_request_body', 'CreateBatchSourceAccountRequestBodyTypedDict'), + 'CreateConnectionRequest': ('codat_bankfeeds.models.create_connection_request', 'CreateConnectionRequest'), + 'CreateConnectionRequestTypedDict': ('codat_bankfeeds.models.create_connection_request', 'CreateConnectionRequestTypedDict'), + 'CreateSourceAccount200Response': ('codat_bankfeeds.models.create_source_account200_response', 'CreateSourceAccount200Response'), + 'CreateSourceAccount200ResponseTypedDict': ('codat_bankfeeds.models.create_source_account200_response', 'CreateSourceAccount200ResponseTypedDict'), + 'CreateSourceAccountRequest': ('codat_bankfeeds.models.create_source_account_request', 'CreateSourceAccountRequest'), + 'CreateSourceAccountRequestTypedDict': ('codat_bankfeeds.models.create_source_account_request', 'CreateSourceAccountRequestTypedDict'), + 'DataConnectionError': ('codat_bankfeeds.models.shared.dataconnectionerror', 'DataConnectionError'), + 'DataConnectionErrorTypedDict': ('codat_bankfeeds.models.shared.dataconnectionerror', 'DataConnectionErrorTypedDict'), + 'DataConnectionStatus': ('codat_bankfeeds.models.shared.dataconnectionstatus', 'DataConnectionStatus'), + 'DataType': ('codat_bankfeeds.models.shared.datatype', 'DataType'), + 'DatasetStatus': ('codat_bankfeeds.models.dataset_status', 'DatasetStatus'), + 'ErrorMessage': ('codat_bankfeeds.models.error_message', 'ErrorMessage'), + 'ErrorMessageTypedDict': ('codat_bankfeeds.models.error_message', 'ErrorMessageTypedDict'), + 'ErrorStatus': ('codat_bankfeeds.models.error_status', 'ErrorStatus'), + 'ErrorValidation': ('codat_bankfeeds.models.shared.errorvalidation', 'ErrorValidation'), + 'ErrorValidationItem': ('codat_bankfeeds.models.shared.errorvalidationitem', 'ErrorValidationItem'), + 'ErrorValidationItemTypedDict': ('codat_bankfeeds.models.shared.errorvalidationitem', 'ErrorValidationItemTypedDict'), + 'ErrorValidationTypedDict': ('codat_bankfeeds.models.shared.errorvalidation', 'ErrorValidationTypedDict'), + 'GenerateOtpResponse': ('codat_bankfeeds.models.shared.generateotpresponse', 'GenerateOtpResponse'), + 'GenerateOtpResponseTypedDict': ('codat_bankfeeds.models.shared.generateotpresponse', 'GenerateOtpResponseTypedDict'), + 'HalRef': ('codat_bankfeeds.models.shared.halref', 'HalRef'), + 'HalRefTypedDict': ('codat_bankfeeds.models.shared.halref', 'HalRefTypedDict'), + 'Items': ('codat_bankfeeds.models.items', 'Items'), + 'ItemsBankAccountType': ('codat_bankfeeds.models.items_bank_account_type', 'ItemsBankAccountType'), + 'ItemsTypedDict': ('codat_bankfeeds.models.items', 'ItemsTypedDict'), + 'Links': ('codat_bankfeeds.models.shared.links', 'Links'), + 'LinksTypedDict': ('codat_bankfeeds.models.shared.links', 'LinksTypedDict'), + 'ListSourceAccounts200Response': ('codat_bankfeeds.models.list_source_accounts200_response', 'ListSourceAccounts200Response'), + 'ListSourceAccounts200ResponseTypedDict': ('codat_bankfeeds.models.list_source_accounts200_response', 'ListSourceAccounts200ResponseTypedDict'), + 'Metadata': ('codat_bankfeeds.models.metadata', 'Metadata'), + 'MetadataTypedDict': ('codat_bankfeeds.models.metadata', 'MetadataTypedDict'), + 'Model1': ('codat_bankfeeds.models.model1', 'Model1'), + 'Model1TypedDict': ('codat_bankfeeds.models.model1', 'Model1TypedDict'), + 'PullOperation': ('codat_bankfeeds.models.pull_operation', 'PullOperation'), + 'PullOperationTypedDict': ('codat_bankfeeds.models.pull_operation', 'PullOperationTypedDict'), + 'PullOperations': ('codat_bankfeeds.models.pull_operations', 'PullOperations'), + 'PullOperationsTypedDict': ('codat_bankfeeds.models.pull_operations', 'PullOperationsTypedDict'), + 'PushChangeType': ('codat_bankfeeds.models.shared.pushchangetype', 'PushChangeType'), + 'PushFieldValidation': ('codat_bankfeeds.models.shared.pushfieldvalidation', 'PushFieldValidation'), + 'PushFieldValidationTypedDict': ('codat_bankfeeds.models.shared.pushfieldvalidation', 'PushFieldValidationTypedDict'), + 'PushOperation': ('codat_bankfeeds.models.shared.pushoperation', 'PushOperation'), + 'PushOperationChange': ('codat_bankfeeds.models.shared.pushoperationchange', 'PushOperationChange'), + 'PushOperationChangeTypedDict': ('codat_bankfeeds.models.shared.pushoperationchange', 'PushOperationChangeTypedDict'), + 'PushOperationRef': ('codat_bankfeeds.models.shared.pushoperationref', 'PushOperationRef'), + 'PushOperationRefTypedDict': ('codat_bankfeeds.models.shared.pushoperationref', 'PushOperationRefTypedDict'), + 'PushOperationStatus': ('codat_bankfeeds.models.shared.pushoperationstatus', 'PushOperationStatus'), + 'PushOperationTypedDict': ('codat_bankfeeds.models.shared.pushoperation', 'PushOperationTypedDict'), + 'PushOperations': ('codat_bankfeeds.models.shared.pushoperations', 'PushOperations'), + 'PushOperationsTypedDict': ('codat_bankfeeds.models.shared.pushoperations', 'PushOperationsTypedDict'), + 'PushOption': ('codat_bankfeeds.models.shared.pushoption', 'PushOption'), + 'PushOptionChoice': ('codat_bankfeeds.models.shared.pushoptionchoice', 'PushOptionChoice'), + 'PushOptionChoiceTypedDict': ('codat_bankfeeds.models.shared.pushoptionchoice', 'PushOptionChoiceTypedDict'), + 'PushOptionProperty': ('codat_bankfeeds.models.shared.pushoptionproperty', 'PushOptionProperty'), + 'PushOptionPropertyTypedDict': ('codat_bankfeeds.models.shared.pushoptionproperty', 'PushOptionPropertyTypedDict'), + 'PushOptionType': ('codat_bankfeeds.models.shared.pushoptiontype', 'PushOptionType'), + 'PushOptionTypedDict': ('codat_bankfeeds.models.shared.pushoption', 'PushOptionTypedDict'), + 'PushValidationInfo': ('codat_bankfeeds.models.shared.pushvalidationinfo', 'PushValidationInfo'), + 'PushValidationInfoTypedDict': ('codat_bankfeeds.models.shared.pushvalidationinfo', 'PushValidationInfoTypedDict'), + 'Result': ('codat_bankfeeds.models.source_account_batch_error_response_result', 'SourceAccountBatchErrorResponseResult'), + 'ResultTypedDict': ('codat_bankfeeds.models.source_account_batch_error_response_result', 'SourceAccountBatchErrorResponseResultTypedDict'), + 'RoutingInfo': ('codat_bankfeeds.models.shared.routinginfo', 'RoutingInfo'), + 'RoutingInfoTypedDict': ('codat_bankfeeds.models.shared.routinginfo', 'RoutingInfoTypedDict'), + 'Security': ('codat_bankfeeds.models.shared.security', 'Security'), + 'SecurityTypedDict': ('codat_bankfeeds.models.shared.security', 'SecurityTypedDict'), + 'SourceAccount': ('codat_bankfeeds.models.shared.sourceaccount', 'SourceAccount'), + 'SourceAccountBatchCreateResponse': ('codat_bankfeeds.models.shared.sourceaccountbatchcreateresponse', 'SourceAccountBatchCreateResponse'), + 'SourceAccountBatchCreateResponseTypedDict': ('codat_bankfeeds.models.shared.sourceaccountbatchcreateresponse', 'SourceAccountBatchCreateResponseTypedDict'), + 'SourceAccountBatchCreateResult': ('codat_bankfeeds.models.shared.sourceaccountbatchcreateresult', 'SourceAccountBatchCreateResult'), + 'SourceAccountBatchCreateResultTypedDict': ('codat_bankfeeds.models.shared.sourceaccountbatchcreateresult', 'SourceAccountBatchCreateResultTypedDict'), + 'SourceAccountBatchErrorResponse': ('codat_bankfeeds.models.shared.sourceaccountbatcherrorresponse', 'SourceAccountBatchErrorResponse'), + 'SourceAccountBatchErrorResponseResult': ('codat_bankfeeds.models.source_account_batch_error_response_result', 'SourceAccountBatchErrorResponseResult'), + 'SourceAccountBatchErrorResponseResultTypedDict': ('codat_bankfeeds.models.source_account_batch_error_response_result', 'SourceAccountBatchErrorResponseResultTypedDict'), + 'SourceAccountBatchErrorResponseTypedDict': ('codat_bankfeeds.models.shared.sourceaccountbatcherrorresponse', 'SourceAccountBatchErrorResponseTypedDict'), + 'SourceAccountPrototype': ('codat_bankfeeds.models.shared.sourceaccountprototype', 'SourceAccountPrototype'), + 'SourceAccountPrototypeTypedDict': ('codat_bankfeeds.models.shared.sourceaccountprototype', 'SourceAccountPrototypeTypedDict'), + 'SourceAccountTypedDict': ('codat_bankfeeds.models.shared.sourceaccount', 'SourceAccountTypedDict'), + 'SourceAccountV2': ('codat_bankfeeds.models.source_account_v2', 'SourceAccountV2'), + 'SourceAccountV2AccountType': ('codat_bankfeeds.models.shared.sourceaccountv2', 'SourceAccountV2AccountType'), + 'SourceAccountV2BatchCreateResponse': ('codat_bankfeeds.models.shared.sourceaccountv2batchcreateresponse', 'SourceAccountV2BatchCreateResponse'), + 'SourceAccountV2BatchCreateResponseTypedDict': ('codat_bankfeeds.models.shared.sourceaccountv2batchcreateresponse', 'SourceAccountV2BatchCreateResponseTypedDict'), + 'SourceAccountV2BatchCreateResult': ('codat_bankfeeds.models.shared.sourceaccountv2batchcreateresult', 'SourceAccountV2BatchCreateResult'), + 'SourceAccountV2BatchCreateResultTypedDict': ('codat_bankfeeds.models.shared.sourceaccountv2batchcreateresult', 'SourceAccountV2BatchCreateResultTypedDict'), + 'SourceAccountV2Prototype': ('codat_bankfeeds.models.shared.sourceaccountv2prototype', 'SourceAccountV2Prototype'), + 'SourceAccountV2PrototypeTypedDict': ('codat_bankfeeds.models.shared.sourceaccountv2prototype', 'SourceAccountV2PrototypeTypedDict'), + 'SourceAccountV2Status': ('codat_bankfeeds.models.source_account_v2_status', 'SourceAccountV2Status'), + 'SourceAccountV2TypedDict': ('codat_bankfeeds.models.source_account_v2', 'SourceAccountV2TypedDict'), + 'SourceAccountWebhook': ('codat_bankfeeds.models.shared.sourceaccountwebhook', 'SourceAccountWebhook'), + 'SourceAccountWebhookPayload': ('codat_bankfeeds.models.shared.sourceaccountwebhookpayload', 'SourceAccountWebhookPayload'), + 'SourceAccountWebhookPayloadSourceAccount': ('codat_bankfeeds.models.shared.source_account_webhook_payload_source_account', 'SourceAccountWebhookPayloadSourceAccount'), + 'SourceAccountWebhookPayloadSourceAccountTypedDict': ('codat_bankfeeds.models.shared.source_account_webhook_payload_source_account_typed_dict', 'SourceAccountWebhookPayloadSourceAccountTypedDict'), + 'SourceAccountWebhookPayloadTypedDict': ('codat_bankfeeds.models.shared.sourceaccountwebhookpayload', 'SourceAccountWebhookPayloadTypedDict'), + 'SourceAccountWebhookTypedDict': ('codat_bankfeeds.models.shared.sourceaccountwebhook', 'SourceAccountWebhookTypedDict'), + 'SourceType': ('codat_bankfeeds.models.source_type', 'SourceType'), + 'StartScheduledSyncResult': ('codat_bankfeeds.models.shared.startscheduledsyncresult', 'StartScheduledSyncResult'), + 'StartScheduledSyncResultTypedDict': ('codat_bankfeeds.models.shared.startscheduledsyncresult', 'StartScheduledSyncResultTypedDict'), + 'Status': ('codat_bankfeeds.models.status', 'Status'), + 'SupplementalData': ('codat_bankfeeds.models.supplemental_data', 'SupplementalData'), + 'SupplementalDataTypedDict': ('codat_bankfeeds.models.supplemental_data', 'SupplementalDataTypedDict'), + 'SyncStatusResult': ('codat_bankfeeds.models.shared.syncstatusresult', 'SyncStatusResult'), + 'SyncStatusResultTypedDict': ('codat_bankfeeds.models.shared.syncstatusresult', 'SyncStatusResultTypedDict'), + 'TargetAccountOption': ('codat_bankfeeds.models.shared.targetaccountoption', 'TargetAccountOption'), + 'TargetAccountOptionTypedDict': ('codat_bankfeeds.models.shared.targetaccountoption', 'TargetAccountOptionTypedDict'), + 'Type': ('codat_bankfeeds.models.type', 'Type'), + 'UpdateConnection': ('codat_bankfeeds.models.update_connection', 'UpdateConnection'), + 'UpdateConnectionTypedDict': ('codat_bankfeeds.models.update_connection', 'UpdateConnectionTypedDict'), + 'Validation': ('codat_bankfeeds.models.shared.validation', 'Validation'), + 'ValidationItem': ('codat_bankfeeds.models.shared.validationitem', 'ValidationItem'), + 'ValidationItemTypedDict': ('codat_bankfeeds.models.shared.validationitem', 'ValidationItemTypedDict'), + 'ValidationTypedDict': ('codat_bankfeeds.models.shared.validation', 'ValidationTypedDict'), } -def __getattr__(attr_name: str) -> Any: - return lazy_getattr( - attr_name, package=__package__, dynamic_imports=_dynamic_imports - ) +def __getattr__(attr_name): + try: + module_path, source_name = _dynamic_imports[attr_name] + except KeyError: + raise AttributeError( + f"module {__name__!r} has no attribute {attr_name!r}" + ) from None + module = import_module(module_path, __package__) + return getattr(module, source_name) def __dir__(): - return lazy_dir(dynamic_imports=_dynamic_imports) + return sorted(set(globals()) | set(_dynamic_imports)) diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/accountinfo.py b/bank-feeds/src/codat_bankfeeds/models/shared/accountinfo.py index 4969f6452..82bb76ed1 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/accountinfo.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/accountinfo.py @@ -1,94 +1,115 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + from __future__ import annotations -from codat_bankfeeds.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_bankfeeds.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 +from codat_bankfeeds.utils.serializers import serialize_decimal, validate_decimal +import pprint +import re # noqa: F401 +import json +from pydantic import BeforeValidator, PlainSerializer, BaseModel, ConfigDict, Field, model_serializer +from typing import Annotated, Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict -class AccountInfoTypedDict(TypedDict): - account_open_date: NotRequired[Nullable[str]] - r"""In Codat's data model, dates are represented using the ISO 8601 standard. Date fields are formatted as strings; for example: - ``` - 2020-10-08 - ``` +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL +class AccountInfo(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'accountOpenDate', 'account_open_date', 'availableBalance', 'available_balance', 'description', 'nickname'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ - available_balance: NotRequired[Nullable[Decimal]] - r"""Balance of funds available for use. This includes pending activity.""" - description: NotRequired[Nullable[str]] - r"""Description of the account.""" - nickname: NotRequired[Nullable[str]] - r"""Name given to the account by the user. Used in UIs to assist in account selection.""" + AccountInfo + """ # noqa: E501 + description: OptionalNullable[str] = Field(default=UNSET, description="Description of the account.") + nickname: OptionalNullable[str] = Field(default=UNSET, description="Name given to the account by the user. Used in UIs to assist in account selection.") + account_open_date: OptionalNullable[str] = Field(default=UNSET, description="In Codat's data model, dates are represented using the ISO 8601 standard. Date fields are formatted as strings; for example: ``` 2020-10-08 ```", alias="accountOpenDate") + available_balance: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Balance of funds available for use. This includes pending activity.", alias="availableBalance") + __properties: ClassVar[List[str]] = ["description", "nickname", "accountOpenDate", "availableBalance"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class AccountInfo(BaseModel): - account_open_date: Annotated[ - OptionalNullable[str], pydantic.Field(alias="accountOpenDate") - ] = UNSET - r"""In Codat's data model, dates are represented using the ISO 8601 standard. Date fields are formatted as strings; for example: - ``` - 2020-10-08 - ``` - """ - available_balance: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="availableBalance"), - ] = UNSET - r"""Balance of funds available for use. This includes pending activity.""" + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - description: OptionalNullable[str] = UNSET - r"""Description of the account.""" + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - nickname: OptionalNullable[str] = UNSET - r"""Name given to the account by the user. Used in UIs to assist in account selection.""" + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AccountInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["accountOpenDate", "availableBalance", "description", "nickname"] - ) - nullable_fields = set( - ["accountOpenDate", "availableBalance", "description", "nickname"] + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, ) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -try: - AccountInfo.model_rebuild() -except NameError: - pass + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "description": obj.get("description"), + "nickname": obj.get("nickname"), + "accountOpenDate": obj.get("accountOpenDate"), + "availableBalance": obj.get("availableBalance") + }) + return _obj + + + + + +class AccountInfoTypedDict(TypedDict): + """TypedDict variant of AccountInfo, for dict-literal request/response inputs.""" + description: NotRequired[Optional[str]] + nickname: NotRequired[Optional[str]] + account_open_date: NotRequired[Optional[str]] + available_balance: NotRequired[Optional[Decimal]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/accounttype.py b/bank-feeds/src/codat_bankfeeds/models/shared/accounttype.py index a2db0ccb0..9e3334aaf 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/accounttype.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/accounttype.py @@ -1,14 +1,12 @@ -"""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 bank account e.g. checking, savings, loan, creditCard, prepaidCard.""" - - CHECKING = "checking" - SAVINGS = "savings" - LOAN = "loan" - CREDIT_CARD = "creditCard" - PREPAID_CARD = "prepaidCard" + """AccountType enum (lifted from inline OAS enum).""" + CHECKING = 'checking' + SAVINGS = 'savings' + LOAN = 'loan' + CREDIT_CARD = 'creditCard' + PREPAID_CARD = 'prepaidCard' diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/bankaccountcreateresponse.py b/bank-feeds/src/codat_bankfeeds/models/shared/bankaccountcreateresponse.py index c1f6d9b07..3b9d00050 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/bankaccountcreateresponse.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/bankaccountcreateresponse.py @@ -1,594 +1,161 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .bankaccountstatus import BankAccountStatus -from .datatype import DataType -from .pushoperationchange import PushOperationChange, PushOperationChangeTypedDict -from .pushoperationstatus import PushOperationStatus -from .validation import Validation, ValidationTypedDict -from codat_bankfeeds.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_bankfeeds.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 Any, Dict, List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict, deprecated - - -class BankAccountCreateResponseBankAccountType(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 MetadataTypedDict(TypedDict): - is_deleted: NotRequired[Nullable[bool]] - r"""Indicates whether the record has been deleted in the third-party system this record originated from.""" - - -class Metadata(BaseModel): - is_deleted: Annotated[OptionalNullable[bool], pydantic.Field(alias="isDeleted")] = ( - UNSET - ) - r"""Indicates whether the record has been deleted in the third-party system this record originated from.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["isDeleted"]) - nullable_fields = set(["isDeleted"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) +""" + Bank Feeds - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | - return m - - -class SupplementalDataTypedDict(TypedDict): - r"""Supplemental data is additional data you can include in our standard data types. - - It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. - """ + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - content: NotRequired[Nullable[Dict[str, Dict[str, Any]]]] + Do not edit the class manually. +""" # noqa: E501 -class SupplementalData(BaseModel): - r"""Supplemental data is additional data you can include in our standard data types. - - It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. - """ - - content: OptionalNullable[Dict[str, Dict[str, Any]]] = UNSET +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_bankfeeds.models.bank_account_create_response_all_of_data import BankAccountCreateResponseAllOfData, BankAccountCreateResponseAllOfDataTypedDict +from codat_bankfeeds.models.shared.datatype import DataType +from codat_bankfeeds.models.shared.pushoperationchange import PushOperationChange, PushOperationChangeTypedDict +from codat_bankfeeds.models.shared.pushoperationstatus import PushOperationStatus +from codat_bankfeeds.models.shared.validation import Validation, ValidationTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL +class BankAccountCreateResponse(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["content"]) - nullable_fields = set(["content"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -@deprecated( - "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." -) -class AccountingBankAccountTypedDict(TypedDict): - r"""> **Accessing Bank Accounts through Banking API** - > - > This datatype was originally used for accessing bank account data both in accounting integrations and open banking aggregators. - > - > To view bank account data through the Banking API, please refer to the new [Banking: Account](https://docs.codat.io/bank-feeds-api#/schemas/Account) data type. - - ## Overview - - A list of bank accounts associated with a company and a specific data connection. - - Bank accounts data includes: - * The name and ID of the account in the accounting software. - * The currency and balance of the account. - * The sort code and account number. - """ - - account_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. - - FreeAgent integrations - For Credit accounts, only the last four digits are required. For other types, the field is optional. - """ - account_type: NotRequired[BankAccountCreateResponseBankAccountType] - 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. - """ - available_balance: NotRequired[Nullable[Decimal]] - r"""Total available balance of the bank account as reported by the underlying data source. This may take into account overdrafts or pending transactions for example.""" - balance: NotRequired[Nullable[Decimal]] - r"""Balance of the bank 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. - """ - i_ban: NotRequired[Nullable[str]] - r"""International bank account number of the account. Often used when making or receiving international payments.""" - id: NotRequired[str] - r"""Identifier for the account, unique for the company in the accounting software.""" - institution: NotRequired[Nullable[str]] - r"""The institution of the bank account.""" - metadata: NotRequired[MetadataTypedDict] - modified_date: NotRequired[str] - nominal_code: NotRequired[Nullable[str]] - r"""Code used to identify each nominal account for a business.""" - overdraft_limit: NotRequired[Nullable[Decimal]] - r"""Pre-arranged overdraft limit of the account. - - The value is always positive. For example, an overdraftLimit of `1000` means that the balance of the account can go down to `-1000`. - """ - 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. - """ - source_modified_date: NotRequired[str] - status: NotRequired[BankAccountStatus] - r"""Status of the bank account.""" - supplemental_data: NotRequired[SupplementalDataTypedDict] - r"""Supplemental data is additional data you can include in our standard data types. - - It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. - """ - - -@deprecated( - "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." -) -class AccountingBankAccount(BaseModel): - r"""> **Accessing Bank Accounts through Banking API** - > - > This datatype was originally used for accessing bank account data both in accounting integrations and open banking aggregators. - > - > To view bank account data through the Banking API, please refer to the new [Banking: Account](https://docs.codat.io/bank-feeds-api#/schemas/Account) data type. - - ## Overview - - A list of bank accounts associated with a company and a specific data connection. - - Bank accounts data includes: - * The name and ID of the account in the accounting software. - * The currency and balance of the account. - * The sort code and account number. - """ - - account_name: Annotated[ - OptionalNullable[str], pydantic.Field(alias="accountName") - ] = 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. - - FreeAgent integrations - For Credit accounts, only the last four digits are required. For other types, the field is optional. - """ - - account_type: Annotated[ - Optional[BankAccountCreateResponseBankAccountType], - 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. - """ - - available_balance: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="availableBalance"), - ] = UNSET - r"""Total available balance of the bank account as reported by the underlying data source. This may take into account overdrafts or pending transactions for example.""" - - balance: Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = UNSET - r"""Balance of the bank 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. - """ - - i_ban: Annotated[OptionalNullable[str], pydantic.Field(alias="iBan")] = UNSET - r"""International bank account number of the account. Often used when making or receiving international payments.""" - - id: Optional[str] = None - r"""Identifier for the account, unique for the company in the accounting software.""" - - institution: OptionalNullable[str] = UNSET - r"""The institution of the bank account.""" - - metadata: Optional[Metadata] = None - - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None - - nominal_code: Annotated[ - OptionalNullable[str], pydantic.Field(alias="nominalCode") - ] = UNSET - r"""Code used to identify each nominal account for a business.""" - - overdraft_limit: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="overdraftLimit"), - ] = UNSET - r"""Pre-arranged overdraft limit of the account. + _nullable = {'changes', 'data', 'errorMessage', 'error_message', 'timeoutInMinutes', 'timeoutInSeconds', 'timeout_in_minutes', 'timeout_in_seconds'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + BankAccountCreateResponse + """ # noqa: E501 + changes: OptionalNullable[List[PushOperationChange]] = Field(default=UNSET, description="Contains a single entry that communicates which record has changed and the manner in which it changed. ") + data_type: Optional[DataType] = Field(default=None, description="The type of data being pushed, eg invoices, customers.", alias="dataType") + company_id: str = Field(description="Unique identifier for your SMB in Codat.", alias="companyId") + push_operation_key: str = Field(description="A unique identifier generated by Codat to represent this single push operation. This identifier can be used to track the status of the push, and should be persisted.", alias="pushOperationKey") + data_connection_key: str = Field(description="Unique identifier for a company's data connection.", alias="dataConnectionKey") + requested_on_utc: str = Field(description="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.", alias="requestedOnUtc") + completed_on_utc: Optional[str] = Field(default=None, description="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.", alias="completedOnUtc") + timeout_in_minutes: OptionalNullable[int] = Field(default=UNSET, description="Number of minutes the push operation must complete within before it times out.", alias="timeoutInMinutes") + timeout_in_seconds: OptionalNullable[int] = Field(default=UNSET, description="Number of seconds the push operation must complete within before it times out.", alias="timeoutInSeconds") + status: PushOperationStatus + error_message: OptionalNullable[str] = Field(default=UNSET, description="A message about the error.", alias="errorMessage") + validation: Optional[Validation] = None + status_code: int = Field(description="Push status code.", alias="statusCode") + data: OptionalNullable[BankAccountCreateResponseAllOfData] = UNSET + __properties: ClassVar[List[str]] = ["changes", "dataType", "companyId", "pushOperationKey", "dataConnectionKey", "requestedOnUtc", "completedOnUtc", "timeoutInMinutes", "timeoutInSeconds", "status", "errorMessage", "validation", "statusCode", "data"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - The value is always positive. For example, an overdraftLimit of `1000` means that the balance of the account can go down to `-1000`. - """ - sort_code: Annotated[OptionalNullable[str], pydantic.Field(alias="sortCode")] = ( - UNSET - ) - r"""Sort code for the bank account. + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - 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. - """ + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BankAccountCreateResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - status: Optional[BankAccountStatus] = None - r"""Status of the bank account.""" + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - supplemental_data: Annotated[ - Optional[SupplementalData], pydantic.Field(alias="supplementalData") - ] = None - r"""Supplemental data is additional data you can include in our standard data types. + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. - """ + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "accountName", - "accountNumber", - "accountType", - "availableBalance", - "balance", - "currency", - "iBan", - "id", - "institution", - "metadata", - "modifiedDate", - "nominalCode", - "overdraftLimit", - "sortCode", - "sourceModifiedDate", - "status", - "supplementalData", - ] + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, ) - nullable_fields = set( - [ - "accountName", - "accountNumber", - "availableBalance", - "balance", - "iBan", - "institution", - "nominalCode", - "overdraftLimit", - "sortCode", - ] - ) - serialized = handler(self) - m = {} + # override the default output from pydantic by calling `to_dict()` of each item in changes (list) + _items = [] + if self.changes: + for _item_changes in self.changes: + if _item_changes: + _items.append(_item_changes.to_dict()) + _dict['changes'] = _items + # override the default output from pydantic by calling `to_dict()` of validation + if self.validation: + _dict['validation'] = self.validation.to_dict() + # override the default output from pydantic by calling `to_dict()` of data + if self.data: + _dict['data'] = self.data.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BankAccountCreateResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "changes": [PushOperationChange.from_dict(_item) for _item in obj["changes"]] if obj.get("changes") is not None else None, + "dataType": obj.get("dataType"), + "companyId": obj.get("companyId"), + "pushOperationKey": obj.get("pushOperationKey"), + "dataConnectionKey": obj.get("dataConnectionKey"), + "requestedOnUtc": obj.get("requestedOnUtc"), + "completedOnUtc": obj.get("completedOnUtc"), + "timeoutInMinutes": obj.get("timeoutInMinutes"), + "timeoutInSeconds": obj.get("timeoutInSeconds"), + "status": obj.get("status"), + "errorMessage": obj.get("errorMessage"), + "validation": Validation.from_dict(obj["validation"]) if obj.get("validation") is not None else None, + "statusCode": obj.get("statusCode"), + "data": BankAccountCreateResponseAllOfData.from_dict(obj["data"]) if obj.get("data") is not None else None + }) + return _obj - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - return m class BankAccountCreateResponseTypedDict(TypedDict): - company_id: str - r"""Unique identifier for your SMB in Codat.""" - data_connection_key: str - r"""Unique identifier for a company's data connection.""" - push_operation_key: str - r"""A unique identifier generated by Codat to represent this single push operation. This identifier can be used to track the status of the push, and should be persisted.""" - requested_on_utc: 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: PushOperationStatus - r"""The current status of the push operation.""" - status_code: int - r"""Push status code.""" - changes: NotRequired[Nullable[List[PushOperationChangeTypedDict]]] - r"""Contains a single entry that communicates which record has changed and the manner in which it changed.""" - completed_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. - """ - data: NotRequired[Nullable[AccountingBankAccountTypedDict]] - data_type: NotRequired[DataType] - r"""Available data types""" - error_message: NotRequired[Nullable[str]] - r"""A message about the error.""" - timeout_in_minutes: NotRequired[Nullable[int]] - r"""Number of minutes the push operation must complete within before it times out.""" - timeout_in_seconds: NotRequired[Nullable[int]] - r"""Number of seconds the push operation must complete within before it times out.""" - validation: NotRequired[ValidationTypedDict] - r"""A human-readable object describing validation decisions Codat has made when pushing data into the platform. If a push has failed because of validation errors, they will be detailed here.""" - - -class BankAccountCreateResponse(BaseModel): - company_id: Annotated[str, pydantic.Field(alias="companyId")] - r"""Unique identifier for your SMB in Codat.""" - - data_connection_key: Annotated[str, pydantic.Field(alias="dataConnectionKey")] - r"""Unique identifier for a company's data connection.""" - - push_operation_key: Annotated[str, pydantic.Field(alias="pushOperationKey")] - r"""A unique identifier generated by Codat to represent this single push operation. This identifier can be used to track the status of the push, and should be persisted.""" - - requested_on_utc: Annotated[str, pydantic.Field(alias="requestedOnUtc")] - 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. - """ - + """TypedDict variant of BankAccountCreateResponse, for dict-literal request/response inputs.""" + changes: NotRequired[Optional[List[PushOperationChangeTypedDict]]] + data_type: NotRequired[Optional[DataType]] + company_id: NotRequired[str] + push_operation_key: NotRequired[str] + data_connection_key: NotRequired[str] + requested_on_utc: NotRequired[str] + completed_on_utc: NotRequired[Optional[str]] + timeout_in_minutes: NotRequired[Optional[int]] + timeout_in_seconds: NotRequired[Optional[int]] status: PushOperationStatus - r"""The current status of the push operation.""" - - status_code: Annotated[int, pydantic.Field(alias="statusCode")] - r"""Push status code.""" - - changes: OptionalNullable[List[PushOperationChange]] = UNSET - r"""Contains a single entry that communicates which record has changed and the manner in which it changed.""" - - completed_on_utc: Annotated[ - Optional[str], pydantic.Field(alias="completedOnUtc") - ] = 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: OptionalNullable[AccountingBankAccount] = UNSET - - data_type: Annotated[Optional[DataType], pydantic.Field(alias="dataType")] = None - r"""Available data types""" - - error_message: Annotated[ - OptionalNullable[str], pydantic.Field(alias="errorMessage") - ] = UNSET - r"""A message about the error.""" - - timeout_in_minutes: Annotated[ - OptionalNullable[int], pydantic.Field(alias="timeoutInMinutes") - ] = UNSET - r"""Number of minutes the push operation must complete within before it times out.""" - - timeout_in_seconds: Annotated[ - OptionalNullable[int], - pydantic.Field( - deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible.", - alias="timeoutInSeconds", - ), - ] = UNSET - r"""Number of seconds the push operation must complete within before it times out.""" - - validation: Optional[Validation] = None - r"""A human-readable object describing validation decisions Codat has made when pushing data into the platform. If a push has failed because of validation errors, they will be detailed here.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "changes", - "completedOnUtc", - "data", - "dataType", - "errorMessage", - "timeoutInMinutes", - "timeoutInSeconds", - "validation", - ] - ) - nullable_fields = set( - ["changes", "data", "errorMessage", "timeoutInMinutes", "timeoutInSeconds"] - ) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -try: - Metadata.model_rebuild() -except NameError: - pass -try: - AccountingBankAccount.model_rebuild() -except NameError: - pass -try: - BankAccountCreateResponse.model_rebuild() -except NameError: - pass + error_message: NotRequired[Optional[str]] + validation: NotRequired[Optional[ValidationTypedDict]] + status_code: NotRequired[int] + data: NotRequired[Optional[BankAccountCreateResponseAllOfDataTypedDict]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/bankaccountcredentials.py b/bank-feeds/src/codat_bankfeeds/models/shared/bankaccountcredentials.py index d81703c5b..b23412f8f 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/bankaccountcredentials.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/bankaccountcredentials.py @@ -1,42 +1,102 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -from pydantic import model_serializer -from typing import Optional -from typing_extensions import NotRequired, TypedDict +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -class BankAccountCredentialsTypedDict(TypedDict): - r"""Result of generate credentials""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - password: NotRequired[str] - r"""Password to enable the bank feeds platform to securely retrieve transactions.""" - username: NotRequired[str] - r"""Username used by the bank feeds platform to retrieve transactions""" + Do not edit the class manually. +""" # noqa: E501 -class BankAccountCredentials(BaseModel): - r"""Result of generate credentials""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - password: Optional[str] = None - r"""Password to enable the bank feeds platform to securely retrieve transactions.""" +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - username: Optional[str] = None - r"""Username used by the bank feeds platform to retrieve transactions""" +class BankAccountCredentials(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["password", "username"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + Result of generate credentials + """ # noqa: E501 + username: Optional[str] = Field(default=None, description="Username used by the bank feeds platform to retrieve transactions") + password: Optional[str] = Field(default=None, description="Password to enable the bank feeds platform to securely retrieve transactions.") + __properties: ClassVar[List[str]] = ["username", "password"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BankAccountCredentials from a JSON string""" + return cls.from_dict(json.loads(json_str)) - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - return m + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BankAccountCredentials from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "username": obj.get("username"), + "password": obj.get("password") + }) + return _obj + + + + + +class BankAccountCredentialsTypedDict(TypedDict): + """TypedDict variant of BankAccountCredentials, for dict-literal request/response inputs.""" + username: NotRequired[Optional[str]] + password: NotRequired[Optional[str]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/bankaccountprototype.py b/bank-feeds/src/codat_bankfeeds/models/shared/bankaccountprototype.py index 1a7f0a80a..c8556f70f 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/bankaccountprototype.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/bankaccountprototype.py @@ -1,230 +1,151 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .bankaccountstatus import BankAccountStatus -from codat_bankfeeds.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_bankfeeds.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 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 BankAccountPrototypeTypedDict(TypedDict): - account_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. - - FreeAgent integrations - For Credit accounts, only the last four digits are required. For other types, the field is optional. - """ - 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. - """ - available_balance: NotRequired[Nullable[Decimal]] - r"""Total available balance of the bank account as reported by the underlying data source. This may take into account overdrafts or pending transactions for example.""" - balance: NotRequired[Nullable[Decimal]] - r"""Balance of the bank 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_. +""" + Bank Feeds - ## Unknown currencies + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | - In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - There are only a very small number of edge cases where this currency code is returned by the Codat system. - """ - i_ban: NotRequired[Nullable[str]] - r"""International bank account number of the account. Often used when making or receiving international payments.""" - institution: NotRequired[Nullable[str]] - r"""The institution of the bank account.""" - nominal_code: NotRequired[Nullable[str]] - r"""Code used to identify each nominal account for a business.""" - overdraft_limit: NotRequired[Nullable[Decimal]] - r"""Pre-arranged overdraft limit of the account. - - The value is always positive. For example, an overdraftLimit of `1000` means that the balance of the account can go down to `-1000`. - """ - 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. - """ - status: NotRequired[BankAccountStatus] - r"""Status of the bank account.""" + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +from decimal import Decimal +from codat_bankfeeds.utils.serializers import serialize_decimal, validate_decimal +from codat_bankfeeds.models.bank_account_type import BankAccountType +import pprint +import re # noqa: F401 +import json + +from pydantic import BeforeValidator, PlainSerializer, BaseModel, ConfigDict, Field, field_validator, model_serializer +from typing import Annotated, Any, ClassVar, Dict, List, Optional, Union +from codat_bankfeeds.models.shared.bankaccountstatus import BankAccountStatus +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL class BankAccountPrototype(BaseModel): - account_name: Annotated[ - OptionalNullable[str], pydantic.Field(alias="accountName") - ] = 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. - - FreeAgent integrations - For Credit accounts, only the last four digits are required. For other types, the field is optional. + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'accountName', 'accountNumber', 'account_name', 'account_number', 'availableBalance', 'available_balance', 'balance', 'iBan', 'i_ban', 'institution', 'nominalCode', 'nominal_code', 'overdraftLimit', 'overdraft_limit', 'sortCode', 'sort_code'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ + BankAccountPrototype + """ # noqa: E501 + account_name: OptionalNullable[str] = Field(default=UNSET, description="Name of the bank account in the accounting software.", alias="accountName") + account_type: Optional[BankAccountType] = Field(default=None, description="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.", alias="accountType") + nominal_code: OptionalNullable[str] = Field(default=UNSET, description="Code used to identify each nominal account for a business.", alias="nominalCode") + sort_code: OptionalNullable[str] = Field(default=UNSET, description="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.", alias="sortCode") + account_number: OptionalNullable[str] = Field(default=UNSET, description="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. FreeAgent integrations For Credit accounts, only the last four digits are required. For other types, the field is optional.", alias="accountNumber") + i_ban: OptionalNullable[str] = Field(default=UNSET, description="International bank account number of the account. Often used when making or receiving international payments.", alias="iBan") + currency: Optional[str] = Field(default=None, description="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.") + balance: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Balance of the bank account.") + institution: OptionalNullable[str] = Field(default=UNSET, description="The institution of the bank account.") + available_balance: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Total available balance of the bank account as reported by the underlying data source. This may take into account overdrafts or pending transactions for example.", alias="availableBalance") + overdraft_limit: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Pre-arranged overdraft limit of the account. The value is always positive. For example, an overdraftLimit of `1000` means that the balance of the account can go down to `-1000`.", alias="overdraftLimit") + status: Optional[BankAccountStatus] = None + __properties: ClassVar[List[str]] = ["accountName", "accountType", "nominalCode", "sortCode", "accountNumber", "iBan", "currency", "balance", "institution", "availableBalance", "overdraftLimit", "status"] + + @field_validator('account_type') + def account_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['Unknown', 'Credit', 'Debit']): + raise ValueError("must be one of enum values ('Unknown', 'Credit', 'Debit')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - 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. - """ - available_balance: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="availableBalance"), - ] = UNSET - r"""Total available balance of the bank account as reported by the underlying data source. This may take into account overdrafts or pending transactions for example.""" + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - balance: Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = UNSET - r"""Balance of the bank account.""" + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - 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_. + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BankAccountPrototype from a JSON string""" + return cls.from_dict(json.loads(json_str)) - ## Unknown currencies + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - There are only a very small number of edge cases where this currency code is returned by the Codat system. - """ + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - i_ban: Annotated[OptionalNullable[str], pydantic.Field(alias="iBan")] = UNSET - r"""International bank account number of the account. Often used when making or receiving international payments.""" + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - institution: OptionalNullable[str] = UNSET - r"""The institution of the bank account.""" + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BankAccountPrototype from a dict""" + if obj is None: + return None - nominal_code: Annotated[ - OptionalNullable[str], pydantic.Field(alias="nominalCode") - ] = UNSET - r"""Code used to identify each nominal account for a business.""" + if not isinstance(obj, dict): + return cls.model_validate(obj) - overdraft_limit: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="overdraftLimit"), - ] = UNSET - r"""Pre-arranged overdraft limit of the account. + _obj = cls.model_validate({ + "accountName": obj.get("accountName"), + "accountType": obj.get("accountType"), + "nominalCode": obj.get("nominalCode"), + "sortCode": obj.get("sortCode"), + "accountNumber": obj.get("accountNumber"), + "iBan": obj.get("iBan"), + "currency": obj.get("currency"), + "balance": obj.get("balance"), + "institution": obj.get("institution"), + "availableBalance": obj.get("availableBalance"), + "overdraftLimit": obj.get("overdraftLimit"), + "status": obj.get("status") + }) + return _obj - The value is always positive. For example, an overdraftLimit of `1000` means that the balance of the account can go down to `-1000`. - """ - 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. - """ - status: Optional[BankAccountStatus] = None - r"""Status of the bank account.""" - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "accountName", - "accountNumber", - "accountType", - "availableBalance", - "balance", - "currency", - "iBan", - "institution", - "nominalCode", - "overdraftLimit", - "sortCode", - "status", - ] - ) - nullable_fields = set( - [ - "accountName", - "accountNumber", - "availableBalance", - "balance", - "iBan", - "institution", - "nominalCode", - "overdraftLimit", - "sortCode", - ] - ) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -try: - BankAccountPrototype.model_rebuild() -except NameError: - pass +class BankAccountPrototypeTypedDict(TypedDict): + """TypedDict variant of BankAccountPrototype, for dict-literal request/response inputs.""" + account_name: NotRequired[Optional[str]] + account_type: NotRequired[Optional[BankAccountType]] + nominal_code: NotRequired[Optional[str]] + sort_code: NotRequired[Optional[str]] + account_number: NotRequired[Optional[str]] + i_ban: NotRequired[Optional[str]] + currency: NotRequired[Optional[str]] + balance: NotRequired[Optional[Decimal]] + institution: NotRequired[Optional[str]] + available_balance: NotRequired[Optional[Decimal]] + overdraft_limit: NotRequired[Optional[Decimal]] + status: NotRequired[Optional[BankAccountStatus]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/bankaccounts.py b/bank-feeds/src/codat_bankfeeds/models/shared/bankaccounts.py index 5f05bc04d..a30d6285c 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/bankaccounts.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/bankaccounts.py @@ -1,427 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .bankaccountstatus import BankAccountStatus -from .links import Links, LinksTypedDict -from codat_bankfeeds.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_bankfeeds.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 Any, Dict, List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class BankAccountsBankAccountType(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 BankAccountsMetadataTypedDict(TypedDict): - is_deleted: NotRequired[Nullable[bool]] - r"""Indicates whether the record has been deleted in the third-party system this record originated from.""" - - -class BankAccountsMetadata(BaseModel): - is_deleted: Annotated[OptionalNullable[bool], pydantic.Field(alias="isDeleted")] = ( - UNSET - ) - r"""Indicates whether the record has been deleted in the third-party system this record originated from.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["isDeleted"]) - nullable_fields = set(["isDeleted"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m +# coding: utf-8 +""" + Bank Feeds -class BankAccountsSupplementalDataTypedDict(TypedDict): - r"""Supplemental data is additional data you can include in our standard data types. + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | - It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. - """ + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - content: NotRequired[Nullable[Dict[str, Dict[str, Any]]]] + Do not edit the class manually. +""" # noqa: E501 -class BankAccountsSupplementalData(BaseModel): - r"""Supplemental data is additional data you can include in our standard data types. +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. - """ +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict +from codat_bankfeeds.models.accounting_bank_account import AccountingBankAccount, AccountingBankAccountTypedDict +from codat_bankfeeds.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self - content: OptionalNullable[Dict[str, Dict[str, Any]]] = UNSET +from codat_bankfeeds.types import Nullable +class BankAccounts(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["content"]) - nullable_fields = set(["content"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -class BankAccountsAccountingBankAccountTypedDict(TypedDict): - r"""> **Accessing Bank Accounts through Banking API** - > - > This datatype was originally used for accessing bank account data both in accounting integrations and open banking aggregators. - > - > To view bank account data through the Banking API, please refer to the new [Banking: Account](https://docs.codat.io/bank-feeds-api#/schemas/Account) data type. - - ## Overview - - A list of bank accounts associated with a company and a specific data connection. - - Bank accounts data includes: - * The name and ID of the account in the accounting software. - * The currency and balance of the account. - * The sort code and account number. - """ - - account_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. - - FreeAgent integrations - For Credit accounts, only the last four digits are required. For other types, the field is optional. - """ - account_type: NotRequired[BankAccountsBankAccountType] - 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. - """ - available_balance: NotRequired[Nullable[Decimal]] - r"""Total available balance of the bank account as reported by the underlying data source. This may take into account overdrafts or pending transactions for example.""" - balance: NotRequired[Nullable[Decimal]] - r"""Balance of the bank 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. - """ - i_ban: NotRequired[Nullable[str]] - r"""International bank account number of the account. Often used when making or receiving international payments.""" - id: NotRequired[str] - r"""Identifier for the account, unique for the company in the accounting software.""" - institution: NotRequired[Nullable[str]] - r"""The institution of the bank account.""" - metadata: NotRequired[BankAccountsMetadataTypedDict] - modified_date: NotRequired[str] - nominal_code: NotRequired[Nullable[str]] - r"""Code used to identify each nominal account for a business.""" - overdraft_limit: NotRequired[Nullable[Decimal]] - r"""Pre-arranged overdraft limit of the account. - - The value is always positive. For example, an overdraftLimit of `1000` means that the balance of the account can go down to `-1000`. - """ - 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. - """ - source_modified_date: NotRequired[str] - status: NotRequired[BankAccountStatus] - r"""Status of the bank account.""" - supplemental_data: NotRequired[BankAccountsSupplementalDataTypedDict] - r"""Supplemental data is additional data you can include in our standard data types. - - It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. - """ - - -class BankAccountsAccountingBankAccount(BaseModel): - r"""> **Accessing Bank Accounts through Banking API** - > - > This datatype was originally used for accessing bank account data both in accounting integrations and open banking aggregators. - > - > To view bank account data through the Banking API, please refer to the new [Banking: Account](https://docs.codat.io/bank-feeds-api#/schemas/Account) data type. - - ## Overview - - A list of bank accounts associated with a company and a specific data connection. - - Bank accounts data includes: - * The name and ID of the account in the accounting software. - * The currency and balance of the account. - * The sort code and account number. - """ - - account_name: Annotated[ - OptionalNullable[str], pydantic.Field(alias="accountName") - ] = 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. - - FreeAgent integrations - For Credit accounts, only the last four digits are required. For other types, the field is optional. - """ - - account_type: Annotated[ - Optional[BankAccountsBankAccountType], 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. - """ - - available_balance: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="availableBalance"), - ] = UNSET - r"""Total available balance of the bank account as reported by the underlying data source. This may take into account overdrafts or pending transactions for example.""" - - balance: Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = UNSET - r"""Balance of the bank 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. - """ - - i_ban: Annotated[OptionalNullable[str], pydantic.Field(alias="iBan")] = UNSET - r"""International bank account number of the account. Often used when making or receiving international payments.""" - - id: Optional[str] = None - r"""Identifier for the account, unique for the company in the accounting software.""" - - institution: OptionalNullable[str] = UNSET - r"""The institution of the bank account.""" - - metadata: Optional[BankAccountsMetadata] = None - - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None - - nominal_code: Annotated[ - OptionalNullable[str], pydantic.Field(alias="nominalCode") - ] = UNSET - r"""Code used to identify each nominal account for a business.""" - - overdraft_limit: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="overdraftLimit"), - ] = UNSET - r"""Pre-arranged overdraft limit of the account. - - The value is always positive. For example, an overdraftLimit of `1000` means that the balance of the account can go down to `-1000`. - """ - - sort_code: Annotated[OptionalNullable[str], pydantic.Field(alias="sortCode")] = ( - UNSET + return {k: v for k, v in serialized.items() if v is not None} + """ + BankAccounts + """ # noqa: E501 + page_number: int = Field(description="Current page number.", alias="pageNumber") + page_size: int = Field(description="Number of items to return in results array.", alias="pageSize") + total_results: int = Field(description="Total number of items.", alias="totalResults") + links: Links = Field(alias="_links") + results: Optional[List[Nullable[AccountingBankAccount]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), ) - 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. - """ - - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None - - status: Optional[BankAccountStatus] = None - r"""Status of the bank account.""" - - supplemental_data: Annotated[ - Optional[BankAccountsSupplementalData], pydantic.Field(alias="supplementalData") - ] = None - r"""Supplemental data is additional data you can include in our standard data types. - - It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. - """ - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "accountName", - "accountNumber", - "accountType", - "availableBalance", - "balance", - "currency", - "iBan", - "id", - "institution", - "metadata", - "modifiedDate", - "nominalCode", - "overdraftLimit", - "sortCode", - "sourceModifiedDate", - "status", - "supplementalData", - ] - ) - nullable_fields = set( - [ - "accountName", - "accountNumber", - "availableBalance", - "balance", - "iBan", - "institution", - "nominalCode", - "overdraftLimit", - "sortCode", - ] - ) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - return m + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) -class BankAccountsTypedDict(TypedDict): - links: LinksTypedDict - 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.""" - results: NotRequired[List[Nullable[BankAccountsAccountingBankAccountTypedDict]]] + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BankAccounts from a JSON string""" + return cls.from_dict(json.loads(json_str)) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. -class BankAccounts(BaseModel): - links: Annotated[Links, pydantic.Field(alias="_links")] + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - page_number: Annotated[int, pydantic.Field(alias="pageNumber")] - r"""Current page number.""" + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - page_size: Annotated[int, pydantic.Field(alias="pageSize")] - r"""Number of items to return in results array.""" + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of links + if self.links: + _dict['_links'] = self.links.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + return _dict - total_results: Annotated[int, pydantic.Field(alias="totalResults")] - r"""Total number of items.""" + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BankAccounts from a dict""" + if obj is None: + return None - results: Optional[List[Nullable[BankAccountsAccountingBankAccount]]] = None + if not isinstance(obj, dict): + return cls.model_validate(obj) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["results"]) - serialized = handler(self) - m = {} + _obj = cls.model_validate({ + "pageNumber": obj.get("pageNumber"), + "pageSize": obj.get("pageSize"), + "totalResults": obj.get("totalResults"), + "_links": Links.from_dict(obj["_links"]) if obj.get("_links") is not None else None, + "results": [AccountingBankAccount.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - return m -try: - BankAccountsMetadata.model_rebuild() -except NameError: - pass -try: - BankAccountsAccountingBankAccount.model_rebuild() -except NameError: - pass -try: - BankAccounts.model_rebuild() -except NameError: - pass +class BankAccountsTypedDict(TypedDict): + """TypedDict variant of BankAccounts, for dict-literal request/response inputs.""" + page_number: NotRequired[int] + page_size: NotRequired[int] + total_results: NotRequired[int] + links: NotRequired[LinksTypedDict] + results: NotRequired[Optional[List[Nullable[AccountingBankAccountTypedDict]]]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/bankaccountstatus.py b/bank-feeds/src/codat_bankfeeds/models/shared/bankaccountstatus.py index be857f929..974f4a72c 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/bankaccountstatus.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/bankaccountstatus.py @@ -1,13 +1,40 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + from __future__ import annotations +import json from enum import Enum +from typing_extensions import Self class BankAccountStatus(str, Enum): - r"""Status of the bank account.""" + """ + Status of the bank account. + """ + + """ + allowed enum values + """ + UNKNOWN = 'Unknown' + ACTIVE = 'Active' + ARCHIVED = 'Archived' + PENDING = 'Pending' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of BankAccountStatus from a JSON string""" + return cls(json.loads(json_str)) + - UNKNOWN = "Unknown" - ACTIVE = "Active" - ARCHIVED = "Archived" - PENDING = "Pending" diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/bankfeedaccountmapping.py b/bank-feeds/src/codat_bankfeeds/models/shared/bankfeedaccountmapping.py index e4cdb901d..7c9296888 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/bankfeedaccountmapping.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/bankfeedaccountmapping.py @@ -1,107 +1,124 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_bankfeeds.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 +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -class BankFeedAccountMappingTypedDict(TypedDict): - source_account_id: str - r"""Unique ID for the source account""" - feed_start_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: + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - - 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` +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL +class BankFeedAccountMapping(BaseModel): - > 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_drop_none(self, handler): + serialized = handler(self) + _nullable = {'targetAccountId', 'target_account_id'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ - target_account_id: NotRequired[Nullable[str]] - r"""Unique ID for the target account""" + BankFeedAccountMapping + """ # noqa: E501 + source_account_id: str = Field(description="Unique ID for the source account", alias="sourceAccountId") + target_account_id: OptionalNullable[str] = Field(default=UNSET, description="Unique ID for the target account", alias="targetAccountId") + feed_start_date: Optional[str] = Field(default=None, description="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.", alias="feedStartDate") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["sourceAccountId", "targetAccountId", "feedStartDate"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class BankFeedAccountMapping(BaseModel): - source_account_id: Annotated[str, pydantic.Field(alias="sourceAccountId")] - r"""Unique ID for the source account""" + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - feed_start_date: Annotated[Optional[str], pydantic.Field(alias="feedStartDate")] = ( - 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: + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BankFeedAccountMapping from a JSON string""" + return cls.from_dict(json.loads(json_str)) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) - - 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` + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value - > 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. - """ + return _dict - target_account_id: Annotated[ - OptionalNullable[str], pydantic.Field(alias="targetAccountId") - ] = UNSET - r"""Unique ID for the target account""" + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BankFeedAccountMapping from a dict""" + if obj is None: + return None - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["feedStartDate", "targetAccountId"]) - nullable_fields = set(["targetAccountId"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -try: - BankFeedAccountMapping.model_rebuild() -except NameError: - pass + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "sourceAccountId": obj.get("sourceAccountId"), + "targetAccountId": obj.get("targetAccountId"), + "feedStartDate": obj.get("feedStartDate") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + + + + +class BankFeedAccountMappingTypedDict(TypedDict): + """TypedDict variant of BankFeedAccountMapping, for dict-literal request/response inputs.""" + source_account_id: NotRequired[str] + target_account_id: NotRequired[Optional[str]] + feed_start_date: NotRequired[Optional[str]] + additional_properties: NotRequired[Dict[str, Any]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/bankfeedaccountmappingresponse.py b/bank-feeds/src/codat_bankfeeds/models/shared/bankfeedaccountmappingresponse.py index 41c380faf..5e1dfa0dc 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/bankfeedaccountmappingresponse.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/bankfeedaccountmappingresponse.py @@ -1,74 +1,127 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_bankfeeds.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 +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -class BankFeedAccountMappingResponseTypedDict(TypedDict): - error: NotRequired[Nullable[str]] - r"""Error returned during the post request""" - source_account_id: NotRequired[str] - r"""Unique ID for the source account.""" - status: NotRequired[Nullable[str]] - r"""Status of the POST request.""" - target_account_id: NotRequired[Nullable[str]] - r"""Unique ID for the target account.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -class BankFeedAccountMappingResponse(BaseModel): - error: OptionalNullable[str] = UNSET - r"""Error returned during the post request""" - source_account_id: Annotated[ - Optional[str], pydantic.Field(alias="sourceAccountId") - ] = None - r"""Unique ID for the source account.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - status: OptionalNullable[str] = UNSET - r"""Status of the POST request.""" +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - target_account_id: Annotated[ - OptionalNullable[str], pydantic.Field(alias="targetAccountId") - ] = UNSET - r"""Unique ID for the target account.""" +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL +class BankFeedAccountMappingResponse(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["error", "sourceAccountId", "status", "targetAccountId"]) - nullable_fields = set(["error", "status", "targetAccountId"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -try: - BankFeedAccountMappingResponse.model_rebuild() -except NameError: - pass + _nullable = {'error', 'status', 'targetAccountId', 'target_account_id'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + BankFeedAccountMappingResponse + """ # noqa: E501 + source_account_id: Optional[str] = Field(default=None, description="Unique ID for the source account.", alias="sourceAccountId") + target_account_id: OptionalNullable[str] = Field(default=UNSET, description="Unique ID for the target account.", alias="targetAccountId") + status: OptionalNullable[str] = Field(default=UNSET, description="Status of the POST request.") + error: OptionalNullable[str] = Field(default=UNSET, description="Error returned during the post request") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["sourceAccountId", "targetAccountId", "status", "error"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BankFeedAccountMappingResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BankFeedAccountMappingResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "sourceAccountId": obj.get("sourceAccountId"), + "targetAccountId": obj.get("targetAccountId"), + "status": obj.get("status"), + "error": obj.get("error") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + + + + +class BankFeedAccountMappingResponseTypedDict(TypedDict): + """TypedDict variant of BankFeedAccountMappingResponse, for dict-literal request/response inputs.""" + source_account_id: NotRequired[Optional[str]] + target_account_id: NotRequired[Optional[str]] + status: NotRequired[Optional[str]] + error: NotRequired[Optional[str]] + additional_properties: NotRequired[Dict[str, Any]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/bankfeedmapping.py b/bank-feeds/src/codat_bankfeeds/models/shared/bankfeedmapping.py index 8f703f0df..0941bd6d1 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/bankfeedmapping.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/bankfeedmapping.py @@ -1,198 +1,155 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .targetaccountoption import TargetAccountOption, TargetAccountOptionTypedDict -from codat_bankfeeds.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_bankfeeds.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 BankFeedMappingTypedDict(TypedDict): - r"""A bank feed connection between a source account and a target account, including potential target accounts.""" - - feed_start_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: +""" + Bank Feeds - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - - 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. - """ - source_account_id: NotRequired[str] - r"""Unique ID for the source account.""" - source_account_name: NotRequired[str] - r"""Name for the source account.""" - source_account_number: NotRequired[str] - r"""Account number for the source account.""" - source_balance: NotRequired[Decimal] - r"""Balance for the source account.""" - source_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[str] - r"""The status.""" - target_account_id: NotRequired[Nullable[str]] - r"""Unique ID for the target account in the accounting software.""" - target_account_name: NotRequired[str] - r"""Name for the target account in the accounting software.""" - target_account_options: NotRequired[Nullable[List[TargetAccountOptionTypedDict]]] - r"""An array of potential target accounts.""" + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +from decimal import Decimal +from codat_bankfeeds.utils.serializers import serialize_decimal, validate_decimal +import pprint +import re # noqa: F401 +import json + +from pydantic import BeforeValidator, PlainSerializer, BaseModel, ConfigDict, Field, model_serializer +from typing import Annotated, Any, ClassVar, Dict, List, Optional, Union +from codat_bankfeeds.models.shared.targetaccountoption import TargetAccountOption, TargetAccountOptionTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL class BankFeedMapping(BaseModel): - r"""A bank feed connection between a source account and a target account, including potential target accounts.""" - feed_start_date: Annotated[Optional[str], pydantic.Field(alias="feedStartDate")] = ( - None + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'targetAccountId', 'targetAccountOptions', 'target_account_id', 'target_account_options'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + A bank feed connection between a source account and a target account, including potential target accounts. + """ # noqa: E501 + source_account_id: Optional[str] = Field(default=None, description="Unique ID for the source account.", alias="sourceAccountId") + source_account_name: Optional[str] = Field(default=None, description="Name for the source account.", alias="sourceAccountName") + source_account_number: Optional[str] = Field(default=None, description="Account number for the source account.", alias="sourceAccountNumber") + source_balance: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Balance for the source account.", alias="sourceBalance") + source_currency: Optional[str] = Field(default=None, description="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.", alias="sourceCurrency") + target_account_id: OptionalNullable[str] = Field(default=UNSET, description="Unique ID for the target account in the accounting software.", alias="targetAccountId") + target_account_name: Optional[str] = Field(default=None, description="Name for the target account in the accounting software.", alias="targetAccountName") + status: Optional[str] = Field(default=None, description="The status.") + target_account_options: OptionalNullable[List[TargetAccountOption]] = Field(default=UNSET, description="An array of potential target accounts.", alias="targetAccountOptions") + feed_start_date: Optional[str] = Field(default=None, description="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.", alias="feedStartDate") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["sourceAccountId", "sourceAccountName", "sourceAccountNumber", "sourceBalance", "sourceCurrency", "targetAccountId", "targetAccountName", "status", "targetAccountOptions", "feedStartDate"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), ) - 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 - ``` + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BankFeedMapping from a JSON string""" + return cls.from_dict(json.loads(json_str)) - - 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` + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - > 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. - """ + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - source_account_id: Annotated[ - Optional[str], pydantic.Field(alias="sourceAccountId") - ] = None - r"""Unique ID for the source account.""" - - source_account_name: Annotated[ - Optional[str], pydantic.Field(alias="sourceAccountName") - ] = None - r"""Name for the source account.""" - - source_account_number: Annotated[ - Optional[str], pydantic.Field(alias="sourceAccountNumber") - ] = None - r"""Account number for the source account.""" - - source_balance: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="sourceBalance"), - ] = None - r"""Balance for the source account.""" - - source_currency: Annotated[ - Optional[str], pydantic.Field(alias="sourceCurrency") - ] = 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. - """ + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) - status: Optional[str] = None - r"""The status.""" + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in target_account_options (list) + _items = [] + if self.target_account_options: + for _item_target_account_options in self.target_account_options: + if _item_target_account_options: + _items.append(_item_target_account_options.to_dict()) + _dict['targetAccountOptions'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BankFeedMapping from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "sourceAccountId": obj.get("sourceAccountId"), + "sourceAccountName": obj.get("sourceAccountName"), + "sourceAccountNumber": obj.get("sourceAccountNumber"), + "sourceBalance": obj.get("sourceBalance"), + "sourceCurrency": obj.get("sourceCurrency"), + "targetAccountId": obj.get("targetAccountId"), + "targetAccountName": obj.get("targetAccountName"), + "status": obj.get("status"), + "targetAccountOptions": [TargetAccountOption.from_dict(_item) for _item in obj["targetAccountOptions"]] if obj.get("targetAccountOptions") is not None else None, + "feedStartDate": obj.get("feedStartDate") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - target_account_id: Annotated[ - OptionalNullable[str], pydantic.Field(alias="targetAccountId") - ] = UNSET - r"""Unique ID for the target account in the accounting software.""" - target_account_name: Annotated[ - Optional[str], pydantic.Field(alias="targetAccountName") - ] = None - r"""Name for the target account in the accounting software.""" - target_account_options: Annotated[ - OptionalNullable[List[TargetAccountOption]], - pydantic.Field(alias="targetAccountOptions"), - ] = UNSET - r"""An array of potential target accounts.""" - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "feedStartDate", - "sourceAccountId", - "sourceAccountName", - "sourceAccountNumber", - "sourceBalance", - "sourceCurrency", - "status", - "targetAccountId", - "targetAccountName", - "targetAccountOptions", - ] - ) - nullable_fields = set(["targetAccountId", "targetAccountOptions"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -try: - BankFeedMapping.model_rebuild() -except NameError: - pass + +class BankFeedMappingTypedDict(TypedDict): + """TypedDict variant of BankFeedMapping, for dict-literal request/response inputs.""" + source_account_id: NotRequired[Optional[str]] + source_account_name: NotRequired[Optional[str]] + source_account_number: NotRequired[Optional[str]] + source_balance: NotRequired[Optional[Decimal]] + source_currency: NotRequired[Optional[str]] + target_account_id: NotRequired[Optional[str]] + target_account_name: NotRequired[Optional[str]] + status: NotRequired[Optional[str]] + target_account_options: NotRequired[Optional[List[TargetAccountOptionTypedDict]]] + feed_start_date: NotRequired[Optional[str]] + additional_properties: NotRequired[Dict[str, Any]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/banktransactions.py b/bank-feeds/src/codat_bankfeeds/models/shared/banktransactions.py deleted file mode 100644 index 33f3c5d04..000000000 --- a/bank-feeds/src/codat_bankfeeds/models/shared/banktransactions.py +++ /dev/null @@ -1,177 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from codat_bankfeeds.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_bankfeeds.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 BankTransactionType(str, Enum): - r"""Type of transaction for the bank statement line.""" - - UNKNOWN = "Unknown" - CREDIT = "Credit" - DEBIT = "Debit" - INT = "Int" - DIV = "Div" - FEE = "Fee" - SER_CHG = "SerChg" - DEP = "Dep" - ATM = "Atm" - POS = "Pos" - XFER = "Xfer" - CHECK = "Check" - PAYMENT = "Payment" - CASH = "Cash" - DIRECT_DEP = "DirectDep" - DIRECT_DEBIT = "DirectDebit" - REPEAT_PMT = "RepeatPmt" - OTHER = "Other" - - -class BankTransactionsTypedDict(TypedDict): - amount: NotRequired[Decimal] - r"""The amount transacted in the bank transaction.""" - balance: NotRequired[Decimal] - r"""The remaining balance in the account with ID `accountId`. This field is optional for QuickBooks Online but is required for Xero, Sage, NetSuite, Exact, and FreeAgent.""" - counterparty: NotRequired[Nullable[str]] - r"""The giving or receiving party such as a person or organization.""" - 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: - - ``` - 2023-08-22T10:21:00 - 2023-08-22 - ``` - - When pushing bank transaction data to Codat, the date is treated as a local date. This means: - - - The date/time is used exactly as provided, without any timezone conversion. - - If a timezone offset is included (e.g., `2023-08-22T10:21:00-05:00`), the offset will be ignored and only the local date/time portion will be used. - - We recommend providing dates without a timezone suffix for clarity (e.g., `2023-08-22T10:21:00` rather than `2023-08-22T10:21:00Z`). - """ - description: NotRequired[Nullable[str]] - r"""Description of the bank transaction.""" - id: NotRequired[str] - r"""Identifier for the bank account transaction, unique for the company in the accounting software.""" - reconciled: NotRequired[Nullable[bool]] - r"""`True` if the bank transaction has been [reconciled](https://www.xero.com/uk/guides/what-is-bank-reconciliation/) in the accounting software.""" - reference: NotRequired[Nullable[str]] - r"""An optional reference to the bank transaction.""" - transaction_type: NotRequired[Nullable[BankTransactionType]] - r"""Type of transaction for the bank statement line.""" - - -class BankTransactions(BaseModel): - amount: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""The amount transacted in the bank transaction.""" - - balance: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""The remaining balance in the account with ID `accountId`. This field is optional for QuickBooks Online but is required for Xero, Sage, NetSuite, Exact, and FreeAgent.""" - - counterparty: OptionalNullable[str] = UNSET - r"""The giving or receiving party such as a person or organization.""" - - date_: Annotated[Optional[str], pydantic.Field(alias="date")] = 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: - - ``` - 2023-08-22T10:21:00 - 2023-08-22 - ``` - - When pushing bank transaction data to Codat, the date is treated as a local date. This means: - - - The date/time is used exactly as provided, without any timezone conversion. - - If a timezone offset is included (e.g., `2023-08-22T10:21:00-05:00`), the offset will be ignored and only the local date/time portion will be used. - - We recommend providing dates without a timezone suffix for clarity (e.g., `2023-08-22T10:21:00` rather than `2023-08-22T10:21:00Z`). - """ - - description: OptionalNullable[str] = UNSET - r"""Description of the bank transaction.""" - - id: Optional[str] = None - r"""Identifier for the bank account transaction, unique for the company in the accounting software.""" - - reconciled: OptionalNullable[bool] = UNSET - r"""`True` if the bank transaction has been [reconciled](https://www.xero.com/uk/guides/what-is-bank-reconciliation/) in the accounting software.""" - - reference: OptionalNullable[str] = UNSET - r"""An optional reference to the bank transaction.""" - - transaction_type: Annotated[ - OptionalNullable[BankTransactionType], pydantic.Field(alias="transactionType") - ] = UNSET - r"""Type of transaction for the bank statement line.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "amount", - "balance", - "counterparty", - "date", - "description", - "id", - "reconciled", - "reference", - "transactionType", - ] - ) - nullable_fields = set( - [ - "counterparty", - "description", - "reconciled", - "reference", - "transactionType", - ] - ) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -try: - BankTransactions.model_rebuild() -except NameError: - pass diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/clientratelimitwebhook.py b/bank-feeds/src/codat_bankfeeds/models/shared/clientratelimitwebhook.py index 96eee603a..4acd7a846 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/clientratelimitwebhook.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/clientratelimitwebhook.py @@ -1,97 +1,112 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .clientratelimitwebhookpayload import ( - ClientRateLimitWebhookPayload, - ClientRateLimitWebhookPayloadTypedDict, -) -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -class ClientRateLimitWebhookTypedDict(TypedDict): - 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: + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_bankfeeds.models.shared.clientratelimitwebhookpayload import ClientRateLimitWebhookPayload, ClientRateLimitWebhookPayloadTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - - 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` +class ClientRateLimitWebhook(BaseModel): - > 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_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} """ - id: NotRequired[str] - r"""Unique identifier of the event.""" - payload: NotRequired[ClientRateLimitWebhookPayloadTypedDict] + ClientRateLimitWebhook + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="Unique identifier of the event.") + event_type: Optional[str] = Field(default=None, description="The type of event.", alias="eventType") + generated_date: Optional[str] = Field(default=None, description="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.", alias="generatedDate") + payload: Optional[ClientRateLimitWebhookPayload] = None + __properties: ClassVar[List[str]] = ["id", "eventType", "generatedDate", "payload"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class ClientRateLimitWebhook(BaseModel): - 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: + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClientRateLimitWebhook from a JSON string""" + return cls.from_dict(json.loads(json_str)) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - - 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` + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - > 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. - """ + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of payload + if self.payload: + _dict['payload'] = self.payload.to_dict() + return _dict - id: Optional[str] = None - r"""Unique identifier of the event.""" + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClientRateLimitWebhook from a dict""" + if obj is None: + return None - payload: Optional[ClientRateLimitWebhookPayload] = None + if not isinstance(obj, dict): + return cls.model_validate(obj) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["eventType", "generatedDate", "id", "payload"]) - serialized = handler(self) - m = {} + _obj = cls.model_validate({ + "id": obj.get("id"), + "eventType": obj.get("eventType"), + "generatedDate": obj.get("generatedDate"), + "payload": ClientRateLimitWebhookPayload.from_dict(obj["payload"]) if obj.get("payload") is not None else None + }) + return _obj - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - return m -try: - ClientRateLimitWebhook.model_rebuild() -except NameError: - pass +class ClientRateLimitWebhookTypedDict(TypedDict): + """TypedDict variant of ClientRateLimitWebhook, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + event_type: NotRequired[Optional[str]] + generated_date: NotRequired[Optional[str]] + payload: NotRequired[Optional[ClientRateLimitWebhookPayloadTypedDict]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/clientratelimitwebhookpayload.py b/bank-feeds/src/codat_bankfeeds/models/shared/clientratelimitwebhookpayload.py index 944129336..8938e88bc 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/clientratelimitwebhookpayload.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/clientratelimitwebhookpayload.py @@ -1,90 +1,105 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -class ClientRateLimitWebhookPayloadTypedDict(TypedDict): - daily_quota: NotRequired[int] - r"""The number of available requests per day.""" - 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: + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - - 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` +class ClientRateLimitWebhookPayload(BaseModel): - > 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_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} """ - quota_remaining: NotRequired[int] - r"""Total number of requests remaining for your client.""" + ClientRateLimitWebhookPayload + """ # noqa: E501 + daily_quota: Optional[int] = Field(default=None, description="The number of available requests per day.", alias="dailyQuota") + quota_remaining: Optional[int] = Field(default=None, description="Total number of requests remaining for your client.", alias="quotaRemaining") + expiry_date: Optional[str] = Field(default=None, description="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.", alias="expiryDate") + __properties: ClassVar[List[str]] = ["dailyQuota", "quotaRemaining", "expiryDate"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class ClientRateLimitWebhookPayload(BaseModel): - daily_quota: Annotated[Optional[int], pydantic.Field(alias="dailyQuota")] = None - r"""The number of available requests per day.""" - 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: + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClientRateLimitWebhookPayload from a JSON string""" + return cls.from_dict(json.loads(json_str)) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - - 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` + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - > 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. - """ + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - quota_remaining: Annotated[ - Optional[int], pydantic.Field(alias="quotaRemaining") - ] = None - r"""Total number of requests remaining for your client.""" + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClientRateLimitWebhookPayload from a dict""" + if obj is None: + return None - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["dailyQuota", "expiryDate", "quotaRemaining"]) - serialized = handler(self) - m = {} + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "dailyQuota": obj.get("dailyQuota"), + "quotaRemaining": obj.get("quotaRemaining"), + "expiryDate": obj.get("expiryDate") + }) + return _obj - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - return m -try: - ClientRateLimitWebhookPayload.model_rebuild() -except NameError: - pass +class ClientRateLimitWebhookPayloadTypedDict(TypedDict): + """TypedDict variant of ClientRateLimitWebhookPayload, for dict-literal request/response inputs.""" + daily_quota: NotRequired[Optional[int]] + quota_remaining: NotRequired[Optional[int]] + expiry_date: NotRequired[Optional[str]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/companies.py b/bank-feeds/src/codat_bankfeeds/models/shared/companies.py index bedb87904..6ada88acc 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/companies.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/companies.py @@ -1,58 +1,124 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + from __future__ import annotations -from .company import Company, CompanyTypedDict -from .links import Links, LinksTypedDict -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import List, Optional +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional from typing_extensions import Annotated, NotRequired, TypedDict +from codat_bankfeeds.models.shared.company import Company, CompanyTypedDict +from codat_bankfeeds.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +class Companies(BaseModel): -class CompaniesTypedDict(TypedDict): - links: LinksTypedDict - 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.""" - results: NotRequired[List[CompanyTypedDict]] + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + """ + Companies + """ # noqa: E501 + results: Optional[List[Company]] = None + page_number: int = Field(description="Current page number.", alias="pageNumber") + page_size: int = Field(description="Number of items to return in results array.", alias="pageSize") + total_results: int = Field(description="Total number of items.", alias="totalResults") + links: Links = Field(alias="_links") + __properties: ClassVar[List[str]] = ["results", "pageNumber", "pageSize", "totalResults", "_links"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class Companies(BaseModel): - links: Annotated[Links, pydantic.Field(alias="_links")] - page_number: Annotated[int, pydantic.Field(alias="pageNumber")] - r"""Current page number.""" + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - page_size: Annotated[int, pydantic.Field(alias="pageSize")] - r"""Number of items to return in results array.""" + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - total_results: Annotated[int, pydantic.Field(alias="totalResults")] - r"""Total number of items.""" + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Companies from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Company]] = None + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["results"]) - serialized = handler(self) - m = {} + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + # override the default output from pydantic by calling `to_dict()` of links + if self.links: + _dict['_links'] = self.links.to_dict() + return _dict - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Companies from a dict""" + if obj is None: + return None - return m + if not isinstance(obj, dict): + return cls.model_validate(obj) + _obj = cls.model_validate({ + "results": [Company.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None, + "pageNumber": obj.get("pageNumber"), + "pageSize": obj.get("pageSize"), + "totalResults": obj.get("totalResults"), + "_links": Links.from_dict(obj["_links"]) if obj.get("_links") is not None else None + }) + return _obj -try: - Companies.model_rebuild() -except NameError: - pass + + + + +class CompaniesTypedDict(TypedDict): + """TypedDict variant of Companies, for dict-literal request/response inputs.""" + results: NotRequired[Optional[List[CompanyTypedDict]]] + page_number: NotRequired[int] + page_size: NotRequired[int] + total_results: NotRequired[int] + links: NotRequired[LinksTypedDict] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/company.py b/bank-feeds/src/codat_bankfeeds/models/shared/company.py index f7e30d3b8..e317adf34 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/company.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/company.py @@ -1,219 +1,157 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .companyreference import CompanyReference, CompanyReferenceTypedDict -from .connection import Connection, ConnectionTypedDict -from codat_bankfeeds.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -import pydantic -from pydantic import model_serializer -from typing import Dict, List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -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/bank-feeds-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.""" - 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: + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - ``` - 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.""" - data_connections: NotRequired[List[ConnectionTypedDict]] - 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: + Do not edit the class manually. +""" # noqa: E501 - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict +from codat_bankfeeds.models.shared.companyreference import CompanyReference, CompanyReferenceTypedDict +from codat_bankfeeds.models.shared.connection import Connection, ConnectionTypedDict +from typing import Optional, Set +from typing_extensions import Self - 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. - """ - products: NotRequired[List[str]] - r"""An array of products that are currently enabled for the company.""" - reference_parent_company: NotRequired[CompanyReferenceTypedDict] - reference_subsidiary_companies: NotRequired[List[CompanyReferenceTypedDict]] - r"""A list of subsidiary companies owned or controlled by this entity. Empty if the company has no children.""" - tags: NotRequired[Dict[str, str]] - r"""A collection of user-defined key-value pairs that store custom metadata against the company.""" - - +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL 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/bank-feeds-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.""" - - 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.""" - - data_connections: Annotated[ - Optional[List[Connection]], pydantic.Field(alias="dataConnections") - ] = None - - 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. + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'createdByUserName', 'created_by_user_name'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ + In Codat, a company represents a business sharing access to their data. Each company can have multiple [connections](https://docs.codat.io/bank-feeds-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. + """ # noqa: E501 + id: str = Field(description="Unique identifier for your SMB in Codat.") + name: str = Field(description="The name of the company") + description: Optional[str] = Field(default=None, description="A description of the property.") + redirect: str = Field(description="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.") + last_sync: Optional[str] = Field(default=None, description="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.", alias="lastSync") + created: Optional[str] = Field(default=None, description="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: OptionalNullable[str] = Field(default=UNSET, description="Name of user that created the company in Codat.", alias="createdByUserName") + products: Optional[List[str]] = Field(default=None, description="An array of products that are currently enabled for the company.") + tags: Optional[Dict[str, str]] = Field(default=None, description="A collection of user-defined key-value pairs that store custom metadata against the company.") + reference_parent_company: Optional[CompanyReference] = Field(default=None, description="The parent entity or controlling organization of this company. Null if the company has no parent.", alias="referenceParentCompany") + reference_subsidiary_companies: Optional[List[CompanyReference]] = Field(default=None, description="A list of subsidiary companies owned or controlled by this entity. Empty if the company has no children.", alias="referenceSubsidiaryCompanies") + data_connections: Optional[List[Connection]] = Field(default=None, alias="dataConnections") + __properties: ClassVar[List[str]] = ["id", "name", "description", "redirect", "lastSync", "created", "createdByUserName", "products", "tags", "referenceParentCompany", "referenceSubsidiaryCompanies", "dataConnections"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Company from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of reference_parent_company + if self.reference_parent_company: + _dict['referenceParentCompany'] = self.reference_parent_company.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in reference_subsidiary_companies (list) + _items = [] + if self.reference_subsidiary_companies: + for _item_reference_subsidiary_companies in self.reference_subsidiary_companies: + if _item_reference_subsidiary_companies: + _items.append(_item_reference_subsidiary_companies.to_dict()) + _dict['referenceSubsidiaryCompanies'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in data_connections (list) + _items = [] + if self.data_connections: + for _item_data_connections in self.data_connections: + if _item_data_connections: + _items.append(_item_data_connections.to_dict()) + _dict['dataConnections'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Company from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "description": obj.get("description"), + "redirect": obj.get("redirect"), + "lastSync": obj.get("lastSync"), + "created": obj.get("created"), + "createdByUserName": obj.get("createdByUserName"), + "products": obj.get("products"), + "tags": obj.get("tags"), + "referenceParentCompany": CompanyReference.from_dict(obj["referenceParentCompany"]) if obj.get("referenceParentCompany") is not None else None, + "referenceSubsidiaryCompanies": [CompanyReference.from_dict(_item) for _item in obj["referenceSubsidiaryCompanies"]] if obj.get("referenceSubsidiaryCompanies") is not None else None, + "dataConnections": [Connection.from_dict(_item) for _item in obj["dataConnections"]] if obj.get("dataConnections") is not None else None + }) + return _obj - products: Optional[List[str]] = None - r"""An array of products that are currently enabled for the company.""" - reference_parent_company: Annotated[ - Optional[CompanyReference], pydantic.Field(alias="referenceParentCompany") - ] = None - reference_subsidiary_companies: Annotated[ - Optional[List[CompanyReference]], - pydantic.Field(alias="referenceSubsidiaryCompanies"), - ] = None - r"""A list of subsidiary companies owned or controlled by this entity. Empty if the company has no children.""" - tags: Optional[Dict[str, str]] = None - r"""A collection of user-defined key-value pairs that store custom metadata against the company.""" - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "created", - "createdByUserName", - "dataConnections", - "description", - "lastSync", - "products", - "referenceParentCompany", - "referenceSubsidiaryCompanies", - "tags", - ] - ) - nullable_fields = set(["createdByUserName"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -try: - Company.model_rebuild() -except NameError: - pass +class CompanyTypedDict(TypedDict): + """TypedDict variant of Company, for dict-literal request/response inputs.""" + id: NotRequired[str] + name: NotRequired[str] + description: NotRequired[Optional[str]] + redirect: NotRequired[str] + last_sync: NotRequired[Optional[str]] + created: NotRequired[Optional[str]] + created_by_user_name: NotRequired[Optional[str]] + products: NotRequired[Optional[List[str]]] + tags: NotRequired[Optional[Dict[str, str]]] + reference_parent_company: NotRequired[Optional[CompanyReferenceTypedDict]] + reference_subsidiary_companies: NotRequired[Optional[List[CompanyReferenceTypedDict]]] + data_connections: NotRequired[Optional[List[ConnectionTypedDict]]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/companyaccesstoken.py b/bank-feeds/src/codat_bankfeeds/models/shared/companyaccesstoken.py index 833ecd136..2623d911a 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/companyaccesstoken.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/companyaccesstoken.py @@ -1,36 +1,105 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_bankfeeds.types import BaseModel -import pydantic -from typing_extensions import Annotated, TypedDict +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -class CompanyAccessTokenTypedDict(TypedDict): - r"""Details of the access token provisioned for a company.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 - access_token: str - r"""The access token for the company.""" - expires_in: int - r"""The number of seconds until the access token expires.""" - token_type: str - r"""The type of token.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class CompanyAccessToken(BaseModel): - r"""Details of the access token provisioned for a company.""" - access_token: Annotated[str, pydantic.Field(alias="accessToken")] - r"""The access token for the company.""" + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + """ + Details of the access token provisioned for a company. + """ # noqa: E501 + expires_in: int = Field(description="The number of seconds until the access token expires.", alias="expiresIn") + access_token: str = Field(description="The access token for the company.", alias="accessToken") + token_type: str = Field(description="The type of token.", alias="tokenType") + __properties: ClassVar[List[str]] = ["expiresIn", "accessToken", "tokenType"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CompanyAccessToken from a JSON string""" + return cls.from_dict(json.loads(json_str)) - expires_in: Annotated[int, pydantic.Field(alias="expiresIn")] - r"""The number of seconds until the access token expires.""" + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - token_type: Annotated[str, pydantic.Field(alias="tokenType")] - r"""The type of token.""" + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) -try: - CompanyAccessToken.model_rebuild() -except NameError: - pass + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CompanyAccessToken from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "expiresIn": obj.get("expiresIn"), + "accessToken": obj.get("accessToken"), + "tokenType": obj.get("tokenType") + }) + return _obj + + + + + +class CompanyAccessTokenTypedDict(TypedDict): + """TypedDict variant of CompanyAccessToken, for dict-literal request/response inputs.""" + expires_in: NotRequired[int] + access_token: NotRequired[str] + token_type: NotRequired[str] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/companyinformation.py b/bank-feeds/src/codat_bankfeeds/models/shared/companyinformation.py index e2749eb4f..7504c020a 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/companyinformation.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/companyinformation.py @@ -1,91 +1,116 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_bankfeeds.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 +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -class CompanyInformationTypedDict(TypedDict): - r"""Information about the company from the underlying accounting software.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 - base_currency: NotRequired[str] - r"""Currency set in the accounting software of the linked company.""" - company_name: NotRequired[str] - r"""Name of the linked company.""" - currencies: NotRequired[Nullable[List[str]]] - r"""Array of enabled currencies for the linked company.""" - multicurrency_enabled: NotRequired[bool] - r"""Boolean showing if the organisation has multicurrency enabled.""" - plan_type: NotRequired[Nullable[str]] - r"""Accounting software subscription type such as Trial, Demo, Standard.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL class CompanyInformation(BaseModel): - r"""Information about the company from the underlying accounting software.""" - base_currency: Annotated[Optional[str], pydantic.Field(alias="baseCurrency")] = None - r"""Currency set in the accounting software of the linked company.""" + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'currencies', 'planType', 'plan_type'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + Information about the company from the underlying accounting software. + """ # noqa: E501 + company_name: Optional[str] = Field(default=None, description="Name of the linked company.", alias="companyName") + base_currency: Optional[str] = Field(default=None, description="Currency set in the accounting software of the linked company.", alias="baseCurrency") + plan_type: OptionalNullable[str] = Field(default=UNSET, description="Accounting software subscription type such as Trial, Demo, Standard.", alias="planType") + multicurrency_enabled: Optional[bool] = Field(default=None, description="Boolean showing if the organisation has multicurrency enabled.", alias="multicurrencyEnabled") + currencies: OptionalNullable[List[str]] = Field(default=UNSET, description="Array of enabled currencies for the linked company.") + __properties: ClassVar[List[str]] = ["companyName", "baseCurrency", "planType", "multicurrencyEnabled", "currencies"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + - company_name: Annotated[Optional[str], pydantic.Field(alias="companyName")] = None - r"""Name of the linked company.""" + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - currencies: OptionalNullable[List[str]] = UNSET - r"""Array of enabled currencies for the linked company.""" + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - multicurrency_enabled: Annotated[ - Optional[bool], pydantic.Field(alias="multicurrencyEnabled") - ] = None - r"""Boolean showing if the organisation has multicurrency enabled.""" + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CompanyInformation from a JSON string""" + return cls.from_dict(json.loads(json_str)) - plan_type: Annotated[OptionalNullable[str], pydantic.Field(alias="planType")] = ( - UNSET - ) - r"""Accounting software subscription type such as Trial, Demo, Standard.""" + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "baseCurrency", - "companyName", - "currencies", - "multicurrencyEnabled", - "planType", - ] + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, ) - nullable_fields = set(["currencies", "planType"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -try: - CompanyInformation.model_rebuild() -except NameError: - pass + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CompanyInformation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "companyName": obj.get("companyName"), + "baseCurrency": obj.get("baseCurrency"), + "planType": obj.get("planType"), + "multicurrencyEnabled": obj.get("multicurrencyEnabled"), + "currencies": obj.get("currencies") + }) + return _obj + + + + + +class CompanyInformationTypedDict(TypedDict): + """TypedDict variant of CompanyInformation, for dict-literal request/response inputs.""" + company_name: NotRequired[Optional[str]] + base_currency: NotRequired[Optional[str]] + plan_type: NotRequired[Optional[str]] + multicurrency_enabled: NotRequired[Optional[bool]] + currencies: NotRequired[Optional[List[str]]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/companyreference.py b/bank-feeds/src/codat_bankfeeds/models/shared/companyreference.py index 68b9205fb..4eaeb8b3c 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/companyreference.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/companyreference.py @@ -1,83 +1,116 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -from pydantic import model_serializer -from typing import Dict, Optional -from typing_extensions import NotRequired, TypedDict +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) -class CompanyReferenceLinksTypedDict(TypedDict): - r"""A collection of links for the company.""" + Do not edit the class manually. +""" # noqa: E501 - portal: NotRequired[str] - r"""Link to the company page in the portal.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json -class CompanyReferenceLinks(BaseModel): - r"""A collection of links for the company.""" +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict +from codat_bankfeeds.models.company_reference_links import CompanyReferenceLinks, CompanyReferenceLinksTypedDict +from typing import Optional, Set +from typing_extensions import Self - portal: Optional[str] = None - r"""Link to the company page in the portal.""" +class CompanyReference(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["portal"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + CompanyReference + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="Unique identifier for your SMB in Codat.") + name: Optional[str] = Field(default=None, description="The name of the company") + description: Optional[str] = Field(default=None, description="A description of the property.") + links: Optional[CompanyReferenceLinks] = None + tags: Optional[Dict[str, str]] = Field(default=None, description="A collection of user-defined key-value pairs that store custom metadata against the company.") + __properties: ClassVar[List[str]] = ["id", "name", "description", "links", "tags"] - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - return m + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) -class CompanyReferenceTypedDict(TypedDict): - description: NotRequired[str] - r"""Additional information about the company. This can be used to store foreign IDs, references, etc.""" - id: NotRequired[str] - r"""Unique identifier for your SMB in Codat.""" - links: NotRequired[CompanyReferenceLinksTypedDict] - r"""A collection of links for the company.""" - name: NotRequired[str] - r"""The name of the company""" - tags: NotRequired[Dict[str, str]] - r"""A collection of user-defined key-value pairs that store custom metadata against the company.""" + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CompanyReference from a JSON string""" + return cls.from_dict(json.loads(json_str)) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. -class CompanyReference(BaseModel): - description: Optional[str] = None - r"""Additional information about the company. This can be used to store foreign IDs, references, etc.""" + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - id: Optional[str] = None - r"""Unique identifier for your SMB in Codat.""" + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - links: Optional[CompanyReferenceLinks] = None - r"""A collection of links for the company.""" + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of links + if self.links: + _dict['links'] = self.links.to_dict() + return _dict - name: Optional[str] = None - r"""The name of the company""" + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CompanyReference from a dict""" + if obj is None: + return None - tags: Optional[Dict[str, str]] = None - r"""A collection of user-defined key-value pairs that store custom metadata against the company.""" + if not isinstance(obj, dict): + return cls.model_validate(obj) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["description", "id", "links", "name", "tags"]) - serialized = handler(self) - m = {} + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "description": obj.get("description"), + "links": CompanyReferenceLinks.from_dict(obj["links"]) if obj.get("links") is not None else None, + "tags": obj.get("tags") + }) + return _obj - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - return m + + +class CompanyReferenceTypedDict(TypedDict): + """TypedDict variant of CompanyReference, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + name: NotRequired[Optional[str]] + description: NotRequired[Optional[str]] + links: NotRequired[Optional[CompanyReferenceLinksTypedDict]] + tags: NotRequired[Optional[Dict[str, str]]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/companyrequestbody.py b/bank-feeds/src/codat_bankfeeds/models/shared/companyrequestbody.py index a9e37a384..a4c9e3e71 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/companyrequestbody.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/companyrequestbody.py @@ -1,43 +1,113 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -from pydantic import model_serializer -from typing import Dict, Optional -from typing_extensions import NotRequired, TypedDict +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -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[Dict[str, str]] - r"""A collection of user-defined key-value pairs that store custom metadata against the company.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -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.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, field_validator, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict +from typing import Optional, Set +from typing_extensions import Self - tags: Optional[Dict[str, str]] = None - r"""A collection of user-defined key-value pairs that store custom metadata against the company.""" +class CompanyRequestBody(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["description", "tags"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + CompanyRequestBody + """ # noqa: E501 + name: str = Field(description="Name of company being connected.") + description: Optional[str] = Field(default=None, description="Additional information about the company. This can be used to store foreign IDs, references, etc.") + tags: Optional[Dict[str, str]] = Field(default=None, description="A collection of user-defined key-value pairs that store custom metadata against the company.") + __properties: ClassVar[List[str]] = ["name", "description", "tags"] + + @field_validator('name') + def name_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^[A-Za-z0-9\s\-\',&@.,?!\s]+$", value): + raise ValueError(r"must validate the regular expression /^[A-Za-z0-9\s\-',&@.,?!\s]+$/") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CompanyRequestBody from a JSON string""" + return cls.from_dict(json.loads(json_str)) - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - return m + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CompanyRequestBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "description": obj.get("description"), + "tags": obj.get("tags") + }) + return _obj + + + + + +class CompanyRequestBodyTypedDict(TypedDict): + """TypedDict variant of CompanyRequestBody, for dict-literal request/response inputs.""" + name: NotRequired[str] + description: NotRequired[Optional[str]] + tags: NotRequired[Optional[Dict[str, str]]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/companyupdaterequest.py b/bank-feeds/src/codat_bankfeeds/models/shared/companyupdaterequest.py index ba06aa41f..5decce289 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/companyupdaterequest.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/companyupdaterequest.py @@ -1,43 +1,116 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -from pydantic import model_serializer -from typing import Dict, Optional -from typing_extensions import NotRequired, TypedDict +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -class CompanyUpdateRequestTypedDict(TypedDict): - description: NotRequired[str] - r"""Additional information about the company. This can be used to store foreign IDs, references, etc.""" - name: NotRequired[str] - r"""Name of company being connected.""" - tags: NotRequired[Dict[str, str]] - r"""A collection of user-defined key-value pairs that store custom metadata against the company.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -class CompanyUpdateRequest(BaseModel): - description: Optional[str] = None - r"""Additional information about the company. This can be used to store foreign IDs, references, etc.""" - name: Optional[str] = None - r"""Name of company being connected.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, field_validator, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict +from typing import Optional, Set +from typing_extensions import Self - tags: Optional[Dict[str, str]] = None - r"""A collection of user-defined key-value pairs that store custom metadata against the company.""" +class CompanyUpdateRequest(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["description", "name", "tags"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + CompanyUpdateRequest + """ # noqa: E501 + name: Optional[str] = Field(default=None, description="Name of company being connected.") + description: Optional[str] = Field(default=None, description="A description of the property.") + tags: Optional[Dict[str, str]] = Field(default=None, description="A collection of user-defined key-value pairs that store custom metadata against the company.") + __properties: ClassVar[List[str]] = ["name", "description", "tags"] + + @field_validator('name') + def name_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"^[A-Za-z0-9\s\-\',&@.,?!\s]+$", value): + raise ValueError(r"must validate the regular expression /^[A-Za-z0-9\s\-',&@.,?!\s]+$/") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CompanyUpdateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - return m + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CompanyUpdateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "description": obj.get("description"), + "tags": obj.get("tags") + }) + return _obj + + + + + +class CompanyUpdateRequestTypedDict(TypedDict): + """TypedDict variant of CompanyUpdateRequest, for dict-literal request/response inputs.""" + name: NotRequired[Optional[str]] + description: NotRequired[Optional[str]] + tags: NotRequired[Optional[Dict[str, str]]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/connection.py b/bank-feeds/src/codat_bankfeeds/models/shared/connection.py index 49419303e..eec1875a2 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/connection.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/connection.py @@ -1,230 +1,168 @@ -"""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_bankfeeds.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from enum import Enum -import pydantic -from pydantic import model_serializer -from typing import Any, 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/bank-feeds-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). - """ - - 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 - ``` +# coding: utf-8 +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - - 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. - """ - id: str - r"""Unique identifier for a company's data connection.""" - integration_id: str - r"""A Codat ID representing the integration.""" - link_url: str - r"""The link URL your customers can use to authorize access to their business application.""" - platform_name: str - r"""Name of integration connected to company.""" - 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.""" - status: DataConnectionStatus - r"""The current authorization status of the data connection.""" - connection_info: NotRequired[Nullable[Dict[str, Any]]] - data_connection_errors: NotRequired[Nullable[List[DataConnectionErrorTypedDict]]] - integration_key: NotRequired[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.""" - 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. - """ + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +from codat_bankfeeds.models.source_type import SourceType +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, field_validator, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_bankfeeds.models.shared.dataconnectionerror import DataConnectionError, DataConnectionErrorTypedDict +from codat_bankfeeds.models.shared.dataconnectionstatus import DataConnectionStatus +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL class Connection(BaseModel): - r"""A connection represents a [company's](https://docs.codat.io/bank-feeds-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). - """ - - 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. + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'connectionInfo', 'connection_info', 'dataConnectionErrors', 'data_connection_errors'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ - - 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.""" - - link_url: Annotated[str, pydantic.Field(alias="linkUrl")] - r"""The link URL your customers can use to authorize access to their business application.""" - - platform_name: Annotated[str, pydantic.Field(alias="platformName")] - r"""Name of integration connected to company.""" - - 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.""" - + A connection represents a [company's](https://docs.codat.io/bank-feeds-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). + """ # noqa: E501 + id: str = Field(description="Unique identifier for a company's data connection.") + integration_id: str = Field(description="A Codat ID representing the integration.", alias="integrationId") + integration_key: Optional[str] = Field(default=None, description="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.", alias="integrationKey") + source_id: str = Field(description="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`.", alias="sourceId") + source_type: SourceType = Field(description="The type of platform of the connection.", alias="sourceType") + platform_name: str = Field(description="Name of integration connected to company.", alias="platformName") + link_url: str = Field(description="The link URL your customers can use to authorize access to their business application.", alias="linkUrl") status: DataConnectionStatus - r"""The current authorization status of the data connection.""" - - connection_info: Annotated[ - OptionalNullable[Dict[str, Any]], pydantic.Field(alias="connectionInfo") - ] = UNSET - - data_connection_errors: Annotated[ - OptionalNullable[List[DataConnectionError]], - pydantic.Field(alias="dataConnectionErrors"), - ] = UNSET - - integration_key: Annotated[ - Optional[str], pydantic.Field(alias="integrationKey") - ] = None - 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.""" - - 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 - ``` + last_sync: Optional[str] = Field(default=None, description="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.", alias="lastSync") + created: str = Field(description="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: OptionalNullable[List[DataConnectionError]] = Field(default=UNSET, alias="dataConnectionErrors") + connection_info: OptionalNullable[Dict[str, Any]] = Field(default=UNSET, alias="connectionInfo") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "integrationId", "integrationKey", "sourceId", "sourceType", "platformName", "linkUrl", "status", "lastSync", "created", "dataConnectionErrors", "connectionInfo"] + + @field_validator('source_type') + def source_type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['Accounting', 'Banking', 'BankFeed', 'Commerce', 'Expense', 'Other', 'Unknown']): + raise ValueError("must be one of enum values ('Accounting', 'Banking', 'BankFeed', 'Commerce', 'Expense', 'Other', 'Unknown')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Connection from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in data_connection_errors (list) + _items = [] + if self.data_connection_errors: + for _item_data_connection_errors in self.data_connection_errors: + if _item_data_connection_errors: + _items.append(_item_data_connection_errors.to_dict()) + _dict['dataConnectionErrors'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Connection from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "integrationId": obj.get("integrationId"), + "integrationKey": obj.get("integrationKey"), + "sourceId": obj.get("sourceId"), + "sourceType": obj.get("sourceType"), + "platformName": obj.get("platformName"), + "linkUrl": obj.get("linkUrl"), + "status": obj.get("status"), + "lastSync": obj.get("lastSync"), + "created": obj.get("created"), + "dataConnectionErrors": [DataConnectionError.from_dict(_item) for _item in obj["dataConnectionErrors"]] if obj.get("dataConnectionErrors") is not None else None, + "connectionInfo": obj.get("connectionInfo") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - 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 = set( - ["connectionInfo", "dataConnectionErrors", "integrationKey", "lastSync"] - ) - nullable_fields = set(["connectionInfo", "dataConnectionErrors"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -try: - Connection.model_rebuild() -except NameError: - pass +class ConnectionTypedDict(TypedDict): + """TypedDict variant of Connection, for dict-literal request/response inputs.""" + id: NotRequired[str] + integration_id: NotRequired[str] + integration_key: NotRequired[Optional[str]] + source_id: NotRequired[str] + source_type: NotRequired[SourceType] + platform_name: NotRequired[str] + link_url: NotRequired[str] + status: DataConnectionStatus + last_sync: NotRequired[Optional[str]] + created: NotRequired[str] + data_connection_errors: NotRequired[Optional[List[DataConnectionErrorTypedDict]]] + connection_info: NotRequired[Optional[Dict[str, Any]]] + additional_properties: NotRequired[Dict[str, Any]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/connections.py b/bank-feeds/src/codat_bankfeeds/models/shared/connections.py index 91f658610..061d385fd 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/connections.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/connections.py @@ -1,58 +1,124 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + from __future__ import annotations -from .connection import Connection, ConnectionTypedDict -from .links import Links, LinksTypedDict -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import List, Optional +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional from typing_extensions import Annotated, NotRequired, TypedDict +from codat_bankfeeds.models.shared.connection import Connection, ConnectionTypedDict +from codat_bankfeeds.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +class Connections(BaseModel): -class ConnectionsTypedDict(TypedDict): - links: LinksTypedDict - 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.""" - results: NotRequired[List[ConnectionTypedDict]] + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + """ + Connections + """ # noqa: E501 + page_number: int = Field(description="Current page number.", alias="pageNumber") + page_size: int = Field(description="Number of items to return in results array.", alias="pageSize") + total_results: int = Field(description="Total number of items.", alias="totalResults") + links: Links = Field(alias="_links") + results: Optional[List[Connection]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class Connections(BaseModel): - links: Annotated[Links, pydantic.Field(alias="_links")] - page_number: Annotated[int, pydantic.Field(alias="pageNumber")] - r"""Current page number.""" + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - page_size: Annotated[int, pydantic.Field(alias="pageSize")] - r"""Number of items to return in results array.""" + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - total_results: Annotated[int, pydantic.Field(alias="totalResults")] - r"""Total number of items.""" + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Connections from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Connection]] = None + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["results"]) - serialized = handler(self) - m = {} + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of links + if self.links: + _dict['_links'] = self.links.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + return _dict - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Connections from a dict""" + if obj is None: + return None - return m + if not isinstance(obj, dict): + return cls.model_validate(obj) + _obj = cls.model_validate({ + "pageNumber": obj.get("pageNumber"), + "pageSize": obj.get("pageSize"), + "totalResults": obj.get("totalResults"), + "_links": Links.from_dict(obj["_links"]) if obj.get("_links") is not None else None, + "results": [Connection.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - Connections.model_rebuild() -except NameError: - pass + + + + +class ConnectionsTypedDict(TypedDict): + """TypedDict variant of Connections, for dict-literal request/response inputs.""" + page_number: NotRequired[int] + page_size: NotRequired[int] + total_results: NotRequired[int] + links: NotRequired[LinksTypedDict] + results: NotRequired[Optional[List[ConnectionTypedDict]]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/createbanktransactions.py b/bank-feeds/src/codat_bankfeeds/models/shared/createbanktransactions.py index 99782526f..c0ccb9f7e 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/createbanktransactions.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/createbanktransactions.py @@ -1,27 +1,111 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .banktransactions import BankTransactions, BankTransactionsTypedDict -from codat_bankfeeds.types import BaseModel -import pydantic -from typing import List -from typing_extensions import Annotated, TypedDict +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -class CreateBankTransactionsTypedDict(TypedDict): - account_id: str - r"""Unique identifier for a bank account.""" - transactions: List[BankTransactionsTypedDict] + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated, NotRequired, TypedDict +from codat_bankfeeds.models.bank_transaction import BankTransaction, BankTransactionTypedDict +from typing import Optional, Set +from typing_extensions import Self class CreateBankTransactions(BaseModel): - account_id: Annotated[str, pydantic.Field(alias="accountId")] - r"""Unique identifier for a bank account.""" - transactions: List[BankTransactions] + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + """ + CreateBankTransactions + """ # noqa: E501 + account_id: str = Field(description="Unique identifier for a bank account.", alias="accountId") + transactions: List[BankTransaction] + __properties: ClassVar[List[str]] = ["accountId", "transactions"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CreateBankTransactions from a JSON string""" + return cls.from_dict(json.loads(json_str)) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. -try: - CreateBankTransactions.model_rebuild() -except NameError: - pass + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in transactions (list) + _items = [] + if self.transactions: + for _item_transactions in self.transactions: + if _item_transactions: + _items.append(_item_transactions.to_dict()) + _dict['transactions'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreateBankTransactions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "accountId": obj.get("accountId"), + "transactions": [BankTransaction.from_dict(_item) for _item in obj["transactions"]] if obj.get("transactions") is not None else None + }) + return _obj + + + + + +class CreateBankTransactionsTypedDict(TypedDict): + """TypedDict variant of CreateBankTransactions, for dict-literal request/response inputs.""" + account_id: NotRequired[str] + transactions: List[BankTransactionTypedDict] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/createbanktransactionsresponse.py b/bank-feeds/src/codat_bankfeeds/models/shared/createbanktransactionsresponse.py index ffe7743db..e14b9503a 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/createbanktransactionsresponse.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/createbanktransactionsresponse.py @@ -1,227 +1,161 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .createbanktransactions import ( - CreateBankTransactions, - CreateBankTransactionsTypedDict, -) -from .datatype import DataType -from .pushoperationchange import PushOperationChange, PushOperationChangeTypedDict -from .pushoperationstatus import PushOperationStatus -from .validation import Validation, ValidationTypedDict -from codat_bankfeeds.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 CreateBankTransactionsResponseTypedDict(TypedDict): - company_id: str - r"""Unique identifier for your SMB in Codat.""" - data_connection_key: str - r"""Unique identifier for a company's data connection.""" - push_operation_key: str - r"""A unique identifier generated by Codat to represent this single push operation. This identifier can be used to track the status of the push, and should be persisted.""" - requested_on_utc: 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: PushOperationStatus - r"""The current status of the push operation.""" - status_code: int - r"""Push status code.""" - changes: NotRequired[Nullable[List[PushOperationChangeTypedDict]]] - r"""Contains a single entry that communicates which record has changed and the manner in which it changed.""" - completed_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 - ``` +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - 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: NotRequired[CreateBankTransactionsTypedDict] - data_type: NotRequired[DataType] - r"""Available data types""" - error_message: NotRequired[Nullable[str]] - r"""A message about the error.""" - timeout_in_minutes: NotRequired[Nullable[int]] - r"""Number of minutes the push operation must complete within before it times out.""" - timeout_in_seconds: NotRequired[Nullable[int]] - r"""Number of seconds the push operation must complete within before it times out.""" - validation: NotRequired[ValidationTypedDict] - r"""A human-readable object describing validation decisions Codat has made when pushing data into the platform. If a push has failed because of validation errors, they will be detailed here.""" + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_bankfeeds.models.shared.createbanktransactions import CreateBankTransactions, CreateBankTransactionsTypedDict +from codat_bankfeeds.models.shared.datatype import DataType +from codat_bankfeeds.models.shared.pushoperationchange import PushOperationChange, PushOperationChangeTypedDict +from codat_bankfeeds.models.shared.pushoperationstatus import PushOperationStatus +from codat_bankfeeds.models.shared.validation import Validation, ValidationTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL class CreateBankTransactionsResponse(BaseModel): - company_id: Annotated[str, pydantic.Field(alias="companyId")] - r"""Unique identifier for your SMB in Codat.""" - - data_connection_key: Annotated[str, pydantic.Field(alias="dataConnectionKey")] - r"""Unique identifier for a company's data connection.""" - - push_operation_key: Annotated[str, pydantic.Field(alias="pushOperationKey")] - r"""A unique identifier generated by Codat to represent this single push operation. This identifier can be used to track the status of the push, and should be persisted.""" - - requested_on_utc: Annotated[str, pydantic.Field(alias="requestedOnUtc")] - 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_drop_none(self, handler): + serialized = handler(self) + _nullable = {'changes', 'errorMessage', 'error_message', 'timeoutInMinutes', 'timeoutInSeconds', 'timeout_in_minutes', 'timeout_in_seconds'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ - + CreateBankTransactionsResponse + """ # noqa: E501 + changes: OptionalNullable[List[PushOperationChange]] = Field(default=UNSET, description="Contains a single entry that communicates which record has changed and the manner in which it changed. ") + data_type: Optional[DataType] = Field(default=None, description="The type of data being pushed, eg invoices, customers.", alias="dataType") + company_id: str = Field(description="Unique identifier for your SMB in Codat.", alias="companyId") + push_operation_key: str = Field(description="A unique identifier generated by Codat to represent this single push operation. This identifier can be used to track the status of the push, and should be persisted.", alias="pushOperationKey") + data_connection_key: str = Field(description="Unique identifier for a company's data connection.", alias="dataConnectionKey") + requested_on_utc: str = Field(description="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.", alias="requestedOnUtc") + completed_on_utc: Optional[str] = Field(default=None, description="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.", alias="completedOnUtc") + timeout_in_minutes: OptionalNullable[int] = Field(default=UNSET, description="Number of minutes the push operation must complete within before it times out.", alias="timeoutInMinutes") + timeout_in_seconds: OptionalNullable[int] = Field(default=UNSET, description="Number of seconds the push operation must complete within before it times out.", alias="timeoutInSeconds") status: PushOperationStatus - r"""The current status of the push operation.""" - - status_code: Annotated[int, pydantic.Field(alias="statusCode")] - r"""Push status code.""" - - changes: OptionalNullable[List[PushOperationChange]] = UNSET - r"""Contains a single entry that communicates which record has changed and the manner in which it changed.""" - - completed_on_utc: Annotated[ - Optional[str], pydantic.Field(alias="completedOnUtc") - ] = 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. - """ - + error_message: OptionalNullable[str] = Field(default=UNSET, description="A message about the error.", alias="errorMessage") + validation: Optional[Validation] = None + status_code: int = Field(description="Push status code.", alias="statusCode") data: Optional[CreateBankTransactions] = None + __properties: ClassVar[List[str]] = ["changes", "dataType", "companyId", "pushOperationKey", "dataConnectionKey", "requestedOnUtc", "completedOnUtc", "timeoutInMinutes", "timeoutInSeconds", "status", "errorMessage", "validation", "statusCode", "data"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CreateBankTransactionsResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in changes (list) + _items = [] + if self.changes: + for _item_changes in self.changes: + if _item_changes: + _items.append(_item_changes.to_dict()) + _dict['changes'] = _items + # override the default output from pydantic by calling `to_dict()` of validation + if self.validation: + _dict['validation'] = self.validation.to_dict() + # override the default output from pydantic by calling `to_dict()` of data + if self.data: + _dict['data'] = self.data.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreateBankTransactionsResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "changes": [PushOperationChange.from_dict(_item) for _item in obj["changes"]] if obj.get("changes") is not None else None, + "dataType": obj.get("dataType"), + "companyId": obj.get("companyId"), + "pushOperationKey": obj.get("pushOperationKey"), + "dataConnectionKey": obj.get("dataConnectionKey"), + "requestedOnUtc": obj.get("requestedOnUtc"), + "completedOnUtc": obj.get("completedOnUtc"), + "timeoutInMinutes": obj.get("timeoutInMinutes"), + "timeoutInSeconds": obj.get("timeoutInSeconds"), + "status": obj.get("status"), + "errorMessage": obj.get("errorMessage"), + "validation": Validation.from_dict(obj["validation"]) if obj.get("validation") is not None else None, + "statusCode": obj.get("statusCode"), + "data": CreateBankTransactions.from_dict(obj["data"]) if obj.get("data") is not None else None + }) + return _obj - data_type: Annotated[Optional[DataType], pydantic.Field(alias="dataType")] = None - r"""Available data types""" - - error_message: Annotated[ - OptionalNullable[str], pydantic.Field(alias="errorMessage") - ] = UNSET - r"""A message about the error.""" - timeout_in_minutes: Annotated[ - OptionalNullable[int], pydantic.Field(alias="timeoutInMinutes") - ] = UNSET - r"""Number of minutes the push operation must complete within before it times out.""" - timeout_in_seconds: Annotated[ - OptionalNullable[int], - pydantic.Field( - deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible.", - alias="timeoutInSeconds", - ), - ] = UNSET - r"""Number of seconds the push operation must complete within before it times out.""" - validation: Optional[Validation] = None - r"""A human-readable object describing validation decisions Codat has made when pushing data into the platform. If a push has failed because of validation errors, they will be detailed here.""" - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "changes", - "completedOnUtc", - "data", - "dataType", - "errorMessage", - "timeoutInMinutes", - "timeoutInSeconds", - "validation", - ] - ) - nullable_fields = set( - ["changes", "errorMessage", "timeoutInMinutes", "timeoutInSeconds"] - ) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -try: - CreateBankTransactionsResponse.model_rebuild() -except NameError: - pass +class CreateBankTransactionsResponseTypedDict(TypedDict): + """TypedDict variant of CreateBankTransactionsResponse, for dict-literal request/response inputs.""" + changes: NotRequired[Optional[List[PushOperationChangeTypedDict]]] + data_type: NotRequired[Optional[DataType]] + company_id: NotRequired[str] + push_operation_key: NotRequired[str] + data_connection_key: NotRequired[str] + requested_on_utc: NotRequired[str] + completed_on_utc: NotRequired[Optional[str]] + timeout_in_minutes: NotRequired[Optional[int]] + timeout_in_seconds: NotRequired[Optional[int]] + status: PushOperationStatus + error_message: NotRequired[Optional[str]] + validation: NotRequired[Optional[ValidationTypedDict]] + status_code: NotRequired[int] + data: NotRequired[Optional[CreateBankTransactionsTypedDict]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/dataconnectionerror.py b/bank-feeds/src/codat_bankfeeds/models/shared/dataconnectionerror.py index 8056f57ac..4708abfc3 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/dataconnectionerror.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/dataconnectionerror.py @@ -1,177 +1,130 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_bankfeeds.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): - 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. - """ - 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 - ``` +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + Do not edit the class manually. +""" # noqa: E501 - - 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.""" - 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.""" +from __future__ import annotations +from codat_bankfeeds.models.error_status import ErrorStatus +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, field_validator, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL class DataConnectionError(BaseModel): - 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 + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'status'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + DataConnectionError + """ # noqa: E501 + status_code: Optional[str] = Field(default=None, description="The HTTP status code returned by the source platform when the error occurred.", alias="statusCode") + status_text: Optional[str] = Field(default=None, description="A non-numeric status code/text returned by the source platform when the error occurred.", alias="statusText") + error_message: Optional[str] = Field(default=None, description="A message about a error returned by Codat.", alias="errorMessage") + errored_on_utc: Optional[str] = Field(default=None, description="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.", alias="erroredOnUtc") + status: OptionalNullable[ErrorStatus] = Field(default=UNSET, description="The current status of a transient error. Null statuses indicate that the error is not transient.") + resolved_on_utc: Optional[str] = Field(default=None, description="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.", alias="resolvedOnUtc") + __properties: ClassVar[List[str]] = ["statusCode", "statusText", "errorMessage", "erroredOnUtc", "status", "resolvedOnUtc"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['Active', 'Resolved']): + raise ValueError("must be one of enum values ('Active', 'Resolved')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), ) - 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 - ``` + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - - 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` + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DataConnectionError from a JSON string""" + return cls.from_dict(json.loads(json_str)) - > 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. - """ + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - 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: + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataConnectionError from a dict""" + if obj is None: + return None - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + if not isinstance(obj, dict): + return cls.model_validate(obj) - - 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` + _obj = cls.model_validate({ + "statusCode": obj.get("statusCode"), + "statusText": obj.get("statusText"), + "errorMessage": obj.get("errorMessage"), + "erroredOnUtc": obj.get("erroredOnUtc"), + "status": obj.get("status"), + "resolvedOnUtc": obj.get("resolvedOnUtc") + }) + return _obj - > 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.""" - 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.""" - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "errorMessage", - "erroredOnUtc", - "resolvedOnUtc", - "status", - "statusCode", - "statusText", - ] - ) - nullable_fields = set(["status"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -try: - DataConnectionError.model_rebuild() -except NameError: - pass +class DataConnectionErrorTypedDict(TypedDict): + """TypedDict variant of DataConnectionError, for dict-literal request/response inputs.""" + status_code: NotRequired[Optional[str]] + status_text: NotRequired[Optional[str]] + error_message: NotRequired[Optional[str]] + errored_on_utc: NotRequired[Optional[str]] + status: NotRequired[Optional[ErrorStatus]] + resolved_on_utc: NotRequired[Optional[str]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/dataconnectionstatus.py b/bank-feeds/src/codat_bankfeeds/models/shared/dataconnectionstatus.py index a97f7be30..578e2a4ef 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/dataconnectionstatus.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/dataconnectionstatus.py @@ -1,13 +1,40 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + from __future__ import annotations +import json from enum import Enum +from typing_extensions import Self class DataConnectionStatus(str, Enum): - r"""The current authorization status of the data connection.""" + """ + The current authorization status of the data connection. + """ + + """ + allowed enum values + """ + PENDING_AUTH = 'PendingAuth' + LINKED = 'Linked' + UNLINKED = 'Unlinked' + DEAUTHORIZED = 'Deauthorized' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of DataConnectionStatus from a JSON string""" + return cls(json.loads(json_str)) + - PENDING_AUTH = "PendingAuth" - LINKED = "Linked" - UNLINKED = "Unlinked" - DEAUTHORIZED = "Deauthorized" diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/datatype.py b/bank-feeds/src/codat_bankfeeds/models/shared/datatype.py index e0aff6fb8..cab45dce9 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/datatype.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/datatype.py @@ -1,52 +1,94 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + from __future__ import annotations +import json from enum import Enum +from typing_extensions import Self class DataType(str, Enum): - r"""Available data types""" - - ACCOUNT_TRANSACTIONS = "accountTransactions" - BALANCE_SHEET = "balanceSheet" - BANK_ACCOUNTS = "bankAccounts" - BANK_TRANSACTIONS = "bankTransactions" - BILL_CREDIT_NOTES = "billCreditNotes" - BILL_PAYMENTS = "billPayments" - BILLS = "bills" - CASH_FLOW_STATEMENT = "cashFlowStatement" - CHART_OF_ACCOUNTS = "chartOfAccounts" - COMPANY = "company" - CREDIT_NOTES = "creditNotes" - CUSTOMERS = "customers" - DIRECT_COSTS = "directCosts" - DIRECT_INCOMES = "directIncomes" - INVOICES = "invoices" - ITEM_RECEIPTS = "itemReceipts" - ITEMS = "items" - JOURNAL_ENTRIES = "journalEntries" - JOURNALS = "journals" - PAYMENT_METHODS = "paymentMethods" - PAYMENTS = "payments" - PROFIT_AND_LOSS = "profitAndLoss" - PURCHASE_ORDERS = "purchaseOrders" - SALES_ORDERS = "salesOrders" - SUPPLIERS = "suppliers" - TAX_RATES = "taxRates" - TRACKING_CATEGORIES = "trackingCategories" - TRANSFERS = "transfers" - BANKING_ACCOUNT_BALANCES = "banking-accountBalances" - BANKING_ACCOUNTS = "banking-accounts" - BANKING_TRANSACTION_CATEGORIES = "banking-transactionCategories" - BANKING_TRANSACTIONS = "banking-transactions" - COMMERCE_COMPANY_INFO = "commerce-companyInfo" - COMMERCE_CUSTOMERS = "commerce-customers" - COMMERCE_DISPUTES = "commerce-disputes" - COMMERCE_LOCATIONS = "commerce-locations" - COMMERCE_ORDERS = "commerce-orders" - COMMERCE_PAYMENT_METHODS = "commerce-paymentMethods" - COMMERCE_PAYMENTS = "commerce-payments" - COMMERCE_PRODUCT_CATEGORIES = "commerce-productCategories" - COMMERCE_PRODUCTS = "commerce-products" - COMMERCE_TAX_COMPONENTS = "commerce-taxComponents" - COMMERCE_TRANSACTIONS = "commerce-transactions" + """ + Available data types + """ + + """ + allowed enum values + """ + ACCOUNT_TRANSACTIONS = 'accountTransactions' + BALANCE_SHEET = 'balanceSheet' + BANK_ACCOUNTS = 'bankAccounts' + BANK_TRANSACTIONS = 'bankTransactions' + BILL_CREDIT_NOTES = 'billCreditNotes' + BILL_PAYMENTS = 'billPayments' + BILLS = 'bills' + CASH_FLOW_STATEMENT = 'cashFlowStatement' + CHART_OF_ACCOUNTS = 'chartOfAccounts' + COMPANY = 'company' + CREDIT_NOTES = 'creditNotes' + CUSTOMERS = 'customers' + DIRECT_COSTS = 'directCosts' + DIRECT_INCOMES = 'directIncomes' + INVOICES = 'invoices' + ITEM_RECEIPTS = 'itemReceipts' + ITEMS = 'items' + JOURNAL_ENTRIES = 'journalEntries' + JOURNALS = 'journals' + PAYMENT_METHODS = 'paymentMethods' + PAYMENTS = 'payments' + PROFIT_AND_LOSS = 'profitAndLoss' + PURCHASE_ORDERS = 'purchaseOrders' + SALES_ORDERS = 'salesOrders' + SUPPLIERS = 'suppliers' + TAX_RATES = 'taxRates' + TRACKING_CATEGORIES = 'trackingCategories' + TRANSFERS = 'transfers' + BANKING_MINUS_ACCOUNT_BALANCES = 'banking-accountBalances' + BANKING_ACCOUNT_BALANCES = 'banking-accountBalances' + BANKING_MINUS_ACCOUNTS = 'banking-accounts' + BANKING_ACCOUNTS = 'banking-accounts' + BANKING_MINUS_TRANSACTION_CATEGORIES = 'banking-transactionCategories' + BANKING_TRANSACTION_CATEGORIES = 'banking-transactionCategories' + BANKING_MINUS_TRANSACTIONS = 'banking-transactions' + BANKING_TRANSACTIONS = 'banking-transactions' + COMMERCE_MINUS_COMPANY_INFO = 'commerce-companyInfo' + COMMERCE_COMPANY_INFO = 'commerce-companyInfo' + COMMERCE_MINUS_CUSTOMERS = 'commerce-customers' + COMMERCE_CUSTOMERS = 'commerce-customers' + COMMERCE_MINUS_DISPUTES = 'commerce-disputes' + COMMERCE_DISPUTES = 'commerce-disputes' + COMMERCE_MINUS_LOCATIONS = 'commerce-locations' + COMMERCE_LOCATIONS = 'commerce-locations' + COMMERCE_MINUS_ORDERS = 'commerce-orders' + COMMERCE_ORDERS = 'commerce-orders' + COMMERCE_MINUS_PAYMENT_METHODS = 'commerce-paymentMethods' + COMMERCE_PAYMENT_METHODS = 'commerce-paymentMethods' + COMMERCE_MINUS_PAYMENTS = 'commerce-payments' + COMMERCE_PAYMENTS = 'commerce-payments' + COMMERCE_MINUS_PRODUCT_CATEGORIES = 'commerce-productCategories' + COMMERCE_PRODUCT_CATEGORIES = 'commerce-productCategories' + COMMERCE_MINUS_PRODUCTS = 'commerce-products' + COMMERCE_PRODUCTS = 'commerce-products' + COMMERCE_MINUS_TAX_COMPONENTS = 'commerce-taxComponents' + COMMERCE_TAX_COMPONENTS = 'commerce-taxComponents' + COMMERCE_MINUS_TRANSACTIONS = 'commerce-transactions' + + COMMERCE_TRANSACTIONS = 'commerce-transactions' + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of DataType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/errorvalidation.py b/bank-feeds/src/codat_bankfeeds/models/shared/errorvalidation.py index 72cb063c6..a878d1be0 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/errorvalidation.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/errorvalidation.py @@ -1,54 +1,122 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .errorvalidationitem import ErrorValidationItem, ErrorValidationItemTypedDict -from codat_bankfeeds.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from pydantic import model_serializer -from typing import List -from typing_extensions import NotRequired, TypedDict +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -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.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - errors: NotRequired[Nullable[List[ErrorValidationItemTypedDict]]] - warnings: NotRequired[Nullable[List[ErrorValidationItemTypedDict]]] + Do not edit the class manually. +""" # noqa: E501 -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.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - errors: OptionalNullable[List[ErrorValidationItem]] = UNSET +from pydantic import BaseModel, ConfigDict, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_bankfeeds.models.shared.errorvalidationitem import ErrorValidationItem, ErrorValidationItemTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - warnings: OptionalNullable[List[ErrorValidationItem]] = UNSET +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL +class ErrorValidation(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["errors", "warnings"]) - nullable_fields = set(["errors", "warnings"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m + _nullable = {'errors', 'warnings'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + A human-readable object describing validation decisions Codat has made. If an operation has failed because of validation errors, they will be detailed here. + """ # noqa: E501 + errors: OptionalNullable[List[ErrorValidationItem]] = UNSET + warnings: OptionalNullable[List[ErrorValidationItem]] = UNSET + __properties: ClassVar[List[str]] = ["errors", "warnings"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ErrorValidation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in errors (list) + _items = [] + if self.errors: + for _item_errors in self.errors: + if _item_errors: + _items.append(_item_errors.to_dict()) + _dict['errors'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in warnings (list) + _items = [] + if self.warnings: + for _item_warnings in self.warnings: + if _item_warnings: + _items.append(_item_warnings.to_dict()) + _dict['warnings'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ErrorValidation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "errors": [ErrorValidationItem.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None, + "warnings": [ErrorValidationItem.from_dict(_item) for _item in obj["warnings"]] if obj.get("warnings") is not None else None + }) + return _obj + + + + + +class ErrorValidationTypedDict(TypedDict): + """TypedDict variant of ErrorValidation, for dict-literal request/response inputs.""" + errors: NotRequired[Optional[List[ErrorValidationItemTypedDict]]] + warnings: NotRequired[Optional[List[ErrorValidationItemTypedDict]]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/errorvalidationitem.py b/bank-feeds/src/codat_bankfeeds/models/shared/errorvalidationitem.py index 638d0c200..e4a8fcbfe 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/errorvalidationitem.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/errorvalidationitem.py @@ -1,66 +1,110 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_bankfeeds.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -import pydantic -from pydantic import model_serializer -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -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.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -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.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - validator_name: Annotated[ - OptionalNullable[str], pydantic.Field(alias="validatorName") - ] = UNSET - r"""Name of validator.""" +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL +class ErrorValidationItem(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["itemId", "message", "validatorName"]) - nullable_fields = set(["itemId", "message", "validatorName"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -try: - ErrorValidationItem.model_rebuild() -except NameError: - pass + _nullable = {'itemId', 'item_id', 'message', 'validatorName', 'validator_name'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + ErrorValidationItem + """ # noqa: E501 + item_id: OptionalNullable[str] = Field(default=UNSET, description="Unique identifier for a validation item.", alias="itemId") + message: OptionalNullable[str] = Field(default=UNSET, description="A message outlining validation item's issue.") + validator_name: OptionalNullable[str] = Field(default=UNSET, description="Name of validator.", alias="validatorName") + __properties: ClassVar[List[str]] = ["itemId", "message", "validatorName"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ErrorValidationItem from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ErrorValidationItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "itemId": obj.get("itemId"), + "message": obj.get("message"), + "validatorName": obj.get("validatorName") + }) + return _obj + + + + + +class ErrorValidationItemTypedDict(TypedDict): + """TypedDict variant of ErrorValidationItem, for dict-literal request/response inputs.""" + item_id: NotRequired[Optional[str]] + message: NotRequired[Optional[str]] + validator_name: NotRequired[Optional[str]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/generateotpresponse.py b/bank-feeds/src/codat_bankfeeds/models/shared/generateotpresponse.py index 201a9c95c..1c26fecf7 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/generateotpresponse.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/generateotpresponse.py @@ -1,62 +1,116 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + from __future__ import annotations -from codat_bankfeeds.types import BaseModel -from typing_extensions import TypedDict +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict -class GenerateOtpResponseTypedDict(TypedDict): - r"""Response containing a one-time password and its expiry time.""" +class GenerateOtpResponse(BaseModel): - expiry: 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: + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + """ + Response containing a one-time password and its expiry time. + """ # noqa: E501 + otp: str = Field(description="The one-time password.") + expiry: str = Field(description="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.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["otp", "expiry"] - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - - 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` + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GenerateOtpResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - > 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. - """ - otp: str - r"""The one-time password.""" + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: -class GenerateOtpResponse(BaseModel): - r"""Response containing a one-time password and its expiry time.""" + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) - expiry: 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: + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + return _dict + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GenerateOtpResponse from a dict""" + if obj is None: + return None + if not isinstance(obj, dict): + return cls.model_validate(obj) - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + _obj = cls.model_validate({ + "otp": obj.get("otp"), + "expiry": obj.get("expiry") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj - - 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. - """ - otp: str - r"""The one-time password.""" + + +class GenerateOtpResponseTypedDict(TypedDict): + """TypedDict variant of GenerateOtpResponse, for dict-literal request/response inputs.""" + otp: NotRequired[str] + expiry: NotRequired[str] + additional_properties: NotRequired[Dict[str, Any]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/halref.py b/bank-feeds/src/codat_bankfeeds/models/shared/halref.py index 10c6d2295..a1a64d5b4 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/halref.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/halref.py @@ -1,33 +1,99 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -from pydantic import model_serializer -from typing import Optional -from typing_extensions import NotRequired, TypedDict +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -class HalRefTypedDict(TypedDict): - href: NotRequired[str] - r"""Uri hypertext reference.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class HalRef(BaseModel): - href: Optional[str] = None - r"""Uri hypertext reference.""" @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["href"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + HalRef + """ # noqa: E501 + href: Optional[str] = Field(default=None, description="Uri hypertext reference.") + __properties: ClassVar[List[str]] = ["href"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of HalRef from a JSON string""" + return cls.from_dict(json.loads(json_str)) - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - return m + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of HalRef from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "href": obj.get("href") + }) + return _obj + + + + + +class HalRefTypedDict(TypedDict): + """TypedDict variant of HalRef, for dict-literal request/response inputs.""" + href: NotRequired[Optional[str]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/links.py b/bank-feeds/src/codat_bankfeeds/models/shared/links.py index c29c6c20d..f080184e8 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/links.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/links.py @@ -1,48 +1,121 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .halref import HalRef, HalRefTypedDict -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -class LinksTypedDict(TypedDict): - current: HalRefTypedDict - self_: HalRefTypedDict - next: NotRequired[HalRefTypedDict] - previous: NotRequired[HalRefTypedDict] + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -class Links(BaseModel): - current: HalRef - self_: Annotated[HalRef, pydantic.Field(alias="self")] +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - next: Optional[HalRef] = None +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_bankfeeds.models.shared.halref import HalRef, HalRefTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - previous: Optional[HalRef] = None +class Links(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["next", "previous"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + Links + """ # noqa: E501 + self_: HalRef = Field(alias="self") + current: HalRef + next: Optional[HalRef] = None + previous: Optional[HalRef] = None + __properties: ClassVar[List[str]] = ["self", "current", "next", "previous"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - return m + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Links from a JSON string""" + return cls.from_dict(json.loads(json_str)) -try: - Links.model_rebuild() -except NameError: - pass + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of var_self + if self.self_: + _dict['self'] = self.self_.to_dict() + # override the default output from pydantic by calling `to_dict()` of current + if self.current: + _dict['current'] = self.current.to_dict() + # override the default output from pydantic by calling `to_dict()` of next + if self.next: + _dict['next'] = self.next.to_dict() + # override the default output from pydantic by calling `to_dict()` of previous + if self.previous: + _dict['previous'] = self.previous.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Links from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "self": HalRef.from_dict(obj["self"]) if obj.get("self") is not None else None, + "current": HalRef.from_dict(obj["current"]) if obj.get("current") is not None else None, + "next": HalRef.from_dict(obj["next"]) if obj.get("next") is not None else None, + "previous": HalRef.from_dict(obj["previous"]) if obj.get("previous") is not None else None + }) + return _obj + + + + + +class LinksTypedDict(TypedDict): + """TypedDict variant of Links, for dict-literal request/response inputs.""" + self_: NotRequired[HalRefTypedDict] + current: HalRefTypedDict + next: NotRequired[Optional[HalRefTypedDict]] + previous: NotRequired[Optional[HalRefTypedDict]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/pushchangetype.py b/bank-feeds/src/codat_bankfeeds/models/shared/pushchangetype.py index 76371e9e3..c3442c43f 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/pushchangetype.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/pushchangetype.py @@ -1,14 +1,40 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + from __future__ import annotations +import json from enum import Enum +from typing_extensions import Self class PushChangeType(str, Enum): - r"""Type of change being applied to record in third party platform.""" + """ + Type of change being applied to record in third party platform. + """ + + """ + allowed enum values + """ + UNKNOWN = 'Unknown' + CREATED = 'Created' + MODIFIED = 'Modified' + DELETED = 'Deleted' + ATTACHMENT_UPLOADED = 'AttachmentUploaded' + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of PushChangeType from a JSON string""" + return cls(json.loads(json_str)) + - UNKNOWN = "Unknown" - CREATED = "Created" - MODIFIED = "Modified" - DELETED = "Deleted" - ATTACHMENT_UPLOADED = "AttachmentUploaded" diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/pushfieldvalidation.py b/bank-feeds/src/codat_bankfeeds/models/shared/pushfieldvalidation.py index cc3805e76..0a7562e15 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/pushfieldvalidation.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/pushfieldvalidation.py @@ -1,58 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_bankfeeds.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from pydantic import model_serializer -from typing import Optional -from typing_extensions import NotRequired, TypedDict +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -class PushFieldValidationTypedDict(TypedDict): - details: str - r"""Details on the validation issue.""" - field: NotRequired[str] - r"""Field name that resulted in the validation issue.""" - ref: NotRequired[Nullable[str]] - r"""Unique reference identifier for the validation issue.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -class PushFieldValidation(BaseModel): - details: str - r"""Details on the validation issue.""" - field: Optional[str] = None - r"""Field name that resulted in the validation issue.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - ref: OptionalNullable[str] = UNSET - r"""Unique reference identifier for the validation issue.""" +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict +from typing import Optional, Set +from typing_extensions import Self + +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL +class PushFieldValidation(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["field", "ref"]) - nullable_fields = set(["ref"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m + _nullable = {'ref'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + PushFieldValidation + """ # noqa: E501 + field: Optional[str] = Field(default=None, description="Field name that resulted in the validation issue.", alias="field") + details: str = Field(description="Details on the validation issue.") + ref: OptionalNullable[str] = Field(default=UNSET, description="Unique reference identifier for the validation issue.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["field", "details", "ref"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PushFieldValidation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PushFieldValidation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "field": obj.get("field"), + "details": obj.get("details"), + "ref": obj.get("ref") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + + + + +class PushFieldValidationTypedDict(TypedDict): + """TypedDict variant of PushFieldValidation, for dict-literal request/response inputs.""" + field: NotRequired[Optional[str]] + details: NotRequired[str] + ref: NotRequired[Optional[str]] + additional_properties: NotRequired[Dict[str, Any]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/pushoperation.py b/bank-feeds/src/codat_bankfeeds/models/shared/pushoperation.py index c4c72cc95..3a0fcdd4e 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/pushoperation.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/pushoperation.py @@ -1,219 +1,154 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .datatype import DataType -from .pushoperationchange import PushOperationChange, PushOperationChangeTypedDict -from .pushoperationstatus import PushOperationStatus -from .validation import Validation, ValidationTypedDict -from codat_bankfeeds.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 PushOperationTypedDict(TypedDict): - company_id: str - r"""Unique identifier for your SMB in Codat.""" - data_connection_key: str - r"""Unique identifier for a company's data connection.""" - push_operation_key: str - r"""A unique identifier generated by Codat to represent this single push operation. This identifier can be used to track the status of the push, and should be persisted.""" - requested_on_utc: 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: PushOperationStatus - r"""The current status of the push operation.""" - status_code: int - r"""Push status code.""" - changes: NotRequired[Nullable[List[PushOperationChangeTypedDict]]] - r"""Contains a single entry that communicates which record has changed and the manner in which it changed.""" - completed_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: +""" + Bank Feeds - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - - 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_type: NotRequired[DataType] - r"""Available data types""" - error_message: NotRequired[Nullable[str]] - r"""A message about the error.""" - timeout_in_minutes: NotRequired[Nullable[int]] - r"""Number of minutes the push operation must complete within before it times out.""" - timeout_in_seconds: NotRequired[Nullable[int]] - r"""Number of seconds the push operation must complete within before it times out.""" - validation: NotRequired[ValidationTypedDict] - r"""A human-readable object describing validation decisions Codat has made when pushing data into the platform. If a push has failed because of validation errors, they will be detailed here.""" + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_bankfeeds.models.shared.datatype import DataType +from codat_bankfeeds.models.shared.pushoperationchange import PushOperationChange, PushOperationChangeTypedDict +from codat_bankfeeds.models.shared.pushoperationstatus import PushOperationStatus +from codat_bankfeeds.models.shared.validation import Validation, ValidationTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL class PushOperation(BaseModel): - company_id: Annotated[str, pydantic.Field(alias="companyId")] - r"""Unique identifier for your SMB in Codat.""" - - data_connection_key: Annotated[str, pydantic.Field(alias="dataConnectionKey")] - r"""Unique identifier for a company's data connection.""" - - push_operation_key: Annotated[str, pydantic.Field(alias="pushOperationKey")] - r"""A unique identifier generated by Codat to represent this single push operation. This identifier can be used to track the status of the push, and should be persisted.""" - - requested_on_utc: Annotated[str, pydantic.Field(alias="requestedOnUtc")] - 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_drop_none(self, handler): + serialized = handler(self) + _nullable = {'changes', 'errorMessage', 'error_message', 'timeoutInMinutes', 'timeoutInSeconds', 'timeout_in_minutes', 'timeout_in_seconds'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ - + PushOperation + """ # noqa: E501 + changes: OptionalNullable[List[PushOperationChange]] = Field(default=UNSET, description="Contains a single entry that communicates which record has changed and the manner in which it changed. ") + data_type: Optional[DataType] = Field(default=None, description="The type of data being pushed, eg invoices, customers.", alias="dataType") + company_id: str = Field(description="Unique identifier for your SMB in Codat.", alias="companyId") + push_operation_key: str = Field(description="A unique identifier generated by Codat to represent this single push operation. This identifier can be used to track the status of the push, and should be persisted.", alias="pushOperationKey") + data_connection_key: str = Field(description="Unique identifier for a company's data connection.", alias="dataConnectionKey") + requested_on_utc: str = Field(description="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.", alias="requestedOnUtc") + completed_on_utc: Optional[str] = Field(default=None, description="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.", alias="completedOnUtc") + timeout_in_minutes: OptionalNullable[int] = Field(default=UNSET, description="Number of minutes the push operation must complete within before it times out.", alias="timeoutInMinutes") + timeout_in_seconds: OptionalNullable[int] = Field(default=UNSET, description="Number of seconds the push operation must complete within before it times out.", alias="timeoutInSeconds") status: PushOperationStatus - r"""The current status of the push operation.""" - - status_code: Annotated[int, pydantic.Field(alias="statusCode")] - r"""Push status code.""" - - changes: OptionalNullable[List[PushOperationChange]] = UNSET - r"""Contains a single entry that communicates which record has changed and the manner in which it changed.""" - - completed_on_utc: Annotated[ - Optional[str], pydantic.Field(alias="completedOnUtc") - ] = 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_type: Annotated[Optional[DataType], pydantic.Field(alias="dataType")] = None - r"""Available data types""" + error_message: OptionalNullable[str] = Field(default=UNSET, description="A message about the error.", alias="errorMessage") + validation: Optional[Validation] = None + status_code: int = Field(description="Push status code.", alias="statusCode") + __properties: ClassVar[List[str]] = ["changes", "dataType", "companyId", "pushOperationKey", "dataConnectionKey", "requestedOnUtc", "completedOnUtc", "timeoutInMinutes", "timeoutInSeconds", "status", "errorMessage", "validation", "statusCode"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PushOperation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in changes (list) + _items = [] + if self.changes: + for _item_changes in self.changes: + if _item_changes: + _items.append(_item_changes.to_dict()) + _dict['changes'] = _items + # override the default output from pydantic by calling `to_dict()` of validation + if self.validation: + _dict['validation'] = self.validation.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PushOperation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "changes": [PushOperationChange.from_dict(_item) for _item in obj["changes"]] if obj.get("changes") is not None else None, + "dataType": obj.get("dataType"), + "companyId": obj.get("companyId"), + "pushOperationKey": obj.get("pushOperationKey"), + "dataConnectionKey": obj.get("dataConnectionKey"), + "requestedOnUtc": obj.get("requestedOnUtc"), + "completedOnUtc": obj.get("completedOnUtc"), + "timeoutInMinutes": obj.get("timeoutInMinutes"), + "timeoutInSeconds": obj.get("timeoutInSeconds"), + "status": obj.get("status"), + "errorMessage": obj.get("errorMessage"), + "validation": Validation.from_dict(obj["validation"]) if obj.get("validation") is not None else None, + "statusCode": obj.get("statusCode") + }) + return _obj - error_message: Annotated[ - OptionalNullable[str], pydantic.Field(alias="errorMessage") - ] = UNSET - r"""A message about the error.""" - timeout_in_minutes: Annotated[ - OptionalNullable[int], pydantic.Field(alias="timeoutInMinutes") - ] = UNSET - r"""Number of minutes the push operation must complete within before it times out.""" - timeout_in_seconds: Annotated[ - OptionalNullable[int], - pydantic.Field( - deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible.", - alias="timeoutInSeconds", - ), - ] = UNSET - r"""Number of seconds the push operation must complete within before it times out.""" - validation: Optional[Validation] = None - r"""A human-readable object describing validation decisions Codat has made when pushing data into the platform. If a push has failed because of validation errors, they will be detailed here.""" - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "changes", - "completedOnUtc", - "dataType", - "errorMessage", - "timeoutInMinutes", - "timeoutInSeconds", - "validation", - ] - ) - nullable_fields = set( - ["changes", "errorMessage", "timeoutInMinutes", "timeoutInSeconds"] - ) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -try: - PushOperation.model_rebuild() -except NameError: - pass +class PushOperationTypedDict(TypedDict): + """TypedDict variant of PushOperation, for dict-literal request/response inputs.""" + changes: NotRequired[Optional[List[PushOperationChangeTypedDict]]] + data_type: NotRequired[Optional[DataType]] + company_id: NotRequired[str] + push_operation_key: NotRequired[str] + data_connection_key: NotRequired[str] + requested_on_utc: NotRequired[str] + completed_on_utc: NotRequired[Optional[str]] + timeout_in_minutes: NotRequired[Optional[int]] + timeout_in_seconds: NotRequired[Optional[int]] + status: PushOperationStatus + error_message: NotRequired[Optional[str]] + validation: NotRequired[Optional[ValidationTypedDict]] + status_code: NotRequired[int] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/pushoperationchange.py b/bank-feeds/src/codat_bankfeeds/models/shared/pushoperationchange.py index c3493b8e9..3e3a7b91e 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/pushoperationchange.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/pushoperationchange.py @@ -1,69 +1,115 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .pushchangetype import PushChangeType -from .pushoperationref import PushOperationRef, PushOperationRefTypedDict -from codat_bankfeeds.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 +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -class PushOperationChangeTypedDict(TypedDict): - attachment_id: NotRequired[Nullable[str]] - r"""Unique identifier for the attachment created otherwise null.""" - record_ref: NotRequired[PushOperationRefTypedDict] - type: NotRequired[PushChangeType] - r"""Type of change being applied to record in third party platform.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -class PushOperationChange(BaseModel): - attachment_id: Annotated[ - OptionalNullable[str], pydantic.Field(alias="attachmentId") - ] = UNSET - r"""Unique identifier for the attachment created otherwise null.""" - record_ref: Annotated[ - Optional[PushOperationRef], pydantic.Field(alias="recordRef") - ] = None +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - type: Optional[PushChangeType] = None - r"""Type of change being applied to record in third party platform.""" +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_bankfeeds.models.shared.pushchangetype import PushChangeType +from codat_bankfeeds.models.shared.pushoperationref import PushOperationRef, PushOperationRefTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL +class PushOperationChange(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["attachmentId", "recordRef", "type"]) - nullable_fields = set(["attachmentId"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -try: - PushOperationChange.model_rebuild() -except NameError: - pass + _nullable = {'attachmentId', 'attachment_id'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + PushOperationChange + """ # noqa: E501 + type: Optional[PushChangeType] = None + record_ref: Optional[PushOperationRef] = Field(default=None, alias="recordRef") + attachment_id: OptionalNullable[str] = Field(default=UNSET, description="Unique identifier for the attachment created otherwise null.", alias="attachmentId") + __properties: ClassVar[List[str]] = ["type", "recordRef", "attachmentId"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PushOperationChange from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of record_ref + if self.record_ref: + _dict['recordRef'] = self.record_ref.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PushOperationChange from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "recordRef": PushOperationRef.from_dict(obj["recordRef"]) if obj.get("recordRef") is not None else None, + "attachmentId": obj.get("attachmentId") + }) + return _obj + + + + + +class PushOperationChangeTypedDict(TypedDict): + """TypedDict variant of PushOperationChange, for dict-literal request/response inputs.""" + type: NotRequired[Optional[PushChangeType]] + record_ref: NotRequired[Optional[PushOperationRefTypedDict]] + attachment_id: NotRequired[Optional[str]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/pushoperationref.py b/bank-feeds/src/codat_bankfeeds/models/shared/pushoperationref.py index cd553ee28..4e40f339c 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/pushoperationref.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/pushoperationref.py @@ -1,46 +1,117 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .datatype import DataType -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -class PushOperationRefTypedDict(TypedDict): - data_type: NotRequired[DataType] - r"""Available data types""" - id: NotRequired[str] - r"""Unique identifier for a push operation.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -class PushOperationRef(BaseModel): - data_type: Annotated[Optional[DataType], pydantic.Field(alias="dataType")] = None - r"""Available data types""" - id: Optional[str] = None - r"""Unique identifier for a push operation.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_bankfeeds.models.shared.datatype import DataType +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class PushOperationRef(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["dataType", "id"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + PushOperationRef + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="Unique identifier for a push operation.") + data_type: Optional[DataType] = Field(default=None, alias="dataType") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "dataType"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PushOperationRef from a JSON string""" + return cls.from_dict(json.loads(json_str)) - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - return m + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) -try: - PushOperationRef.model_rebuild() -except NameError: - pass + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PushOperationRef from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "dataType": obj.get("dataType") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + + + + +class PushOperationRefTypedDict(TypedDict): + """TypedDict variant of PushOperationRef, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + data_type: NotRequired[Optional[DataType]] + additional_properties: NotRequired[Dict[str, Any]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/pushoperations.py b/bank-feeds/src/codat_bankfeeds/models/shared/pushoperations.py index e8dc177ca..907cef86d 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/pushoperations.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/pushoperations.py @@ -1,58 +1,124 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + from __future__ import annotations -from .links import Links, LinksTypedDict -from .pushoperation import PushOperation, PushOperationTypedDict -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import List, Optional +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional from typing_extensions import Annotated, NotRequired, TypedDict +from codat_bankfeeds.models.shared.links import Links, LinksTypedDict +from codat_bankfeeds.models.shared.pushoperation import PushOperation, PushOperationTypedDict +from typing import Optional, Set +from typing_extensions import Self +class PushOperations(BaseModel): -class PushOperationsTypedDict(TypedDict): - links: LinksTypedDict - 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.""" - results: NotRequired[List[PushOperationTypedDict]] + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + """ + PushOperations + """ # noqa: E501 + page_number: int = Field(description="Current page number.", alias="pageNumber") + page_size: int = Field(description="Number of items to return in results array.", alias="pageSize") + total_results: int = Field(description="Total number of items.", alias="totalResults") + links: Links = Field(alias="_links") + results: Optional[List[PushOperation]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class PushOperations(BaseModel): - links: Annotated[Links, pydantic.Field(alias="_links")] - page_number: Annotated[int, pydantic.Field(alias="pageNumber")] - r"""Current page number.""" + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - page_size: Annotated[int, pydantic.Field(alias="pageSize")] - r"""Number of items to return in results array.""" + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - total_results: Annotated[int, pydantic.Field(alias="totalResults")] - r"""Total number of items.""" + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PushOperations from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[PushOperation]] = None + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["results"]) - serialized = handler(self) - m = {} + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of links + if self.links: + _dict['_links'] = self.links.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + return _dict - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PushOperations from a dict""" + if obj is None: + return None - return m + if not isinstance(obj, dict): + return cls.model_validate(obj) + _obj = cls.model_validate({ + "pageNumber": obj.get("pageNumber"), + "pageSize": obj.get("pageSize"), + "totalResults": obj.get("totalResults"), + "_links": Links.from_dict(obj["_links"]) if obj.get("_links") is not None else None, + "results": [PushOperation.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - PushOperations.model_rebuild() -except NameError: - pass + + + + +class PushOperationsTypedDict(TypedDict): + """TypedDict variant of PushOperations, for dict-literal request/response inputs.""" + page_number: NotRequired[int] + page_size: NotRequired[int] + total_results: NotRequired[int] + links: NotRequired[LinksTypedDict] + results: NotRequired[Optional[List[PushOperationTypedDict]]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/pushoperationstatus.py b/bank-feeds/src/codat_bankfeeds/models/shared/pushoperationstatus.py index 09fa8b1f2..b8d615856 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/pushoperationstatus.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/pushoperationstatus.py @@ -1,13 +1,39 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + from __future__ import annotations +import json from enum import Enum +from typing_extensions import Self class PushOperationStatus(str, Enum): - r"""The current status of the push operation.""" + """ + The current status of the push operation. + """ + + """ + allowed enum values + """ + PENDING = 'Pending' + FAILED = 'Failed' + SUCCESS = 'Success' + TIMED_OUT = 'TimedOut' + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of PushOperationStatus from a JSON string""" + return cls(json.loads(json_str)) + - PENDING = "Pending" - FAILED = "Failed" - SUCCESS = "Success" - TIMED_OUT = "TimedOut" diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/pushoption.py b/bank-feeds/src/codat_bankfeeds/models/shared/pushoption.py index c612d2c8c..89aa36836 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/pushoption.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/pushoption.py @@ -1,83 +1,149 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .pushoptionchoice import PushOptionChoice, PushOptionChoiceTypedDict -from .pushoptionproperty import PushOptionProperty, PushOptionPropertyTypedDict -from .pushoptiontype import PushOptionType -from .pushvalidationinfo import PushValidationInfo, PushValidationInfoTypedDict -from codat_bankfeeds.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -import pydantic -from pydantic import model_serializer -from typing import Dict, List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class PushOptionTypedDict(TypedDict): - display_name: str - r"""The property's display name.""" - required: bool - r"""The property is required if `True`.""" - type: PushOptionType - r"""The option type.""" - description: NotRequired[str] - r"""A description of the property.""" - options: NotRequired[Nullable[List[PushOptionChoiceTypedDict]]] - properties: NotRequired[Nullable[Dict[str, PushOptionPropertyTypedDict]]] - validation: NotRequired[PushValidationInfoTypedDict] +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -class PushOption(BaseModel): - display_name: Annotated[str, pydantic.Field(alias="displayName")] - r"""The property's display name.""" - - required: bool - r"""The property is required if `True`.""" - - type: PushOptionType - r"""The option type.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - description: Optional[str] = None - r"""A description of the property.""" + Do not edit the class manually. +""" # noqa: E501 - options: OptionalNullable[List[PushOptionChoice]] = UNSET - properties: OptionalNullable[Dict[str, PushOptionProperty]] = UNSET +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - validation: Optional[PushValidationInfo] = None +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict +from codat_bankfeeds.models.shared.pushoptionchoice import PushOptionChoice, PushOptionChoiceTypedDict +from codat_bankfeeds.models.shared.pushoptionproperty import PushOptionProperty, PushOptionPropertyTypedDict +from codat_bankfeeds.models.shared.pushoptiontype import PushOptionType +from codat_bankfeeds.models.shared.pushvalidationinfo import PushValidationInfo, PushValidationInfoTypedDict +from typing import Optional, Set +from typing_extensions import Self + +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL +class PushOption(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["description", "options", "properties", "validation"]) - nullable_fields = set(["options", "properties"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + _nullable = {'options', 'properties'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + PushOption + """ # noqa: E501 + type: PushOptionType + display_name: str = Field(description="The property's display name.", alias="displayName") + description: Optional[str] = Field(default=None, description="A description of the property.") + required: bool = Field(description="The property is required if `True`.") + properties: OptionalNullable[Dict[str, PushOptionProperty]] = UNSET + options: OptionalNullable[List[PushOptionChoice]] = UNSET + validation: Optional[PushValidationInfo] = None + __properties: ClassVar[List[str]] = ["type", "displayName", "description", "required", "properties", "options", "validation"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PushOption from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each value in properties (dict) + _field_dict = {} + if self.properties: + for _key_properties in self.properties: + if self.properties[_key_properties]: + _field_dict[_key_properties] = self.properties[_key_properties].to_dict() + _dict['properties'] = _field_dict + # override the default output from pydantic by calling `to_dict()` of each item in options (list) + _items = [] + if self.options: + for _item_options in self.options: + if _item_options: + _items.append(_item_options.to_dict()) + _dict['options'] = _items + # override the default output from pydantic by calling `to_dict()` of validation + if self.validation: + _dict['validation'] = self.validation.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PushOption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "displayName": obj.get("displayName"), + "description": obj.get("description"), + "required": obj.get("required"), + "properties": dict( + (_k, PushOptionProperty.from_dict(_v)) + for _k, _v in obj["properties"].items() ) + if obj.get("properties") is not None + else None, + "options": [PushOptionChoice.from_dict(_item) for _item in obj["options"]] if obj.get("options") is not None else None, + "validation": PushValidationInfo.from_dict(obj["validation"]) if obj.get("validation") is not None else None + }) + return _obj + - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - return m -try: - PushOption.model_rebuild() -except NameError: - pass +class PushOptionTypedDict(TypedDict): + """TypedDict variant of PushOption, for dict-literal request/response inputs.""" + type: PushOptionType + display_name: NotRequired[str] + description: NotRequired[Optional[str]] + required: NotRequired[bool] + properties: NotRequired[Optional[Dict[str, PushOptionPropertyTypedDict]]] + options: NotRequired[Optional[List[PushOptionChoiceTypedDict]]] + validation: NotRequired[Optional[PushValidationInfoTypedDict]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/pushoptionchoice.py b/bank-feeds/src/codat_bankfeeds/models/shared/pushoptionchoice.py index ac0c38e4b..b64420ea3 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/pushoptionchoice.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/pushoptionchoice.py @@ -1,63 +1,113 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + from __future__ import annotations -from .pushoptiontype import PushOptionType -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional from typing_extensions import Annotated, NotRequired, TypedDict +from codat_bankfeeds.models.shared.pushoptiontype import PushOptionType +from typing import Optional, Set +from typing_extensions import Self +class PushOptionChoice(BaseModel): -class PushOptionChoiceTypedDict(TypedDict): - description: NotRequired[str] - r"""A description of the property.""" - display_name: NotRequired[str] - r"""The property's display name.""" - required: NotRequired[bool] - r"""The property is required if `True`.""" - type: NotRequired[PushOptionType] - r"""The option type.""" - value: NotRequired[str] - r"""Allowed value for field.""" + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + """ + PushOptionChoice + """ # noqa: E501 + value: Optional[str] = Field(default=None, description="Allowed value for field.") + type: Optional[PushOptionType] = None + display_name: Optional[str] = Field(default=None, description="The property's display name.", alias="displayName") + description: Optional[str] = Field(default=None, description="A description of the property.") + required: Optional[bool] = Field(default=None, description="The property is required if `True`.") + __properties: ClassVar[List[str]] = ["value", "type", "displayName", "description", "required"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class PushOptionChoice(BaseModel): - description: Optional[str] = None - r"""A description of the property.""" - display_name: Annotated[Optional[str], pydantic.Field(alias="displayName")] = None - r"""The property's display name.""" + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - required: Optional[bool] = None - r"""The property is required if `True`.""" + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - type: Optional[PushOptionType] = None - r"""The option type.""" + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PushOptionChoice from a JSON string""" + return cls.from_dict(json.loads(json_str)) - value: Optional[str] = None - r"""Allowed value for field.""" + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["description", "displayName", "required", "type", "value"] + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, ) - serialized = handler(self) - m = {} + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PushOptionChoice from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) + _obj = cls.model_validate({ + "value": obj.get("value"), + "type": obj.get("type"), + "displayName": obj.get("displayName"), + "description": obj.get("description"), + "required": obj.get("required") + }) + return _obj - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - return m -try: - PushOptionChoice.model_rebuild() -except NameError: - pass + +class PushOptionChoiceTypedDict(TypedDict): + """TypedDict variant of PushOptionChoice, for dict-literal request/response inputs.""" + value: NotRequired[Optional[str]] + type: NotRequired[Optional[PushOptionType]] + display_name: NotRequired[Optional[str]] + description: NotRequired[Optional[str]] + required: NotRequired[Optional[bool]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/pushoptionproperty.py b/bank-feeds/src/codat_bankfeeds/models/shared/pushoptionproperty.py index 4f8e474b3..8c381ed15 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/pushoptionproperty.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/pushoptionproperty.py @@ -1,82 +1,150 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .pushoptionchoice import PushOptionChoice, PushOptionChoiceTypedDict -from .pushoptiontype import PushOptionType -from .pushvalidationinfo import PushValidationInfo, PushValidationInfoTypedDict -from codat_bankfeeds.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -import pydantic -from pydantic import model_serializer -from typing import Dict, List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict +# coding: utf-8 +""" + Bank Feeds -class PushOptionPropertyTypedDict(TypedDict): - description: str - r"""A description of the property.""" - display_name: str - r"""The property's display name.""" - required: bool - r"""The property is required if `True`.""" - type: PushOptionType - r"""The option type.""" - options: NotRequired[Nullable[List[PushOptionChoiceTypedDict]]] - properties: NotRequired[Nullable[Dict[str, PushOptionPropertyTypedDict]]] - validation: NotRequired[PushValidationInfoTypedDict] + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) -class PushOptionProperty(BaseModel): - description: str - r"""A description of the property.""" + Do not edit the class manually. +""" # noqa: E501 - display_name: Annotated[str, pydantic.Field(alias="displayName")] - r"""The property's display name.""" - required: bool - r"""The property is required if `True`.""" - - type: PushOptionType - r"""The option type.""" - - options: OptionalNullable[List[PushOptionChoice]] = UNSET +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - properties: OptionalNullable[Dict[str, PushOptionProperty]] = UNSET +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict +from codat_bankfeeds.models.shared.pushoptionchoice import PushOptionChoice, PushOptionChoiceTypedDict +from codat_bankfeeds.models.shared.pushoptiontype import PushOptionType +from codat_bankfeeds.models.shared.pushvalidationinfo import PushValidationInfo, PushValidationInfoTypedDict +from typing import Optional, Set +from typing_extensions import Self - validation: Optional[PushValidationInfo] = None +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL +class PushOptionProperty(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["options", "properties", "validation"]) - nullable_fields = set(["options", "properties"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + _nullable = {'options', 'properties'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + PushOptionProperty + """ # noqa: E501 + type: PushOptionType + display_name: str = Field(description="The property's display name.", alias="displayName") + description: str = Field(description="A description of the property.") + required: bool = Field(description="The property is required if `True`.") + properties: OptionalNullable[Dict[str, PushOptionProperty]] = UNSET + options: OptionalNullable[List[PushOptionChoice]] = UNSET + validation: Optional[PushValidationInfo] = None + __properties: ClassVar[List[str]] = ["type", "displayName", "description", "required", "properties", "options", "validation"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PushOptionProperty from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each value in properties (dict) + _field_dict = {} + if self.properties: + for _key_properties in self.properties: + if self.properties[_key_properties]: + _field_dict[_key_properties] = self.properties[_key_properties].to_dict() + _dict['properties'] = _field_dict + # override the default output from pydantic by calling `to_dict()` of each item in options (list) + _items = [] + if self.options: + for _item_options in self.options: + if _item_options: + _items.append(_item_options.to_dict()) + _dict['options'] = _items + # override the default output from pydantic by calling `to_dict()` of validation + if self.validation: + _dict['validation'] = self.validation.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PushOptionProperty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "displayName": obj.get("displayName"), + "description": obj.get("description"), + "required": obj.get("required"), + "properties": dict( + (_k, PushOptionProperty.from_dict(_v)) + for _k, _v in obj["properties"].items() ) + if obj.get("properties") is not None + else None, + "options": [PushOptionChoice.from_dict(_item) for _item in obj["options"]] if obj.get("options") is not None else None, + "validation": PushValidationInfo.from_dict(obj["validation"]) if obj.get("validation") is not None else None + }) + return _obj + +# TODO: Rewrite to not use raise_errors +PushOptionProperty.model_rebuild(raise_errors=False) - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - return m -try: - PushOptionProperty.model_rebuild() -except NameError: - pass +class PushOptionPropertyTypedDict(TypedDict): + """TypedDict variant of PushOptionProperty, for dict-literal request/response inputs.""" + type: PushOptionType + display_name: NotRequired[str] + description: NotRequired[str] + required: NotRequired[bool] + properties: NotRequired[Optional[Dict[str, PushOptionPropertyTypedDict]]] + options: NotRequired[Optional[List[PushOptionChoiceTypedDict]]] + validation: NotRequired[Optional[PushValidationInfoTypedDict]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/pushoptiontype.py b/bank-feeds/src/codat_bankfeeds/models/shared/pushoptiontype.py index c9c246f2a..f546175a0 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/pushoptiontype.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/pushoptiontype.py @@ -1,17 +1,43 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + from __future__ import annotations +import json from enum import Enum +from typing_extensions import Self class PushOptionType(str, Enum): - r"""The option type.""" - - ARRAY = "Array" - OBJECT = "Object" - STRING = "String" - NUMBER = "Number" - BOOLEAN = "Boolean" - DATE_TIME = "DateTime" - FILE = "File" - MULTI_PART = "MultiPart" + """ + The option type. + """ + + """ + allowed enum values + """ + ARRAY = 'Array' + OBJECT = 'Object' + STRING = 'String' + NUMBER = 'Number' + BOOLEAN = 'Boolean' + DATE_TIME = 'DateTime' + FILE = 'File' + MULTI_PART = 'MultiPart' + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of PushOptionType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/pushvalidationinfo.py b/bank-feeds/src/codat_bankfeeds/models/shared/pushvalidationinfo.py index 2c4cdde2a..cf3953cac 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/pushvalidationinfo.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/pushvalidationinfo.py @@ -1,50 +1,136 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .pushfieldvalidation import PushFieldValidation, PushFieldValidationTypedDict -from codat_bankfeeds.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from pydantic import model_serializer -from typing import List -from typing_extensions import NotRequired, TypedDict +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -class PushValidationInfoTypedDict(TypedDict): - information: NotRequired[Nullable[List[PushFieldValidationTypedDict]]] - warnings: NotRequired[Nullable[List[PushFieldValidationTypedDict]]] + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -class PushValidationInfo(BaseModel): - information: OptionalNullable[List[PushFieldValidation]] = UNSET - warnings: OptionalNullable[List[PushFieldValidation]] = UNSET +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_bankfeeds.models.shared.pushfieldvalidation import PushFieldValidation, PushFieldValidationTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL +class PushValidationInfo(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["information", "warnings"]) - nullable_fields = set(["information", "warnings"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m + _nullable = {'information', 'warnings'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + PushValidationInfo + """ # noqa: E501 + warnings: OptionalNullable[List[PushFieldValidation]] = UNSET + information: OptionalNullable[List[PushFieldValidation]] = UNSET + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["warnings", "information"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PushValidationInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in warnings (list) + _items = [] + if self.warnings: + for _item_warnings in self.warnings: + if _item_warnings: + _items.append(_item_warnings.to_dict()) + _dict['warnings'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in information (list) + _items = [] + if self.information: + for _item_information in self.information: + if _item_information: + _items.append(_item_information.to_dict()) + _dict['information'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PushValidationInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "warnings": [PushFieldValidation.from_dict(_item) for _item in obj["warnings"]] if obj.get("warnings") is not None else None, + "information": [PushFieldValidation.from_dict(_item) for _item in obj["information"]] if obj.get("information") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + + + + +class PushValidationInfoTypedDict(TypedDict): + """TypedDict variant of PushValidationInfo, for dict-literal request/response inputs.""" + warnings: NotRequired[Optional[List[PushFieldValidationTypedDict]]] + information: NotRequired[Optional[List[PushFieldValidationTypedDict]]] + additional_properties: NotRequired[Dict[str, Any]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/routinginfo.py b/bank-feeds/src/codat_bankfeeds/models/shared/routinginfo.py index da77d3227..d1aafc6cf 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/routinginfo.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/routinginfo.py @@ -1,84 +1,118 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_bankfeeds.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from enum import Enum -import pydantic -from pydantic import model_serializer -from typing_extensions import Annotated, NotRequired, TypedDict - - -class Type(str, Enum): - r"""The type of routing number.""" - - RTN = "rtn" - ABA = "aba" - SWIFT = "swift" - BSB = "bsb" - IBAN = "iban" - NZ2 = "nz2" - TRNO = "trno" - SORTCODE = "sortcode" - BLZ = "blz" - IFSC = "ifsc" - BANKCODE = "bankcode" - APCA = "apca" - CLABE = "clabe" +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -class RoutingInfoTypedDict(TypedDict): - r"""Routing information for the bank. This does not include account number.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - bank_code: NotRequired[Nullable[str]] - r"""The numeric identifier of the routing number""" - type: NotRequired[Nullable[Type]] - r"""The type of routing number.""" + Do not edit the class manually. +""" # noqa: E501 -class RoutingInfo(BaseModel): - r"""Routing information for the bank. This does not include account number.""" +from __future__ import annotations +from codat_bankfeeds.models.type import Type +import pprint +import re # noqa: F401 +import json - bank_code: Annotated[OptionalNullable[str], pydantic.Field(alias="bankCode")] = ( - UNSET - ) - r"""The numeric identifier of the routing number""" +from pydantic import BaseModel, ConfigDict, Field, field_validator, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - type: OptionalNullable[Type] = Type.BANKCODE - r"""The type of routing number.""" +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL +class RoutingInfo(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["bankCode", "type"]) - nullable_fields = set(["bankCode", "type"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -try: - RoutingInfo.model_rebuild() -except NameError: - pass + _nullable = {'bankCode', 'bank_code'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + Routing information for the bank. This does not include account number. + """ # noqa: E501 + bank_code: OptionalNullable[str] = Field(default=UNSET, description="The numeric identifier of the routing number", alias="bankCode") + type: Optional[Type] = Field(default='bankcode', description="The type of routing number.") + __properties: ClassVar[List[str]] = ["bankCode", "type"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['rtn', 'aba', 'swift', 'bsb', 'iban', 'nz2', 'trno', 'sortcode', 'blz', 'ifsc', 'bankcode', 'apca', 'clabe']): + raise ValueError("must be one of enum values ('rtn', 'aba', 'swift', 'bsb', 'iban', 'nz2', 'trno', 'sortcode', 'blz', 'ifsc', 'bankcode', 'apca', 'clabe')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RoutingInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RoutingInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "bankCode": obj.get("bankCode"), + "type": obj.get("type") if obj.get("type") is not None else 'bankcode' + }) + return _obj + + + + + +class RoutingInfoTypedDict(TypedDict): + """TypedDict variant of RoutingInfo, for dict-literal request/response inputs.""" + bank_code: NotRequired[Optional[str]] + type: NotRequired[Optional[Type]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/security.py b/bank-feeds/src/codat_bankfeeds/models/shared/security.py index a09989ae2..53c10f7e7 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/security.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/security.py @@ -1,9 +1,12 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""Security model for codat_bankfeeds. + +Generated by pipeline/postprocess_generated.py — do not edit by hand. +""" from __future__ import annotations -from codat_bankfeeds.types import BaseModel -from codat_bankfeeds.utils import FieldMetadata, SecurityMetadata -from typing_extensions import Annotated, TypedDict + +from pydantic import BaseModel +from typing_extensions import TypedDict class SecurityTypedDict(TypedDict): @@ -11,14 +14,5 @@ class SecurityTypedDict(TypedDict): class Security(BaseModel): - auth_header: Annotated[ - str, - FieldMetadata( - security=SecurityMetadata( - scheme=True, - scheme_type="apiKey", - sub_type="header", - field_name="Authorization", - ) - ), - ] + auth_header: str + r"""The word "Basic" followed by a space and your API key. [API keys](https://docs.codat.io/platform-api#/schemas/ApiKeyDetails) are tokens used to control access to the API. You can get an API key via [the Codat Portal](https://app.codat.io/developers/api-keys), via [the API](https://docs.codat.io/platform-api#/operations/list-api-keys), or [read more](https://docs.codat.io/using-the-api/authentication) about authentication at Codat.""" diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/source_account_webhook_payload_source_account.py b/bank-feeds/src/codat_bankfeeds/models/shared/source_account_webhook_payload_source_account.py new file mode 100644 index 000000000..7dcff6717 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/shared/source_account_webhook_payload_source_account.py @@ -0,0 +1,7 @@ +from __future__ import annotations +from typing import Union +from typing_extensions import TypeAliasType +from codat_bankfeeds.models.shared.sourceaccount import SourceAccount +from codat_bankfeeds.models.source_account_v2 import SourceAccountV2 + +SourceAccountWebhookPayloadSourceAccount = TypeAliasType("SourceAccountWebhookPayloadSourceAccount", Union[SourceAccount, SourceAccountV2]) diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/source_account_webhook_payload_source_account_typed_dict.py b/bank-feeds/src/codat_bankfeeds/models/shared/source_account_webhook_payload_source_account_typed_dict.py new file mode 100644 index 000000000..1954ea648 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/shared/source_account_webhook_payload_source_account_typed_dict.py @@ -0,0 +1,7 @@ +from __future__ import annotations +from typing import Union +from typing_extensions import TypeAliasType +from codat_bankfeeds.models.shared.sourceaccount import SourceAccountTypedDict +from codat_bankfeeds.models.source_account_v2 import SourceAccountV2TypedDict + +SourceAccountWebhookPayloadSourceAccountTypedDict = TypeAliasType("SourceAccountWebhookPayloadSourceAccountTypedDict", Union[SourceAccountTypedDict, SourceAccountV2TypedDict]) diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccount.py b/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccount.py index a799ac020..2ba8b0404 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccount.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccount.py @@ -1,244 +1,158 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from codat_bankfeeds.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_bankfeeds.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 Status(str, Enum): - r"""Status of the source account.""" - - PENDING = "pending" - CONNECTED = "connected" - CONNECTING = "connecting" - DISCONNECTED = "disconnected" - UNKNOWN = "unknown" - - -class SourceAccountTypedDict(TypedDict): - r"""The target bank account in a supported accounting software for ingestion into a bank feed.""" - - id: str - r"""Unique ID for the bank account.""" - account_name: NotRequired[Nullable[str]] - r"""The bank account name.""" - account_number: NotRequired[Nullable[str]] - r"""The account number.""" - account_type: NotRequired[Nullable[str]] - r"""The type of bank account e.g. Credit.""" - balance: NotRequired[Nullable[Decimal]] - r"""The latest balance for the bank 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. - """ - feed_start_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 - ``` +# coding: utf-8 +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - - 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. - """ - modified_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. - """ - sort_code: NotRequired[Nullable[str]] - r"""The sort code.""" - status: NotRequired[Nullable[Status]] - r"""Status of the source account.""" + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +from decimal import Decimal +from codat_bankfeeds.utils.serializers import serialize_decimal, validate_decimal +from codat_bankfeeds.models.status import Status +import pprint +import re # noqa: F401 +import json + +from pydantic import BeforeValidator, PlainSerializer, BaseModel, ConfigDict, Field, field_validator, model_serializer +from typing import Annotated, Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL class SourceAccount(BaseModel): - r"""The target bank account in a supported accounting software for ingestion into a bank feed.""" - id: str - r"""Unique ID for the bank account.""" - - account_name: Annotated[ - OptionalNullable[str], pydantic.Field(alias="accountName") - ] = UNSET - r"""The bank account name.""" - - account_number: Annotated[ - OptionalNullable[str], pydantic.Field(alias="accountNumber") - ] = UNSET - r"""The account number.""" - - account_type: Annotated[ - OptionalNullable[str], pydantic.Field(alias="accountType") - ] = UNSET - r"""The type of bank account e.g. Credit.""" - - balance: Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = UNSET - r"""The latest balance for the bank 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. + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'accountName', 'accountNumber', 'accountType', 'account_name', 'account_number', 'account_type', 'balance', 'sortCode', 'sort_code', 'status'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ - - feed_start_date: Annotated[Optional[str], pydantic.Field(alias="feedStartDate")] = ( - None + The target bank account in a supported accounting software for ingestion into a bank feed. + """ # noqa: E501 + id: str = Field(description="Unique ID for the bank account.") + account_name: OptionalNullable[str] = Field(default=UNSET, description="The bank account name.", alias="accountName") + account_type: OptionalNullable[str] = Field(default=UNSET, description="The type of bank account e.g. Credit.", alias="accountType") + account_number: OptionalNullable[str] = Field(default=UNSET, description="The account number.", alias="accountNumber") + sort_code: OptionalNullable[str] = Field(default=UNSET, description="The sort code.", alias="sortCode") + currency: Optional[str] = Field(default=None, description="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.") + balance: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="The latest balance for the bank account.") + modified_date: Optional[str] = Field(default=None, description="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.", alias="modifiedDate") + status: OptionalNullable[Status] = Field(default=UNSET, description="Status of the source account.") + feed_start_date: Optional[str] = Field(default=None, description="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.", alias="feedStartDate") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "accountName", "accountType", "accountNumber", "sortCode", "currency", "balance", "modifiedDate", "status", "feedStartDate"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['pending', 'connected', 'connecting', 'disconnected', 'unknown']): + raise ValueError("must be one of enum values ('pending', 'connected', 'connecting', 'disconnected', 'unknown')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), ) - 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 - ``` + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SourceAccount from a JSON string""" + return cls.from_dict(json.loads(json_str)) - - 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` + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - > 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. - """ + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = 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: + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + return _dict + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SourceAccount from a dict""" + if obj is None: + return None - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + if not isinstance(obj, dict): + return cls.model_validate(obj) - - 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` + _obj = cls.model_validate({ + "id": obj.get("id"), + "accountName": obj.get("accountName"), + "accountType": obj.get("accountType"), + "accountNumber": obj.get("accountNumber"), + "sortCode": obj.get("sortCode"), + "currency": obj.get("currency"), + "balance": obj.get("balance"), + "modifiedDate": obj.get("modifiedDate"), + "status": obj.get("status"), + "feedStartDate": obj.get("feedStartDate") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) - > 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. - """ + return _obj - sort_code: Annotated[OptionalNullable[str], pydantic.Field(alias="sortCode")] = ( - UNSET - ) - r"""The sort code.""" - status: OptionalNullable[Status] = UNSET - r"""Status of the source account.""" - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "accountName", - "accountNumber", - "accountType", - "balance", - "currency", - "feedStartDate", - "modifiedDate", - "sortCode", - "status", - ] - ) - nullable_fields = set( - [ - "accountName", - "accountNumber", - "accountType", - "balance", - "sortCode", - "status", - ] - ) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -try: - SourceAccount.model_rebuild() -except NameError: - pass + + +class SourceAccountTypedDict(TypedDict): + """TypedDict variant of SourceAccount, for dict-literal request/response inputs.""" + id: NotRequired[str] + account_name: NotRequired[Optional[str]] + account_type: NotRequired[Optional[str]] + account_number: NotRequired[Optional[str]] + sort_code: NotRequired[Optional[str]] + currency: NotRequired[Optional[str]] + balance: NotRequired[Optional[Decimal]] + modified_date: NotRequired[Optional[str]] + status: NotRequired[Optional[Status]] + feed_start_date: NotRequired[Optional[str]] + additional_properties: NotRequired[Dict[str, Any]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountbatchcreateresponse.py b/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountbatchcreateresponse.py index b70cdcbc3..bda73dc53 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountbatchcreateresponse.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountbatchcreateresponse.py @@ -1,55 +1,106 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .sourceaccountbatchcreateresult import ( - SourceAccountBatchCreateResult, - SourceAccountBatchCreateResultTypedDict, -) -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -class SourceAccountBatchCreateResponseTypedDict(TypedDict): - r"""Account ID and resulting object of the batch `Create source account` request.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - result: NotRequired[SourceAccountBatchCreateResultTypedDict] - r"""Status details and corresponding object of the `Create account` operation.""" - source_account_id: NotRequired[str] - r"""Unique ID for the source account.""" + Do not edit the class manually. +""" # noqa: E501 -class SourceAccountBatchCreateResponse(BaseModel): - r"""Account ID and resulting object of the batch `Create source account` request.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - result: Optional[SourceAccountBatchCreateResult] = None - r"""Status details and corresponding object of the `Create account` operation.""" +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_bankfeeds.models.shared.sourceaccountbatchcreateresult import SourceAccountBatchCreateResult, SourceAccountBatchCreateResultTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - source_account_id: Annotated[ - Optional[str], pydantic.Field(alias="sourceAccountId") - ] = None - r"""Unique ID for the source account.""" +class SourceAccountBatchCreateResponse(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["result", "sourceAccountId"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + Account ID and resulting object of the batch `Create source account` request. + """ # noqa: E501 + source_account_id: Optional[str] = Field(default=None, description="Unique ID for the source account.", alias="sourceAccountId") + result: Optional[SourceAccountBatchCreateResult] = None + __properties: ClassVar[List[str]] = ["sourceAccountId", "result"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SourceAccountBatchCreateResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - return m + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: -try: - SourceAccountBatchCreateResponse.model_rebuild() -except NameError: - pass + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of result + if self.result: + _dict['result'] = self.result.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SourceAccountBatchCreateResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "sourceAccountId": obj.get("sourceAccountId"), + "result": SourceAccountBatchCreateResult.from_dict(obj["result"]) if obj.get("result") is not None else None + }) + return _obj + + + + + +class SourceAccountBatchCreateResponseTypedDict(TypedDict): + """TypedDict variant of SourceAccountBatchCreateResponse, for dict-literal request/response inputs.""" + source_account_id: NotRequired[Optional[str]] + result: NotRequired[Optional[SourceAccountBatchCreateResultTypedDict]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountbatchcreateresult.py b/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountbatchcreateresult.py index 49be47670..2dcc0b856 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountbatchcreateresult.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountbatchcreateresult.py @@ -1,70 +1,114 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .sourceaccount import SourceAccount, SourceAccountTypedDict -from codat_bankfeeds.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 +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -class SourceAccountBatchCreateResultTypedDict(TypedDict): - r"""Status details and corresponding object of the `Create account` operation.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 - account: NotRequired[SourceAccountTypedDict] - r"""The target bank account in a supported accounting software for ingestion into a bank feed.""" - error: NotRequired[Nullable[str]] - r"""A brief description of the error.""" - status_code: NotRequired[int] - r"""The HTTP status code for the creation of the source account""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_bankfeeds.models.shared.sourceaccount import SourceAccount, SourceAccountTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL class SourceAccountBatchCreateResult(BaseModel): - r"""Status details and corresponding object of the `Create account` operation.""" + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'error'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + Status details and corresponding object of the `Create account` operation. + """ # noqa: E501 + status_code: Optional[int] = Field(default=None, description="The HTTP status code for the creation of the source account", alias="statusCode") + error: OptionalNullable[str] = Field(default=UNSET, description="A brief description of the error.") account: Optional[SourceAccount] = None - r"""The target bank account in a supported accounting software for ingestion into a bank feed.""" + __properties: ClassVar[List[str]] = ["statusCode", "error", "account"] - error: OptionalNullable[str] = UNSET - r"""A brief description of the error.""" + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - status_code: Annotated[Optional[int], pydantic.Field(alias="statusCode")] = None - r"""The HTTP status code for the creation of the source account""" - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["account", "error", "statusCode"]) - nullable_fields = set(["error"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -try: - SourceAccountBatchCreateResult.model_rebuild() -except NameError: - pass + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SourceAccountBatchCreateResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of account + if self.account: + _dict['account'] = self.account.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SourceAccountBatchCreateResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "statusCode": obj.get("statusCode"), + "error": obj.get("error"), + "account": SourceAccount.from_dict(obj["account"]) if obj.get("account") is not None else None + }) + return _obj + + + + + +class SourceAccountBatchCreateResultTypedDict(TypedDict): + """TypedDict variant of SourceAccountBatchCreateResult, for dict-literal request/response inputs.""" + status_code: NotRequired[Optional[int]] + error: NotRequired[Optional[str]] + account: NotRequired[Optional[SourceAccountTypedDict]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountbatcherrorresponse.py b/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountbatcherrorresponse.py index db9ad81ab..631be3504 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountbatcherrorresponse.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountbatcherrorresponse.py @@ -1,84 +1,106 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -class ResultTypedDict(TypedDict): - error: NotRequired[str] - r"""The error description for the attempted creation of the source account.""" - status_code: NotRequired[str] - r"""The error status code for the attempted creation of the source account.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json -class Result(BaseModel): - error: Optional[str] = None - r"""The error description for the attempted creation of the source account.""" +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_bankfeeds.models.source_account_batch_error_response_result import SourceAccountBatchErrorResponseResult, SourceAccountBatchErrorResponseResultTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - status_code: Annotated[Optional[str], pydantic.Field(alias="statusCode")] = None - r"""The error status code for the attempted creation of the source account.""" +class SourceAccountBatchErrorResponse(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["error", "statusCode"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + Describes the error that occured when trying to create the specified source account. + """ # noqa: E501 + source_account_id: Optional[str] = Field(default=None, description="Unique ID for the source account.", alias="sourceAccountId") + result: Optional[SourceAccountBatchErrorResponseResult] = None + __properties: ClassVar[List[str]] = ["sourceAccountId", "result"] - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - return m + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) -class SourceAccountBatchErrorResponseTypedDict(TypedDict): - r"""Describes the error that occured when trying to create the specified source account.""" + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SourceAccountBatchErrorResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - result: NotRequired[ResultTypedDict] - source_account_id: NotRequired[str] - r"""Unique ID for the source account.""" + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: -class SourceAccountBatchErrorResponse(BaseModel): - r"""Describes the error that occured when trying to create the specified source account.""" + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - result: Optional[Result] = None + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of result + if self.result: + _dict['result'] = self.result.to_dict() + return _dict - source_account_id: Annotated[ - Optional[str], pydantic.Field(alias="sourceAccountId") - ] = None - r"""Unique ID for the source account.""" + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SourceAccountBatchErrorResponse from a dict""" + if obj is None: + return None - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["result", "sourceAccountId"]) - serialized = handler(self) - m = {} + if not isinstance(obj, dict): + return cls.model_validate(obj) - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) + _obj = cls.model_validate({ + "sourceAccountId": obj.get("sourceAccountId"), + "result": SourceAccountBatchErrorResponseResult.from_dict(obj["result"]) if obj.get("result") is not None else None + }) + return _obj - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - return m -try: - Result.model_rebuild() -except NameError: - pass -try: - SourceAccountBatchErrorResponse.model_rebuild() -except NameError: - pass + +class SourceAccountBatchErrorResponseTypedDict(TypedDict): + """TypedDict variant of SourceAccountBatchErrorResponse, for dict-literal request/response inputs.""" + source_account_id: NotRequired[Optional[str]] + result: NotRequired[Optional[SourceAccountBatchErrorResponseResultTypedDict]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountprototype.py b/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountprototype.py index 87c9b4cc8..c7cefd8fb 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountprototype.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountprototype.py @@ -1,170 +1,127 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_bankfeeds.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_bankfeeds.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 SourceAccountPrototypeTypedDict(TypedDict): - id: str - r"""Unique ID for the bank account.""" - account_name: NotRequired[Nullable[str]] - r"""The bank account name.""" - account_number: NotRequired[Nullable[str]] - r"""The account number.""" - account_type: NotRequired[Nullable[str]] - r"""The type of bank account e.g. Credit.""" - balance: NotRequired[Nullable[Decimal]] - r"""The latest balance for the bank 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. - """ - modified_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: +""" + Bank Feeds - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 - 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. - """ - sort_code: NotRequired[Nullable[str]] - r"""The sort code.""" +from __future__ import annotations +from decimal import Decimal +from codat_bankfeeds.utils.serializers import serialize_decimal, validate_decimal +import pprint +import re # noqa: F401 +import json +from pydantic import BeforeValidator, PlainSerializer, BaseModel, ConfigDict, Field, model_serializer +from typing import Annotated, Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL class SourceAccountPrototype(BaseModel): - id: str - r"""Unique ID for the bank account.""" - account_name: Annotated[ - OptionalNullable[str], pydantic.Field(alias="accountName") - ] = UNSET - r"""The bank account name.""" + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'accountName', 'accountNumber', 'accountType', 'account_name', 'account_number', 'account_type', 'balance', 'sortCode', 'sort_code'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + SourceAccountPrototype + """ # noqa: E501 + id: str = Field(description="Unique ID for the bank account.") + account_name: OptionalNullable[str] = Field(default=UNSET, description="The bank account name.", alias="accountName") + account_type: OptionalNullable[str] = Field(default=UNSET, description="The type of bank account e.g. Credit.", alias="accountType") + account_number: OptionalNullable[str] = Field(default=UNSET, description="The account number.", alias="accountNumber") + sort_code: OptionalNullable[str] = Field(default=UNSET, description="The sort code.", alias="sortCode") + currency: Optional[str] = Field(default=None, description="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.") + balance: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="The latest balance for the bank account.") + modified_date: Optional[str] = Field(default=None, description="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.", alias="modifiedDate") + __properties: ClassVar[List[str]] = ["id", "accountName", "accountType", "accountNumber", "sortCode", "currency", "balance", "modifiedDate"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - account_number: Annotated[ - OptionalNullable[str], pydantic.Field(alias="accountNumber") - ] = UNSET - r"""The account number.""" - account_type: Annotated[ - OptionalNullable[str], pydantic.Field(alias="accountType") - ] = UNSET - r"""The type of bank account e.g. Credit.""" + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - balance: Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = UNSET - r"""The latest balance for the bank account.""" + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - 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_. + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SourceAccountPrototype from a JSON string""" + return cls.from_dict(json.loads(json_str)) - ## Unknown currencies + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - There are only a very small number of edge cases where this currency code is returned by the Codat system. - """ + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = 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: + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SourceAccountPrototype from a dict""" + if obj is None: + return None + if not isinstance(obj, dict): + return cls.model_validate(obj) + _obj = cls.model_validate({ + "id": obj.get("id"), + "accountName": obj.get("accountName"), + "accountType": obj.get("accountType"), + "accountNumber": obj.get("accountNumber"), + "sortCode": obj.get("sortCode"), + "currency": obj.get("currency"), + "balance": obj.get("balance"), + "modifiedDate": obj.get("modifiedDate") + }) + return _obj - 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. - """ - sort_code: Annotated[OptionalNullable[str], pydantic.Field(alias="sortCode")] = ( - UNSET - ) - r"""The sort code.""" - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "accountName", - "accountNumber", - "accountType", - "balance", - "currency", - "modifiedDate", - "sortCode", - ] - ) - nullable_fields = set( - ["accountName", "accountNumber", "accountType", "balance", "sortCode"] - ) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -try: - SourceAccountPrototype.model_rebuild() -except NameError: - pass +class SourceAccountPrototypeTypedDict(TypedDict): + """TypedDict variant of SourceAccountPrototype, for dict-literal request/response inputs.""" + id: NotRequired[str] + account_name: NotRequired[Optional[str]] + account_type: NotRequired[Optional[str]] + account_number: NotRequired[Optional[str]] + sort_code: NotRequired[Optional[str]] + currency: NotRequired[Optional[str]] + balance: NotRequired[Optional[Decimal]] + modified_date: NotRequired[Optional[str]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountv2.py b/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountv2.py index edb938777..5f0ecc07c 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountv2.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountv2.py @@ -1,222 +1,6 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - from __future__ import annotations -from .accountinfo import AccountInfo, AccountInfoTypedDict -from .routinginfo import RoutingInfo, RoutingInfoTypedDict -from codat_bankfeeds.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_bankfeeds.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 SourceAccountV2AccountType(str, Enum): - r"""The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard.""" - - CHECKING = "checking" - SAVINGS = "savings" - LOAN = "loan" - CREDIT_CARD = "creditCard" - PREPAID_CARD = "prepaidCard" - - -class SourceAccountV2Status(str, Enum): - r"""Status of the source account.""" - - PENDING = "pending" - CONNECTED = "connected" - CONNECTING = "connecting" - DISCONNECTED = "disconnected" - UNKNOWN = "unknown" - - -class SourceAccountV2TypedDict(TypedDict): - r"""The target bank account in a supported accounting software for ingestion into a bank feed.""" - - account_name: str - r"""The bank account name.""" - account_number: str - r"""The account number.""" - account_type: SourceAccountV2AccountType - r"""The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard.""" - balance: Decimal - r"""The latest balance for the bank account.""" - 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. - """ - id: str - r"""Unique ID for the bank account.""" - account_info: NotRequired[Nullable[AccountInfoTypedDict]] - feed_start_date: NotRequired[Nullable[str]] - r"""In Codat's data model, dates are represented using the ISO 8601 standard. Date fields are formatted as strings; for example: - ``` - 2020-10-08 - ``` - """ - modified_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. - """ - routing_info: NotRequired[RoutingInfoTypedDict] - r"""Routing information for the bank. This does not include account number.""" - sort_code: NotRequired[Nullable[str]] - r"""The sort code.""" - status: NotRequired[Nullable[SourceAccountV2Status]] - r"""Status of the source account.""" - - -class SourceAccountV2(BaseModel): - r"""The target bank account in a supported accounting software for ingestion into a bank feed.""" - - account_name: Annotated[str, pydantic.Field(alias="accountName")] - r"""The bank account name.""" - - account_number: Annotated[str, pydantic.Field(alias="accountNumber")] - r"""The account number.""" - account_type: Annotated[ - SourceAccountV2AccountType, pydantic.Field(alias="accountType") - ] - r"""The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard.""" - - balance: Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] - r"""The latest balance for the bank account.""" - - 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. - """ - - id: str - r"""Unique ID for the bank account.""" - - account_info: Annotated[ - OptionalNullable[AccountInfo], pydantic.Field(alias="accountInfo") - ] = UNSET - - feed_start_date: Annotated[ - OptionalNullable[str], pydantic.Field(alias="feedStartDate") - ] = UNSET - r"""In Codat's data model, dates are represented using the ISO 8601 standard. Date fields are formatted as strings; for example: - ``` - 2020-10-08 - ``` - """ - - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = 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. - """ - - routing_info: Annotated[ - Optional[RoutingInfo], pydantic.Field(alias="routingInfo") - ] = None - r"""Routing information for the bank. This does not include account number.""" - - sort_code: Annotated[OptionalNullable[str], pydantic.Field(alias="sortCode")] = ( - UNSET - ) - r"""The sort code.""" - - status: OptionalNullable[SourceAccountV2Status] = UNSET - r"""Status of the source account.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "accountInfo", - "feedStartDate", - "modifiedDate", - "routingInfo", - "sortCode", - "status", - ] - ) - nullable_fields = set(["accountInfo", "feedStartDate", "sortCode", "status"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m +from enum import Enum -try: - SourceAccountV2.model_rebuild() -except NameError: - pass +from codat_bankfeeds.models._compat.sourceaccountv2 import SourceAccountV2AccountType diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountv2batchcreateresponse.py b/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountv2batchcreateresponse.py index 570b66dbc..5dfe437b1 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountv2batchcreateresponse.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountv2batchcreateresponse.py @@ -1,55 +1,106 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .sourceaccountv2batchcreateresult import ( - SourceAccountV2BatchCreateResult, - SourceAccountV2BatchCreateResultTypedDict, -) -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -class SourceAccountV2BatchCreateResponseTypedDict(TypedDict): - r"""Account ID and resulting object of the batch `Create source account` request.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - result: NotRequired[SourceAccountV2BatchCreateResultTypedDict] - r"""Status details and corresponding object of the `Create account` operation.""" - source_account_id: NotRequired[str] - r"""Unique ID for the source account.""" + Do not edit the class manually. +""" # noqa: E501 -class SourceAccountV2BatchCreateResponse(BaseModel): - r"""Account ID and resulting object of the batch `Create source account` request.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - result: Optional[SourceAccountV2BatchCreateResult] = None - r"""Status details and corresponding object of the `Create account` operation.""" +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_bankfeeds.models.shared.sourceaccountv2batchcreateresult import SourceAccountV2BatchCreateResult, SourceAccountV2BatchCreateResultTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - source_account_id: Annotated[ - Optional[str], pydantic.Field(alias="sourceAccountId") - ] = None - r"""Unique ID for the source account.""" +class SourceAccountV2BatchCreateResponse(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["result", "sourceAccountId"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + Account ID and resulting object of the batch `Create source account` request. + """ # noqa: E501 + source_account_id: Optional[str] = Field(default=None, description="Unique ID for the source account.", alias="sourceAccountId") + result: Optional[SourceAccountV2BatchCreateResult] = None + __properties: ClassVar[List[str]] = ["sourceAccountId", "result"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SourceAccountV2BatchCreateResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - return m + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: -try: - SourceAccountV2BatchCreateResponse.model_rebuild() -except NameError: - pass + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of result + if self.result: + _dict['result'] = self.result.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SourceAccountV2BatchCreateResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "sourceAccountId": obj.get("sourceAccountId"), + "result": SourceAccountV2BatchCreateResult.from_dict(obj["result"]) if obj.get("result") is not None else None + }) + return _obj + + + + + +class SourceAccountV2BatchCreateResponseTypedDict(TypedDict): + """TypedDict variant of SourceAccountV2BatchCreateResponse, for dict-literal request/response inputs.""" + source_account_id: NotRequired[Optional[str]] + result: NotRequired[Optional[SourceAccountV2BatchCreateResultTypedDict]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountv2batchcreateresult.py b/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountv2batchcreateresult.py index 271bb9217..ca01bdde0 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountv2batchcreateresult.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountv2batchcreateresult.py @@ -1,70 +1,114 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .sourceaccountv2 import SourceAccountV2, SourceAccountV2TypedDict -from codat_bankfeeds.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 +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -class SourceAccountV2BatchCreateResultTypedDict(TypedDict): - r"""Status details and corresponding object of the `Create account` operation.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 - account: NotRequired[SourceAccountV2TypedDict] - r"""The target bank account in a supported accounting software for ingestion into a bank feed.""" - error: NotRequired[Nullable[str]] - r"""A brief description of the error.""" - status_code: NotRequired[int] - r"""The HTTP status code for the creation of the source account""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_bankfeeds.models.source_account_v2 import SourceAccountV2, SourceAccountV2TypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL class SourceAccountV2BatchCreateResult(BaseModel): - r"""Status details and corresponding object of the `Create account` operation.""" + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'error'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + Status details and corresponding object of the `Create account` operation. + """ # noqa: E501 + status_code: Optional[int] = Field(default=None, description="The HTTP status code for the creation of the source account", alias="statusCode") + error: OptionalNullable[str] = Field(default=UNSET, description="A brief description of the error.") account: Optional[SourceAccountV2] = None - r"""The target bank account in a supported accounting software for ingestion into a bank feed.""" + __properties: ClassVar[List[str]] = ["statusCode", "error", "account"] - error: OptionalNullable[str] = UNSET - r"""A brief description of the error.""" + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - status_code: Annotated[Optional[int], pydantic.Field(alias="statusCode")] = None - r"""The HTTP status code for the creation of the source account""" - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["account", "error", "statusCode"]) - nullable_fields = set(["error"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -try: - SourceAccountV2BatchCreateResult.model_rebuild() -except NameError: - pass + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SourceAccountV2BatchCreateResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of account + if self.account: + _dict['account'] = self.account.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SourceAccountV2BatchCreateResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "statusCode": obj.get("statusCode"), + "error": obj.get("error"), + "account": SourceAccountV2.from_dict(obj["account"]) if obj.get("account") is not None else None + }) + return _obj + + + + + +class SourceAccountV2BatchCreateResultTypedDict(TypedDict): + """TypedDict variant of SourceAccountV2BatchCreateResult, for dict-literal request/response inputs.""" + status_code: NotRequired[Optional[int]] + error: NotRequired[Optional[str]] + account: NotRequired[Optional[SourceAccountV2TypedDict]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountv2prototype.py b/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountv2prototype.py index 1681994f1..628d35f21 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountv2prototype.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountv2prototype.py @@ -1,169 +1,142 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountinfo import AccountInfo, AccountInfoTypedDict -from .accounttype import AccountType -from .routinginfo import RoutingInfo, RoutingInfoTypedDict -from codat_bankfeeds.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_bankfeeds.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 SourceAccountV2PrototypeTypedDict(TypedDict): - account_name: str - r"""The bank account name.""" - account_number: str - r"""The account number.""" - account_type: AccountType - r"""The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard.""" - balance: Decimal - r"""The latest balance for the bank account.""" - 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. - """ - id: str - r"""Unique ID for the bank account.""" - account_info: NotRequired[Nullable[AccountInfoTypedDict]] - modified_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 - ``` +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - 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. - """ - routing_info: NotRequired[RoutingInfoTypedDict] - r"""Routing information for the bank. This does not include account number.""" - sort_code: NotRequired[Nullable[str]] - r"""The sort code.""" + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +from decimal import Decimal +from codat_bankfeeds.utils.serializers import serialize_decimal, validate_decimal +import pprint +import re # noqa: F401 +import json + +from pydantic import BeforeValidator, PlainSerializer, BaseModel, ConfigDict, Field, model_serializer +from typing import Annotated, Any, ClassVar, Dict, List, Optional, Union +from codat_bankfeeds.models.shared.accountinfo import AccountInfo, AccountInfoTypedDict +from codat_bankfeeds.models.shared.routinginfo import RoutingInfo, RoutingInfoTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_bankfeeds.models.shared.accounttype import AccountType +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL class SourceAccountV2Prototype(BaseModel): - account_name: Annotated[str, pydantic.Field(alias="accountName")] - r"""The bank account name.""" - - account_number: Annotated[str, pydantic.Field(alias="accountNumber")] - r"""The account number.""" - account_type: Annotated[AccountType, pydantic.Field(alias="accountType")] - r"""The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard.""" + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'accountInfo', 'account_info', 'sortCode', 'sort_code'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + SourceAccountV2Prototype + """ # noqa: E501 + id: str = Field(description="Unique ID for the bank account.") + account_name: str = Field(description="The bank account name.", alias="accountName") + account_type: AccountType = Field(description="The type of bank account e.g. Credit.", alias="accountType") + account_number: str = Field(description="The account number.", alias="accountNumber") + routing_info: Optional[RoutingInfo] = Field(default=None, alias="routingInfo") + sort_code: OptionalNullable[str] = Field(default=UNSET, description="The sort code.", alias="sortCode") + currency: str = Field(description="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.") + balance: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="The latest balance for the bank account.") + modified_date: Optional[str] = Field(default=None, description="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.", alias="modifiedDate") + account_info: OptionalNullable[AccountInfo] = Field(default=UNSET, alias="accountInfo") + __properties: ClassVar[List[str]] = ["id", "accountName", "accountType", "accountNumber", "routingInfo", "sortCode", "currency", "balance", "modifiedDate", "accountInfo"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - balance: Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] - r"""The latest balance for the bank account.""" - 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_. + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - ## Unknown currencies + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SourceAccountV2Prototype from a JSON string""" + return cls.from_dict(json.loads(json_str)) - There are only a very small number of edge cases where this currency code is returned by the Codat system. - """ + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - id: str - r"""Unique ID for the bank account.""" + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - account_info: Annotated[ - OptionalNullable[AccountInfo], pydantic.Field(alias="accountInfo") - ] = UNSET + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = 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: + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of routing_info + if self.routing_info: + _dict['routingInfo'] = self.routing_info.to_dict() + # override the default output from pydantic by calling `to_dict()` of account_info + if self.account_info: + _dict['accountInfo'] = self.account_info.to_dict() + return _dict - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SourceAccountV2Prototype from a dict""" + if obj is None: + return None + if not isinstance(obj, dict): + return cls.model_validate(obj) + _obj = cls.model_validate({ + "id": obj.get("id"), + "accountName": obj.get("accountName"), + "accountType": obj.get("accountType"), + "accountNumber": obj.get("accountNumber"), + "routingInfo": RoutingInfo.from_dict(obj["routingInfo"]) if obj.get("routingInfo") is not None else None, + "sortCode": obj.get("sortCode"), + "currency": obj.get("currency"), + "balance": obj.get("balance"), + "modifiedDate": obj.get("modifiedDate"), + "accountInfo": AccountInfo.from_dict(obj["accountInfo"]) if obj.get("accountInfo") is not None else None + }) + return _obj - 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. - """ - routing_info: Annotated[ - Optional[RoutingInfo], pydantic.Field(alias="routingInfo") - ] = None - r"""Routing information for the bank. This does not include account number.""" - sort_code: Annotated[OptionalNullable[str], pydantic.Field(alias="sortCode")] = ( - UNSET - ) - r"""The sort code.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["accountInfo", "modifiedDate", "routingInfo", "sortCode"] - ) - nullable_fields = set(["accountInfo", "sortCode"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -try: - SourceAccountV2Prototype.model_rebuild() -except NameError: - pass +class SourceAccountV2PrototypeTypedDict(TypedDict): + """TypedDict variant of SourceAccountV2Prototype, for dict-literal request/response inputs.""" + id: NotRequired[str] + account_name: NotRequired[str] + account_type: NotRequired[AccountType] + account_number: NotRequired[str] + routing_info: NotRequired[Optional[RoutingInfoTypedDict]] + sort_code: NotRequired[Optional[str]] + currency: NotRequired[str] + balance: NotRequired[Decimal] + modified_date: NotRequired[Optional[str]] + account_info: NotRequired[Optional[AccountInfoTypedDict]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountwebhook.py b/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountwebhook.py index 9039cd3d0..15d312b34 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountwebhook.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountwebhook.py @@ -1,97 +1,112 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .sourceaccountwebhookpayload import ( - SourceAccountWebhookPayload, - SourceAccountWebhookPayloadTypedDict, -) -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -class SourceAccountWebhookTypedDict(TypedDict): - 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: + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_bankfeeds.models.shared.sourceaccountwebhookpayload import SourceAccountWebhookPayload, SourceAccountWebhookPayloadTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - - 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` +class SourceAccountWebhook(BaseModel): - > 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_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} """ - id: NotRequired[str] - r"""Unique identifier of the event.""" - payload: NotRequired[SourceAccountWebhookPayloadTypedDict] + SourceAccountWebhook + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="Unique identifier of the event.") + event_type: Optional[str] = Field(default=None, description="The type of event.", alias="eventType") + generated_date: Optional[str] = Field(default=None, description="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.", alias="generatedDate") + payload: Optional[SourceAccountWebhookPayload] = None + __properties: ClassVar[List[str]] = ["id", "eventType", "generatedDate", "payload"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class SourceAccountWebhook(BaseModel): - 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: + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SourceAccountWebhook from a JSON string""" + return cls.from_dict(json.loads(json_str)) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - - 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` + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - > 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. - """ + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of payload + if self.payload: + _dict['payload'] = self.payload.to_dict() + return _dict - id: Optional[str] = None - r"""Unique identifier of the event.""" + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SourceAccountWebhook from a dict""" + if obj is None: + return None - payload: Optional[SourceAccountWebhookPayload] = None + if not isinstance(obj, dict): + return cls.model_validate(obj) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["eventType", "generatedDate", "id", "payload"]) - serialized = handler(self) - m = {} + _obj = cls.model_validate({ + "id": obj.get("id"), + "eventType": obj.get("eventType"), + "generatedDate": obj.get("generatedDate"), + "payload": SourceAccountWebhookPayload.from_dict(obj["payload"]) if obj.get("payload") is not None else None + }) + return _obj - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - return m -try: - SourceAccountWebhook.model_rebuild() -except NameError: - pass +class SourceAccountWebhookTypedDict(TypedDict): + """TypedDict variant of SourceAccountWebhook, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + event_type: NotRequired[Optional[str]] + generated_date: NotRequired[Optional[str]] + payload: NotRequired[Optional[SourceAccountWebhookPayloadTypedDict]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountwebhookpayload.py b/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountwebhookpayload.py index 69a2dfcde..0e1428b5b 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountwebhookpayload.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/sourceaccountwebhookpayload.py @@ -1,72 +1,117 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .companyreference import CompanyReference, CompanyReferenceTypedDict -from .sourceaccount import SourceAccount, SourceAccountTypedDict -from .sourceaccountv2 import SourceAccountV2, SourceAccountV2TypedDict -from codat_bankfeeds.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional, Union -from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict +# coding: utf-8 +""" + Bank Feeds -SourceAccountWebhookPayloadSourceAccountTypedDict = TypeAliasType( - "SourceAccountWebhookPayloadSourceAccountTypedDict", - Union[SourceAccountTypedDict, SourceAccountV2TypedDict], -) + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) -SourceAccountWebhookPayloadSourceAccount = TypeAliasType( - "SourceAccountWebhookPayloadSourceAccount", Union[SourceAccount, SourceAccountV2] -) - - -class SourceAccountWebhookPayloadTypedDict(TypedDict): - company_id: NotRequired[str] - r"""Unique identifier for your SMB in Codat.""" - connection_id: NotRequired[str] - r"""Unique identifier for a company's data connection.""" - reference_company: NotRequired[CompanyReferenceTypedDict] - source_account: NotRequired[SourceAccountWebhookPayloadSourceAccountTypedDict] + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_bankfeeds.models.shared.companyreference import CompanyReference, CompanyReferenceTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_bankfeeds.models.shared.source_account_webhook_payload_source_account import SourceAccountWebhookPayloadSourceAccount +from codat_bankfeeds.models.shared.source_account_webhook_payload_source_account_typed_dict import SourceAccountWebhookPayloadSourceAccountTypedDict class SourceAccountWebhookPayload(BaseModel): - company_id: Annotated[Optional[str], pydantic.Field(alias="companyId")] = None - r"""Unique identifier for your SMB in Codat.""" - connection_id: Annotated[Optional[str], pydantic.Field(alias="connectionId")] = None - r"""Unique identifier for a company's data connection.""" + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + """ + SourceAccountWebhookPayload + """ # noqa: E501 + reference_company: Optional[CompanyReference] = Field(default=None, alias="referenceCompany") + company_id: Optional[str] = Field(default=None, description="Unique identifier for your SMB in Codat.", alias="companyId") + connection_id: Optional[str] = Field(default=None, description="Unique identifier for a company's data connection.", alias="connectionId") + source_account: Optional[SourceAccountWebhookPayloadSourceAccount] = Field(default=None, alias="sourceAccount") + __properties: ClassVar[List[str]] = ["referenceCompany", "companyId", "connectionId", "sourceAccount"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SourceAccountWebhookPayload from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of reference_company + if self.reference_company: + _dict['referenceCompany'] = self.reference_company.to_dict() + # override the default output from pydantic by calling `to_dict()` of source_account + if self.source_account: + _dict['sourceAccount'] = self.source_account.to_dict() + return _dict - reference_company: Annotated[ - Optional[CompanyReference], pydantic.Field(alias="referenceCompany") - ] = None + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SourceAccountWebhookPayload from a dict""" + if obj is None: + return None - source_account: Annotated[ - Optional[SourceAccountWebhookPayloadSourceAccount], - pydantic.Field(alias="sourceAccount"), - ] = None + if not isinstance(obj, dict): + return cls.model_validate(obj) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["companyId", "connectionId", "referenceCompany", "sourceAccount"] - ) - serialized = handler(self) - m = {} + _obj = cls.model_validate({ + "referenceCompany": CompanyReference.from_dict(obj["referenceCompany"]) if obj.get("referenceCompany") is not None else None, + "companyId": obj.get("companyId"), + "connectionId": obj.get("connectionId"), + "sourceAccount": obj.get("sourceAccount") + }) + return _obj - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - return m -try: - SourceAccountWebhookPayload.model_rebuild() -except NameError: - pass +class SourceAccountWebhookPayloadTypedDict(TypedDict): + """TypedDict variant of SourceAccountWebhookPayload, for dict-literal request/response inputs.""" + reference_company: NotRequired[Optional[CompanyReferenceTypedDict]] + company_id: NotRequired[Optional[str]] + connection_id: NotRequired[Optional[str]] + source_account: NotRequired[Optional[SourceAccountWebhookPayloadSourceAccountTypedDict]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/startscheduledsyncresult.py b/bank-feeds/src/codat_bankfeeds/models/shared/startscheduledsyncresult.py index b1f79f3fe..a5f9f8807 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/startscheduledsyncresult.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/startscheduledsyncresult.py @@ -1,26 +1,99 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_bankfeeds.types import BaseModel -import pydantic -from typing_extensions import Annotated, TypedDict +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -class StartScheduledSyncResultTypedDict(TypedDict): - r"""Represents the result of an ad-hoc sync request.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 - sync_id: str - r"""The unique identifier for the created sync.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class StartScheduledSyncResult(BaseModel): - r"""Represents the result of an ad-hoc sync request.""" - sync_id: Annotated[str, pydantic.Field(alias="syncId")] - r"""The unique identifier for the created sync.""" + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + """ + Represents the result of an ad-hoc sync request. + """ # noqa: E501 + sync_id: str = Field(description="The unique identifier for the created sync.", alias="syncId") + __properties: ClassVar[List[str]] = ["syncId"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of StartScheduledSyncResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: -try: - StartScheduledSyncResult.model_rebuild() -except NameError: - pass + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of StartScheduledSyncResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "syncId": obj.get("syncId") + }) + return _obj + + + + + +class StartScheduledSyncResultTypedDict(TypedDict): + """TypedDict variant of StartScheduledSyncResult, for dict-literal request/response inputs.""" + sync_id: NotRequired[str] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/syncstatusresult.py b/bank-feeds/src/codat_bankfeeds/models/shared/syncstatusresult.py index 2a182db15..93cb41adf 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/syncstatusresult.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/syncstatusresult.py @@ -1,137 +1,144 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_bankfeeds.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from datetime import datetime -import pydantic -from pydantic import model_serializer -from typing import List -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 -class SyncStatusResultTypedDict(TypedDict): - r"""Represents the status of a managed bank feed sync.""" - - client_id: str - r"""The ID of the client associated with the company that owns the source bank account.""" - company_id: str - r"""The ID of the company that owns the source bank account.""" - company_name: str - r"""The name of the company that owns the source bank account.""" - data_connection_id: str - r"""The ID of the target accounting data connection.""" - execution_start_utc: datetime - r"""The UTC timestamp when the sync started executing.""" - period_end_utc: datetime - r"""The end of the sync period.""" - period_start_utc: datetime - r"""The start of the sync period.""" - source_account_id: str - r"""The ID of the source bank account from which transactions are fetched.""" - status: str - r"""The current status of the sync. Known values are `Started`, `Failed`, `SuccessDataPushed`, `SuccessNoDataPushed`, `PartialSuccessDataPushed`.""" - sync_id: str - r"""The unique identifier for the sync.""" - error_code: NotRequired[Nullable[str]] - r"""Error code if the sync failed.""" - error_message: NotRequired[Nullable[str]] - r"""Error message if the sync failed.""" - execution_end_utc: NotRequired[Nullable[datetime]] - r"""The UTC timestamp when the sync execution ended, if completed (i.e. `status` is any value other than `Started`).""" - push_operation_keys: NotRequired[Nullable[List[str]]] - r"""List of write operation keys associated with the sync, if the sync resulted in write attempts.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL class SyncStatusResult(BaseModel): - r"""Represents the status of a managed bank feed sync.""" - client_id: Annotated[str, pydantic.Field(alias="clientId")] - r"""The ID of the client associated with the company that owns the source bank account.""" + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'errorCode', 'errorMessage', 'error_code', 'error_message', 'executionEndUtc', 'execution_end_utc', 'pushOperationKeys', 'push_operation_keys'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + Represents the status of a managed bank feed sync. + """ # noqa: E501 + sync_id: str = Field(description="The unique identifier for the sync.", alias="syncId") + client_id: str = Field(description="The ID of the client associated with the company that owns the source bank account.", alias="clientId") + company_id: str = Field(description="The ID of the company that owns the source bank account.", alias="companyId") + company_name: str = Field(description="The name of the company that owns the source bank account.", alias="companyName") + data_connection_id: str = Field(description="The ID of the target accounting data connection.", alias="dataConnectionId") + source_account_id: str = Field(description="The ID of the source bank account from which transactions are fetched.", alias="sourceAccountId") + period_start_utc: datetime = Field(description="The start of the sync period.", alias="periodStartUtc") + period_end_utc: datetime = Field(description="The end of the sync period.", alias="periodEndUtc") + execution_start_utc: datetime = Field(description="The UTC timestamp when the sync started executing.", alias="executionStartUtc") + status: str = Field(description="The current status of the sync. Known values are `Started`, `Failed`, `SuccessDataPushed`, `SuccessNoDataPushed`, `PartialSuccessDataPushed`.") + execution_end_utc: OptionalNullable[datetime] = Field(default=UNSET, description="The UTC timestamp when the sync execution ended, if completed (i.e. `status` is any value other than `Started`).", alias="executionEndUtc") + error_message: OptionalNullable[str] = Field(default=UNSET, description="Error message if the sync failed.", alias="errorMessage") + error_code: OptionalNullable[str] = Field(default=UNSET, description="Error code if the sync failed.", alias="errorCode") + push_operation_keys: OptionalNullable[List[str]] = Field(default=UNSET, description="List of write operation keys associated with the sync, if the sync resulted in write attempts.", alias="pushOperationKeys") + __properties: ClassVar[List[str]] = ["syncId", "clientId", "companyId", "companyName", "dataConnectionId", "sourceAccountId", "periodStartUtc", "periodEndUtc", "executionStartUtc", "status", "executionEndUtc", "errorMessage", "errorCode", "pushOperationKeys"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + - company_id: Annotated[str, pydantic.Field(alias="companyId")] - r"""The ID of the company that owns the source bank account.""" + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - company_name: Annotated[str, pydantic.Field(alias="companyName")] - r"""The name of the company that owns the source bank account.""" + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - data_connection_id: Annotated[str, pydantic.Field(alias="dataConnectionId")] - r"""The ID of the target accounting data connection.""" + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SyncStatusResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) - execution_start_utc: Annotated[datetime, pydantic.Field(alias="executionStartUtc")] - r"""The UTC timestamp when the sync started executing.""" + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - period_end_utc: Annotated[datetime, pydantic.Field(alias="periodEndUtc")] - r"""The end of the sync period.""" + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - period_start_utc: Annotated[datetime, pydantic.Field(alias="periodStartUtc")] - r"""The start of the sync period.""" + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - source_account_id: Annotated[str, pydantic.Field(alias="sourceAccountId")] - r"""The ID of the source bank account from which transactions are fetched.""" + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - status: str - r"""The current status of the sync. Known values are `Started`, `Failed`, `SuccessDataPushed`, `SuccessNoDataPushed`, `PartialSuccessDataPushed`.""" + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SyncStatusResult from a dict""" + if obj is None: + return None - sync_id: Annotated[str, pydantic.Field(alias="syncId")] - r"""The unique identifier for the sync.""" + if not isinstance(obj, dict): + return cls.model_validate(obj) - error_code: Annotated[OptionalNullable[str], pydantic.Field(alias="errorCode")] = ( - UNSET - ) - r"""Error code if the sync failed.""" + _obj = cls.model_validate({ + "syncId": obj.get("syncId"), + "clientId": obj.get("clientId"), + "companyId": obj.get("companyId"), + "companyName": obj.get("companyName"), + "dataConnectionId": obj.get("dataConnectionId"), + "sourceAccountId": obj.get("sourceAccountId"), + "periodStartUtc": obj.get("periodStartUtc"), + "periodEndUtc": obj.get("periodEndUtc"), + "executionStartUtc": obj.get("executionStartUtc"), + "status": obj.get("status"), + "executionEndUtc": obj.get("executionEndUtc"), + "errorMessage": obj.get("errorMessage"), + "errorCode": obj.get("errorCode"), + "pushOperationKeys": obj.get("pushOperationKeys") + }) + return _obj - error_message: Annotated[ - OptionalNullable[str], pydantic.Field(alias="errorMessage") - ] = UNSET - r"""Error message if the sync failed.""" - execution_end_utc: Annotated[ - OptionalNullable[datetime], pydantic.Field(alias="executionEndUtc") - ] = UNSET - r"""The UTC timestamp when the sync execution ended, if completed (i.e. `status` is any value other than `Started`).""" - push_operation_keys: Annotated[ - OptionalNullable[List[str]], pydantic.Field(alias="pushOperationKeys") - ] = UNSET - r"""List of write operation keys associated with the sync, if the sync resulted in write attempts.""" - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["errorCode", "errorMessage", "executionEndUtc", "pushOperationKeys"] - ) - nullable_fields = set( - ["errorCode", "errorMessage", "executionEndUtc", "pushOperationKeys"] - ) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -try: - SyncStatusResult.model_rebuild() -except NameError: - pass + +class SyncStatusResultTypedDict(TypedDict): + """TypedDict variant of SyncStatusResult, for dict-literal request/response inputs.""" + sync_id: NotRequired[str] + client_id: NotRequired[str] + company_id: NotRequired[str] + company_name: NotRequired[str] + data_connection_id: NotRequired[str] + source_account_id: NotRequired[str] + period_start_utc: NotRequired[datetime] + period_end_utc: NotRequired[datetime] + execution_start_utc: NotRequired[datetime] + status: NotRequired[str] + execution_end_utc: NotRequired[Optional[datetime]] + error_message: NotRequired[Optional[str]] + error_code: NotRequired[Optional[str]] + push_operation_keys: NotRequired[Optional[List[str]]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/targetaccountoption.py b/bank-feeds/src/codat_bankfeeds/models/shared/targetaccountoption.py index 459615b6e..4ead19109 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/targetaccountoption.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/targetaccountoption.py @@ -1,87 +1,118 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_bankfeeds.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_bankfeeds.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 +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -class TargetAccountOptionTypedDict(TypedDict): - account_number: NotRequired[Nullable[str]] - r"""The account number of the account.""" - balance: NotRequired[Nullable[Decimal]] - r"""The balance of the account.""" - id: NotRequired[str] - r"""Id of the target account.""" - name: NotRequired[Nullable[str]] - r"""Name of the target account.""" - sort_code: NotRequired[Nullable[str]] - r"""The sort code of the account.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from decimal import Decimal +from codat_bankfeeds.utils.serializers import serialize_decimal, validate_decimal +import pprint +import re # noqa: F401 +import json +from pydantic import BeforeValidator, PlainSerializer, BaseModel, ConfigDict, Field, model_serializer +from typing import Annotated, Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL class TargetAccountOption(BaseModel): - account_number: Annotated[ - OptionalNullable[str], pydantic.Field(alias="accountNumber") - ] = UNSET - r"""The account number of the account.""" - - balance: Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = UNSET - r"""The balance of the account.""" - - id: Optional[str] = None - r"""Id of the target account.""" - - name: OptionalNullable[str] = UNSET - r"""Name of the target account.""" - - sort_code: Annotated[OptionalNullable[str], pydantic.Field(alias="sortCode")] = ( - UNSET - ) - r"""The sort code of the account.""" @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["accountNumber", "balance", "id", "name", "sortCode"]) - nullable_fields = set(["accountNumber", "balance", "name", "sortCode"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -try: - TargetAccountOption.model_rebuild() -except NameError: - pass + _nullable = {'accountNumber', 'account_number', 'balance', 'name', 'sortCode', 'sort_code'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + TargetAccountOption + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="Id of the target account.") + name: OptionalNullable[str] = Field(default=UNSET, description="Name of the target account.") + balance: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="The balance of the account.") + sort_code: OptionalNullable[str] = Field(default=UNSET, description="The sort code of the account.", alias="sortCode") + account_number: OptionalNullable[str] = Field(default=UNSET, description="The account number of the account.", alias="accountNumber") + __properties: ClassVar[List[str]] = ["id", "name", "balance", "sortCode", "accountNumber"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TargetAccountOption from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TargetAccountOption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "balance": obj.get("balance"), + "sortCode": obj.get("sortCode"), + "accountNumber": obj.get("accountNumber") + }) + return _obj + + + + + +class TargetAccountOptionTypedDict(TypedDict): + """TypedDict variant of TargetAccountOption, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + name: NotRequired[Optional[str]] + balance: NotRequired[Optional[Decimal]] + sort_code: NotRequired[Optional[str]] + account_number: NotRequired[Optional[str]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/validation.py b/bank-feeds/src/codat_bankfeeds/models/shared/validation.py index 57199f9b1..5efdfbc61 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/validation.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/validation.py @@ -1,54 +1,122 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .validationitem import ValidationItem, ValidationItemTypedDict -from codat_bankfeeds.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from pydantic import model_serializer -from typing import List -from typing_extensions import NotRequired, TypedDict +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -class ValidationTypedDict(TypedDict): - r"""A human-readable object describing validation decisions Codat has made when pushing data into the platform. If a push has failed because of validation errors, they will be detailed here.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - errors: NotRequired[Nullable[List[ValidationItemTypedDict]]] - warnings: NotRequired[Nullable[List[ValidationItemTypedDict]]] + Do not edit the class manually. +""" # noqa: E501 -class Validation(BaseModel): - r"""A human-readable object describing validation decisions Codat has made when pushing data into the platform. If a push has failed because of validation errors, they will be detailed here.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - errors: OptionalNullable[List[ValidationItem]] = UNSET +from pydantic import BaseModel, ConfigDict, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_bankfeeds.models.shared.validationitem import ValidationItem, ValidationItemTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - warnings: OptionalNullable[List[ValidationItem]] = UNSET +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL +class Validation(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["errors", "warnings"]) - nullable_fields = set(["errors", "warnings"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m + _nullable = {'errors', 'warnings'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + A human-readable object describing validation decisions Codat has made when pushing data into the platform. If a push has failed because of validation errors, they will be detailed here. + """ # noqa: E501 + errors: OptionalNullable[List[ValidationItem]] = UNSET + warnings: OptionalNullable[List[ValidationItem]] = UNSET + __properties: ClassVar[List[str]] = ["errors", "warnings"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Validation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in errors (list) + _items = [] + if self.errors: + for _item_errors in self.errors: + if _item_errors: + _items.append(_item_errors.to_dict()) + _dict['errors'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in warnings (list) + _items = [] + if self.warnings: + for _item_warnings in self.warnings: + if _item_warnings: + _items.append(_item_warnings.to_dict()) + _dict['warnings'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Validation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "errors": [ValidationItem.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None, + "warnings": [ValidationItem.from_dict(_item) for _item in obj["warnings"]] if obj.get("warnings") is not None else None + }) + return _obj + + + + + +class ValidationTypedDict(TypedDict): + """TypedDict variant of Validation, for dict-literal request/response inputs.""" + errors: NotRequired[Optional[List[ValidationItemTypedDict]]] + warnings: NotRequired[Optional[List[ValidationItemTypedDict]]] diff --git a/bank-feeds/src/codat_bankfeeds/models/shared/validationitem.py b/bank-feeds/src/codat_bankfeeds/models/shared/validationitem.py index c4e580906..ca45897d6 100644 --- a/bank-feeds/src/codat_bankfeeds/models/shared/validationitem.py +++ b/bank-feeds/src/codat_bankfeeds/models/shared/validationitem.py @@ -1,66 +1,124 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_bankfeeds.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -import pydantic -from pydantic import model_serializer -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Bank Feeds + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | -class ValidationItemTypedDict(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.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -class ValidationItem(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.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - validator_name: Annotated[ - OptionalNullable[str], pydantic.Field(alias="validatorName") - ] = UNSET - r"""Name of validator.""" +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL +class ValidationItem(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["itemId", "message", "validatorName"]) - nullable_fields = set(["itemId", "message", "validatorName"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - is_nullable_and_explicitly_set = ( - k in nullable_fields - and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member - ) - - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val - - return m - - -try: - ValidationItem.model_rebuild() -except NameError: - pass + _nullable = {'itemId', 'item_id', 'message', 'validatorName', 'validator_name'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + ValidationItem + """ # noqa: E501 + item_id: OptionalNullable[str] = Field(default=UNSET, description="Unique identifier for a validation item.", alias="itemId") + message: OptionalNullable[str] = Field(default=UNSET, description="A message outlining validation item's issue.") + validator_name: OptionalNullable[str] = Field(default=UNSET, description="Name of validator.", alias="validatorName") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["itemId", "message", "validatorName"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidationItem from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidationItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "itemId": obj.get("itemId"), + "message": obj.get("message"), + "validatorName": obj.get("validatorName") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + + + + +class ValidationItemTypedDict(TypedDict): + """TypedDict variant of ValidationItem, for dict-literal request/response inputs.""" + item_id: NotRequired[Optional[str]] + message: NotRequired[Optional[str]] + validator_name: NotRequired[Optional[str]] + additional_properties: NotRequired[Dict[str, Any]] diff --git a/bank-feeds/src/codat_bankfeeds/models/source_account_batch_error_response_result.py b/bank-feeds/src/codat_bankfeeds/models/source_account_batch_error_response_result.py new file mode 100644 index 000000000..f0f3731ec --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/source_account_batch_error_response_result.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class SourceAccountBatchErrorResponseResult(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + """ + SourceAccountBatchErrorResponseResult + """ # noqa: E501 + status_code: Optional[str] = Field(default=None, description="The error status code for the attempted creation of the source account.", alias="statusCode") + error: Optional[str] = Field(default=None, description="The error description for the attempted creation of the source account.") + __properties: ClassVar[List[str]] = ["statusCode", "error"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SourceAccountBatchErrorResponseResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SourceAccountBatchErrorResponseResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "statusCode": obj.get("statusCode"), + "error": obj.get("error") + }) + return _obj + + + + + +class SourceAccountBatchErrorResponseResultTypedDict(TypedDict): + """TypedDict variant of SourceAccountBatchErrorResponseResult, for dict-literal request/response inputs.""" + status_code: NotRequired[Optional[str]] + error: NotRequired[Optional[str]] diff --git a/bank-feeds/src/codat_bankfeeds/models/source_account_v2.py b/bank-feeds/src/codat_bankfeeds/models/source_account_v2.py new file mode 100644 index 000000000..635bb1e13 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/source_account_v2.py @@ -0,0 +1,181 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from decimal import Decimal +from codat_bankfeeds.utils.serializers import serialize_decimal, validate_decimal +from codat_bankfeeds.models.source_account_v2_status import SourceAccountV2Status +from codat_bankfeeds.models.shared.accounttype import AccountType +import pprint +import re # noqa: F401 +import json + +from pydantic import BeforeValidator, PlainSerializer, BaseModel, ConfigDict, Field, field_validator, model_serializer +from typing import Annotated, Any, ClassVar, Dict, List, Optional, Union +from codat_bankfeeds.models.shared.accountinfo import AccountInfo, AccountInfoTypedDict +from codat_bankfeeds.models.shared.routinginfo import RoutingInfo, RoutingInfoTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_bankfeeds.models._compat.sourceaccountv2 import SourceAccountV2AccountType +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL +class SourceAccountV2(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'accountInfo', 'account_info', 'feedStartDate', 'feed_start_date', 'sortCode', 'sort_code', 'status'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + The target bank account in a supported accounting software for ingestion into a bank feed. + """ # noqa: E501 + id: str = Field(description="Unique ID for the bank account.") + account_name: str = Field(description="The bank account name.", alias="accountName") + account_type: SourceAccountV2AccountType = Field(description="The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard.", alias="accountType") + account_number: str = Field(description="The account number.", alias="accountNumber") + sort_code: OptionalNullable[str] = Field(default=UNSET, description="The sort code.", alias="sortCode") + routing_info: Optional[RoutingInfo] = Field(default=None, alias="routingInfo") + currency: str = Field(description="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.") + balance: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="The latest balance for the bank account.") + account_info: OptionalNullable[AccountInfo] = Field(default=UNSET, alias="accountInfo") + modified_date: Optional[str] = Field(default=None, description="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.", alias="modifiedDate") + status: OptionalNullable[SourceAccountV2Status] = Field(default=UNSET, description="Status of the source account.") + feed_start_date: OptionalNullable[str] = Field(default=UNSET, description="In Codat's data model, dates are represented using the ISO 8601 standard. Date fields are formatted as strings; for example: ``` 2020-10-08 ```", alias="feedStartDate") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "accountName", "accountType", "accountNumber", "sortCode", "routingInfo", "currency", "balance", "accountInfo", "modifiedDate", "status", "feedStartDate"] + + @field_validator('account_type') + def account_type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['checking', 'savings', 'loan', 'creditCard', 'prepaidCard']): + raise ValueError("must be one of enum values ('checking', 'savings', 'loan', 'creditCard', 'prepaidCard')") + return value + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['pending', 'connected', 'connecting', 'disconnected', 'unknown']): + raise ValueError("must be one of enum values ('pending', 'connected', 'connecting', 'disconnected', 'unknown')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SourceAccountV2 from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of routing_info + if self.routing_info: + _dict['routingInfo'] = self.routing_info.to_dict() + # override the default output from pydantic by calling `to_dict()` of account_info + if self.account_info: + _dict['accountInfo'] = self.account_info.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SourceAccountV2 from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "accountName": obj.get("accountName"), + "accountType": obj.get("accountType"), + "accountNumber": obj.get("accountNumber"), + "sortCode": obj.get("sortCode"), + "routingInfo": RoutingInfo.from_dict(obj["routingInfo"]) if obj.get("routingInfo") is not None else None, + "currency": obj.get("currency"), + "balance": obj.get("balance"), + "accountInfo": AccountInfo.from_dict(obj["accountInfo"]) if obj.get("accountInfo") is not None else None, + "modifiedDate": obj.get("modifiedDate"), + "status": obj.get("status"), + "feedStartDate": obj.get("feedStartDate") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + + + + +class SourceAccountV2TypedDict(TypedDict): + """TypedDict variant of SourceAccountV2, for dict-literal request/response inputs.""" + id: NotRequired[str] + account_name: NotRequired[str] + account_type: NotRequired[SourceAccountV2AccountType] + account_number: NotRequired[str] + sort_code: NotRequired[Optional[str]] + routing_info: NotRequired[Optional[RoutingInfoTypedDict]] + currency: NotRequired[str] + balance: NotRequired[Decimal] + account_info: NotRequired[Optional[AccountInfoTypedDict]] + modified_date: NotRequired[Optional[str]] + status: NotRequired[Optional[SourceAccountV2Status]] + feed_start_date: NotRequired[Optional[str]] + additional_properties: NotRequired[Dict[str, Any]] diff --git a/bank-feeds/src/codat_bankfeeds/models/source_account_v2_status.py b/bank-feeds/src/codat_bankfeeds/models/source_account_v2_status.py new file mode 100644 index 000000000..a071b6641 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/source_account_v2_status.py @@ -0,0 +1,12 @@ +from __future__ import annotations + +from enum import Enum + + +class SourceAccountV2Status(str, Enum): + """SourceAccountV2Status enum (lifted from inline OAS enum).""" + PENDING = 'pending' + CONNECTED = 'connected' + CONNECTING = 'connecting' + DISCONNECTED = 'disconnected' + UNKNOWN = 'unknown' diff --git a/bank-feeds/src/codat_bankfeeds/models/source_type.py b/bank-feeds/src/codat_bankfeeds/models/source_type.py new file mode 100644 index 000000000..f78ddf03d --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/source_type.py @@ -0,0 +1,14 @@ +from __future__ import annotations + +from enum import Enum + + +class SourceType(str, Enum): + """SourceType enum (lifted from inline OAS enum).""" + ACCOUNTING = 'Accounting' + BANKING = 'Banking' + BANK_FEED = 'BankFeed' + COMMERCE = 'Commerce' + EXPENSE = 'Expense' + OTHER = 'Other' + UNKNOWN = 'Unknown' diff --git a/bank-feeds/src/codat_bankfeeds/models/status.py b/bank-feeds/src/codat_bankfeeds/models/status.py new file mode 100644 index 000000000..c8727d7bb --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/status.py @@ -0,0 +1,12 @@ +from __future__ import annotations + +from enum import Enum + + +class Status(str, Enum): + """Status enum (lifted from inline OAS enum).""" + PENDING = 'pending' + CONNECTED = 'connected' + CONNECTING = 'connecting' + DISCONNECTED = 'disconnected' + UNKNOWN = 'unknown' diff --git a/bank-feeds/src/codat_bankfeeds/models/supplemental_data.py b/bank-feeds/src/codat_bankfeeds/models/supplemental_data.py new file mode 100644 index 000000000..9ad958c12 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/supplemental_data.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_bankfeeds.types import OptionalNullable, UNSET, UNSET_SENTINEL +class SupplementalData(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'content'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + Supplemental data is additional data you can include in our standard data types. It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. + """ # noqa: E501 + content: OptionalNullable[Dict[str, Dict[str, Any]]] = UNSET + __properties: ClassVar[List[str]] = ["content"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SupplementalData from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SupplementalData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "content": obj.get("content") + }) + return _obj + + + + + +class SupplementalDataTypedDict(TypedDict): + """TypedDict variant of SupplementalData, for dict-literal request/response inputs.""" + content: NotRequired[Optional[Dict[str, Dict[str, Any]]]] diff --git a/bank-feeds/src/codat_bankfeeds/models/type.py b/bank-feeds/src/codat_bankfeeds/models/type.py new file mode 100644 index 000000000..4ffaffa6e --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/type.py @@ -0,0 +1,20 @@ +from __future__ import annotations + +from enum import Enum + + +class Type(str, Enum): + """Type enum (lifted from inline OAS enum).""" + RTN = 'rtn' + ABA = 'aba' + SWIFT = 'swift' + BSB = 'bsb' + IBAN = 'iban' + NZ2 = 'nz2' + TRNO = 'trno' + SORTCODE = 'sortcode' + BLZ = 'blz' + IFSC = 'ifsc' + BANKCODE = 'bankcode' + APCA = 'apca' + CLABE = 'clabe' diff --git a/bank-feeds/src/codat_bankfeeds/models/update_connection.py b/bank-feeds/src/codat_bankfeeds/models/update_connection.py new file mode 100644 index 000000000..8c7ac171d --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/models/update_connection.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_bankfeeds.models.shared.dataconnectionstatus import DataConnectionStatus +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class UpdateConnection(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} + """ + UpdateConnection + """ # noqa: E501 + status: Optional[DataConnectionStatus] = Field(default=None, description="The current authorization status of the data connection.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["status"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UpdateConnection from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UpdateConnection from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "status": obj.get("status") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + + + + +class UpdateConnectionTypedDict(TypedDict): + """TypedDict variant of UpdateConnection, for dict-literal request/response inputs.""" + status: NotRequired[Optional[DataConnectionStatus]] + additional_properties: NotRequired[Dict[str, Any]] diff --git a/bank-feeds/src/codat_bankfeeds/py.typed b/bank-feeds/src/codat_bankfeeds/py.typed index 3e38f1a92..e69de29bb 100644 --- a/bank-feeds/src/codat_bankfeeds/py.typed +++ b/bank-feeds/src/codat_bankfeeds/py.typed @@ -1 +0,0 @@ -# Marker file for PEP 561. The package enables type hints. diff --git a/bank-feeds/src/codat_bankfeeds/rest.py b/bank-feeds/src/codat_bankfeeds/rest.py new file mode 100644 index 000000000..638eb5cb3 --- /dev/null +++ b/bank-feeds/src/codat_bankfeeds/rest.py @@ -0,0 +1,258 @@ +# coding: utf-8 + +""" + Bank Feeds + + Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [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. | | Source accounts | Provide and manage lists of source bank accounts. | | Account mapping | Extra functionality for building an account management UI. | | Company information | Get detailed information about a company from the underlying platform. | | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | + + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import io +import json +import re +import ssl + +import urllib3 + +from codat_bankfeeds.exceptions import ApiException, ApiValueError + +SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"} +RESTResponseType = urllib3.HTTPResponse + + +def is_socks_proxy_url(url): + if url is None: + return False + split_section = url.split("://") + if len(split_section) < 2: + return False + else: + return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES + + +class RESTResponse(io.IOBase): + + def __init__(self, resp) -> None: + self.response = resp + self.status = resp.status + self.reason = resp.reason + self.data = None + + def read(self): + if self.data is None: + self.data = self.response.data + return self.data + + def getheaders(self): + """Returns a dictionary of the response headers.""" + return self.response.headers + + def getheader(self, name, default=None): + """Returns a given response header.""" + return self.response.headers.get(name, default) + + +class RESTClientObject: + + def __init__(self, configuration) -> None: + # urllib3.PoolManager will pass all kw parameters to connectionpool + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 + # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 + + # cert_reqs + if configuration.verify_ssl: + cert_reqs = ssl.CERT_REQUIRED + else: + cert_reqs = ssl.CERT_NONE + + pool_args = { + "cert_reqs": cert_reqs, + "ca_certs": configuration.ssl_ca_cert, + "cert_file": configuration.cert_file, + "key_file": configuration.key_file, + } + if configuration.assert_hostname is not None: + pool_args['assert_hostname'] = ( + configuration.assert_hostname + ) + + if configuration.retries is not None: + pool_args['retries'] = configuration.retries + + if configuration.tls_server_name: + pool_args['server_hostname'] = configuration.tls_server_name + + + if configuration.socket_options is not None: + pool_args['socket_options'] = configuration.socket_options + + if configuration.connection_pool_maxsize is not None: + pool_args['maxsize'] = configuration.connection_pool_maxsize + + # https pool manager + self.pool_manager: urllib3.PoolManager + + if configuration.proxy: + if is_socks_proxy_url(configuration.proxy): + from urllib3.contrib.socks import SOCKSProxyManager + pool_args["proxy_url"] = configuration.proxy + pool_args["headers"] = configuration.proxy_headers + self.pool_manager = SOCKSProxyManager(**pool_args) + else: + pool_args["proxy_url"] = configuration.proxy + pool_args["proxy_headers"] = configuration.proxy_headers + self.pool_manager = urllib3.ProxyManager(**pool_args) + else: + self.pool_manager = urllib3.PoolManager(**pool_args) + + def request( + self, + method, + url, + headers=None, + body=None, + post_params=None, + _request_timeout=None + ): + """Perform requests. + + :param method: http request method + :param url: http request url + :param headers: http request headers + :param body: request json body, for `application/json` + :param post_params: request post parameters, + `application/x-www-form-urlencoded` + and `multipart/form-data` + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + """ + method = method.upper() + assert method in [ + 'GET', + 'HEAD', + 'DELETE', + 'POST', + 'PUT', + 'PATCH', + 'OPTIONS' + ] + + if post_params and body: + raise ApiValueError( + "body parameter cannot be used with post_params parameter." + ) + + post_params = post_params or {} + headers = headers or {} + + timeout = None + if _request_timeout: + if isinstance(_request_timeout, (int, float)): + timeout = urllib3.Timeout(total=_request_timeout) + elif ( + isinstance(_request_timeout, tuple) + and len(_request_timeout) == 2 + ): + timeout = urllib3.Timeout( + connect=_request_timeout[0], + read=_request_timeout[1] + ) + + try: + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + + # no content type provided or payload is json + content_type = headers.get('Content-Type') + if ( + not content_type + or re.search('json', content_type, re.IGNORECASE) + ): + request_body = None + if body is not None: + request_body = json.dumps(body) + r = self.pool_manager.request( + method, + url, + body=request_body, + timeout=timeout, + headers=headers, + preload_content=False + ) + elif content_type == 'application/x-www-form-urlencoded': + r = self.pool_manager.request( + method, + url, + fields=post_params, + encode_multipart=False, + timeout=timeout, + headers=headers, + preload_content=False + ) + elif content_type == 'multipart/form-data': + # must del headers['Content-Type'], or the correct + # Content-Type which generated by urllib3 will be + # overwritten. + del headers['Content-Type'] + # Ensures that dict objects are serialized + post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params] + r = self.pool_manager.request( + method, + url, + fields=post_params, + encode_multipart=True, + timeout=timeout, + headers=headers, + preload_content=False + ) + # Pass a `string` parameter directly in the body to support + # other content types than JSON when `body` argument is + # provided in serialized form. + elif isinstance(body, str) or isinstance(body, bytes): + r = self.pool_manager.request( + method, + url, + body=body, + timeout=timeout, + headers=headers, + preload_content=False + ) + elif headers['Content-Type'].startswith('text/') and isinstance(body, bool): + request_body = "true" if body else "false" + r = self.pool_manager.request( + method, + url, + body=request_body, + preload_content=False, + timeout=timeout, + headers=headers) + else: + # Cannot generate the request from given parameters + msg = """Cannot prepare a request message for provided + arguments. Please check that your arguments match + declared content type.""" + raise ApiException(status=0, reason=msg) + # For `GET`, `HEAD` + else: + r = self.pool_manager.request( + method, + url, + fields={}, + timeout=timeout, + headers=headers, + preload_content=False + ) + except urllib3.exceptions.SSLError as e: + msg = "\n".join([type(e).__name__, str(e)]) + raise ApiException(status=0, reason=msg) + + return RESTResponse(r) diff --git a/bank-feeds/src/codat_bankfeeds/sdk.py b/bank-feeds/src/codat_bankfeeds/sdk.py index 9331c7a04..c551cafb3 100644 --- a/bank-feeds/src/codat_bankfeeds/sdk.py +++ b/bank-feeds/src/codat_bankfeeds/sdk.py @@ -1,89 +1,75 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from .basesdk import BaseSDK -from .httpclient import AsyncHttpClient, ClientOwner, HttpClient, close_clients -from .sdkconfiguration import SDKConfiguration -from .utils.logger import Logger, get_default_logger -from .utils.retries import RetryConfig -from codat_bankfeeds import utils -from codat_bankfeeds._hooks import SDKHooks -from codat_bankfeeds.models import shared -from codat_bankfeeds.types import OptionalNullable, UNSET -import httpx -import importlib -import sys -from typing import Callable, Dict, Optional, TYPE_CHECKING, Union, cast -import weakref +"""Top-level composed client for Bank Feeds. + +Generated by pipeline/postprocess_generated.py — do not edit by hand. +""" + +from __future__ import annotations + +from typing import TYPE_CHECKING, Any, Callable, Dict, Mapping, Optional, Union + +from codat_bankfeeds.api_client import ApiClient +from codat_bankfeeds.configuration import Configuration +from codat_bankfeeds._hooks import SDKHooks, attach_hooks_to_api_client +from codat_bankfeeds.types import UNSET, OptionalNullable +from codat_bankfeeds.utils.retries import RetryConfig if TYPE_CHECKING: - from codat_bankfeeds.account_mapping import AccountMapping - from codat_bankfeeds.bank_accounts import BankAccounts - from codat_bankfeeds.companies import Companies - from codat_bankfeeds.company_information import CompanyInformation - from codat_bankfeeds.connections import Connections - from codat_bankfeeds.managed_bank_feeds import ManagedBankFeeds - from codat_bankfeeds.source_accounts import SourceAccounts - from codat_bankfeeds.transactions import Transactions + from codat_bankfeeds.httpclient import AsyncHttpClient, HttpClient + +from codat_bankfeeds.api.companies import Companies +from codat_bankfeeds.api.connections import Connections +from codat_bankfeeds.api.bank_accounts import BankAccounts +from codat_bankfeeds.api.source_accounts import SourceAccounts +from codat_bankfeeds.api.account_mapping import AccountMapping +from codat_bankfeeds.api.transactions import Transactions +from codat_bankfeeds.api.company_information import CompanyInformation +from codat_bankfeeds.api.managed_bank_feeds import ManagedBankFeeds -class CodatBankFeeds(BaseSDK): +_DEFAULT_TIMEOUT_MS = 5000 + + +class CodatBankFeeds: r"""Bank Feeds: Bank Feeds solution enables your SMB users to set up bank feeds from accounts in your application to supported accounting software. - A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. +A bank feed is a connection between a source bank account in your application and a target bank account in a supported accounting software. - [Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [See OpenAPI spec](https://github.com/codatio/oas) +[Explore solution](https://docs.codat.io/bank-feeds-api/overview) | [See OpenAPI spec](https://github.com/codatio/oas) - --- - - ## Endpoints +--- + +## Endpoints - | Endpoints | Description | - | :- |:- | - | Companies | Create and manage your SMB users' companies. | - | Connections | Create new and manage existing data connections for a company. | - | Source accounts | Provide and manage lists of source bank accounts. | - | Account mapping | Extra functionality for building an account management UI. | - | Company information | Get detailed information about a company from the underlying platform. | - | Transactions | Create new bank account transactions for a company's connections, and see previous operations. | - - """ +| Endpoints | Description | +| :- |:- | +| Companies | Create and manage your SMB users' companies. | +| Connections | Create new and manage existing data connections for a company. | +| Source accounts | Provide and manage lists of source bank accounts. | +| Account mapping | Extra functionality for building an account management UI. | +| Company information | Get detailed information about a company from the underlying platform. | +| Transactions | Create new bank account transactions for a company's connections, and see previous operations. | +""" companies: "Companies" r"""Create and manage your SMB users' companies.""" connections: "Connections" r"""Create new and manage existing data connections for a company.""" - account_mapping: "AccountMapping" - r"""Extra functionality for building an account management UI.""" - managed_bank_feeds: "ManagedBankFeeds" - r"""Manage bank feed syncs for source accounts.""" - company_information: "CompanyInformation" - r"""Get detailed information about a company from the underlying accounting software.""" - source_accounts: "SourceAccounts" - r"""Provide and manage lists of source bank accounts.""" bank_accounts: "BankAccounts" r"""Access bank accounts in an SMBs accounting software.""" + source_accounts: "SourceAccounts" + r"""Provide and manage lists of source bank accounts.""" + account_mapping: "AccountMapping" + r"""Extra functionality for building an account management UI.""" transactions: "Transactions" r"""Create new bank account transactions for a company's connections, and see previous operations.""" - _sub_sdk_map = { - "companies": ("codat_bankfeeds.companies", "Companies"), - "connections": ("codat_bankfeeds.connections", "Connections"), - "account_mapping": ("codat_bankfeeds.account_mapping", "AccountMapping"), - "managed_bank_feeds": ( - "codat_bankfeeds.managed_bank_feeds", - "ManagedBankFeeds", - ), - "company_information": ( - "codat_bankfeeds.company_information", - "CompanyInformation", - ), - "source_accounts": ("codat_bankfeeds.source_accounts", "SourceAccounts"), - "bank_accounts": ("codat_bankfeeds.bank_accounts", "BankAccounts"), - "transactions": ("codat_bankfeeds.transactions", "Transactions"), - } + company_information: "CompanyInformation" + r"""Get detailed information about a company from the underlying accounting software.""" + managed_bank_feeds: "ManagedBankFeeds" + r"""Manage bank feed syncs for source accounts.""" def __init__( self, - security: Union[shared.Security, Callable[[], shared.Security]], + security: Optional[Any] = None, server_idx: Optional[int] = None, url_params: Optional[Dict[str, str]] = None, server_url: Optional[str] = None, @@ -91,139 +77,90 @@ def __init__( async_client: Optional[AsyncHttpClient] = None, retry_config: OptionalNullable[RetryConfig] = UNSET, timeout_ms: Optional[int] = None, - debug_logger: Optional[Logger] = None, + debug_logger: Optional[Any] = 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 - """ - client_supplied = True - if client is None: - client = httpx.Client(follow_redirects=True) - client_supplied = False - - assert issubclass( - type(client), HttpClient - ), "The provided client must implement the HttpClient protocol." - - async_client_supplied = True - if async_client is None: - async_client = httpx.AsyncClient(follow_redirects=True) - async_client_supplied = False - - 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, - client_supplied=client_supplied, - async_client=async_client, - async_client_supplied=async_client_supplied, - security=security, - server_url=server_url, - server_idx=server_idx, - retry_config=retry_config, - timeout_ms=timeout_ms, - debug_logger=debug_logger, - ), - parent_ref=self, + self._security = security + self._retry_config = retry_config + self._timeout_ms = timeout_ms + self._debug_logger = debug_logger + if async_client is not None: + import warnings as _w + _w.warn( + "the async_client kwarg is accepted for Speakeasy-SDK compatibility " + "but not used: the bare async methods (e.g. .companies.list_async(...)) " + "run the sync stack in a worker thread, where an httpx.AsyncClient " + "cannot be driven safely. Pass client= (an httpx.Client) instead — it " + "carries every request, including the *_async methods.", + stacklevel=2, + ) + + config = Configuration(host=server_url) if server_url else Configuration() + self._api_client = ApiClient(configuration=config) + if client is not None: + from codat_bankfeeds._httpx_transport import HttpxRestClient + self._api_client.rest_client = HttpxRestClient(client) + try: + from codat_bankfeeds._version import __user_agent__ as _ua + self._api_client.set_default_header("User-Agent", _ua) + except Exception: + pass + self._hooks = SDKHooks() + attach_hooks_to_api_client( + self._api_client, + self._hooks, + base_url=(server_url or ""), + security_source=security, + auth_headers=[('auth_header', 'Authorization')], ) - hooks = SDKHooks() - - # pylint: disable=protected-access - self.sdk_configuration.__dict__["_hooks"] = hooks - - current_server_url, *_ = self.sdk_configuration.get_server_details() - server_url, self.sdk_configuration.client = hooks.sdk_init( - current_server_url, client - ) - if current_server_url != server_url: - self.sdk_configuration.server_url = server_url - - weakref.finalize( - self, - close_clients, - cast(ClientOwner, self.sdk_configuration), - self.sdk_configuration.client, - self.sdk_configuration.client_supplied, - self.sdk_configuration.async_client, - self.sdk_configuration.async_client_supplied, - ) - - def dynamic_import(self, modname, retries=3): - for attempt in range(retries): - try: - return importlib.import_module(modname) - except KeyError: - # Clear any half-initialized module and retry - sys.modules.pop(modname, None) - if attempt == retries - 1: - break - raise KeyError(f"Failed to import module '{modname}' after {retries} attempts") - - def __getattr__(self, name: str): - if name in self._sub_sdk_map: - module_path, class_name = self._sub_sdk_map[name] - try: - module = self.dynamic_import(module_path) - klass = getattr(module, class_name) - instance = klass(self.sdk_configuration, parent_ref=self) - setattr(self, name, instance) - return instance - except ImportError as e: - raise AttributeError( - f"Failed to import module {module_path} for attribute {name}: {e}" - ) from e - except AttributeError as e: - raise AttributeError( - f"Failed to find class {class_name} in module {module_path} for attribute {name}: {e}" - ) from e - - raise AttributeError( - f"'{type(self).__name__}' object has no attribute '{name}'" - ) - - def __dir__(self): - default_attrs = list(super().__dir__()) - lazy_attrs = list(self._sub_sdk_map.keys()) - return sorted(list(set(default_attrs + lazy_attrs))) + self.companies = Companies(api_client=self._api_client) + self.connections = Connections(api_client=self._api_client) + self.bank_accounts = BankAccounts(api_client=self._api_client) + self.source_accounts = SourceAccounts(api_client=self._api_client) + self.account_mapping = AccountMapping(api_client=self._api_client) + self.transactions = Transactions(api_client=self._api_client) + self.company_information = CompanyInformation(api_client=self._api_client) + self.managed_bank_feeds = ManagedBankFeeds(api_client=self._api_client) + + # Attach the SDK-level retry + timeout defaults to each method-group so a + # per-call retries=UNSET / timeout_ms=None falls back to them. When no + # timeout_ms is set the default is _DEFAULT_TIMEOUT_MS (matches the shipped SDK). + _sdk_retry_default = retry_config if not isinstance(retry_config, type(UNSET)) else None + _sdk_timeout_default = timeout_ms if timeout_ms is not None else _DEFAULT_TIMEOUT_MS + _group_api_prefix = type(self).__module__.rsplit(".", 1)[0] + ".api." + _defaults_seen: set = set() + + def _attach_sdk_defaults(_grp) -> None: + if id(_grp) in _defaults_seen: + return + _defaults_seen.add(id(_grp)) + object.__setattr__(_grp, "_sdk_retry_config", _sdk_retry_default) + object.__setattr__(_grp, "_sdk_timeout_ms", _sdk_timeout_default) + for _name, _child in list(vars(_grp).items()): + if not _name.startswith("_") and type(_child).__module__.startswith(_group_api_prefix): + _attach_sdk_defaults(_child) + + for _grp in ( + self.companies, + self.connections, + self.bank_accounts, + self.source_accounts, + self.account_mapping, + self.transactions, + self.company_information, + self.managed_bank_feeds, + ): + _attach_sdk_defaults(_grp) - def __enter__(self): + def __enter__(self) -> "CodatBankFeeds": + self._api_client.__enter__() return self - async def __aenter__(self): - return self + def __exit__(self, exc_type, exc, tb) -> None: + self._api_client.__exit__(exc_type, exc, tb) - def __exit__(self, exc_type, exc_val, exc_tb): - if ( - self.sdk_configuration.client is not None - and not self.sdk_configuration.client_supplied - ): - self.sdk_configuration.client.close() - self.sdk_configuration.client = None + async def __aenter__(self) -> "CodatBankFeeds": + return self - async def __aexit__(self, exc_type, exc_val, exc_tb): - if ( - self.sdk_configuration.async_client is not None - and not self.sdk_configuration.async_client_supplied - ): - await self.sdk_configuration.async_client.aclose() - self.sdk_configuration.async_client = None + async def __aexit__(self, exc_type, exc, tb) -> None: + self._api_client.__exit__(exc_type, exc, tb) diff --git a/bank-feeds/src/codat_bankfeeds/sdkconfiguration.py b/bank-feeds/src/codat_bankfeeds/sdkconfiguration.py deleted file mode 100644 index 9d8e12b99..000000000 --- a/bank-feeds/src/codat_bankfeeds/sdkconfiguration.py +++ /dev/null @@ -1,49 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from ._version import ( - __gen_version__, - __openapi_doc_version__, - __user_agent__, - __version__, -) -from .httpclient import AsyncHttpClient, HttpClient -from .utils import Logger, RetryConfig, remove_suffix -from codat_bankfeeds.models import shared -from codat_bankfeeds.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: Union[HttpClient, None] - client_supplied: bool - async_client: Union[AsyncHttpClient, None] - async_client_supplied: bool - 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 = __openapi_doc_version__ - sdk_version: str = __version__ - gen_version: str = __gen_version__ - user_agent: str = __user_agent__ - retry_config: OptionalNullable[RetryConfig] = Field(default_factory=lambda: UNSET) - timeout_ms: Optional[int] = None - - 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], {} diff --git a/bank-feeds/src/codat_bankfeeds/source_accounts.py b/bank-feeds/src/codat_bankfeeds/source_accounts.py index a80edd105..b50777635 100644 --- a/bank-feeds/src/codat_bankfeeds/source_accounts.py +++ b/bank-feeds/src/codat_bankfeeds/source_accounts.py @@ -1,1898 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.source_accounts — re-export of the source_accounts method group.""" -from .basesdk import BaseSDK -from codat_bankfeeds import utils -from codat_bankfeeds._hooks import HookContext -from codat_bankfeeds.models import errors, operations, shared -from codat_bankfeeds.types import BaseModel, OptionalNullable, UNSET -from codat_bankfeeds.utils.unmarshal_json_response import unmarshal_json_response -import io -from typing import Any, IO, List, Mapping, Optional, Union, cast - - -class SourceAccounts(BaseSDK): - r"""Provide and manage lists of source bank accounts.""" - - def create( - self, - *, - request: Union[ - operations.CreateSourceAccountRequest, - operations.CreateSourceAccountRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> operations.CreateSourceAccountResponseBody: - r"""Create single source account - - The _Create Source Account_ endpoint allows you to create a representation of a bank account within Codat's domain. The company can then map the source account to an existing or new target account in their accounting software. - - > ### Versioning - > If you are integrating the Bank Feeds solution with Codat after August 1, 2024, please use the v2 version of the API, as detailed in the schema below. For integrations completed before August 1, 2024, select the v1 version from the schema dropdown below. - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.CreateSourceAccountRequest) - request = cast(operations.CreateSourceAccountRequest, request) - - req = self._build_request( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/connectionInfo/bankFeedAccounts", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.request_body if request is not None else None, - False, - True, - "json", - Optional[operations.CreateSourceAccountRequestBody], - ), - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="create-source-account", - oauth2_scopes=None, - 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, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - operations.CreateSourceAccountResponseBody, http_res - ) - if utils.match_response( - http_res, ["400", "401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - async def create_async( - self, - *, - request: Union[ - operations.CreateSourceAccountRequest, - operations.CreateSourceAccountRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> operations.CreateSourceAccountResponseBody: - r"""Create single source account - - The _Create Source Account_ endpoint allows you to create a representation of a bank account within Codat's domain. The company can then map the source account to an existing or new target account in their accounting software. - - > ### Versioning - > If you are integrating the Bank Feeds solution with Codat after August 1, 2024, please use the v2 version of the API, as detailed in the schema below. For integrations completed before August 1, 2024, select the v1 version from the schema dropdown below. - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.CreateSourceAccountRequest) - request = cast(operations.CreateSourceAccountRequest, request) - - req = self._build_request_async( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/connectionInfo/bankFeedAccounts", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.request_body if request is not None else None, - False, - True, - "json", - Optional[operations.CreateSourceAccountRequestBody], - ), - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="create-source-account", - oauth2_scopes=None, - 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, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - operations.CreateSourceAccountResponseBody, http_res - ) - if utils.match_response( - http_res, ["400", "401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - def create_batch( - self, - *, - request: Union[ - operations.CreateBatchSourceAccountRequest, - operations.CreateBatchSourceAccountRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> operations.CreateBatchSourceAccountResponse: - r"""Create source accounts - - The _Batch create source accounts_ endpoint allows you to create multiple representations of your SMB's bank accounts within Codat's domain. The company can then map the source account to an existing or new target account in their accounting software. - - > ### Versioning - > If you are integrating the Bank Feeds solution with Codat after August 1, 2024, please use the v2 version of the API, as detailed in the schema below. For integrations completed before August 1, 2024, select the v1 version from the schema dropdown below. - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, operations.CreateBatchSourceAccountRequest - ) - request = cast(operations.CreateBatchSourceAccountRequest, request) - - req = self._build_request( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/connectionInfo/bankFeedAccounts/batch", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.request_body if request is not None else None, - False, - True, - "json", - Optional[operations.CreateBatchSourceAccountRequestBody], - ), - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="create-batch-source-account", - oauth2_scopes=None, - 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, - ) - - response_data: Any = None - if utils.match_response(http_res, "201", "application/json"): - return unmarshal_json_response(List[operations.ResponseBody], http_res) - if utils.match_response(http_res, "207", "application/json"): - return unmarshal_json_response( - List[operations.CreateBatchSourceAccountResponseBody], http_res - ) - if utils.match_response( - http_res, ["400", "401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["409", "4XX"], "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - async def create_batch_async( - self, - *, - request: Union[ - operations.CreateBatchSourceAccountRequest, - operations.CreateBatchSourceAccountRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> operations.CreateBatchSourceAccountResponse: - r"""Create source accounts - - The _Batch create source accounts_ endpoint allows you to create multiple representations of your SMB's bank accounts within Codat's domain. The company can then map the source account to an existing or new target account in their accounting software. - - > ### Versioning - > If you are integrating the Bank Feeds solution with Codat after August 1, 2024, please use the v2 version of the API, as detailed in the schema below. For integrations completed before August 1, 2024, select the v1 version from the schema dropdown below. - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, operations.CreateBatchSourceAccountRequest - ) - request = cast(operations.CreateBatchSourceAccountRequest, request) - - req = self._build_request_async( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/connectionInfo/bankFeedAccounts/batch", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.request_body if request is not None else None, - False, - True, - "json", - Optional[operations.CreateBatchSourceAccountRequestBody], - ), - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="create-batch-source-account", - oauth2_scopes=None, - 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, - ) - - response_data: Any = None - if utils.match_response(http_res, "201", "application/json"): - return unmarshal_json_response(List[operations.ResponseBody], http_res) - if utils.match_response(http_res, "207", "application/json"): - return unmarshal_json_response( - List[operations.CreateBatchSourceAccountResponseBody], http_res - ) - if utils.match_response( - http_res, ["400", "401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["409", "4XX"], "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - def delete( - self, - *, - request: Union[ - operations.DeleteSourceAccountRequest, - operations.DeleteSourceAccountRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ): - r"""Delete source account - - The _Delete source account_ endpoint enables you to remove a source account. - - Removing a source account will also remove any mapping between the source bank feed bank accounts and the target bankfeed bank 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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.DeleteSourceAccountRequest) - request = cast(operations.DeleteSourceAccountRequest, request) - - req = self._build_request( - method="DELETE", - path="/companies/{companyId}/connections/{connectionId}/connectionInfo/bankFeedAccounts/{accountId}", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="delete-source-account", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "204", "*"): - return - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - async def delete_async( - self, - *, - request: Union[ - operations.DeleteSourceAccountRequest, - operations.DeleteSourceAccountRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ): - r"""Delete source account - - The _Delete source account_ endpoint enables you to remove a source account. - - Removing a source account will also remove any mapping between the source bank feed bank accounts and the target bankfeed bank 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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.DeleteSourceAccountRequest) - request = cast(operations.DeleteSourceAccountRequest, request) - - req = self._build_request_async( - method="DELETE", - path="/companies/{companyId}/connections/{connectionId}/connectionInfo/bankFeedAccounts/{accountId}", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="delete-source-account", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "204", "*"): - return - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - def delete_credentials( - self, - *, - request: Union[ - operations.DeleteBankFeedCredentialsRequest, - operations.DeleteBankFeedCredentialsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ): - r"""Delete all source account credentials - - The _Delete Bank Account Credentials_ endpoint serves as a comprehensive mechanism for revoking all existing authorization credentials that a company employs to establish its Bank Feed connection. - - In cases where multiple credential sets have been generated, a single API call to this endpoint revokes all of them. - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, operations.DeleteBankFeedCredentialsRequest - ) - request = cast(operations.DeleteBankFeedCredentialsRequest, request) - - req = self._build_request( - method="DELETE", - path="/companies/{companyId}/connections/{connectionId}/connectionInfo/bankFeedAccounts/credentials", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="delete-bank-feed-credentials", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "204", "*"): - return - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - async def delete_credentials_async( - self, - *, - request: Union[ - operations.DeleteBankFeedCredentialsRequest, - operations.DeleteBankFeedCredentialsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ): - r"""Delete all source account credentials - - The _Delete Bank Account Credentials_ endpoint serves as a comprehensive mechanism for revoking all existing authorization credentials that a company employs to establish its Bank Feed connection. - - In cases where multiple credential sets have been generated, a single API call to this endpoint revokes all of them. - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, operations.DeleteBankFeedCredentialsRequest - ) - request = cast(operations.DeleteBankFeedCredentialsRequest, request) - - req = self._build_request_async( - method="DELETE", - path="/companies/{companyId}/connections/{connectionId}/connectionInfo/bankFeedAccounts/credentials", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="delete-bank-feed-credentials", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "204", "*"): - return - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - def generate_credentials( - self, - *, - request: Union[ - operations.GenerateCredentialsRequest, - operations.GenerateCredentialsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.BankAccountCredentials: - r"""Generate source account credentials - - The _Generate bank account credentials_ endpoint can be used to generate credentials for QuickBooks Online to authenticate the Bank Feed in the QBO portal. Each time this endpoint is called, a new set of credentials will be generated. - - The old credentials will still be valid until the revoke credentials endpoint is used, which will revoke all credentials associated to the data connection. - - > **For QuickBooks Online only** - > - > Only call this endpoint when onboarding SMBs that use QuickBooks Online. - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.GenerateCredentialsRequest) - request = cast(operations.GenerateCredentialsRequest, request) - - req = self._build_request( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/connectionInfo/bankFeedAccounts/credentials", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=True, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.request_body, - False, - False, - "json", - Union[bytes, IO[bytes], io.BufferedReader], - ), - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="generate-credentials", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.BankAccountCredentials, http_res) - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - async def generate_credentials_async( - self, - *, - request: Union[ - operations.GenerateCredentialsRequest, - operations.GenerateCredentialsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.BankAccountCredentials: - r"""Generate source account credentials - - The _Generate bank account credentials_ endpoint can be used to generate credentials for QuickBooks Online to authenticate the Bank Feed in the QBO portal. Each time this endpoint is called, a new set of credentials will be generated. - - The old credentials will still be valid until the revoke credentials endpoint is used, which will revoke all credentials associated to the data connection. - - > **For QuickBooks Online only** - > - > Only call this endpoint when onboarding SMBs that use QuickBooks Online. - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.GenerateCredentialsRequest) - request = cast(operations.GenerateCredentialsRequest, request) - - req = self._build_request_async( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/connectionInfo/bankFeedAccounts/credentials", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=True, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.request_body, - False, - False, - "json", - Union[bytes, IO[bytes], io.BufferedReader], - ), - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="generate-credentials", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.BankAccountCredentials, http_res) - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - def generate_otp( - self, - *, - request: Union[ - operations.GenerateOtpRequest, operations.GenerateOtpRequestTypedDict - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.GenerateOtpResponse: - r"""Generate one-time password - - The *Generate OTP* endpoint generates a one-time password (OTP) for a bank feed connection. The OTP is returned along with an expiry time, after which it will no longer be valid. - - > **For Sage only** - > - > Only call this endpoint for connections to Sage. Calling it for other integrations will return an error. - - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.GenerateOtpRequest) - request = cast(operations.GenerateOtpRequest, request) - - req = self._build_request( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/bankFeeds/otp", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="generate-otp", - oauth2_scopes=None, - 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, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.GenerateOtpResponse, http_res) - if utils.match_response( - http_res, ["400", "401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - async def generate_otp_async( - self, - *, - request: Union[ - operations.GenerateOtpRequest, operations.GenerateOtpRequestTypedDict - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.GenerateOtpResponse: - r"""Generate one-time password - - The *Generate OTP* endpoint generates a one-time password (OTP) for a bank feed connection. The OTP is returned along with an expiry time, after which it will no longer be valid. - - > **For Sage only** - > - > Only call this endpoint for connections to Sage. Calling it for other integrations will return an error. - - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.GenerateOtpRequest) - request = cast(operations.GenerateOtpRequest, request) - - req = self._build_request_async( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/bankFeeds/otp", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="generate-otp", - oauth2_scopes=None, - 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, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.GenerateOtpResponse, http_res) - if utils.match_response( - http_res, ["400", "401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - def list( - self, - *, - request: Union[ - operations.ListSourceAccountsRequest, - operations.ListSourceAccountsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> operations.ListSourceAccountsResponseBody: - r"""List source accounts - - The _List source accounts_ endpoint returns a list of [source accounts](https://docs.codat.io/bank-feeds-api#/schemas/BankFeedAccount) for a given company's connection. - - [Source accounts](https://docs.codat.io/bank-feeds-api#/schemas/BankFeedAccount) are the bank's bank account within Codat's domain from which transactions are synced into the accounting platform. - - > ### Versioning - > If you are integrating the Bank Feeds solution with Codat after August 1, 2024, please use the v2 version of the API, as detailed in the schema below. For integrations completed before August 1, 2024, select the v1 version from the schema dropdown below. - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.ListSourceAccountsRequest) - request = cast(operations.ListSourceAccountsRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/connectionInfo/bankFeedAccounts", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="list-source-accounts", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - operations.ListSourceAccountsResponseBody, http_res - ) - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - async def list_async( - self, - *, - request: Union[ - operations.ListSourceAccountsRequest, - operations.ListSourceAccountsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> operations.ListSourceAccountsResponseBody: - r"""List source accounts - - The _List source accounts_ endpoint returns a list of [source accounts](https://docs.codat.io/bank-feeds-api#/schemas/BankFeedAccount) for a given company's connection. - - [Source accounts](https://docs.codat.io/bank-feeds-api#/schemas/BankFeedAccount) are the bank's bank account within Codat's domain from which transactions are synced into the accounting platform. - - > ### Versioning - > If you are integrating the Bank Feeds solution with Codat after August 1, 2024, please use the v2 version of the API, as detailed in the schema below. For integrations completed before August 1, 2024, select the v1 version from the schema dropdown below. - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.ListSourceAccountsRequest) - request = cast(operations.ListSourceAccountsRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/connectionInfo/bankFeedAccounts", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="list-source-accounts", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - operations.ListSourceAccountsResponseBody, http_res - ) - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - def update( - self, - *, - request: Union[ - operations.UpdateSourceAccountRequest, - operations.UpdateSourceAccountRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.SourceAccount: - r"""Update source account - - The _Update source account_ endpoint updates a single source account for a single data connection connected to a single company. - - ### Tips and pitfalls - - * This endpoint makes it possible to update the `accountName`, `status`, and `balance` fields. - * The `status` field can only be updated to 'disconnected'. - * The `balance` field can only be updated on accounts that are **not** 'connected'. - * Updates made here apply exclusively to source accounts and will not affect target accounts in the 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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.UpdateSourceAccountRequest) - request = cast(operations.UpdateSourceAccountRequest, request) - - req = self._build_request( - method="PATCH", - path="/companies/{companyId}/connections/{connectionId}/connectionInfo/bankFeedAccounts/{accountId}", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.source_account if request is not None else None, - False, - True, - "json", - Optional[shared.SourceAccount], - ), - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="update-source-account", - oauth2_scopes=None, - 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, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.SourceAccount, http_res) - if utils.match_response( - http_res, ["400", "401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - async def update_async( - self, - *, - request: Union[ - operations.UpdateSourceAccountRequest, - operations.UpdateSourceAccountRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.SourceAccount: - r"""Update source account - - The _Update source account_ endpoint updates a single source account for a single data connection connected to a single company. - - ### Tips and pitfalls - - * This endpoint makes it possible to update the `accountName`, `status`, and `balance` fields. - * The `status` field can only be updated to 'disconnected'. - * The `balance` field can only be updated on accounts that are **not** 'connected'. - * Updates made here apply exclusively to source accounts and will not affect target accounts in the 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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.UpdateSourceAccountRequest) - request = cast(operations.UpdateSourceAccountRequest, request) - - req = self._build_request_async( - method="PATCH", - path="/companies/{companyId}/connections/{connectionId}/connectionInfo/bankFeedAccounts/{accountId}", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.source_account if request is not None else None, - False, - True, - "json", - Optional[shared.SourceAccount], - ), - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="update-source-account", - oauth2_scopes=None, - 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, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.SourceAccount, http_res) - if utils.match_response( - http_res, ["400", "401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) +from codat_bankfeeds.api.source_accounts import SourceAccounts diff --git a/bank-feeds/src/codat_bankfeeds/transactions.py b/bank-feeds/src/codat_bankfeeds/transactions.py index cafc80e60..52c0e2d94 100644 --- a/bank-feeds/src/codat_bankfeeds/transactions.py +++ b/bank-feeds/src/codat_bankfeeds/transactions.py @@ -1,945 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.transactions — re-export of the transactions method group.""" -from .basesdk import BaseSDK -from codat_bankfeeds import utils -from codat_bankfeeds._hooks import HookContext -from codat_bankfeeds.models import errors, operations, shared -from codat_bankfeeds.types import BaseModel, OptionalNullable, UNSET -from codat_bankfeeds.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class Transactions(BaseSDK): - r"""Create new bank account transactions for a company's connections, and see previous operations.""" - - def create( - self, - *, - request: Union[ - operations.CreateBankTransactionsRequest, - operations.CreateBankTransactionsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CreateBankTransactionsResponse: - r"""Create bank transactions - - The *Create bank transactions* endpoint creates new [bank transactions](https://docs.codat.io/bank-feeds-api#/schemas/BankTransactions) for a given company's connection. - - [Bank transactions](https://docs.codat.io/bank-feeds-api#/schemas/BankTransactions) are records of monetary amounts that have moved in and out of an SMB's bank account. - - **Integration-specific behavior** - - The required properties may vary based on the integration. For detailed requirements specific to each accounting software, refer to the API reference examples. - Alternatively, you can view the [Get create bank transaction model](https://docs.codat.io/bank-feeds-api#/operations/get-create-bank-transactions-model) for more information. - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.CreateBankTransactionsRequest) - request = cast(operations.CreateBankTransactionsRequest, request) - - req = self._build_request( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/push/bankAccounts/{accountId}/bankTransactions", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.create_bank_transactions if request is not None else None, - False, - True, - "json", - Optional[shared.CreateBankTransactions], - ), - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="create-bank-transactions", - oauth2_scopes=None, - 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, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.CreateBankTransactionsResponse, http_res - ) - if utils.match_response( - http_res, ["400", "401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - async def create_async( - self, - *, - request: Union[ - operations.CreateBankTransactionsRequest, - operations.CreateBankTransactionsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CreateBankTransactionsResponse: - r"""Create bank transactions - - The *Create bank transactions* endpoint creates new [bank transactions](https://docs.codat.io/bank-feeds-api#/schemas/BankTransactions) for a given company's connection. - - [Bank transactions](https://docs.codat.io/bank-feeds-api#/schemas/BankTransactions) are records of monetary amounts that have moved in and out of an SMB's bank account. - - **Integration-specific behavior** - - The required properties may vary based on the integration. For detailed requirements specific to each accounting software, refer to the API reference examples. - Alternatively, you can view the [Get create bank transaction model](https://docs.codat.io/bank-feeds-api#/operations/get-create-bank-transactions-model) for more information. - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.CreateBankTransactionsRequest) - request = cast(operations.CreateBankTransactionsRequest, request) - - req = self._build_request_async( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/push/bankAccounts/{accountId}/bankTransactions", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.create_bank_transactions if request is not None else None, - False, - True, - "json", - Optional[shared.CreateBankTransactions], - ), - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="create-bank-transactions", - oauth2_scopes=None, - 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, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.CreateBankTransactionsResponse, http_res - ) - if utils.match_response( - http_res, ["400", "401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - def get_create_model( - self, - *, - request: Union[ - operations.GetCreateBankTransactionsModelRequest, - operations.GetCreateBankTransactionsModelRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.PushOption: - r"""Get create bank transactions model - - The *Get create bank account transactions model* endpoint returns the expected data for the request payload when creating [bank account transactions](https://docs.codat.io/bank-feeds-api#/schemas/BankTransactions) for a given company and integration. - - [Bank account transactions](https://docs.codat.io/bank-feeds-api#/schemas/BankTransactions) are records of money that has moved in and out of an SMB's bank account. - - **Integration-specific behavior** - - See the *response examples* for integration-specific indicative models. - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, operations.GetCreateBankTransactionsModelRequest - ) - request = cast(operations.GetCreateBankTransactionsModelRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/options/bankAccounts/{accountId}/bankTransactions", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="get-create-bank-transactions-model", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.PushOption, http_res) - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - async def get_create_model_async( - self, - *, - request: Union[ - operations.GetCreateBankTransactionsModelRequest, - operations.GetCreateBankTransactionsModelRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.PushOption: - r"""Get create bank transactions model - - The *Get create bank account transactions model* endpoint returns the expected data for the request payload when creating [bank account transactions](https://docs.codat.io/bank-feeds-api#/schemas/BankTransactions) for a given company and integration. - - [Bank account transactions](https://docs.codat.io/bank-feeds-api#/schemas/BankTransactions) are records of money that has moved in and out of an SMB's bank account. - - **Integration-specific behavior** - - See the *response examples* for integration-specific indicative models. - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal( - request, operations.GetCreateBankTransactionsModelRequest - ) - request = cast(operations.GetCreateBankTransactionsModelRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/options/bankAccounts/{accountId}/bankTransactions", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="get-create-bank-transactions-model", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.PushOption, http_res) - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - def get_create_operation( - self, - *, - request: Union[ - operations.GetCreateOperationRequest, - operations.GetCreateOperationRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.PushOperation: - r"""Get create operation - - The **Get create operation** endpoint returns a specific [write operation](/using-the-api/push) identified by the `pushOperationKey` that was performed on the company. - - Write operations are actions that send requests to Codat, enabling the creation, updating, deletion of records, or uploading attachments in the connected accounting software. - - For bank feeds, your push operations will only relate to the `bankTransactions` data type. - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.GetCreateOperationRequest) - request = cast(operations.GetCreateOperationRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/push/{pushOperationKey}", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="get-create-operation", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.PushOperation, http_res) - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - async def get_create_operation_async( - self, - *, - request: Union[ - operations.GetCreateOperationRequest, - operations.GetCreateOperationRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.PushOperation: - r"""Get create operation - - The **Get create operation** endpoint returns a specific [write operation](/using-the-api/push) identified by the `pushOperationKey` that was performed on the company. - - Write operations are actions that send requests to Codat, enabling the creation, updating, deletion of records, or uploading attachments in the connected accounting software. - - For bank feeds, your push operations will only relate to the `bankTransactions` data type. - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.GetCreateOperationRequest) - request = cast(operations.GetCreateOperationRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/push/{pushOperationKey}", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="get-create-operation", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=[ - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.PushOperation, http_res) - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - def list_create_operations( - self, - *, - request: Union[ - operations.ListCreateOperationsRequest, - operations.ListCreateOperationsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.PushOperations: - r"""List create operations - - The **List create operations** endpoint returns a list of [write operations](/using-the-api/push) performed on the company. - - Write operations are actions that send requests to Codat, enabling the creation, updating, deletion of records, or uploading attachments in the connected accounting software. - - For bank feeds, use this endpoint to view write operations related to the `bankTransactions` data type. - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.ListCreateOperationsRequest) - request = cast(operations.ListCreateOperationsRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/push", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="list-create-operations", - oauth2_scopes=None, - 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, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.PushOperations, http_res) - if utils.match_response( - http_res, ["400", "401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) - - async def list_create_operations_async( - self, - *, - request: Union[ - operations.ListCreateOperationsRequest, - operations.ListCreateOperationsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.PushOperations: - r"""List create operations - - The **List create operations** endpoint returns a list of [write operations](/using-the-api/push) performed on the company. - - Write operations are actions that send requests to Codat, enabling the creation, updating, deletion of records, or uploading attachments in the connected accounting software. - - For bank feeds, use this endpoint to view write operations related to the `bankTransactions` data type. - - :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 - :param http_headers: Additional headers to set or replace on requests. - """ - 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 - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, operations.ListCreateOperationsRequest) - request = cast(operations.ListCreateOperationsRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/push", - 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", - http_headers=http_headers, - security=self.sdk_configuration.security, - allow_empty_value=None, - 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( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="list-create-operations", - oauth2_scopes=None, - 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, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.PushOperations, http_res) - if utils.match_response( - http_res, ["400", "401", "402", "403", "404", "429"], "application/json" - ): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, ["500", "503"], "application/json"): - response_data = unmarshal_json_response(errors.ErrorMessageData, http_res) - raise errors.ErrorMessage(response_data, http_res) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("API error occurred", http_res, http_res_text) - - raise errors.SDKError("Unexpected response received", http_res) +from codat_bankfeeds.api.transactions import Transactions diff --git a/bank-feeds/src/codat_bankfeeds/types/__init__.py b/bank-feeds/src/codat_bankfeeds/types/__init__.py index fc76fe0c5..a5e7b8709 100644 --- a/bank-feeds/src/codat_bankfeeds/types/__init__.py +++ b/bank-feeds/src/codat_bankfeeds/types/__init__.py @@ -1,21 +1,52 @@ -"""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", -] +"""Sentinel / type-alias helpers — matches Speakeasy SDK surface.""" + +from __future__ import annotations + +from typing import TYPE_CHECKING, Optional, TypeVar, Union +from typing_extensions import Literal, TypeAlias, TypeAliasType + +from pydantic import BaseModel as BaseModel, ConfigDict, model_serializer + +# Speakeasy exposes UnrecognizedInt/UnrecognizedStr as the fallback types for open +# (extensible) enums. POC keeps the plain scalar, so these alias to int/str — a +# consumer annotating with them type-checks and runs identically. +UnrecognizedInt: TypeAlias = int +UnrecognizedStr: TypeAlias = str + +UNSET_SENTINEL = "~?~unset~?~sentinel~?~" + + +class Unset(BaseModel): + """Sentinel distinguishing "not provided" (UNSET) from "explicit None". As a + pydantic model it serializes to UNSET_SENTINEL, so a model serializer can drop + UNSET fields from the wire payload while still emitting explicit nulls.""" + + model_config = ConfigDict(arbitrary_types_allowed=True) + + @model_serializer(mode="plain") + def serialize_model(self): + return UNSET_SENTINEL + + def __bool__(self) -> Literal[False]: + return False + + def __repr__(self) -> str: + return "UNSET" + + +UNSET = Unset() +_Unset = Unset # backwards-compat alias for the class name + +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[T], _Unset], type_params=(T,) + ) + + +__all__ = ["BaseModel", "UNSET", "UNSET_SENTINEL", "Unset", "Nullable", "OptionalNullable", "UnrecognizedInt", "UnrecognizedStr"] diff --git a/bank-feeds/src/codat_bankfeeds/types/basemodel.py b/bank-feeds/src/codat_bankfeeds/types/basemodel.py deleted file mode 100644 index a9a640a1a..000000000 --- a/bank-feeds/src/codat_bankfeeds/types/basemodel.py +++ /dev/null @@ -1,77 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from pydantic import ConfigDict, model_serializer -from pydantic import BaseModel as PydanticBaseModel -from pydantic_core import core_schema -from typing import TYPE_CHECKING, Any, Literal, Optional, TypeVar, Union -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,) - ) - - -class UnrecognizedStr(str): - @classmethod - def __get_pydantic_core_schema__(cls, _source_type: Any, _handler: Any) -> core_schema.CoreSchema: - # Make UnrecognizedStr only work in lax mode, not strict mode - # This makes it a "fallback" option when more specific types (like Literals) don't match - def validate_lax(v: Any) -> 'UnrecognizedStr': - if isinstance(v, cls): - return v - return cls(str(v)) - - # Use lax_or_strict_schema where strict always fails - # This forces Pydantic to prefer other union members in strict mode - # and only fall back to UnrecognizedStr in lax mode - return core_schema.lax_or_strict_schema( - lax_schema=core_schema.chain_schema([ - core_schema.str_schema(), - core_schema.no_info_plain_validator_function(validate_lax) - ]), - strict_schema=core_schema.none_schema(), # Always fails in strict mode - ) - - -class UnrecognizedInt(int): - @classmethod - def __get_pydantic_core_schema__(cls, _source_type: Any, _handler: Any) -> core_schema.CoreSchema: - # Make UnrecognizedInt only work in lax mode, not strict mode - # This makes it a "fallback" option when more specific types (like Literals) don't match - def validate_lax(v: Any) -> 'UnrecognizedInt': - if isinstance(v, cls): - return v - return cls(int(v)) - return core_schema.lax_or_strict_schema( - lax_schema=core_schema.chain_schema([ - core_schema.int_schema(), - core_schema.no_info_plain_validator_function(validate_lax) - ]), - strict_schema=core_schema.none_schema(), # Always fails in strict mode - ) diff --git a/bank-feeds/src/codat_bankfeeds/utils/__init__.py b/bank-feeds/src/codat_bankfeeds/utils/__init__.py index 0498cb8da..857e8352d 100644 --- a/bank-feeds/src/codat_bankfeeds/utils/__init__.py +++ b/bank-feeds/src/codat_bankfeeds/utils/__init__.py @@ -1,175 +1,5 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_bankfeeds.utils — utility helpers (currently retry config).""" -from typing import Any, TYPE_CHECKING, Callable, TypeVar -import asyncio +from .retries import BackoffStrategy, RetryConfig, Retries -from .dynamic_imports import lazy_getattr, lazy_dir - -_T = TypeVar("_T") - - -async def run_sync_in_thread(func: Callable[..., _T], *args) -> _T: - """Run a synchronous function in a thread pool to avoid blocking the event loop.""" - return await asyncio.to_thread(func, *args) - - -if TYPE_CHECKING: - from .annotations import get_discriminator - from .datetimes import parse_datetime - 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, - ) - from .url import generate_url, template_url, remove_suffix - from .values import ( - get_global_from_env, - match_content_type, - match_status_codes, - match_response, - cast_partial, - ) - 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", - "parse_datetime", - "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", - "cast_partial", -] - -_dynamic_imports: dict[str, str] = { - "BackoffStrategy": ".retries", - "FieldMetadata": ".metadata", - "find_metadata": ".metadata", - "FormMetadata": ".metadata", - "generate_url": ".url", - "get_body_content": ".logger", - "get_default_logger": ".logger", - "get_discriminator": ".annotations", - "parse_datetime": ".datetimes", - "get_global_from_env": ".values", - "get_headers": ".headers", - "get_pydantic_model": ".serializers", - "get_query_params": ".queryparams", - "get_response_headers": ".headers", - "get_security": ".security", - "HeaderMetadata": ".metadata", - "Logger": ".logger", - "marshal_json": ".serializers", - "match_content_type": ".values", - "match_status_codes": ".values", - "match_response": ".values", - "MultipartFormMetadata": ".metadata", - "OpenEnumMeta": ".enums", - "PathParamMetadata": ".metadata", - "QueryParamMetadata": ".metadata", - "remove_suffix": ".url", - "Retries": ".retries", - "retry": ".retries", - "retry_async": ".retries", - "RetryConfig": ".retries", - "RequestMetadata": ".metadata", - "SecurityMetadata": ".metadata", - "serialize_decimal": ".serializers", - "serialize_float": ".serializers", - "serialize_int": ".serializers", - "serialize_request_body": ".requestbodies", - "SerializedRequestBody": ".requestbodies", - "stream_to_text": ".serializers", - "stream_to_text_async": ".serializers", - "stream_to_bytes": ".serializers", - "stream_to_bytes_async": ".serializers", - "template_url": ".url", - "unmarshal": ".serializers", - "unmarshal_json": ".serializers", - "validate_decimal": ".serializers", - "validate_const": ".serializers", - "validate_float": ".serializers", - "validate_int": ".serializers", - "cast_partial": ".values", -} - - -def __getattr__(attr_name: str) -> Any: - return lazy_getattr( - attr_name, package=__package__, dynamic_imports=_dynamic_imports - ) - - -def __dir__(): - return lazy_dir(dynamic_imports=_dynamic_imports) +__all__ = ["BackoffStrategy", "RetryConfig", "Retries"] diff --git a/bank-feeds/src/codat_bankfeeds/utils/annotations.py b/bank-feeds/src/codat_bankfeeds/utils/annotations.py deleted file mode 100644 index 12e0aa4f1..000000000 --- a/bank-feeds/src/codat_bankfeeds/utils/annotations.py +++ /dev/null @@ -1,79 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from enum import Enum -from typing import Any, Optional - - -def get_discriminator(model: Any, fieldname: str, key: str) -> str: - """ - Recursively search for the discriminator attribute in a model. - - Args: - model (Any): The model to search within. - fieldname (str): The name of the field to search for. - key (str): The key to search for in dictionaries. - - Returns: - str: The name of the discriminator attribute. - - Raises: - ValueError: If the discriminator attribute is not found. - """ - upper_fieldname = fieldname.upper() - - def get_field_discriminator(field: Any) -> Optional[str]: - """Search for the discriminator attribute in a given field.""" - - if isinstance(field, dict): - if key in field: - return f"{field[key]}" - - if hasattr(field, fieldname): - attr = getattr(field, fieldname) - if isinstance(attr, Enum): - return f"{attr.value}" - return f"{attr}" - - if hasattr(field, upper_fieldname): - attr = getattr(field, upper_fieldname) - if isinstance(attr, Enum): - return f"{attr.value}" - return f"{attr}" - - return None - - def search_nested_discriminator(obj: Any) -> Optional[str]: - """Recursively search for discriminator in nested structures.""" - # First try direct field lookup - discriminator = get_field_discriminator(obj) - if discriminator is not None: - return discriminator - - # If it's a dict, search in nested values - if isinstance(obj, dict): - for value in obj.values(): - if isinstance(value, list): - # Search in list items - for item in value: - nested_discriminator = search_nested_discriminator(item) - if nested_discriminator is not None: - return nested_discriminator - elif isinstance(value, dict): - # Search in nested dict - nested_discriminator = search_nested_discriminator(value) - if nested_discriminator is not None: - return nested_discriminator - - return None - - if isinstance(model, list): - for field in model: - discriminator = search_nested_discriminator(field) - if discriminator is not None: - return discriminator - - discriminator = search_nested_discriminator(model) - if discriminator is not None: - return discriminator - - raise ValueError(f"Could not find discriminator field {fieldname} in {model}") diff --git a/bank-feeds/src/codat_bankfeeds/utils/datetimes.py b/bank-feeds/src/codat_bankfeeds/utils/datetimes.py deleted file mode 100644 index a6c52cd61..000000000 --- a/bank-feeds/src/codat_bankfeeds/utils/datetimes.py +++ /dev/null @@ -1,23 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from datetime import datetime -import sys - - -def parse_datetime(datetime_string: str) -> datetime: - """ - Convert a RFC 3339 / ISO 8601 formatted string into a datetime object. - Python versions 3.11 and later support parsing RFC 3339 directly with - datetime.fromisoformat(), but for earlier versions, this function - encapsulates the necessary extra logic. - """ - # Python 3.11 and later can parse RFC 3339 directly - if sys.version_info >= (3, 11): - return datetime.fromisoformat(datetime_string) - - # For Python 3.10 and earlier, a common ValueError is trailing 'Z' suffix, - # so fix that upfront. - if datetime_string.endswith("Z"): - datetime_string = datetime_string[:-1] + "+00:00" - - return datetime.fromisoformat(datetime_string) diff --git a/bank-feeds/src/codat_bankfeeds/utils/dynamic_imports.py b/bank-feeds/src/codat_bankfeeds/utils/dynamic_imports.py deleted file mode 100644 index 673edf82a..000000000 --- a/bank-feeds/src/codat_bankfeeds/utils/dynamic_imports.py +++ /dev/null @@ -1,54 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from importlib import import_module -import builtins -import sys - - -def dynamic_import(package, modname, retries=3): - """Import a module relative to package, retrying on KeyError from half-initialized modules.""" - for attempt in range(retries): - try: - return import_module(modname, package) - except KeyError: - sys.modules.pop(modname, None) - if attempt == retries - 1: - break - raise KeyError(f"Failed to import module '{modname}' after {retries} attempts") - - -def lazy_getattr(attr_name, *, package, dynamic_imports, sub_packages=None): - """Module-level __getattr__ that lazily loads from a dynamic_imports mapping. - - Args: - attr_name: The attribute being looked up. - package: The caller's __package__ (for relative imports). - dynamic_imports: Dict mapping attribute names to relative module paths. - sub_packages: Optional list of subpackage names to lazy-load. - """ - module_name = dynamic_imports.get(attr_name) - if module_name is not None: - try: - module = dynamic_import(package, module_name) - return getattr(module, attr_name) - except ImportError as e: - raise ImportError( - f"Failed to import {attr_name} from {module_name}: {e}" - ) from e - except AttributeError as e: - raise AttributeError( - f"Failed to get {attr_name} from {module_name}: {e}" - ) from e - - if sub_packages and attr_name in sub_packages: - return import_module(f".{attr_name}", package) - - raise AttributeError(f"module '{package}' has no attribute '{attr_name}'") - - -def lazy_dir(*, dynamic_imports, sub_packages=None): - """Module-level __dir__ that lists lazily-loadable attributes.""" - lazy_attrs = builtins.list(dynamic_imports.keys()) - if sub_packages: - lazy_attrs.extend(sub_packages) - return builtins.sorted(lazy_attrs) diff --git a/bank-feeds/src/codat_bankfeeds/utils/enums.py b/bank-feeds/src/codat_bankfeeds/utils/enums.py deleted file mode 100644 index 3324e1bc2..000000000 --- a/bank-feeds/src/codat_bankfeeds/utils/enums.py +++ /dev/null @@ -1,134 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -import enum -import sys -from typing import Any - -from pydantic_core import core_schema - - -class OpenEnumMeta(enum.EnumMeta): - # The __call__ method `boundary` kwarg was added in 3.11 and must be present - # for pyright. Refer also: https://github.com/pylint-dev/pylint/issues/9622 - # pylint: disable=unexpected-keyword-arg - # The __call__ method `values` varg must be named for pyright. - # pylint: disable=keyword-arg-before-vararg - - if sys.version_info >= (3, 11): - def __call__( - cls, value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None - ): - # 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, - *values, - module=module, - qualname=qualname, - type=type, - start=start, - boundary=boundary, - ) - - try: - return super().__call__( - value, - names=names, # pyright: ignore[reportArgumentType] - *values, - module=module, - qualname=qualname, - type=type, - start=start, - boundary=boundary, - ) - except ValueError: - return value - else: - 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 - - def __new__(mcs, name, bases, namespace, **kwargs): - cls = super().__new__(mcs, name, bases, namespace, **kwargs) - - # Add __get_pydantic_core_schema__ to make open enums work correctly - # in union discrimination. In strict mode (used by Pydantic for unions), - # only known enum values match. In lax mode, unknown values are accepted. - def __get_pydantic_core_schema__( - cls_inner: Any, _source_type: Any, _handler: Any - ) -> core_schema.CoreSchema: - # Create a validator that only accepts known enum values (for strict mode) - def validate_strict(v: Any) -> Any: - if isinstance(v, cls_inner): - return v - # Use the parent EnumMeta's __call__ which raises ValueError for unknown values - return enum.EnumMeta.__call__(cls_inner, v) - - # Create a lax validator that accepts unknown values - def validate_lax(v: Any) -> Any: - if isinstance(v, cls_inner): - return v - try: - return enum.EnumMeta.__call__(cls_inner, v) - except ValueError: - # Return the raw value for unknown enum values - return v - - # Determine the base type schema (str or int) - is_int_enum = False - for base in cls_inner.__mro__: - if base is int: - is_int_enum = True - break - if base is str: - break - - base_schema = ( - core_schema.int_schema() - if is_int_enum - else core_schema.str_schema() - ) - - # Use lax_or_strict_schema: - # - strict mode: only known enum values match (raises ValueError for unknown) - # - lax mode: accept any value, return enum member or raw value - return core_schema.lax_or_strict_schema( - lax_schema=core_schema.chain_schema( - [base_schema, core_schema.no_info_plain_validator_function(validate_lax)] - ), - strict_schema=core_schema.chain_schema( - [base_schema, core_schema.no_info_plain_validator_function(validate_strict)] - ), - ) - - setattr(cls, "__get_pydantic_core_schema__", classmethod(__get_pydantic_core_schema__)) - return cls diff --git a/bank-feeds/src/codat_bankfeeds/utils/eventstreaming.py b/bank-feeds/src/codat_bankfeeds/utils/eventstreaming.py deleted file mode 100644 index 3bdcd6d3d..000000000 --- a/bank-feeds/src/codat_bankfeeds/utils/eventstreaming.py +++ /dev/null @@ -1,309 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -import re -import json -from dataclasses import dataclass, asdict -from typing import ( - Any, - Callable, - Generic, - TypeVar, - Optional, - Generator, - AsyncGenerator, - Tuple, -) -import httpx - -T = TypeVar("T") - - -class EventStream(Generic[T]): - # Holds a reference to the SDK client to avoid it being garbage collected - # and cause termination of the underlying httpx client. - client_ref: Optional[object] - response: httpx.Response - generator: Generator[T, None, None] - _closed: bool - - def __init__( - self, - response: httpx.Response, - decoder: Callable[[str], T], - sentinel: Optional[str] = None, - client_ref: Optional[object] = None, - data_required: bool = True, - ): - self.response = response - self.generator = stream_events( - response, decoder, sentinel, data_required=data_required - ) - self.client_ref = client_ref - self._closed = False - - def __iter__(self): - return self - - def __next__(self): - if self._closed: - raise StopIteration - return next(self.generator) - - def __enter__(self): - return self - - def __exit__(self, exc_type, exc_val, exc_tb): - self._closed = True - self.response.close() - - -class EventStreamAsync(Generic[T]): - # Holds a reference to the SDK client to avoid it being garbage collected - # and cause termination of the underlying httpx client. - client_ref: Optional[object] - response: httpx.Response - generator: AsyncGenerator[T, None] - _closed: bool - - def __init__( - self, - response: httpx.Response, - decoder: Callable[[str], T], - sentinel: Optional[str] = None, - client_ref: Optional[object] = None, - data_required: bool = True, - ): - self.response = response - self.generator = stream_events_async( - response, decoder, sentinel, data_required=data_required - ) - self.client_ref = client_ref - self._closed = False - - def __aiter__(self): - return self - - async def __anext__(self): - if self._closed: - raise StopAsyncIteration - return await self.generator.__anext__() - - async def __aenter__(self): - return self - - async def __aexit__(self, exc_type, exc_val, exc_tb): - self._closed = True - await self.response.aclose() - - -@dataclass -class ServerEvent: - id: Optional[str] = None - event: Optional[str] = None - data: Any = None - retry: Optional[int] = None - - -MESSAGE_BOUNDARIES = [ - b"\r\n\r\n", - b"\r\n\r", - b"\r\n\n", - b"\r\r\n", - b"\n\r\n", - b"\r\r", - b"\n\r", - b"\n\n", -] - -UTF8_BOM = b"\xef\xbb\xbf" - - -async def stream_events_async( - response: httpx.Response, - decoder: Callable[[str], T], - sentinel: Optional[str] = None, - data_required: bool = True, -) -> AsyncGenerator[T, None]: - buffer = bytearray() - position = 0 - event_id: Optional[str] = None - async for chunk in response.aiter_bytes(): - if len(buffer) == 0 and chunk.startswith(UTF8_BOM): - chunk = chunk[len(UTF8_BOM) :] - 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, event_id = _parse_event( - raw=block, - decoder=decoder, - sentinel=sentinel, - event_id=event_id, - data_required=data_required, - ) - if event is not None: - yield event - if discard: - await response.aclose() - return - - if position > 0: - buffer = buffer[position:] - position = 0 - - event, discard, _ = _parse_event( - raw=buffer, - decoder=decoder, - sentinel=sentinel, - event_id=event_id, - data_required=data_required, - ) - if event is not None: - yield event - - -def stream_events( - response: httpx.Response, - decoder: Callable[[str], T], - sentinel: Optional[str] = None, - data_required: bool = True, -) -> Generator[T, None, None]: - buffer = bytearray() - position = 0 - event_id: Optional[str] = None - for chunk in response.iter_bytes(): - if len(buffer) == 0 and chunk.startswith(UTF8_BOM): - chunk = chunk[len(UTF8_BOM) :] - 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, event_id = _parse_event( - raw=block, - decoder=decoder, - sentinel=sentinel, - event_id=event_id, - data_required=data_required, - ) - if event is not None: - yield event - if discard: - response.close() - return - - if position > 0: - buffer = buffer[position:] - position = 0 - - event, discard, _ = _parse_event( - raw=buffer, - decoder=decoder, - sentinel=sentinel, - event_id=event_id, - data_required=data_required, - ) - if event is not None: - yield event - - -def _parse_event( - *, - raw: bytearray, - decoder: Callable[[str], T], - sentinel: Optional[str] = None, - event_id: Optional[str] = None, - data_required: bool = True, -) -> Tuple[Optional[T], bool, Optional[str]]: - 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 - value = "" - if delim > 0: - 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": - publish = True - if "\x00" not in value: - event_id = value - elif field == "retry": - if value.isdigit(): - event.retry = int(value) - publish = True - - event.id = event_id - - if sentinel and data == f"{sentinel}\n": - return None, True, event_id - - # Skip data-less events when data is required - if not data and publish and data_required: - return None, False, event_id - - if data: - data = data[:-1] - try: - event.data = json.loads(data) - except json.JSONDecodeError: - event.data = data - - out = None - if publish: - out_dict = { - k: v - for k, v in asdict(event).items() - if v is not None or (k == "data" and data) - } - out = decoder(json.dumps(out_dict)) - - return out, False, event_id - - -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/bank-feeds/src/codat_bankfeeds/utils/forms.py b/bank-feeds/src/codat_bankfeeds/utils/forms.py deleted file mode 100644 index f961e76be..000000000 --- a/bank-feeds/src/codat_bankfeeds/utils/forms.py +++ /dev/null @@ -1,234 +0,0 @@ -"""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 _extract_file_properties(file_obj: Any) -> Tuple[str, Any, Any]: - """Extract file name, content, and content type from a file object.""" - file_fields: Dict[str, FieldInfo] = file_obj.__class__.model_fields - - file_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(file_obj, file_field_name, None) - elif file_field_name == "content_type": - content_type = getattr(file_obj, file_field_name, None) - else: - file_name = getattr(file_obj, file_field_name) - - if file_name == "" or content is None: - raise ValueError("invalid multipart/form-data file") - - return file_name, content, content_type - - -def serialize_multipart_form( - media_type: str, request: Any -) -> Tuple[str, Dict[str, Any], List[Tuple[str, Any]]]: - form: Dict[str, Any] = {} - files: List[Tuple[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 else name - - if field_metadata.file: - if isinstance(val, List): - # Handle array of files - array_field_name = f_name + "[]" - for file_obj in val: - if not _is_set(file_obj): - continue - - file_name, content, content_type = _extract_file_properties( - file_obj - ) - - if content_type is not None: - files.append( - (array_field_name, (file_name, content, content_type)) - ) - else: - files.append((array_field_name, (file_name, content))) - else: - # Handle single file - file_name, content, content_type = _extract_file_properties(val) - - if content_type is not None: - files.append((f_name, (file_name, content, content_type))) - else: - files.append((f_name, (file_name, content))) - elif field_metadata.json: - files.append( - ( - 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)) - - array_field_name = f_name + "[]" - form[array_field_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/bank-feeds/src/codat_bankfeeds/utils/headers.py b/bank-feeds/src/codat_bankfeeds/utils/headers.py deleted file mode 100644 index 37864cbbb..000000000 --- a/bank-feeds/src/codat_bankfeeds/utils/headers.py +++ /dev/null @@ -1,136 +0,0 @@ -"""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/bank-feeds/src/codat_bankfeeds/utils/logger.py b/bank-feeds/src/codat_bankfeeds/utils/logger.py deleted file mode 100644 index b661aff65..000000000 --- a/bank-feeds/src/codat_bankfeeds/utils/logger.py +++ /dev/null @@ -1,22 +0,0 @@ -"""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/bank-feeds/src/codat_bankfeeds/utils/metadata.py b/bank-feeds/src/codat_bankfeeds/utils/metadata.py deleted file mode 100644 index 5abddd588..000000000 --- a/bank-feeds/src/codat_bankfeeds/utils/metadata.py +++ /dev/null @@ -1,119 +0,0 @@ -"""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 - composite: bool = False - - 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/bank-feeds/src/codat_bankfeeds/utils/queryparams.py b/bank-feeds/src/codat_bankfeeds/utils/queryparams.py deleted file mode 100644 index c04e0db82..000000000 --- a/bank-feeds/src/codat_bankfeeds/utils/queryparams.py +++ /dev/null @@ -1,217 +0,0 @@ -"""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, - allow_empty_value: Optional[List[str]] = None, -) -> Dict[str, List[str]]: - params: Dict[str, List[str]] = {} - - globals_already_populated = _populate_query_params(query_params, gbls, params, [], allow_empty_value) - if _is_set(gbls): - _populate_query_params(gbls, None, params, globals_already_populated, allow_empty_value) - - return params - - -def _populate_query_params( - query_params: Any, - gbls: Any, - query_param_values: Dict[str, List[str]], - skip_fields: List[str], - allow_empty_value: Optional[List[str]] = None, -) -> 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 - - allow_empty_set = set(allow_empty_value or []) - should_include_empty = f_name in allow_empty_set and ( - value is None or value == [] or value == "" - ) - - if should_include_empty: - query_param_values[f_name] = [""] - continue - - 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/bank-feeds/src/codat_bankfeeds/utils/requestbodies.py b/bank-feeds/src/codat_bankfeeds/utils/requestbodies.py deleted file mode 100644 index 1de32b6d2..000000000 --- a/bank-feeds/src/codat_bankfeeds/utils/requestbodies.py +++ /dev/null @@ -1,66 +0,0 @@ -"""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: Optional[str] = None - 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/bank-feeds/src/codat_bankfeeds/utils/retries.py b/bank-feeds/src/codat_bankfeeds/utils/retries.py index af07d4e94..28b22e85e 100644 --- a/bank-feeds/src/codat_bankfeeds/utils/retries.py +++ b/bank-feeds/src/codat_bankfeeds/utils/retries.py @@ -1,13 +1,13 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""Retry configuration matching Speakeasy SDK surface, with runtime backoff loop.""" + +from __future__ import annotations -import asyncio import random import time +import urllib3 from datetime import datetime from email.utils import parsedate_to_datetime -from typing import List, Optional - -import httpx +from typing import Any, Callable, Iterable, List, Optional, Set class BackoffStrategy: @@ -18,10 +18,10 @@ class BackoffStrategy: def __init__( self, - initial_interval: int, - max_interval: int, - exponent: float, - max_elapsed_time: int, + initial_interval: int = 500, + max_interval: int = 60000, + exponent: float = 1.5, + max_elapsed_time: int = 3600000, ): self.initial_interval = initial_interval self.max_interval = max_interval @@ -35,10 +35,13 @@ class RetryConfig: retry_connection_errors: bool def __init__( - self, strategy: str, backoff: BackoffStrategy, retry_connection_errors: bool + self, + strategy: str = "backoff", + backoff: Optional[BackoffStrategy] = None, + retry_connection_errors: bool = True, ): self.strategy = strategy - self.backoff = backoff + self.backoff = backoff if backoff is not None else BackoffStrategy() self.retry_connection_errors = retry_connection_errors @@ -51,221 +54,119 @@ def __init__(self, config: RetryConfig, status_codes: List[str]): self.status_codes = status_codes -class TemporaryError(Exception): - response: httpx.Response - retry_after: Optional[int] - - def __init__(self, response: httpx.Response): - self.response = response - self.retry_after = _parse_retry_after_header(response) - - -class PermanentError(Exception): - inner: Exception - - def __init__(self, inner: Exception): - self.inner = inner - - -def _parse_retry_after_header(response: httpx.Response) -> Optional[int]: - """Parse Retry-After header from response. - - Returns: - Retry interval in milliseconds, or None if header is missing or invalid. - """ - retry_after_header = response.headers.get("retry-after") - if not retry_after_header: +# Default retryable status codes from the OAS (x-speakeasy-retries.statusCodes). +# Entries may be ints or strings like "5XX" denoting wildcards across a hundred-block. +DEFAULT_RETRY_STATUS_CODES: List[Any] = [408, 429, '5XX'] + + +def _matches_status(code: int, retry_codes: Iterable[Any]) -> bool: + for entry in retry_codes: + if isinstance(entry, int) and entry == code: + return True + if isinstance(entry, str): + entry_u = entry.upper() + if entry_u.endswith("XX") and len(entry_u) == 3 and entry_u[0].isdigit(): + if (code // 100) == int(entry_u[0]): + return True + else: + try: + if int(entry_u) == code: + return True + except ValueError: + pass + return False + + +def _retry_after_ms(exc: Any) -> Optional[int]: + """Milliseconds to wait from a response's Retry-After header, or None if absent. + Accepts an integer number of seconds or an HTTP date, matching Speakeasy and the + TypeScript runtime. A past date clamps to 0.""" + headers = getattr(exc, "headers", None) + if not headers: return None - - try: - seconds = float(retry_after_header) - return round(seconds * 1000) - except ValueError: - pass - + getter = getattr(headers, "get", None) + if getter is None: + return None + value = getter("Retry-After") + if value is None: + value = getter("retry-after") + if value is None: + return None + text = str(value).strip() + if text.isdigit(): + return int(text) * 1000 try: - retry_date = parsedate_to_datetime(retry_after_header) - delta = (retry_date - datetime.now(retry_date.tzinfo)).total_seconds() - return round(max(0, delta) * 1000) - except (ValueError, TypeError): - pass - - return None - - -def _get_sleep_interval( - exception: Exception, - initial_interval: int, - max_interval: int, - exponent: float, - retries: int, -) -> float: - """Get sleep interval for retry with exponential backoff. - - Args: - exception: The exception that triggered the retry. - initial_interval: Initial retry interval in milliseconds. - max_interval: Maximum retry interval in milliseconds. - exponent: Base for exponential backoff calculation. - retries: Current retry attempt count. - - Returns: - Sleep interval in seconds. + parsed = parsedate_to_datetime(text) + except (TypeError, ValueError): + return None + if parsed is None: + return None + now = datetime.now(parsed.tzinfo) if parsed.tzinfo is not None else datetime.utcnow() + delta_ms = int((parsed - now).total_seconds() * 1000) + return delta_ms if delta_ms > 0 else 0 + + +def execute_with_retries( + call_fn: Callable[[], Any], + retry_config: Optional[RetryConfig], + retry_status_codes: Optional[Iterable[Any]] = None, +) -> Any: + """Run call_fn() and retry on retryable failures per retry_config. + + `retry_config=None` means nothing was supplied, so fall back to the default backoff + policy (retry by default, matching Speakeasy). A RetryConfig with strategy "none" + disables retries -> just one attempt. `retry_status_codes` falls back to + DEFAULT_RETRY_STATUS_CODES. """ - if ( - isinstance(exception, TemporaryError) - and exception.retry_after is not None - and exception.retry_after > 0 - ): - return exception.retry_after / 1000 - - sleep = (initial_interval / 1000) * exponent**retries + random.uniform(0, 1) - return min(sleep, max_interval / 1000) - - -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.NetworkError, 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.NetworkError, 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 - + if retry_config is None: + retry_config = RetryConfig() + if getattr(retry_config, "strategy", "backoff") == "none": + return call_fn() + + codes = retry_status_codes if retry_status_codes is not None else DEFAULT_RETRY_STATUS_CODES + backoff = retry_config.backoff + elapsed_ms = 0 + attempt = 0 + last_exc: Optional[BaseException] = None 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 = _get_sleep_interval( - exception, initial_interval, max_interval, exponent, retries + return call_fn() + except Exception as exc: + status = getattr(exc, "status", None) + if status is None: + status = getattr(exc, "status_code", None) + is_retryable_status = isinstance(status, int) and _matches_status(status, codes) + is_conn_err = retry_config.retry_connection_errors and ( + status == 0 or isinstance(exc, urllib3.exceptions.HTTPError) ) - 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 - + if not (is_retryable_status or is_conn_err): raise - - sleep = _get_sleep_interval( - exception, initial_interval, max_interval, exponent, retries + last_exc = exc + + # Decide sleep duration; abort if total elapsed exceeds budget + retry_after_ms = _retry_after_ms(last_exc) + if retry_after_ms is not None: + sleep_ms = min(retry_after_ms, backoff.max_interval) + else: + interval = min( + backoff.initial_interval * (backoff.exponent ** attempt), + backoff.max_interval, ) - await asyncio.sleep(sleep) - retries += 1 + # half-jitter + sleep_ms = int(interval / 2 + random.random() * (interval / 2)) + if elapsed_ms + sleep_ms > backoff.max_elapsed_time: + if last_exc is not None: + raise last_exc + return None + time.sleep(sleep_ms / 1000.0) + elapsed_ms += sleep_ms + attempt += 1 + + +__all__ = [ + "BackoffStrategy", + "RetryConfig", + "Retries", + "DEFAULT_RETRY_STATUS_CODES", + "execute_with_retries", +] diff --git a/bank-feeds/src/codat_bankfeeds/utils/security.py b/bank-feeds/src/codat_bankfeeds/utils/security.py deleted file mode 100644 index 42d8d78e9..000000000 --- a/bank-feeds/src/codat_bankfeeds/utils/security.py +++ /dev/null @@ -1,198 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -import base64 -from typing import ( - Any, - Dict, - List, - Optional, - Tuple, -) -from pydantic import BaseModel -from pydantic.fields import FieldInfo - -from .metadata import ( - SecurityMetadata, - find_field_metadata, -) - - -def get_security( - security: Any, allowed_fields: Optional[List[str]] = None -) -> 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 - sec_field_names = ( - list(sec_fields.keys()) if allowed_fields is None else allowed_fields - ) - - for name in sec_field_names: - if name not in sec_fields: - continue - - 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) - - if not metadata.composite: - return headers, query_params - - 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 - - value = getattr(option, name) - if ( - metadata.scheme_type == "http" - and metadata.sub_type == "basic" - and not isinstance(value, BaseModel) - ): - _parse_basic_auth_scheme(headers, option) - return - - _parse_security_scheme(headers, query_params, metadata, name, value) - - -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 == "basic": - headers[header_name] = 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/bank-feeds/src/codat_bankfeeds/utils/serializers.py b/bank-feeds/src/codat_bankfeeds/utils/serializers.py index d2149f8b9..608389cd9 100644 --- a/bank-feeds/src/codat_bankfeeds/utils/serializers.py +++ b/bank-feeds/src/codat_bankfeeds/utils/serializers.py @@ -1,18 +1,7 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - +"""Decimal validators and serializers matching Speakeasy's money-field handling.""" +from __future__ import annotations from decimal import Decimal -import functools -import json -import typing -from typing import Any, Dict, List, Tuple, Union, get_args -import typing_extensions -from typing_extensions import get_origin - -import httpx -from pydantic import ConfigDict, create_model -from pydantic_core import from_json - -from ..types.basemodel import BaseModel, Nullable, OptionalNullable, Unset +from codat_bankfeeds.types import Unset def serialize_decimal(as_str: bool): @@ -21,205 +10,17 @@ def serialize(d): 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 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 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_const(v): - def validate(c): - if 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=(",", ":")) - - -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 is_union(obj: object) -> bool: - """ - Returns True if the given object is a typing.Union or typing_extensions.Union. - """ - return any( - obj is typing_obj for typing_obj in _get_typing_objects_by_name_of("Union") - ) - - -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 - - -@functools.cache -def _get_typing_objects_by_name_of(name: str) -> Tuple[Any, ...]: - """ - Get typing objects by name from typing and typing_extensions. - Reference: https://typing-extensions.readthedocs.io/en/latest/#runtime-use-of-types - """ - result = tuple( - getattr(module, name) - for module in (typing, typing_extensions) - if hasattr(module, name) - ) - if not result: - raise ValueError( - f"Neither typing nor typing_extensions has an object called {name!r}" - ) - return result diff --git a/bank-feeds/src/codat_bankfeeds/utils/unmarshal_json_response.py b/bank-feeds/src/codat_bankfeeds/utils/unmarshal_json_response.py deleted file mode 100644 index 540421b3a..000000000 --- a/bank-feeds/src/codat_bankfeeds/utils/unmarshal_json_response.py +++ /dev/null @@ -1,38 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from typing import Any, Optional, Type, TypeVar, overload - -import httpx - -from .serializers import unmarshal_json -from codat_bankfeeds.models import errors - -T = TypeVar("T") - - -@overload -def unmarshal_json_response( - typ: Type[T], http_res: httpx.Response, body: Optional[str] = None -) -> T: ... - - -@overload -def unmarshal_json_response( - typ: Any, http_res: httpx.Response, body: Optional[str] = None -) -> Any: ... - - -def unmarshal_json_response( - typ: Any, http_res: httpx.Response, body: Optional[str] = None -) -> Any: - if body is None: - body = http_res.text - try: - return unmarshal_json(body, typ) - except Exception as e: - raise errors.ResponseValidationError( - "Response validation failed", - http_res, - e, - body, - ) from e diff --git a/bank-feeds/src/codat_bankfeeds/utils/url.py b/bank-feeds/src/codat_bankfeeds/utils/url.py deleted file mode 100644 index c78ccbae4..000000000 --- a/bank-feeds/src/codat_bankfeeds/utils/url.py +++ /dev/null @@ -1,155 +0,0 @@ -"""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/bank-feeds/src/codat_bankfeeds/utils/values.py b/bank-feeds/src/codat_bankfeeds/utils/values.py deleted file mode 100644 index dae01a443..000000000 --- a/bank-feeds/src/codat_bankfeeds/utils/values.py +++ /dev/null @@ -1,137 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from datetime import datetime -from enum import Enum -from email.message import Message -from functools import partial -import os -from typing import Any, Callable, Dict, List, Optional, Tuple, TypeVar, Union, cast - -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 cast_partial(typ): - return partial(cast, typ) - -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)